:root {
    --msg-border: rgba(17, 24, 39, 0.08);
    --msg-muted: #68758a;
}

.messenger-page--support {
    grid-template-columns: minmax(0, 1fr) 380px;
}

.support-thread-panel,
.support-info-panel {
    min-width: 0;
}

.support-thread-panel {
    border-right: 0;
}

.support-chat-window {
    background: transparent;
}

.support-chat-header {
    align-items: center;
}

.support-chat-header__meta {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 16px;
    row-gap: 0;
}

.support-chat-header__lead {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.support-chat-header__home {
    display: none;
    width: 46px;
    height: 46px;
    border-radius: 16px;
    align-items: center;
    justify-content: center;
    color: #31507f;
    background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
    border: 1px solid rgba(109, 132, 173, 0.2);
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    flex-shrink: 0;
}

.support-chat-header__icon,
.support-chat-info__icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #1958d8;
    background: linear-gradient(180deg, #edf4ff 0%, #dfeaff 100%);
    border: 1px solid rgba(20, 99, 255, 0.12);
    box-shadow: 0 10px 22px rgba(20, 99, 255, 0.1);
    flex-shrink: 0;
}

.support-chat-header__copy {
    min-width: 0;
    min-height: 46px;
    display: grid;
    gap: 6px;
    align-content: center;
}

.support-chat-header__copy strong {
    font-size: 24px;
    line-height: 1.1;
}

.support-chat-header__copy span {
    color: var(--msg-muted);
    line-height: 1.6;
}

.support-chat-input .chat-input__row {
    align-items: center;
}

.support-client-attach {
    background: linear-gradient(180deg, #f4f8ff 0%, #e7efff 100%);
    border: 1px solid rgba(20, 99, 255, 0.12);
    box-shadow: 0 10px 20px rgba(20, 99, 255, 0.08);
}

.support-chat-input textarea {
    border-radius: 22px;
    padding: 14px 18px;
}

.support-chat-input textarea::placeholder {
    color: #8996aa;
}

.support-chat-input button {
    background: linear-gradient(135deg, #88adff 0%, #6d98fb 100%);
    box-shadow: 0 12px 24px rgba(109, 152, 251, 0.24);
}

.support-chat-header__eyebrow {
    margin-bottom: 2px;
}

.support-chat-header__status {
    display: grid;
    justify-items: end;
    gap: 10px;
    text-align: right;
    flex-shrink: 0;
}

.support-ticket-code {
    color: var(--msg-muted);
    font-size: 13px;
    font-weight: 700;
}

.support-ticket-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.support-ticket-badge--new { background: #eef5ff; color: #1c5fa3; }
.support-ticket-badge--open { background: #e8fff3; color: #19744f; }
.support-ticket-badge--waiting_customer { background: #fff6df; color: #996c00; }
.support-ticket-badge--resolved { background: #efe8ff; color: #6a35b6; }
.support-ticket-badge--closed { background: #f1f4f7; color: #5f6770; }
.support-ticket-badge--spam { background: #ffe8e6; color: #b53f37; }

.support-client-resolution {
    padding: 0 18px 12px;
}

.support-client-resolution[hidden] {
    display: none !important;
}

.support-client-resolution__card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 20px;
    border: 1px solid rgba(21, 111, 74, 0.12);
    background: linear-gradient(135deg, #f2fff8 0%, #e6f8ee 100%);
}

.support-client-resolution__copy {
    display: grid;
    gap: 4px;
}

.support-client-resolution__copy strong {
    font-size: 15px;
    line-height: 1.35;
}

.support-client-resolution__copy span {
    color: var(--msg-muted);
    line-height: 1.5;
}

.support-client-resolution__btn {
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #15925f 0%, #0f7a4f 100%);
    color: #fff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    flex-shrink: 0;
}

.support-client-resolution__btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

.support-desk-kicker,
.support-desk-ticket-kicker {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #3d6b96;
}

.support-desk-header h1,
.support-desk-ticket-head h2 {
    margin: 0;
    font-size: 32px;
    line-height: 1;
}

.support-desk-header p {
    margin: 10px 0 0;
    color: #5b6d81;
    line-height: 1.6;
}

.support-empty-thread {
    color: #6c7a8b;
}

.support-message {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
    padding: 14px 16px;
    border-radius: 18px;
    background: #fff;
    border: 1px solid rgba(15, 32, 52, 0.08);
}

.support-message--customer { margin-left: 12%; background: #fff8ec; }
.support-message--staff { margin-right: 12%; background: #eef8ff; }
.support-message--system { background: #f3f5f8; }

.support-message-meta,
.support-ticket-list-head,
.support-ticket-list-meta,
.support-desk-ticket-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.support-message-meta span,
.support-message-type,
.support-ticket-list-meta span:last-child {
    color: #6d7884;
    font-size: 12px;
}

.support-message-body {
    white-space: normal;
    line-height: 1.6;
}

.support-message-image img {
    display: block;
    max-width: 280px;
    width: 100%;
    border-radius: 14px;
}

.support-desk-compose {
    margin-top: 16px;
}

.support-desk-compose-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.support-desk-attach {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eff6fc;
    color: #1c5fa3;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
}

.support-desk-compose textarea,
.support-desk-templates input,
.support-desk-actions select,
.support-action-btn,
.support-desk-compose button,
.support-desk-back {
    font: inherit;
}

.support-desk-compose textarea,
.support-desk-templates input,
.support-desk-actions select {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(15, 32, 52, 0.12);
    background: #fff;
    resize: vertical;
}

.support-action-btn,
.support-desk-compose button,
.support-desk-back {
    min-height: 48px;
    padding: 0 18px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, #1674d1 0%, #0d58a4 100%);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.support-action-btn--ghost {
    background: #edf4fb;
    color: #124d87;
}

.support-desk-preview {
    display: none;
    margin-bottom: 10px;
}

.support-desk-preview.is-visible {
    display: flex;
}

.support-preview-card {
    position: relative;
    width: 110px;
    height: 110px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(15, 32, 52, 0.12);
}

.support-preview-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.support-preview-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 32, 52, 0.72);
    color: #fff;
    cursor: pointer;
}

.support-chat-messages {
    padding: 18px 18px 14px;
}

.support-chat-empty-state {
    width: min(100%, 440px);
    margin: auto;
    padding: 28px 24px;
    border-radius: 28px;
    border: 1px solid rgba(20, 99, 255, 0.12);
    background:
        radial-gradient(circle at top, rgba(20, 99, 255, 0.12), transparent 58%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(243, 247, 253, 0.98) 100%);
    display: grid;
    justify-items: center;
    gap: 12px;
    text-align: center;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.08);
}

.support-chat-empty-state__icon {
    width: 68px;
    height: 68px;
    border-radius: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #1958d8;
    background: linear-gradient(180deg, #edf4ff 0%, #dfeaff 100%);
    border: 1px solid rgba(20, 99, 255, 0.14);
}

.support-chat-empty-state__icon-image {
    width: 42px;
    height: 42px;
    object-fit: contain;
    display: block;
}

.support-chat-empty-state__eyebrow {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #5d7aa7;
}

.support-chat-empty-state strong {
    font-size: 22px;
    line-height: 1.15;
    color: #102033;
}

.support-chat-empty-state > span:last-child {
    color: #647488;
    line-height: 1.7;
    max-width: 34ch;
}

.support-chat-message {
    gap: 8px;
}

.support-chat-message__sender {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #5c6f87;
}

.message--me .support-chat-message__sender {
    color: rgba(255, 255, 255, 0.84);
}

.support-chat-message--system .support-chat-message__sender {
    color: #6f7d8e;
}

.support-chat-message__image img {
    max-width: 300px;
}

.support-chat-input__meta {
    flex-wrap: wrap;
    align-items: center;
}

.support-chat-input__counter {
    margin-left: auto;
    min-height: 26px;
    padding: 5px 10px;
    border-radius: 999px;
    background: linear-gradient(180deg, #eef5ff 0%, #e4eeff 100%);
    border: 1px solid rgba(20, 99, 255, 0.12);
    color: #2459b8;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.support-chat-input__counter.is-near-limit {
    background: linear-gradient(180deg, #fff6df 0%, #ffedbd 100%);
    border-color: rgba(177, 120, 0, 0.18);
    color: #986700;
}

.support-client-captcha-modal__content {
    width: min(92vw, 420px);
    padding: 28px;
    border-radius: 30px;
    border: 1px solid rgba(20, 99, 255, 0.08);
    background:
        radial-gradient(circle at top, rgba(20, 99, 255, 0.1), transparent 42%),
        linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.22);
    overflow: hidden;
}

.support-client-captcha-modal__content::before {
    content: "";
    position: absolute;
    top: 0;
    left: 24px;
    right: 24px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(20, 99, 255, 0.3), transparent);
}

.support-client-captcha-modal__header {
    position: relative;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(17, 24, 39, 0.06);
}

.support-client-captcha-modal__header h3 {
    margin: 0;
    font-size: 20px;
    line-height: 1.2;
}

.support-client-captcha-modal__header p {
    margin: 8px 0 0;
    color: var(--msg-muted);
    line-height: 1.5;
}

.support-client-captcha-modal__body {
    margin-top: 18px;
    display: grid;
    gap: 14px;
}

.support-client-captcha-modal__question {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    padding: 14px 16px;
    border-radius: 18px;
    background: linear-gradient(180deg, #f4f8ff 0%, #edf3ff 100%);
    border: 1px solid rgba(20, 99, 255, 0.1);
}

.support-client-captcha-modal__field {
    display: grid;
    gap: 8px;
    color: #4f5e73;
    font-size: 14px;
    font-weight: 600;
}

.support-client-captcha-modal__field input {
    width: 100%;
    min-height: 54px;
    padding: 0 18px;
    border-radius: 18px;
    border: 1px solid rgba(20, 99, 255, 0.16);
    background: rgba(255, 255, 255, 0.92);
    font: inherit;
    color: inherit;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.support-client-captcha-modal__field input:focus,
.support-client-captcha-modal__field input:focus-visible {
    background: #ffffff;
    border-color: rgba(20, 99, 255, 0.32);
    box-shadow: 0 0 0 4px rgba(20, 99, 255, 0.12);
}

.support-client-captcha-modal__error[hidden] {
    display: none !important;
}

.support-client-captcha-modal__error {
    padding: 10px 12px;
    border-radius: 14px;
    background: #fff0f0;
    color: #b33b3b;
    font-size: 14px;
    line-height: 1.45;
}

.support-client-captcha-modal__actions {
    margin-top: 18px;
}

.support-client-captcha-modal__submit {
    width: 100%;
    min-height: 54px;
    border-radius: 18px;
    background: linear-gradient(135deg, #2b76ff 0%, #165be0 100%);
    box-shadow: 0 18px 34px rgba(22, 91, 224, 0.26);
}

.support-client-captcha-modal__submit:hover {
    filter: brightness(1.03);
}

.support-client-attach svg {
    width: 20px;
    height: 20px;
}

.support-info-panel {
    padding: 12px;
}

.support-chat-info {
    padding: 0;
}

.support-chat-info__card {
    justify-items: start;
    text-align: left;
}

.support-chat-info__section {
    margin-bottom: 0;
}

.support-chat-steps {
    margin: 0;
    padding-left: 20px;
    color: var(--msg-muted);
    line-height: 1.6;
}

.support-chat-steps li + li {
    margin-top: 10px;
}

@media (max-width: 1080px) {
    .messenger-page--support {
        grid-template-columns: minmax(0, 1fr) 336px;
    }
}

@media (max-width: 900px) {
    .messenger-page--support {
        grid-template-columns: minmax(0, 1fr);
        height: 100%;
        min-height: 100%;
    }

    .messenger-page--support .support-info-panel {
        display: none !important;
    }

    body.support-chat-mobile-open .menu-mobile-bottom {
        display: none !important;
    }

    .support-thread-panel {
        border-right: 0;
    }

    .support-info-panel {
        min-height: auto;
    }
}

@media (max-width: 720px) {
    .support-client-resolution {
        padding: 0 12px 12px;
    }

    .support-chat-header__lead {
        min-width: 0;
        display: flex!important;
        gap: 4px;
    }

    .support-client-resolution__card {
        align-items: stretch;
        flex-direction: column;
        padding: 14px;
        gap: 12px;
    }

    .support-client-resolution__btn {
        width: 100%;
        min-height: 46px;
    }

    .support-client-resolution__copy strong {
        font-size: 14px;
    }

    .support-client-resolution__copy span {
        font-size: 13px;
        line-height: 1.45;
    }

    .support-chat-header {
        align-items: center;
        gap: 10px;
        padding: 12px 14px;
        min-height: 70px;
    }

    .support-chat-header__home {
        display: inline-flex;
    }

    .support-chat-header__status {
        justify-items: end;
        text-align: right;
        gap: 2px!important;
    }

    .support-chat-header__meta {
        align-items: center;
        column-gap: 12px;
    }

    .support-chat-header__copy strong {
        font-size: 17px;
        line-height: 1.15;
    }

    .support-chat-messages {
        padding: 14px;
    }

    .support-chat-empty-state {
        width: 100%;
        padding: 24px 18px;
        border-radius: 24px;
        gap: 10px;
    }

    .support-chat-empty-state__icon {
        width: 62px;
        height: 62px;
        border-radius: 22px;
    }

    .support-chat-empty-state__icon-image {
        width: 38px;
        height: 38px;
    }

    .support-chat-empty-state strong {
        font-size: 19px;
    }

    .support-chat-header__copy span,
    .support-chat-header__eyebrow {
        display: none;
    }

    .support-chat-input {
        padding: 12px 12px 14px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        background: #fff;
        backdrop-filter: blur(12px);
        box-shadow: 0 -10px 24px rgba(15, 23, 42, 0.06);
    }

    .support-chat-input textarea {
        min-height: 50px;
        padding: 14px 18px;
        background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
        border: 1px solid rgba(20, 99, 255, 0.14);
        border-radius: 24px;
        color: #102033;
        box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
    }

    .support-chat-input textarea:focus,
    .support-chat-input textarea:focus-visible {
        background: #ffffff;
        border-color: rgba(20, 99, 255, 0.28);
        box-shadow: 0 0 0 4px rgba(20, 99, 255, 0.12);
    }

    .support-client-attach,
    .support-chat-input button {
        min-width: 50px;
        min-height: 50px;
        border-radius: 18px;
    }

    .support-client-attach {
        background: linear-gradient(180deg, #f5f8ff 0%, #e8efff 100%);
    }

    .support-chat-input button {
        background: linear-gradient(135deg, #8eb3ff 0%, #74a0ff 100%);
        box-shadow: 0 14px 26px rgba(116, 160, 255, 0.28);
    }

    .support-chat-input__meta {
        display: flex;
        justify-content: flex-end;
        margin-top: 8px;
    }

    .support-chat-input__hint {
        display: none;
    }

    .support-chat-input__counter {
        margin-left: 0;
        min-height: 24px;
        padding: 4px 9px;
        font-size: 11px;
    }
}

@media (max-width: 560px) {
    .support-chat-header__meta {
        column-gap: 10px;
    }

    .support-chat-header__lead {
        gap: 10px;
    }

    .support-chat-header__icon,
    .support-chat-info__icon {
        width: 42px;
        height: 42px;
        border-radius: 14px;
    }

    .support-chat-header__home {
        width: 42px;
        height: 42px;
        border-radius: 14px;
    }

    .support-chat-header__copy strong {
        font-size: 16px;
    }

    .support-chat-header__copy {
        min-height: 42px;
    }

    .support-chat-header {
        padding: 10px 12px;
    }

    .support-chat-header__status .support-ticket-badge {
        min-height: 30px;
        padding: 0 12px;
        font-size: 11px;
    }

    .support-ticket-code {
        font-size: 12px;
    }

    .support-chat-input {
        padding: 8px 10px 10px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }

    .support-chat-empty-state {
        padding: 22px 16px;
    }

    .support-chat-empty-state strong {
        font-size: 18px;
    }
}
