
.tkw-root {
    position: fixed !important;
    bottom: 28px;
    right: 28px;
    z-index: 99999;
    font-family: 'Roboto', sans-serif;
}

/* ── Launcher Button ── */
.tkw-launcher {
    position: relative;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: none;
    background: #eb5017;
    box-shadow: 0 6px 28px rgba(235,80,23,.55), 0 2px 8px rgba(0,0,0,.22);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s ease;
    outline: none;
    flex-shrink: 0;
    overflow: visible;
}

.tkw-launcher:hover {
    transform: scale(1.10);
    box-shadow: 0 10px 36px rgba(235,80,23,.65), 0 4px 12px rgba(0,0,0,.25);
}

.tkw-launcher.tkw-launcher--open {
    background: #eb5017;
}

.tkw-launcher-logo {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    padding: 6px;
    transition: opacity .2s, transform .2s;
}

.tkw-launcher-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.tkw-launcher-logo.tkw-launcher-logo--hidden {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
    position: absolute;
    pointer-events: none;
}

.tkw-launcher-close {
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .2s, transform .2s;
}

.tkw-launcher-close.tkw-launcher-close--hidden {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
    position: absolute;
    pointer-events: none;
}

.tkw-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2.5px solid rgba(235,80,23,.5);
    animation: tkwPulse 2.4s ease-out infinite;
    pointer-events: none;
}

@keyframes tkwPulse {
    0%   { transform: scale(1);    opacity: .7; }
    70%  { transform: scale(1.4);  opacity: 0;  }
    100% { transform: scale(1.4);  opacity: 0;  }
}

/* ── Chat Panel ── */
.tkw-panel {
    position: absolute;
    bottom: calc(62px + 14px);
    right: 0;
    width: 370px;
    height: min(530px, calc(100vh - 140px));
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(235,80,23,.18), 0 4px 20px rgba(0,0,0,.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.95);
    pointer-events: none;
    transition: opacity .28s cubic-bezier(.4,0,.2,1), transform .28s cubic-bezier(.34,1.56,.64,1);
    transform-origin: bottom right;
}

.tkw-panel.tkw-panel--open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ── Header ── */
.tkw-header {
    background: #eb5017;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.tkw-header::before {
    content: '';
    position: absolute;
    top: -30px; right: -30px;
    width: 100px; height: 100px;
    border-radius: 50%;
    background: rgba(255,255,255,.07);
    pointer-events: none;
}

.tkw-header::after {
    content: '';
    position: absolute;
    bottom: -40px; left: 30px;
    width: 130px; height: 130px;
    border-radius: 50%;
    background: rgba(255,255,255,.05);
    pointer-events: none;
}

.tkw-header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1;
}

.tkw-header-avatar {
    position: relative;
    width: 42px; height: 42px;
    flex-shrink: 0;
}

.tkw-header-logo {
    width: 42px; height: 42px;
    border-radius: 50%;
    object-fit: contain;
    background: rgba(255,255,255,.18);
    padding: 7px;
    border: 2px solid rgba(255,255,255,.3);
    filter: brightness(0) invert(1);
}

.tkw-online-dot {
    position: absolute;
    bottom: 1px; right: 1px;
    width: 10px; height: 10px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #fff;
}

.tkw-header-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    z-index: 1;
}

.tkw-header-title {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
}

.tkw-header-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: rgba(255,255,255,.75);
}

.tkw-status-dot {
    width: 6px; height: 6px;
    background: #22c55e;
    border-radius: 50%;
    animation: tkwBlink 2s ease-in-out infinite;
}

@keyframes tkwBlink {
    0%, 100% { opacity: 1; }
    50%       { opacity: .4; }
}

.tkw-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 1;
}

.tkw-icon-btn {
    width: 30px; height: 30px;
    border: none;
    background: rgba(255,255,255,.15);
    border-radius: 8px;
    color: rgba(255,255,255,.85);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    transition: background .15s;
}

.tkw-icon-btn:hover {
    background: rgba(255,255,255,.28);
    color: #fff;
}

/* ── Messages ── */
.tkw-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #f5f7fb;
}

.tkw-messages::-webkit-scrollbar { width: 4px; }
.tkw-messages::-webkit-scrollbar-track { background: transparent; }
.tkw-messages::-webkit-scrollbar-thumb { background: #d0d5dd; border-radius: 10px; }

/* ── Welcome ── */
.tkw-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 8px 4px;
    gap: 8px;
}

.tkw-welcome-avatar {
    width: 58px; height: 58px;
    border-radius: 50%;
    background: #eb5017;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 11px;
    box-shadow: 0 4px 16px rgba(235,80,23,.35);
    margin-bottom: 4px;
}

.tkw-welcome-avatar img {
    width: 100%; height: 100%;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.tkw-welcome-greeting {
    font-size: 17px;
    font-weight: 700;
    color: #101828;
    margin: 0;
}

.tkw-welcome-text {
    font-size: 13px;
    color: #667085;
    margin: 0 0 6px;
    line-height: 1.55;
    max-width: 280px;
}

/* ── Chips ── */
.tkw-chips {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 4px;
}

.tkw-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1.5px solid #e4e7ec;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #344054;
    cursor: pointer;
    text-align: left;
    transition: border-color .15s, background .15s, color .15s, transform .12s;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.tkw-chip i { font-size: 14px; color: #eb5017; flex-shrink: 0; }

.tkw-chip:hover {
    border-color: #eb5017;
    background: rgba(235,80,23,.05);
    color: #eb5017;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(235,80,23,.12);
}

/* ── Message rows ── */
.tkw-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.tkw-row.tkw-row--user { flex-direction: row-reverse; }

/* ── Avatars ── */
.tkw-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tkw-avatar.tkw-avatar--bot {
    background: #eb5017;
    padding: 5px;
    box-shadow: 0 2px 8px rgba(235,80,23,.3);
}

.tkw-avatar.tkw-avatar--bot img {
    width: 100%; height: 100%;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

/* ── Bubbles ── */
.tkw-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 16px;
    word-break: break-word;
}

.tkw-bubble.tkw-bubble--bot {
    background: #fff;
    border: 1px solid #e9ecf0;
    border-bottom-left-radius: 4px;
    color: #101828;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.tkw-bubble.tkw-bubble--user {
    background: #eb5017;
    border-bottom-right-radius: 4px;
    color: #fff;
    box-shadow: 0 2px 10px rgba(235,80,23,.35);
}

.tkw-bubble.tkw-bubble--error {
    background: #fff1f0;
    border-color: #ffa39e;
    color: #a8071a;
}

.tkw-bubble-text {
    font-size: 13.5px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.tkw-bubble-time {
    display: block;
    font-size: 10px;
    margin-top: 4px;
    opacity: .5;
}

.tkw-bubble.tkw-bubble--user .tkw-bubble-time { text-align: right; }

/* ── Typing dots ── */
.tkw-typing {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.tkw-dot {
    width: 7px; height: 7px;
    background: #eb5017;
    border-radius: 50%;
    animation: tkwBounce 1.3s ease-in-out infinite;
}

.tkw-dot:nth-child(2) { animation-delay: .18s; }
.tkw-dot:nth-child(3) { animation-delay: .36s; }

@keyframes tkwBounce {
    0%, 57%, 100% { transform: translateY(0);   opacity: .4; }
    28%            { transform: translateY(-6px); opacity: 1;  }
}

/* ── Input area ── */
.tkw-input-area {
    background: #fff;
    border-top: 1px solid #eaecf0;
    padding: 12px 14px 8px;
    flex-shrink: 0;
}

.tkw-input-box {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #f8f9fc;
    border: 1.5px solid #d0d5dd;
    border-radius: 12px;
    padding: 7px 7px 7px 13px;
    transition: border-color .18s, box-shadow .18s;
}

.tkw-input-box:focus-within {
    border-color: #eb5017;
    box-shadow: 0 0 0 3px rgba(235,80,23,.10);
    background: #fff;
}

.tkw-input-box.tkw-input-box--disabled { opacity: .6; }

.tkw-textarea {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    font-size: 13.5px;
    line-height: 1.5;
    max-height: 100px;
    overflow-y: auto;
    color: #101828;
    padding: 3px 0;
    font-family: 'Roboto', sans-serif;
}

.tkw-textarea::placeholder { color: #98a2b3; }
.tkw-textarea:disabled { cursor: not-allowed; }

.tkw-send {
    width: 34px; height: 34px;
    background: #eb5017;
    border: none;
    border-radius: 9px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 14px;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 2px 8px rgba(235,80,23,.35);
}

.tkw-send:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow: 0 4px 14px rgba(235,80,23,.50);
}

.tkw-send:disabled {
    background: #d0d5dd;
    box-shadow: none;
    cursor: not-allowed;
}

.tkw-footer-note {
    text-align: center;
    font-size: 10.5px;
    color: #adb5bd;
    margin: 6px 0 0;
}

.tkw-footer-note strong { color: #eb5017; }

@media (max-width: 480px) {
    .tkw-root { bottom: 16px; right: 16px; }
    .tkw-panel { width: calc(100vw - 32px); height: 70vh; }
}

/* ── Search mode toggle bar ── */
.tkw-mode-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff;
    border-top: 1px solid #eaecf0;
    flex-shrink: 0;
}

.tkw-mode-label {
    font-size: 11.5px;
    color: #98a2b3;
    font-weight: 500;
    white-space: nowrap;
}

.tkw-mode-toggle {
    display: flex;
    background: #f2f4f7;
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

.tkw-mode-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 12px;
    font-weight: 500;
    color: #667085;
    cursor: pointer;
    transition: background .15s, color .15s, box-shadow .15s;
    white-space: nowrap;
}

.tkw-mode-btn i { font-size: 12px; }

.tkw-mode-btn:hover:not(.tkw-mode-btn--active) {
    background: rgba(235,80,23,.07);
    color: #eb5017;
}

.tkw-mode-btn.tkw-mode-btn--active {
    background: #fff;
    color: #eb5017;
    box-shadow: 0 1px 4px rgba(0,0,0,.10);
    font-weight: 600;
}

/* ── Wider bubble when it contains employee selection ── */
.tkw-bubble:has(.tkw-selection-btns) {
    max-width: 92%;
}

/* ── Employee Selection Buttons ── */
.tkw-selection-btns {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}

.tkw-selection-btn {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: #fff;
    border: 1.5px solid #e4e7ec;
    border-radius: 8px;
    font-size: 12.5px;
    color: #344054;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s, transform .1s;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tkw-selection-btn:hover {
    border-color: #eb5017;
    background: rgba(235,80,23,.05);
    color: #eb5017;
    transform: translateX(2px);
}

.tkw-selection-btn.tkw-selection-btn--chosen {
    border-color: #eb5017;
    background: #eb5017;
    color: #fff;
    cursor: default;
}

.tkw-selection-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

/* ── Load More Button ── */
.tkw-load-more-btn {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 7px 12px;
    background: transparent;
    border: 1.5px dashed #eb5017;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #eb5017;
    text-align: center;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.tkw-load-more-btn:hover:not(:disabled) {
    background: rgba(235,80,23,.08);
}

.tkw-load-more-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* ── Sidebar (chat history) ── */
.tkw-panel {
    flex-direction: row;
}

.tkw-panel.tkw-panel--history-open {
    width: min(580px, calc(100vw - 32px));
}

.tkw-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 20px;
}

.tkw-sidebar {
    width: 0;
    box-sizing: border-box;
    flex: 0 0 auto;
    background: #f9fafb;
    border-right: 1px solid #eaecf0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transition: width .28s cubic-bezier(.4,0,.2,1), opacity .22s ease;
}

.tkw-panel.tkw-panel--history-open .tkw-sidebar {
    width: 210px;
    opacity: 1;
}

.tkw-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 12px;
    border-bottom: 1px solid #eaecf0;
    flex-shrink: 0;
}

.tkw-sidebar-title {
    font-size: 14px;
    font-weight: 700;
    color: #101828;
}

.tkw-sidebar-close {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: #667085;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.tkw-sidebar-close:hover {
    background: #f2f4f7;
    color: #101828;
}

.tkw-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px 12px;
}

.tkw-sidebar-list::-webkit-scrollbar { width: 4px; }
.tkw-sidebar-list::-webkit-scrollbar-track { background: transparent; }
.tkw-sidebar-list::-webkit-scrollbar-thumb { background: #d0d5dd; border-radius: 10px; }

.tkw-session-empty {
    padding: 20px 10px;
    text-align: center;
    font-size: 12px;
    color: #98a2b3;
}

.tkw-session-item {
    padding: 10px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
    margin-bottom: 2px;
}

.tkw-session-item:hover {
    background: #f2f4f7;
}

.tkw-session-item.tkw-session-item--active {
    background: #fff0eb;
}

.tkw-session-title {
    font-size: 13px;
    font-weight: 500;
    color: #101828;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.35;
}

.tkw-session-meta {
    font-size: 11px;
    color: #98a2b3;
    margin-top: 2px;
}

@media (max-width: 480px) {
    .tkw-panel.tkw-panel--history-open {
        width: calc(100vw - 32px);
    }

    .tkw-panel.tkw-panel--history-open .tkw-sidebar {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: 180px;
        z-index: 10;
        border-radius: 20px 0 0 20px;
    }
}
