/* =========================================================
   Technical Support Chat Widget — Professional Redesign
   ========================================================= */

/* ─── Design Tokens ─── */
.ts-chat-toggle,
.ts-chat-panel,
.unified-chat-toggle,
.unified-chat-launcher {
    --ts-primary:        var(--primary-color, #6366f1);
    --ts-primary-dark:   color-mix(in srgb, var(--ts-primary) 80%, #0f172a 20%);
    --ts-primary-light:  color-mix(in srgb, var(--ts-primary) 12%, #ffffff 88%);
    --ts-primary-glow:   color-mix(in srgb, var(--ts-primary) 35%, transparent);
    --ts-secondary:      var(--primary-600, var(--secondary-color, #8b5cf6));
    --ts-ink:            color-mix(in srgb, var(--ts-primary) 72%, #0f172a 28%);
    --ts-surface:        #ffffff;
    --ts-bg:             #f1f5f9;
    --ts-border:         #e2e8f0;
    --ts-text-muted:     #64748b;
    --ts-radius:         20px;
    --ts-shadow-lg:      0 24px 64px rgba(15, 23, 42, 0.22), 0 8px 24px rgba(15, 23, 42, 0.10);
    --ts-shadow-btn:     0 8px 24px var(--ts-primary-glow);
    --ts-gradient:       linear-gradient(135deg, var(--ts-primary) 0%, var(--ts-secondary) 100%);
}

/* ─── Keyframes ─── */
@keyframes ts-bounce-in {
    0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
    60%  { transform: scale(1.15) rotate(5deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes ts-pulse-ring {
    0%   { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.85); opacity: 0; }
}
@keyframes ts-slide-up {
    0%   { transform: translateY(28px) scale(0.96); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes ts-slide-down {
    0%   { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(28px) scale(0.96); opacity: 0; }
}
@keyframes ts-bubble-in-bot {
    0%   { transform: translateX(-12px) scale(0.94); opacity: 0; }
    100% { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes ts-bubble-in-user {
    0%   { transform: translateX(12px) scale(0.94); opacity: 0; }
    100% { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes ts-typing-dot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30%            { transform: translateY(-5px); opacity: 1; }
}
@keyframes ts-icon-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes ts-shimmer {
    0%   { background-position: 200% center; }
    100% { background-position: -200% center; }
}
@keyframes ts-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes ts-suggestion-pop {
    0%   { transform: scale(0.88) translateY(6px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* ─── Toggle Button ─── */
.ts-chat-toggle {
    position: fixed;
    right: 24px;
    bottom: calc(24px + var(--qs-protected-copyright-offset, 0px));
    z-index: 1088;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 0;
    background: var(--ts-gradient);
    color: #fff;
    box-shadow: var(--ts-shadow-btn), 0 2px 8px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease;
    animation: ts-bounce-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.ts-chat-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--ts-gradient);
    animation: ts-pulse-ring 2.4s ease-out infinite;
    z-index: -1;
}
.ts-chat-toggle:hover {
    transform: translateY(-4px) scale(1.06);
    box-shadow: 0 16px 40px var(--ts-primary-glow), 0 4px 12px rgba(0,0,0,0.14);
}
.ts-chat-toggle.open {
    transform: translateY(-2px) rotate(15deg) scale(1.04);
    box-shadow: 0 12px 32px var(--ts-primary-glow);
}
.ts-chat-toggle .ts-toggle-icon {
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ts-chat-toggle.open .ts-toggle-icon {
    transform: rotate(180deg);
}
.ts-chat-toggle__badge {
    position: absolute;
    top: -4px;
    left: -2px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 22px;
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.28);
}
.ts-chat-toggle__preview {
    position: fixed;
    right: 24px;
    bottom: calc(96px + var(--qs-protected-copyright-offset, 0px));
    z-index: 1089;
    max-width: min(320px, calc(100vw - 48px));
    padding: 10px 14px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.94);
    color: #fff;
    font-size: 0.8rem;
    line-height: 1.65;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.24);
    opacity: 0;
    transform: translateY(10px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}
.ts-chat-toggle__preview.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.ts-chat-toggle__preview::after {
    content: none;
}

/* ─── Chat Panel ─── */
.ts-chat-panel {
    position: fixed;
    right: 24px;
    bottom: calc(96px + var(--qs-protected-copyright-offset, 0px));
    z-index: 1087;
    width: 460px;
    max-width: calc(100vw - 48px);
    height: 740px;
    max-height: calc(100vh - 130px);
    background: var(--ts-surface);
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: var(--ts-radius);
    box-shadow: var(--ts-shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* closed state */
    opacity: 0;
    transform: translateY(28px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.32s ease, transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ts-chat-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.ts-chat-panel.is-detached-window {
    right: 16px;
    bottom: calc(16px + var(--qs-protected-copyright-offset, 0px));
    width: calc(100vw - 32px);
    max-width: none;
    height: calc(100vh - 32px);
    max-height: none;
    border-radius: 24px;
}
.ts-chat-toggle.is-detached-locked {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    box-shadow: 0 14px 34px rgba(239, 68, 68, 0.28);
}
.ts-chat-toggle.is-detached-locked::before {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
}
.ts-chat-panel__detached-lock {
    position: absolute;
    inset: 0;
    z-index: 9;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(4px);
}
.ts-chat-panel__detached-lock-card {
    width: min(100%, 320px);
    border-radius: 20px;
    border: 1px solid rgba(99, 102, 241, 0.16);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 22px 48px rgba(15, 23, 42, 0.16);
    padding: 18px 18px 16px;
    text-align: center;
}
.ts-chat-panel__detached-lock-title {
    font-weight: 900;
    color: #312e81;
    margin-bottom: 8px;
}
.ts-chat-panel__detached-lock-text {
    color: #475569;
    line-height: 1.8;
    font-size: 0.86rem;
    margin-bottom: 14px;
}

/* ─── Header ─── */
.ts-chat-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: var(--ts-gradient);
    color: #fff;
    gap: 12px;
}
.ts-chat-header-left {
    display: flex;
    align-items: center;
    gap: 11px;
    flex: 1 1 auto;
    min-width: 0;
}
.ts-chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.22);
}
.ts-chat-header-info {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}
.ts-chat-header-title {
    font-weight: 700;
    font-size: 0.97rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ts-chat-header-subtitle {
    display: block;
    font-size: 0.78rem;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.ts-chat-header-online {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    opacity: 0.9;
    max-width: 100%;
    min-width: 0;
}
.ts-chat-header-online::before {
    content: '';
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 2px rgba(74,222,128,0.35);
}
.ts-chat-close-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 0;
    background: rgba(255,255,255,0.15);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    backdrop-filter: blur(4px);
}
.ts-chat-close-btn:hover {
    background: rgba(255,255,255,0.28);
    transform: scale(1.1);
}
.ts-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.ts-chat-reset-btn {
    border: 0;
    border-radius: 999px;
    background: rgba(255,255,255,0.16);
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    font-size: 0.77rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    backdrop-filter: blur(4px);
}
.ts-chat-reset-btn:hover {
    background: rgba(255,255,255,0.28);
    transform: translateY(-1px);
}
.ts-chat-reset-btn span {
    display: inline-block;
}
.ts-chat-detach-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 0;
    background: rgba(255,255,255,0.15);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    backdrop-filter: blur(4px);
}
.ts-chat-detach-btn:hover {
    background: rgba(255,255,255,0.28);
    transform: translateY(-1px);
}

/* ─── Messages Body ─── */
.ts-chat-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 16px 10px;
    background: var(--ts-bg);
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}
.ts-chat-body::-webkit-scrollbar {
    width: 5px;
}
.ts-chat-body::-webkit-scrollbar-track {
    background: transparent;
}
.ts-chat-body::-webkit-scrollbar-thumb {
    background: rgba(99,102,241,0.22);
    border-radius: 999px;
}
.ts-chat-body::-webkit-scrollbar-thumb:hover {
    background: rgba(99,102,241,0.38);
}

/* ─── Chat Bubbles ─── */
.ts-chat-bubble {
    max-width: 82%;
    padding: 11px 15px;
    border-radius: 18px;
    margin-bottom: 10px;
    white-space: pre-wrap;
    line-height: 1.72;
    font-size: 0.93rem;
    word-break: break-word;
    position: relative;
}
.ts-chat-bubble__body {
    white-space: pre-wrap;
}
.ts-chat-bubble__attachments {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}
.ts-chat-bubble__attachment {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-radius: 14px;
    padding: 9px 11px;
    border: 1px solid color-mix(in srgb, var(--ts-border) 86%, rgba(99,102,241,0.14) 14%);
    background: rgba(248, 250, 252, 0.92);
    color: #0f172a;
    text-decoration: none;
}
.ts-chat-bubble__attachment:hover {
    color: #0f172a;
    border-color: color-mix(in srgb, var(--ts-primary) 35%, var(--ts-border) 65%);
    background: #ffffff;
}
.ts-chat-bubble__attachment.is-local {
    cursor: default;
}
.ts-chat-bubble__attachment-name {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 0.8rem;
    font-weight: 700;
}
.ts-chat-bubble__attachment-name span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ts-chat-bubble__attachment-meta {
    flex-shrink: 0;
    font-size: 0.68rem;
    color: #64748b;
    text-align: left;
}
.ts-chat-bubble.is-user .ts-chat-bubble__attachment {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.24);
    color: #ffffff;
}
.ts-chat-bubble.is-user .ts-chat-bubble__attachment:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.22);
}
.ts-chat-bubble.is-user .ts-chat-bubble__attachment-meta {
    color: rgba(255, 255, 255, 0.82);
}
.ts-chat-bubble__time {
    margin-top: 8px;
    font-size: 0.68rem;
    line-height: 1;
    opacity: 0.8;
}
.ts-chat-bubble.is-bot {
    background: var(--ts-surface);
    color: #0f172a;
    border: 1px solid var(--ts-border);
    border-bottom-right-radius: 5px;
    box-shadow: 0 3px 12px rgba(15,23,42,0.07);
    align-self: flex-start;
    animation: ts-bubble-in-bot 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.ts-chat-bubble.is-bot .ts-chat-bubble__time {
    color: #64748b;
    text-align: left;
}
.ts-chat-bubble.is-user {
    background: var(--ts-gradient);
    color: #fff;
    border-bottom-left-radius: 5px;
    margin-inline-start: auto;
    box-shadow: 0 4px 14px var(--ts-primary-glow);
    animation: ts-bubble-in-user 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.ts-chat-bubble.is-user .ts-chat-bubble__time {
    color: rgba(255, 255, 255, 0.9);
    text-align: right;
}

.ts-chat-agent-intro {
    align-self: center;
    max-width: 92%;
    margin: 2px 0 10px;
    padding: 6px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--ts-primary) 10%, #ffffff 90%);
    border: 1px solid color-mix(in srgb, var(--ts-primary) 20%, var(--ts-border) 80%);
    color: var(--ts-ink);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
    animation: ts-fade-in 0.22s ease both;
}

.ts-chat-session-closed {
    margin: 4px 0 12px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(245, 158, 11, 0.28);
    background: linear-gradient(180deg, rgba(255, 251, 235, 0.98), rgba(255, 247, 237, 0.95));
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.08);
    animation: ts-fade-in 0.22s ease both;
}
.ts-chat-session-closed__title {
    font-size: 0.85rem;
    font-weight: 800;
    color: #92400e;
    margin-bottom: 5px;
}
.ts-chat-session-closed__text {
    font-size: 0.8rem;
    line-height: 1.7;
    color: #78350f;
}

/* Typing indicator */
.ts-chat-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    background: var(--ts-surface);
    border: 1px solid var(--ts-border);
    border-radius: 18px;
    border-bottom-right-radius: 5px;
    width: fit-content;
    margin-bottom: 10px;
    box-shadow: 0 3px 12px rgba(15,23,42,0.07);
    animation: ts-fade-in 0.25s ease both;
}
.ts-chat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ts-primary);
    display: block;
}
.ts-chat-typing span:nth-child(1) { animation: ts-typing-dot 1.2s ease-in-out 0s infinite; }
.ts-chat-typing span:nth-child(2) { animation: ts-typing-dot 1.2s ease-in-out 0.2s infinite; }
.ts-chat-typing span:nth-child(3) { animation: ts-typing-dot 1.2s ease-in-out 0.4s infinite; }

/* Info cards inside messages */
.ts-chat-link-wrap {
    margin-bottom: 10px;
    animation: ts-bubble-in-bot 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.ts-chat-link-wrap .border {
    border-radius: 14px !important;
    border-color: var(--ts-border) !important;
    background: var(--ts-surface) !important;
    box-shadow: 0 3px 12px rgba(15,23,42,0.06);
}

.ts-chat-summary-card {
    margin-bottom: 10px;
    animation: ts-bubble-in-bot 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.ts-chat-summary-card__box {
    padding: 12px 13px;
    border-radius: 16px;
    border: 1px solid color-mix(in srgb, var(--ts-border) 78%, rgba(99,102,241,0.18) 22%);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,249,255,0.96)),
        var(--ts-surface);
    box-shadow: 0 8px 22px rgba(15,23,42,0.06);
}

.ts-chat-summary-card__heading {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--ts-ink);
    margin-bottom: 10px;
}

.ts-chat-summary-card__rows {
    display: grid;
    gap: 7px;
}

.ts-chat-summary-card__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(255,255,255,0.74);
    border: 1px solid rgba(148,163,184,0.18);
}

.ts-chat-summary-card__label {
    font-size: 0.78rem;
    color: var(--ts-text-muted);
}

.ts-chat-summary-card__value {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--ts-ink);
    text-align: left;
}

.ts-chat-summary-card__notes {
    display: grid;
    gap: 6px;
    margin-top: 9px;
}

.ts-chat-summary-card__note {
    font-size: 0.81rem;
    line-height: 1.7;
    color: #475569;
}

.ts-chat-summary-card__channels {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.ts-chat-summary-card__chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(99,102,241,0.08);
    border: 1px solid rgba(99,102,241,0.16);
    color: #334155;
    font-size: 0.78rem;
    line-height: 1.5;
    word-break: break-word;
}

.ts-chat-summary-card__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
    border-radius: 11px;
    padding: 7px 14px;
    box-shadow: 0 8px 18px rgba(99,102,241,0.16);
}

/* Quick link action buttons inside messages */
.ts-chat-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 10px;
    animation: ts-fade-in 0.35s ease both;
}
.ts-chat-actions .btn {
    border-radius: 10px;
    font-size: 0.82rem;
    padding: 5px 12px;
    transition: all 0.2s ease;
}
.ts-chat-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(99,102,241,0.18);
}
.ts-chat-actions .btn.is-current-page,
.ts-chat-actions .btn:disabled {
    opacity: 0.72;
    cursor: default;
    box-shadow: none;
}
.ts-chat-actions .btn.is-current-page:hover,
.ts-chat-actions .btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Feedback controls */
.ts-chat-feedback {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    animation: ts-fade-in 0.35s ease both;
}
.ts-chat-panel.is-chat-closed .ts-chat-form textarea,
.ts-chat-panel.is-chat-closed .ts-chat-form input {
    background: rgba(241, 245, 249, 0.88);
    cursor: not-allowed;
}
.ts-chat-panel.is-chat-closed .ts-chat-footer-actions {
    display: none;
}
.ts-chat-feedback__label {
    font-size: 0.8rem;
    color: var(--ts-text-muted);
}
.ts-chat-feedback .btn {
    border-radius: 8px;
    font-size: 0.85rem;
    padding: 4px 10px;
    transition: all 0.2s ease;
}
.ts-chat-feedback .btn:hover {
    transform: scale(1.12);
}
.ts-chat-feedback-result {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--ts-primary) 18%, var(--ts-border) 82%);
    background: color-mix(in srgb, var(--ts-primary) 7%, #ffffff 93%);
    animation: ts-fade-in 0.28s ease both;
}
.ts-chat-feedback-result__icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(99,102,241,0.12);
    font-size: 1rem;
}
.ts-chat-feedback-result__text {
    min-width: 0;
}
.ts-chat-feedback-result__title {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--ts-ink);
}
.ts-chat-feedback-result__body {
    font-size: 0.76rem;
    color: var(--ts-text-muted);
    line-height: 1.6;
}
.ts-chat-idle-prompt {
    margin-bottom: 10px;
    padding: 14px 14px 12px;
    border-radius: 16px;
    border: 1px solid color-mix(in srgb, #f59e0b 30%, var(--ts-border) 70%);
    background: linear-gradient(180deg, rgba(255, 251, 235, 0.98), rgba(255, 247, 237, 0.96));
    box-shadow: 0 14px 28px rgba(245, 158, 11, 0.10);
    animation: ts-fade-in 0.28s ease both;
}
.ts-chat-idle-prompt__title {
    font-size: 0.86rem;
    font-weight: 800;
    color: #9a3412;
    margin-bottom: 6px;
}
.ts-chat-idle-prompt__body {
    font-size: 0.79rem;
    line-height: 1.8;
    color: #7c2d12;
}
.ts-chat-idle-prompt__actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.ts-chat-idle-prompt__actions .btn {
    flex: 1;
    border-radius: 11px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* ─── Suggestions Strip ─── */
.ts-chat-suggestions {
    flex-shrink: 0;
    padding: 10px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    background: var(--ts-bg);
    border-top: 1px solid var(--ts-border);
    max-height: 132px;
    overflow-y: auto;
}
.ts-chat-suggestions::-webkit-scrollbar { height: 3px; width: 3px; }
.ts-chat-suggestions::-webkit-scrollbar-thumb {
    background: rgba(99,102,241,0.22);
    border-radius: 999px;
}
.ts-chat-suggestions .btn {
    border-radius: 20px;
    font-size: 0.8rem;
    padding: 5px 13px;
    border-color: color-mix(in srgb, var(--ts-primary) 28%, var(--ts-border) 72%);
    color: var(--ts-ink);
    background: var(--ts-surface);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    line-height: 1.35;
    max-width: 72%;
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: ts-suggestion-pop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.ts-chat-suggestions .btn:hover {
    background: var(--ts-primary-light);
    border-color: var(--ts-primary);
    color: var(--ts-ink);
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 4px 12px rgba(99,102,241,0.16);
}

/* ─── Footer / Input Area ─── */
.ts-chat-footer {
    flex-shrink: 0;
    padding: 14px 14px 16px;
    border-top: 1px solid var(--ts-border);
    background: var(--ts-surface);
}
.ts-chat-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 10px;
}
.ts-chat-attach-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1.5px solid color-mix(in srgb, var(--ts-primary) 18%, var(--ts-border) 82%);
    background: var(--ts-surface);
    color: var(--ts-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    cursor: pointer;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                border-color 0.2s ease,
                box-shadow 0.22s ease,
                opacity 0.2s ease;
}
.ts-chat-attach-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    border-color: var(--ts-primary);
    box-shadow: 0 8px 20px rgba(99,102,241,0.14);
}
.ts-chat-attach-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.ts-chat-input-wrap {
    flex: 1;
    position: relative;
}
.ts-chat-input-wrap textarea,
.ts-chat-input-wrap input[type="text"] {
    width: 100%;
    border: 1.5px solid var(--ts-border);
    border-radius: 14px;
    padding: 10px 14px;
    font-size: 0.92rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: var(--ts-bg);
    color: #0f172a;
    min-height: 44px;
    max-height: 110px;
    overflow-y: auto;
    font-family: inherit;
}
.ts-chat-input-wrap textarea:focus,
.ts-chat-input-wrap input[type="text"]:focus {
    border-color: var(--ts-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ts-primary) 15%, transparent);
    background: var(--ts-surface);
}
.ts-chat-send-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 0;
    background: var(--ts-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    cursor: pointer;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.22s ease,
                opacity 0.2s;
    box-shadow: 0 4px 14px var(--ts-primary-glow);
}
.ts-chat-send-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.08);
    box-shadow: 0 8px 22px var(--ts-primary-glow);
}
.ts-chat-send-btn:active:not(:disabled) {
    transform: scale(0.94);
}
.ts-chat-send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.ts-chat-send-btn.sending i {
    animation: ts-icon-spin 0.6s linear infinite;
}
.ts-chat-attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -2px 0 10px;
}
.ts-chat-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--ts-primary) 18%, var(--ts-border) 82%);
    background: color-mix(in srgb, var(--ts-primary) 7%, #ffffff 93%);
    color: var(--ts-ink);
    padding: 6px 8px 6px 10px;
    box-shadow: 0 4px 12px rgba(15,23,42,0.05);
}
.ts-chat-attachment-chip__name {
    min-width: 0;
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.76rem;
    font-weight: 700;
}
.ts-chat-attachment-chip__meta {
    font-size: 0.68rem;
    color: var(--ts-text-muted);
}
.ts-chat-attachment-chip__remove {
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: rgba(99,102,241,0.12);
    color: var(--ts-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}
.ts-chat-attachment-chip__remove:hover {
    background: rgba(99,102,241,0.2);
    transform: scale(1.06);
}

/* Action buttons row */
.ts-chat-footer-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}
.ts-chat-footer-actions .btn {
    border-radius: 12px;
    font-size: 0.82rem;
    padding: 7px 13px;
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.ts-chat-footer-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 14px rgba(15,23,42,0.12);
}
.ts-chat-footer-actions .btn-create {
    background: var(--ts-surface);
    border: 1.5px solid var(--ts-border);
    color: var(--ts-text-muted);
}
.ts-chat-footer-actions .btn-create:hover {
    border-color: var(--ts-primary);
    color: var(--ts-primary);
    background: var(--ts-primary-light);
}
.ts-chat-footer-actions .btn-human {
    background: var(--ts-surface);
    border: 1.5px solid var(--ts-border);
    color: var(--ts-text-muted);
}
.ts-chat-footer-actions .btn-human:hover {
    border-color: #10b981;
    color: #059669;
    background: #f0fdf4;
}

/* ─── Unified Launcher ─── */
.unified-chat-toggle {
    position: fixed;
    right: 24px;
    bottom: calc(24px + var(--qs-protected-copyright-offset, 0px));
    z-index: 1088;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 0;
    background: var(--ts-gradient);
    color: #fff;
    box-shadow: var(--ts-shadow-btn);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    animation: ts-bounce-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.unified-chat-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--ts-gradient);
    animation: ts-pulse-ring 2.4s ease-out infinite;
    z-index: -1;
}
.unified-chat-toggle:hover {
    transform: translateY(-4px) scale(1.06);
    box-shadow: 0 16px 40px var(--ts-primary-glow);
}
.unified-chat-toggle.open {
    transform: translateY(-2px) rotate(15deg) scale(1.04);
}

.unified-chat-launcher {
    position: fixed;
    right: 24px;
    bottom: calc(96px + var(--qs-protected-copyright-offset, 0px));
    z-index: 1087;
    width: 440px;
    max-width: calc(100vw - 48px);
    background: var(--ts-surface);
    border: 1px solid rgba(99,102,241,0.12);
    border-radius: var(--ts-radius);
    box-shadow: var(--ts-shadow-lg);
    overflow: hidden;
    opacity: 0;
    transform: translateY(24px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.unified-chat-launcher.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.unified-chat-launcher__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: var(--ts-gradient);
    color: #fff;
}

.unified-chat-launcher__body {
    padding: 14px;
    display: grid;
    gap: 10px;
    background: var(--ts-bg);
}

.unified-chat-option {
    width: 100%;
    border: 1.5px solid var(--ts-border);
    background: var(--ts-surface);
    border-radius: 16px;
    padding: 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    text-align: start;
    cursor: pointer;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.22s ease,
                border-color 0.22s ease;
    animation: ts-suggestion-pop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.unified-chat-option:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--ts-primary) 40%, var(--ts-border) 60%);
    box-shadow: 0 10px 28px color-mix(in srgb, var(--ts-primary) 12%, transparent);
}
@keyframes ts-support-alert-pulse {
    0% {
        border-color: rgba(239, 68, 68, 0.38);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.20);
    }
    50% {
        border-color: rgba(239, 68, 68, 0.9);
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.08);
    }
    100% {
        border-color: rgba(239, 68, 68, 0.38);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.0);
    }
}
.unified-chat-option.has-unread-support {
    border-color: rgba(239, 68, 68, 0.78);
    background: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(255, 245, 245, 0.98));
    animation: ts-suggestion-pop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both, ts-support-alert-pulse 1.7s ease-in-out infinite;
}
.unified-chat-option.has-unread-support:hover {
    border-color: rgba(239, 68, 68, 0.95);
    box-shadow: 0 12px 28px rgba(239, 68, 68, 0.18);
}

.unified-chat-option__icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex: 0 0 auto;
    font-size: 1.1rem;
}
.unified-chat-option__icon.is-ai,
.unified-chat-option__icon.is-support {
    background: var(--ts-gradient);
}
.unified-chat-option__content {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.unified-chat-option__title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.unified-chat-option__title {
    color: var(--ts-ink);
    font-weight: 700;
    font-size: 0.93rem;
}
.unified-chat-option__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 10px 22px rgba(239, 68, 68, 0.24);
}
.unified-chat-option__desc {
    color: var(--ts-text-muted);
    font-size: 0.83rem;
    line-height: 1.6;
}

/* ─── Send animation shimmer ─── */
@keyframes ts-send-shimmer {
    0%   { background-position: 200% center; }
    100% { background-position: -200% center; }
}
.ts-chat-send-btn.shimmer {
    background: linear-gradient(90deg,
        var(--ts-primary) 0%,
        var(--ts-secondary) 40%,
        var(--ts-primary) 80%,
        var(--ts-secondary) 100%);
    background-size: 200% auto;
    animation: ts-send-shimmer 0.8s linear 1;
}

/* ─── Responsive ─── */
@media (max-width: 767.98px) {
    .ts-chat-toggle,
    .unified-chat-toggle {
        right: 16px;
        bottom: calc(16px + var(--qs-protected-copyright-offset, 0px));
    }
    .ts-chat-toggle__preview {
        right: 16px;
        bottom: calc(88px + var(--qs-protected-copyright-offset, 0px));
        max-width: calc(100vw - 32px);
    }
    .ts-chat-panel {
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
        bottom: calc(80px + var(--qs-protected-copyright-offset, 0px));
        height: calc(100dvh - 100px);
        max-height: none;
        border-radius: 18px;
    }
    .ts-chat-panel.is-detached-window {
        right: 10px;
        left: 10px;
        bottom: calc(10px + var(--qs-protected-copyright-offset, 0px));
        width: auto;
        height: calc(100vh - 20px);
    }
    .unified-chat-launcher {
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
        bottom: calc(84px + var(--qs-protected-copyright-offset, 0px));
        border-radius: 18px;
    }
    .ts-chat-footer-actions .btn {
        font-size: 0.78rem;
        padding: 7px 10px;
    }
    .ts-chat-header {
        align-items: flex-start;
        gap: 10px;
        padding: 14px 14px 12px;
    }
    .ts-chat-header-left {
        gap: 9px;
    }
    .ts-chat-header-avatar {
        width: 36px;
        height: 36px;
        border-radius: 12px;
        font-size: 1rem;
    }
    .ts-chat-header-title {
        font-size: 0.9rem;
    }
    .ts-chat-header-subtitle {
        display: -webkit-box;
        white-space: normal;
        line-height: 1.35;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        max-height: calc(1.35em * 2);
    }
    .ts-chat-header-actions {
        gap: 6px;
    }
    .ts-chat-reset-btn {
        padding: 7px 8px;
    }
    .ts-chat-detach-btn,
    .ts-chat-close-btn {
        width: 30px;
        height: 30px;
    }
    .ts-chat-reset-btn span {
        display: none;
    }
}
