#tk-connect-chat.tk-ai-dialog {
    width: min(480px, calc(100vw - 24px)); max-width: none; max-height: min(720px, 90dvh);
    padding: 0; overflow: hidden; border: 1px solid #e0e1e4; border-radius: 20px; color: #212327; background: #fff;
}
#tk-connect-chat[open].tk-ai-dialog { display: flex; flex-direction: column; }
.tk-ai-head { padding: 18px 54px 17px 20px; background: #202225; color: #fff; }
.tk-ai-head small { color: #ff9959; letter-spacing: .12em; font-weight: 700; }
#tk-connect-chat .tk-ai-head h2 { color: #fff; margin: 4px 0 0; font-size: 21px; }
#tk-connect-chat .tk-connect__close { color: #fff; background: #ffffff20; }
.tk-ai-log { min-height: 120px; overflow-y: auto; overscroll-behavior: contain; padding: 14px; background: #f5f5f6; }
.tk-ai-log > * { margin: 0 0 10px; }
.tk-ai-log p { line-height: 1.45; font-size: 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.tk-ai-answer { padding: 12px; background: #fff; border-radius: 12px; border: 1px solid #e8e8ea; }
.tk-ai-answer p { margin: 0; }
.tk-ai-user { margin-left: auto; width: fit-content; max-width: 85%; padding: 8px 12px; background: #ffebdd; border-radius: 12px; }
.tk-ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tk-ai-chips button { color: #8d3705; background: #fff1e6; border: 0; padding: 6px 9px; border-radius: 8px; font-size: 12px; }
.tk-ai-card { display: flex; align-items: center; gap: 9px; margin-top: 8px; padding: 8px; border: 1px solid #eee; border-radius: 9px; color: #252629; font-size: 13px; }
.tk-ai-card img { width: 58px; height: 54px; object-fit: contain; flex: none; }
.tk-ai-card span { display: block; color: #a33b00; font-weight: 700; }
.tk-ai-form { display: flex; gap: 6px; padding: 10px 12px 0; }
.tk-ai-form input { min-width: 0; flex: 1; padding: 8px; border: 1px solid #ccc; border-radius: 8px; font-size: 16px; }
.tk-ai-form button { padding: 9px; border: 0; border-radius: 8px; background: #bb4400; color: #fff; font-weight: 700; }
.tk-ai-form button:disabled { opacity: .65; }
#tk-connect-chat .tk-ai-footer { padding: 4px 12px 10px; font-size: 12px; }
#tk-connect-chat .tk-ai-footer p { margin: 0; }

@font-face {
    font-family: 'TK Chat Montserrat';
    src: url('../fonts/montserrat-variable.woff') format('woff');
    font-weight: 100 900;
    font-display: swap;
}
.tk-connect, #tk-connect-chat, #tk-connect-chat input, #tk-connect-chat button {
    font-family: 'TK Chat Montserrat', Montserrat, sans-serif;
}
#tk-connect-chat.tk-ai-dialog {
    position: fixed;
    inset: auto max(20px, env(safe-area-inset-right)) calc(90px + env(safe-area-inset-bottom)) auto;
    z-index: 10045;
    margin: 0;
    width: min(410px, calc(100vw - 32px));
    height: min(620px, calc(100dvh - 108px));
    max-height: none;
    box-shadow: 0 16px 52px #17191d40;
}
.tk-ai-head { flex: none; }
.tk-ai-log { flex: 1 1 auto; min-height: 0; }
.tk-ai-form, .tk-ai-footer { flex: none; }
#tk-connect-chat .tk-ai-card {
    color: #22252a; text-decoration: none; background: #fafafb;
    line-height: 1.35; padding: 8px; border-radius: 10px;
}
#tk-connect-chat .tk-ai-card:hover { border-color: #ef6a25; }
.tk-ai-thumb {
    display: grid; place-items: center; width: 60px; height: 56px; flex: none;
    border-radius: 8px; overflow: hidden; background: #eeeef0;
    color: #60646c; font-size: 9px; text-align: center;
}
.tk-ai-thumb img { width: 100%; height: 100%; }
.tk-ai-card strong { font-weight: 650; }
#tk-connect-chat .tk-ai-footer a { color: #555960; }
@media (max-width: 767px) {
    #tk-connect-chat.tk-ai-dialog {
        right: max(10px, env(safe-area-inset-right));
        bottom: calc(146px + env(safe-area-inset-bottom));
        width: min(410px, calc(100vw - 20px));
        height: min(590px, calc(100dvh - 156px));
    }
    #tk-connect-chat.tk-ai-dialog:focus-within {
        bottom: 8px;
        height: min(590px, calc(100dvh - 16px));
    }
}

#tk-connect-chat .tk-ai-card .tk-ai-thumb { display: grid; place-items: center; color: #6a6e75; background: #eceef0; font-size: 10px; font-weight: 550; line-height: 1; }
