:root {
    --support-primary: #0f766e;
    --support-primary-dark: #064e48;
    --support-accent: #14b8a6;
    --support-surface: #ffffff;
    --support-page: #edf5f7;
    --support-ink: #0f172a;
    --support-muted: #64748b;
    --support-border: #dce6ea;
    --support-success: #22c55e;
    --support-warning-bg: #fff7ed;
    --support-warning-border: #fdba74;
    --support-shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
}

* {
    box-sizing: border-box;
}

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

.support-page {
    min-height: 100vh;
    margin: 0;
    color: var(--support-ink);
    font-family: "Segoe UI", Arial, sans-serif;
    background:
        radial-gradient(circle at 8% 0%, rgba(20, 184, 166, 0.18), transparent 34%),
        radial-gradient(circle at 92% 8%, rgba(37, 99, 235, 0.1), transparent 30%),
        var(--support-page);
}

.support-shell {
    color: var(--support-ink);
    font-family: "Segoe UI", Arial, sans-serif;
}

.support-shell button,
.support-shell textarea,
.support-shell input {
    font: inherit;
}

.support-shell--page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.support-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--support-surface);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: var(--support-shadow);
}

.support-shell--page .support-panel {
    width: min(880px, 100%);
    height: min(880px, calc(100vh - 40px));
    border-radius: 28px;
}

.support-shell--widget {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 99990;
}

.support-shell--widget .support-panel {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: min(420px, calc(100vw - 28px));
    height: min(690px, calc(100vh - 115px));
    border-radius: 24px;
    transform-origin: right bottom;
    animation: support-panel-in 180ms ease-out;
}

.support-launcher {
    position: relative;
    display: grid;
    width: 62px;
    height: 62px;
    margin-left: auto;
    padding: 0;
    place-items: center;
    color: #ffffff;
    cursor: pointer;
    background: linear-gradient(145deg, var(--support-primary-dark), var(--support-accent));
    border: 0;
    border-radius: 22px;
    box-shadow: 0 15px 35px rgba(15, 118, 110, 0.36);
}

.support-launcher:focus-visible,
.support-shell button:focus-visible,
.support-shell textarea:focus-visible {
    outline: 3px solid rgba(20, 184, 166, 0.35);
    outline-offset: 3px;
}

.support-launcher__icon {
    position: relative;
    z-index: 1;
    font-size: 27px;
}

.support-launcher__pulse {
    position: absolute;
    inset: -5px;
    border: 2px solid rgba(20, 184, 166, 0.45);
    border-radius: 26px;
    animation: support-pulse 2s infinite;
}

.support-launcher__badge {
    position: absolute;
    top: -7px;
    right: -7px;
    z-index: 2;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    line-height: 24px;
    background: #dc2626;
    border: 2px solid #ffffff;
    border-radius: 999px;
}

.support-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 17px;
    color: #ffffff;
    background:
        linear-gradient(135deg, rgba(4, 47, 46, 0.97), rgba(15, 118, 110, 0.96)),
        var(--support-primary);
}

.support-avatar {
    display: grid;
    flex: 0 0 50px;
    width: 50px;
    height: 50px;
    place-items: center;
    color: var(--support-primary);
    font-size: 17px;
    font-weight: 900;
    background: #ffffff;
    border-radius: 17px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.16);
}

.support-heading {
    min-width: 0;
    flex: 1;
}

.support-heading h2 {
    margin: 0 0 6px;
    overflow: hidden;
    font-size: 18px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.support-presence {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 12px;
    font-size: 11px;
    font-weight: 700;
    opacity: 0.96;
}

.support-presence span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.support-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border: 2px solid rgba(255, 255, 255, 0.65);
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.16);
}

.support-icon-button {
    display: grid;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    padding: 0;
    place-items: center;
    color: #ffffff;
    font-size: 23px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
}

.support-shell--page .support-icon-button {
    display: none;
}

.support-identity {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 45px;
    padding: 8px 14px;
    overflow: hidden;
    color: #475569;
    font-size: 12px;
    background: #f8fafc;
    border-bottom: 1px solid var(--support-border);
}

.support-identity strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.support-chip {
    flex: 0 0 auto;
    padding: 5px 8px;
    color: #334155;
    font-weight: 800;
    background: #ffffff;
    border: 1px solid #dbe4e8;
    border-radius: 999px;
}

.support-chip--registered {
    color: #166534;
    background: #dcfce7;
    border-color: #bbf7d0;
}

.support-handover {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 10px 12px 0;
    padding: 10px 12px;
    color: #9a3412;
    font-size: 12px;
    background: var(--support-warning-bg);
    border: 1px solid var(--support-warning-border);
    border-radius: 13px;
}

.support-broadcast-list {
    display: grid;
    gap: 8px;
    padding: 10px 12px 0;
}

.support-broadcast {
    position: relative;
    padding: 11px 38px 11px 12px;
    color: #1e3a5f;
    background: linear-gradient(135deg, #eff6ff, #ecfeff);
    border: 1px solid #bae6fd;
    border-radius: 14px;
}

.support-broadcast strong {
    display: block;
    margin-bottom: 3px;
    font-size: 12px;
}

.support-broadcast p {
    margin: 0;
    font-size: 11px;
    line-height: 1.45;
}

.support-broadcast a {
    display: inline-block;
    margin-top: 7px;
    color: #0369a1;
    font-size: 11px;
    font-weight: 900;
}

.support-broadcast button {
    position: absolute;
    top: 8px;
    right: 8px;
    display: grid;
    width: 24px;
    height: 24px;
    padding: 0;
    place-items: center;
    color: #475569;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid #cbd5e1;
    border-radius: 50%;
}

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

.support-welcome {
    margin: 11px 12px 8px;
    padding: 11px 12px;
    color: #134e4a;
    font-size: 13px;
    line-height: 1.45;
    background: linear-gradient(135deg, #ecfeff, #f0fdf4);
    border: 1px solid #ccfbf1;
    border-radius: 15px;
}

.support-quick-replies {
    display: flex;
    flex: 0 0 auto;
    gap: 7px;
    padding: 0 12px 10px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.support-quick-replies button {
    flex: 0 0 auto;
    padding: 7px 10px;
    color: #334155;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    background: #ffffff;
    border: 1px solid #dbe4e8;
    border-radius: 999px;
}

.support-quick-replies button:hover {
    color: var(--support-primary);
    background: #ecfeff;
    border-color: var(--support-accent);
}

.support-messages {
    min-height: 150px;
    flex: 1;
    padding: 13px;
    overflow-y: auto;
    background:
        linear-gradient(rgba(248, 250, 252, 0.9), rgba(248, 250, 252, 0.9)),
        radial-gradient(circle at 20% 10%, rgba(20, 184, 166, 0.08), transparent 34%);
}

.support-loading,
.support-empty {
    margin: 15px auto;
    color: var(--support-muted);
    font-size: 12px;
    text-align: center;
}

.support-message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin: 0 0 11px;
}

.support-message--visitor {
    align-items: flex-end;
}

.support-message__sender {
    margin: 0 5px 4px;
    color: var(--support-muted);
    font-size: 10px;
    font-weight: 800;
}

.support-message__bubble {
    max-width: 82%;
    padding: 9px 11px;
    color: #1e293b;
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 5px 15px 15px;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.05);
}

.support-message--visitor .support-message__bubble {
    color: #ffffff;
    background: var(--support-primary);
    border-color: var(--support-primary);
    border-radius: 15px 5px 15px 15px;
}

.support-message--system {
    align-items: center;
}

.support-message--system .support-message__sender {
    display: none;
}

.support-message--system .support-message__bubble {
    max-width: 92%;
    padding: 7px 10px;
    color: #475569;
    font-size: 11px;
    text-align: center;
    background: #eef2f6;
    border: 0;
    border-radius: 999px;
    box-shadow: none;
}

.support-message__attachment {
    display: block;
    margin-top: 7px;
    color: inherit;
    font-weight: 800;
}

.support-message__time {
    margin: 4px 5px 0;
    color: #94a3b8;
    font-size: 9px;
}

.support-composer-wrap {
    flex: 0 0 auto;
    background: #ffffff;
    border-top: 1px solid var(--support-border);
}

.support-file-preview {
    margin: 9px 11px 0;
    padding: 8px 10px;
    overflow: hidden;
    color: var(--support-primary);
    font-size: 11px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: #f0fdfa;
    border: 1px dashed var(--support-accent);
    border-radius: 11px;
}

.support-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px 0;
}

.support-admin-button {
    flex: 0 0 auto;
    padding: 7px 10px;
    color: #9a3412;
    font-size: 11px;
    font-weight: 900;
    cursor: pointer;
    background: #fff7ed;
    border: 1px solid #fdba74;
    border-radius: 999px;
}

.support-admin-button:disabled {
    cursor: default;
    opacity: 0.65;
}

.support-owner {
    min-width: 0;
    color: var(--support-muted);
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.support-composer {
    display: flex;
    align-items: flex-end;
    gap: 7px;
    padding: 9px 11px;
}

.support-attach-button,
.support-send-button {
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    place-items: center;
    cursor: pointer;
    border-radius: 50%;
}

.support-attach-button {
    color: #475569;
    font-size: 18px;
    background: #f8fafc;
    border: 1px solid #dbe4e8;
}

.support-attach-button input {
    display: none;
}

.support-composer textarea {
    min-height: 42px;
    max-height: 115px;
    flex: 1;
    padding: 11px 13px;
    resize: none;
    color: var(--support-ink);
    font-size: 13px;
    line-height: 19px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 18px;
    outline: none;
}

.support-composer textarea:focus {
    border-color: var(--support-accent);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}

.support-send-button {
    color: #ffffff;
    font-size: 18px;
    background: var(--support-primary);
    border: 0;
}

.support-send-button:disabled {
    cursor: wait;
    opacity: 0.6;
}

.support-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 0 12px 10px;
    color: #94a3b8;
    font-size: 9px;
}

.support-footer button {
    flex: 0 0 auto;
    padding: 0;
    color: #64748b;
    font-size: inherit;
    cursor: pointer;
    background: transparent;
    border: 0;
    text-decoration: underline;
}

@keyframes support-pulse {
    0%,
    100% {
        transform: scale(0.96);
        opacity: 0.85;
    }

    60% {
        transform: scale(1.12);
        opacity: 0;
    }
}

@keyframes support-panel-in {
    from {
        transform: translateY(8px) scale(0.98);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@media (max-width: 640px) {
    .support-shell--page {
        display: block;
        padding: 0;
    }

    .support-shell--page .support-panel {
        width: 100%;
        height: 100vh;
        border: 0;
        border-radius: 0;
    }

    .support-shell--widget {
        right: 12px;
        bottom: 12px;
    }

    .support-shell--widget .support-panel {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100%;
        max-height: none;
        border: 0;
        border-radius: 0;
    }

    .support-shell--widget .support-header {
        padding-top: max(14px, env(safe-area-inset-top));
    }

    .support-message__bubble {
        max-width: 88%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .support-launcher__pulse,
    .support-shell--widget .support-panel {
        animation: none;
    }
}
