/**
 * Support chat — matches dashboard flat shell (zero radius, inset lines, notify-bell language).
 */
.et-support-chat {
    --sc-bg: var(--et-bg-primary, #111114);
    --sc-surface: var(--et-bg-card-solid, #101012);
    --sc-border: var(--et-border, rgba(255, 255, 255, 0.1));
    --sc-accent: var(--et-accent-primary, #818cf8);
    --sc-muted: var(--et-text-muted, #71717a);
    --sc-text: var(--et-text-primary, #fafafa);
    --sc-secondary: var(--et-text-secondary, #a1a1aa);
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 1090;
    font-family: inherit;
}

.et-support-chat__launcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-width: 2.25rem;
    min-height: 2.25rem;
    padding: 0 0.8rem;
    border: 1px solid var(--sc-border);
    border-radius: 0;
    color: var(--sc-secondary);
    background: var(--sc-surface);
    box-shadow: inset 0 0 0 1px var(--et-dash-accent-line, rgba(255, 255, 255, 0.04));
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.16s ease;
}

.et-support-chat__launcher:hover {
    color: var(--sc-text);
    background: var(--et-bg-hover, rgba(255, 255, 255, 0.06));
    border-color: color-mix(in srgb, var(--sc-accent) 35%, var(--sc-border));
}

.et-support-chat__launcher:focus-visible,
.et-support-chat button:focus-visible,
.et-support-chat textarea:focus-visible,
.et-support-chat label:focus-within {
    outline: 2px solid var(--sc-accent);
    outline-offset: 2px;
}

.et-support-chat__launcher-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.et-support-chat__launcher-presence {
    position: absolute;
    top: auto;
    bottom: 0.28rem;
    left: 0.28rem;
    right: auto;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 2px var(--sc-surface, #101012);
    pointer-events: none;
}

.et-support-chat__launcher-presence.is-offline {
    background: #71717a;
}

.et-support-chat__launcher > i {
    font-size: 0.9rem;
}

.et-support-chat__badge {
    position: absolute;
    top: -0.3rem;
    right: -0.3rem;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    border: 0;
    color: #fff;
    background: #ef4444;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 0 0 2px var(--sc-bg);
}

.et-support-chat[data-role="admin"].is-alert .et-support-chat__launcher {
    color: var(--sc-text);
    border-color: color-mix(in srgb, #ef4444 45%, var(--sc-border));
    background: color-mix(in srgb, #ef4444 12%, var(--sc-surface));
    animation: et-sc-launcher-pulse 1.2s ease-in-out infinite;
}

.et-support-chat[data-role="user"].is-alert .et-support-chat__launcher {
    border-color: color-mix(in srgb, var(--sc-accent) 45%, var(--sc-border));
    background: color-mix(in srgb, var(--sc-accent) 12%, var(--sc-surface));
    animation: et-sc-launcher-pulse-user 1.4s ease-in-out infinite;
}

.et-support-chat.has-connection-error .et-support-chat__launcher {
    border-color: color-mix(in srgb, #f59e0b 40%, var(--sc-border));
}

.et-support-chat__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    width: min(390px, calc(100vw - 24px));
    height: min(560px, calc(100vh - 36px));
    overflow: hidden;
    border: 1px solid var(--sc-border);
    border-radius: 0;
    background: var(--sc-bg);
    box-shadow: inset 0 0 0 1px var(--et-dash-accent-line, rgba(255, 255, 255, 0.03));
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.18s ease, visibility 0.16s ease;
}

.et-support-chat--admin .et-support-chat__panel {
    width: min(720px, calc(100vw - 24px));
}

.et-support-chat.is-open .et-support-chat__panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.et-support-chat.is-open .et-support-chat__launcher {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.et-support-chat__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.4rem;
    min-height: 3.25rem;
    padding: 0.7rem 0.75rem;
    color: var(--sc-text);
    background: var(--sc-bg);
    border-bottom: 1px solid var(--sc-border);
    flex-shrink: 0;
}

.et-support-chat__header-actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.1rem;
    margin-left: auto;
}

.et-support-chat__status-flash {
    animation: et-sc-status-flash 0.9s ease;
}

@keyframes et-sc-status-flash {
    0% { color: var(--sc-accent); }
    100% { color: inherit; }
}

.et-support-chat__avatar {
    position: relative;
    display: grid;
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
    place-items: center;
    border: 1px solid var(--sc-border);
    border-radius: 0;
    color: var(--sc-accent);
    background: color-mix(in srgb, var(--sc-accent) 12%, transparent);
    font-size: 0.8rem;
}

.et-support-chat__presence-dot {
    position: absolute;
    right: -3px;
    bottom: -3px;
    width: 10px;
    height: 10px;
    border: 2px solid var(--sc-bg);
    border-radius: 50%;
    background: #71717a;
}

.et-support-chat__presence-dot.is-online {
    background: #22c55e;
}

.et-support-chat__heading strong {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.45rem;
    overflow: hidden;
    font-size: 0.875rem;
    font-weight: 600;
    max-width: 100%;
    line-height: 1.3;
}

.et-support-chat__tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.12rem 0.45rem 0.12rem 0.32rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--sc-muted, #a1a1aa);
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.2;
    vertical-align: middle;
    flex: 0 0 auto;
}

.et-support-chat__tag[data-state="unknown"] {
    opacity: 0.75;
}

.et-support-chat__tag-dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: #71717a;
    flex-shrink: 0;
}

.et-support-chat__tag.is-online {
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
}

.et-support-chat__tag.is-online .et-support-chat__tag-dot {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
    animation: et-sc-online-pulse 2.2s ease-in-out infinite;
}

.et-support-chat__tag.is-offline {
    border-color: rgba(161, 161, 170, 0.28);
    background: rgba(161, 161, 170, 0.08);
    color: #d4d4d8;
}

.et-support-chat__tag.is-offline .et-support-chat__tag-dot {
    background: #a1a1aa;
}

.et-support-chat__heading {
    display: flex;
    min-width: 0;
    flex: 1 1 7rem;
    flex-direction: column;
    line-height: 1.25;
}

.et-support-chat__heading > #etSupportChatStatus {
    overflow: hidden;
    margin-top: 0.1rem;
    color: var(--sc-muted);
    font-size: 0.6875rem;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
}

.et-support-chat.has-connection-error .et-support-chat__heading > #etSupportChatStatus {
    color: #fca5a5;
}

.et-support-chat__minimize,
.et-support-chat__header-action {
    display: grid;
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
    place-items: center;
    border: 0;
    border-radius: 0;
    color: var(--sc-secondary);
    background: transparent;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.et-support-chat__minimize:hover,
.et-support-chat__header-action:hover {
    color: var(--sc-text);
    background: var(--et-bg-hover, rgba(255, 255, 255, 0.06));
}

.et-support-chat__header-action:disabled {
    opacity: 0.45;
    cursor: default;
}

.et-support-chat__header-action--danger:hover,
.et-support-chat__header-action#etSupportChatClearThread:hover,
.et-support-chat__header-action#etSupportChatDeleteThread:hover {
    color: #fca5a5;
    background: color-mix(in srgb, #ef4444 14%, transparent);
}

.et-support-chat__admin-layout {
    display: grid;
    min-height: 0;
    flex: 1;
    grid-template-columns: 240px minmax(0, 1fr);
}

.et-support-chat__threads {
    overflow: auto;
    border-right: 1px solid var(--sc-border);
    background: color-mix(in srgb, var(--sc-surface) 88%, transparent);
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--sc-muted) 45%, transparent) transparent;
}

.et-support-chat__thread {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    border-bottom: 1px solid var(--sc-border);
    border-left: 2px solid transparent;
    color: var(--sc-text);
    background: transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.et-support-chat__thread:hover {
    background: color-mix(in srgb, var(--sc-accent) 8%, transparent);
}

.et-support-chat__thread.is-active {
    background: color-mix(in srgb, var(--sc-accent) 12%, transparent);
    border-left-color: var(--sc-accent);
}

.et-support-chat__thread.has-unread {
    background: color-mix(in srgb, #ef4444 6%, transparent);
}

.et-support-chat__thread-main {
    display: grid;
    width: 100%;
    grid-template-columns: 2rem minmax(0, 1fr) auto;
    gap: 0.55rem;
    align-items: center;
    padding: 0.7rem 0.4rem 0.7rem 0.65rem;
    border: 0;
    color: inherit;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.et-support-chat__thread-delete {
    display: grid;
    place-items: center;
    width: 2rem;
    margin: 0.35rem 0.35rem 0.35rem 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: var(--sc-muted);
    background: transparent;
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.et-support-chat__thread:hover .et-support-chat__thread-delete,
.et-support-chat__thread.is-active .et-support-chat__thread-delete,
.et-support-chat__thread-delete:focus-visible {
    opacity: 1;
}

.et-support-chat__thread-delete:hover,
.et-support-chat__thread-delete:focus-visible {
    color: #fca5a5;
    background: color-mix(in srgb, #ef4444 14%, transparent);
}

.et-support-chat__thread.has-unread.is-active {
    background: color-mix(in srgb, var(--sc-accent) 12%, transparent);
}

.et-support-chat__thread-avatar {
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border: 1px solid var(--sc-border);
    border-radius: 0;
    color: var(--sc-accent);
    background: color-mix(in srgb, var(--sc-accent) 12%, transparent);
    font-size: 0.7rem;
    font-weight: 700;
}

.et-support-chat__thread-avatar.is-system {
    border-color: color-mix(in srgb, #f59e0b 55%, var(--sc-border));
    color: #f59e0b;
    background: color-mix(in srgb, #f59e0b 12%, transparent);
}

.et-support-chat__thread-copy {
    min-width: 0;
}

.et-support-chat__thread-copy strong,
.et-support-chat__thread-copy span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.et-support-chat__thread-copy strong {
    font-size: 0.78rem;
    font-weight: 600;
}

.et-support-chat__thread.has-unread .et-support-chat__thread-copy strong {
    font-weight: 700;
}

.et-support-chat__thread.has-unread .et-support-chat__thread-copy span {
    color: var(--sc-secondary);
}

.et-support-chat__thread-copy span {
    margin-top: 0.15rem;
    color: var(--sc-muted);
    font-size: 0.68rem;
}

.et-support-chat__thread-unread {
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    color: #fff;
    background: #ef4444;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.et-support-chat__conversation {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    overflow: hidden;
    background: var(--sc-bg);
}

.et-support-chat__conversation--empty .et-support-chat__messages {
    flex: 0 0 auto;
}

.et-support-chat__conversation.is-dragging::after {
    position: absolute;
    inset: 0.5rem;
    z-index: 5;
    display: grid;
    content: "Drop file to attach";
    place-items: center;
    border: 1px dashed color-mix(in srgb, var(--sc-accent) 50%, transparent);
    color: var(--sc-text);
    background: color-mix(in srgb, var(--sc-bg) 92%, transparent);
    font-size: 0.8rem;
    font-weight: 600;
    pointer-events: none;
}

.et-support-chat__welcome {
    display: grid;
    margin: auto;
    max-width: 260px;
    padding: 1.25rem;
    place-items: center;
    color: var(--sc-text);
    text-align: center;
}

.et-support-chat__welcome[hidden] {
    display: none !important;
}

.et-support-chat__welcome-icon {
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: 0.65rem;
    place-items: center;
    border: 1px solid var(--sc-border);
    color: var(--sc-accent);
    background: color-mix(in srgb, var(--sc-accent) 10%, transparent);
    font-size: 1.15rem;
}

.et-support-chat__welcome strong {
    font-size: 0.9rem;
    font-weight: 600;
}

.et-support-chat__welcome p {
    margin: 0.4rem 0 0;
    color: var(--sc-muted);
    font-size: 0.75rem;
    line-height: 1.5;
}

.et-support-chat__messages {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    gap: 0.55rem;
    overflow-y: auto;
    padding: 0.85rem;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--sc-muted) 45%, transparent) transparent;
}

.et-support-chat.is-loading-messages .et-support-chat__messages {
    position: relative;
    min-height: 4.5rem;
}

.et-support-chat.is-loading-messages .et-support-chat__messages:empty::after {
    content: '';
    display: block;
    width: 1.65rem;
    height: 1.65rem;
    margin: 1.25rem auto;
    border: 2px solid color-mix(in srgb, var(--sc-accent, #3b82f6) 25%, transparent);
    border-top-color: var(--sc-accent, #3b82f6);
    border-radius: 50%;
    animation: et-sc-spin 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .et-support-chat.is-loading-messages .et-support-chat__messages:empty::after {
        animation: none;
        border-top-color: color-mix(in srgb, var(--sc-accent, #3b82f6) 25%, transparent);
        opacity: 0.7;
    }
}

@media (prefers-reduced-motion: reduce) {
    .et-support-chat__messages {
        scroll-behavior: auto;
    }

    .et-support-chat__message {
        animation: none;
    }

    .et-support-chat__thread-delete {
        opacity: 0.85;
        transition: none;
    }
}

.et-support-chat__message {
    display: flex;
    max-width: 88%;
    flex-direction: column;
    align-self: flex-start;
    animation: et-sc-msg-in 0.18s ease both;
}

.et-support-chat__message-row {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    max-width: 100%;
}

.et-support-chat__message.is-mine .et-support-chat__message-row {
    flex-direction: row-reverse;
}

.et-support-chat__message .et-support-chat__bubble {
    min-width: 0;
    flex: 1 1 auto;
}

.et-support-chat__msg-delete {
    flex: 0 0 auto;
    display: grid;
    width: 1.55rem;
    height: 1.55rem;
    margin-top: 0.15rem;
    place-items: center;
    border: 0;
    border-radius: 0;
    color: var(--sc-muted);
    background: transparent;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.et-support-chat__msg-delete:hover,
.et-support-chat__msg-delete:focus-visible {
    color: #fca5a5;
    background: color-mix(in srgb, #ef4444 14%, transparent);
}

.et-support-chat__message:hover .et-support-chat__msg-delete,
.et-support-chat__message:focus-within .et-support-chat__msg-delete {
    opacity: 1;
    pointer-events: auto;
}

@media (hover: none) {
    .et-support-chat__msg-delete {
        opacity: 0.7;
        pointer-events: auto;
    }
}

.et-support-chat__message.is-mine {
    align-self: flex-end;
}

.et-support-chat__bubble {
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--sc-border);
    border-radius: 0;
    color: var(--sc-text);
    background: var(--sc-surface);
    font-size: 0.8rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.et-support-chat__message.is-mine .et-support-chat__bubble {
    border-color: color-mix(in srgb, var(--sc-accent) 40%, var(--sc-border));
    background: color-mix(in srgb, var(--sc-accent) 14%, var(--sc-surface));
}

.et-support-chat__message.is-system {
    max-width: 100%;
}

.et-support-chat__message.is-system .et-support-chat__bubble {
    border-color: color-mix(in srgb, #f59e0b 48%, var(--sc-border));
    background: color-mix(in srgb, #f59e0b 10%, var(--sc-surface));
}

.et-support-chat__message.is-system .et-support-chat__message-meta {
    color: color-mix(in srgb, #f59e0b 75%, var(--sc-muted));
    font-weight: 700;
}

.et-support-chat__bubble a {
    color: var(--sc-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.et-support-chat__message-meta {
    margin-top: 0.2rem;
    padding: 0 0.1rem;
    color: var(--sc-muted);
    font-size: 0.625rem;
}

.et-support-chat__translate-note {
    margin-top: 0.35rem;
    color: var(--sc-muted);
    font-size: 0.625rem;
    line-height: 1.35;
    font-style: italic;
}

.et-support-chat__translate-original {
    margin-top: 0.4rem;
    padding-top: 0.35rem;
    border-top: 1px solid color-mix(in srgb, var(--sc-border) 80%, transparent);
    color: var(--sc-muted);
    font-size: 0.6875rem;
    line-height: 1.4;
}

.et-support-chat__translate-original summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
    color: color-mix(in srgb, var(--sc-accent) 70%, var(--sc-muted));
}

.et-support-chat__translate-original summary::-webkit-details-marker {
    display: none;
}

.et-support-chat__translate-original[open] summary {
    margin-bottom: 0.3rem;
}

.et-support-chat__message.is-mine .et-support-chat__message-meta {
    text-align: right;
}

.et-support-chat__file {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.4rem;
    padding: 0.4rem;
    border: 1px solid var(--sc-border);
    color: inherit;
    background: color-mix(in srgb, var(--sc-bg) 70%, transparent);
    text-decoration: none;
}

.et-support-chat__file:hover {
    color: inherit;
    border-color: color-mix(in srgb, var(--sc-accent) 35%, var(--sc-border));
}

.et-support-chat__file span {
    min-width: 0;
    overflow: hidden;
    font-size: 0.7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.et-support-chat__attachment-image {
    display: block;
    max-width: 100%;
    max-height: 160px;
    margin-top: 0.4rem;
    border: 1px solid var(--sc-border);
    object-fit: cover;
}

.et-support-chat__composer {
    position: relative;
    z-index: 2;
    padding: 0.65rem;
    border-top: 1px solid var(--sc-border);
    background: var(--sc-surface);
    flex: 0 0 auto;
    flex-shrink: 0;
}

.et-support-chat__guest-meta {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 0.55rem;
}

.et-support-chat__page-context {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.55rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--sc-border);
    background: color-mix(in srgb, var(--sc-accent) 6%, transparent);
    color: var(--sc-secondary);
    font-size: 0.72rem;
    line-height: 1.35;
}

.et-support-chat__page-context-label {
    color: var(--sc-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.62rem;
    font-weight: 700;
}

.et-support-chat__page-context-value {
    color: var(--sc-text);
    font-weight: 550;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 8rem;
}

.et-support-chat__guest-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.et-support-chat__guest-fields input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--sc-border);
    border-radius: 0;
    background: var(--sc-bg);
    color: var(--sc-text);
    font: inherit;
    font-size: 0.78rem;
}

.et-support-chat__guest-fields input::placeholder {
    color: var(--sc-muted);
}

.et-support-chat__guest-fields input:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--sc-accent) 45%, var(--sc-border));
}

@media (max-width: 420px) {
    .et-support-chat__guest-fields {
        grid-template-columns: 1fr;
    }
}

.et-support-chat__composer[hidden] {
    display: none !important;
}

.et-support-chat__composer-row {
    display: flex;
    align-items: flex-end;
    gap: 0.25rem;
    min-width: 0;
}

.et-support-chat__composer textarea {
    box-sizing: border-box;
    min-width: 0;
    min-height: 2.25rem;
    max-height: 110px;
    flex: 1 1 auto;
    resize: none;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--sc-border);
    border-radius: 0;
    color: var(--sc-text);
    background: var(--sc-bg);
    font: inherit;
    font-size: 0.8rem;
    line-height: 1.4;
}

.et-support-chat__composer textarea::placeholder {
    color: var(--sc-muted);
}

.et-support-chat__composer textarea:focus {
    border-color: color-mix(in srgb, var(--sc-accent) 45%, var(--sc-border));
    outline: none;
}

.et-support-chat__icon-btn,
.et-support-chat__tool,
.et-support-chat__send {
    position: relative;
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 2.25rem;
    place-items: center;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    color: var(--sc-muted);
    background: transparent;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.et-support-chat__icon-btn:hover,
.et-support-chat__tool:hover {
    color: var(--sc-accent);
    background: color-mix(in srgb, var(--sc-accent) 10%, transparent);
}

/* Clip the native file control so it cannot push the textarea out of the row. */
.et-support-chat__icon-btn input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
    font-size: 0;
}

.et-support-chat .visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.et-support-chat__send {
    color: #fff;
    background: var(--sc-accent);
}

.et-support-chat__send:hover:not(:disabled) {
    filter: brightness(1.08);
}

.et-support-chat__send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: none;
}

.et-support-chat__send.is-sending {
    opacity: 0.55;
    cursor: wait;
}

.et-support-chat__emoji-panel {
    position: absolute;
    right: 0.65rem;
    bottom: 3.25rem;
    z-index: 2;
    display: grid;
    width: 13.5rem;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.15rem;
    padding: 0.45rem;
    border: 1px solid var(--sc-border);
    border-radius: 0;
    background: var(--sc-bg);
}

.et-support-chat__emoji-panel[hidden] {
    display: none !important;
}

.et-support-chat__emoji-panel button {
    width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
}

.et-support-chat__emoji-panel button:hover {
    background: color-mix(in srgb, var(--sc-accent) 12%, transparent);
}

.et-support-chat__attachment-preview {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.45rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--sc-border);
    color: var(--sc-muted);
    background: var(--sc-bg);
    font-size: 0.7rem;
}

.et-support-chat__attachment-preview[hidden] {
    display: none !important;
}

.et-support-chat__attachment-preview span {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.et-support-chat__attachment-preview button {
    border: 0;
    color: inherit;
    background: transparent;
    cursor: pointer;
}

.et-support-chat__error {
    margin-top: 0.4rem;
    color: #fca5a5;
    font-size: 0.7rem;
}

.et-support-chat__error[hidden] {
    display: none !important;
}

.et-support-chat__typing {
    align-self: flex-start;
    margin: 0 0.85rem 0.45rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--sc-border);
    background: var(--sc-surface);
}

.et-support-chat__typing[hidden] {
    display: none !important;
}

.et-support-chat__typing span {
    display: inline-block;
    width: 4px;
    height: 4px;
    margin: 0 1px;
    border-radius: 50%;
    background: var(--sc-accent);
    animation: et-sc-dot 1s infinite ease-in-out;
}

.et-support-chat__typing span:nth-child(2) { animation-delay: 0.14s; }
.et-support-chat__typing span:nth-child(3) { animation-delay: 0.28s; }

.et-support-chat__empty {
    display: grid;
    gap: 0.45rem;
    padding: 1.75rem 1rem;
    place-items: center;
    color: var(--sc-muted);
    font-size: 0.75rem;
    text-align: center;
}

.et-support-chat__empty i {
    font-size: 1.1rem;
    opacity: 0.85;
}

@keyframes et-sc-launcher-pulse {
    0%, 100% { background: color-mix(in srgb, #ef4444 12%, var(--sc-surface)); }
    50% { background: color-mix(in srgb, #ef4444 22%, var(--sc-surface)); }
}

@keyframes et-sc-launcher-pulse-user {
    0%, 100% { background: color-mix(in srgb, var(--sc-accent) 12%, var(--sc-surface)); }
    50% { background: color-mix(in srgb, var(--sc-accent) 22%, var(--sc-surface)); }
}

@keyframes et-sc-msg-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes et-sc-dot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-3px); opacity: 1; }
}

@keyframes et-sc-online-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12); }
    50% { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.22); }
}

@media (max-width: 991.98px) {
    .et-support-chat {
        right: 12px;
        bottom: calc(74px + env(safe-area-inset-bottom));
    }

    body.et-admin-space .et-support-chat,
    body.et-admin-space .et-support-chat--admin {
        bottom: max(12px, env(safe-area-inset-bottom));
    }

    /* Ship fixed bottom nav — lift launcher + panel above it */
    body.et-page-write.et-studio-drafting.et-ship-mode .et-support-chat {
        bottom: calc(var(--et-ship-wiz-nav-h, 5.75rem) + 0.85rem + env(safe-area-inset-bottom, 0px));
    }

    body.et-page-write.et-studio-drafting.et-ship-mode .et-support-chat__panel,
    body.et-page-write.et-studio-drafting.et-ship-mode .et-support-chat--admin .et-support-chat__panel {
        inset: max(8px, env(safe-area-inset-top)) 8px calc(var(--et-ship-wiz-nav-h, 5.75rem) + 0.65rem + env(safe-area-inset-bottom, 0px)) 8px;
    }

    .et-support-chat__launcher-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .et-support-chat__launcher {
        min-width: 2.5rem;
        width: 2.5rem;
        height: 2.5rem;
        padding: 0;
    }

    .et-support-chat__panel,
    .et-support-chat--admin .et-support-chat__panel {
        position: fixed;
        inset: max(8px, env(safe-area-inset-top)) 8px calc(70px + env(safe-area-inset-bottom)) 8px;
        width: auto;
        height: auto;
    }

    body.et-admin-space .et-support-chat__panel,
    body.et-admin-space .et-support-chat--admin .et-support-chat__panel {
        bottom: max(8px, env(safe-area-inset-bottom));
    }

    .et-support-chat__admin-layout {
        grid-template-columns: minmax(110px, 34%) minmax(0, 1fr);
    }

    body.et-support-chat-open {
        overflow: hidden;
    }
}

@media (prefers-reduced-motion: reduce) {
    .et-support-chat,
    .et-support-chat * {
        scroll-behavior: auto !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
