/* TKK website chat widget. Scoped styles avoid changes to existing site modules. */
.tkk-webchat {
    position: fixed;
    right: 18px;
    bottom: 18px;
    /* The public header uses z-index:9000. Keep the chat above it, below system modals. */
    z-index: 10000;
    font-family: inherit;
    font-size: 13px;
    color: #172b4d;
}
.tkk-webchat * { box-sizing: border-box; }
.tkk-webchat [hidden] { display: none !important; }

.tkk-webchat-launcher {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border: 0;
    border-radius: 999px;
    background: #1569c7;
    color: #fff;
    box-shadow: 0 8px 26px rgba(14, 71, 145, .25);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    cursor: pointer;
    transform-origin: center;
}
.tkk-webchat-launcher svg { width: 25px; height: 25px; flex: 0 0 25px; }
/* Gentle recurring pulse only while the chat is closed. */
.tkk-webchat-launcher[aria-expanded="false"] {
    animation: tkk-webchat-breathe 3.5s ease-in-out infinite;
}
@keyframes tkk-webchat-breathe {
    0%, 15%, 65%, 100% { transform: scale(1); }
    38% { transform: scale(1.05); }
}
.tkk-webchat-launcher:hover {
    background: #0b55b3;
    animation: none;
    transform: scale(1.025);
}
.tkk-webchat-launcher:focus-visible,
.tkk-webchat-close:focus-visible,
.tkk-webchat button:focus-visible,
.tkk-webchat textarea:focus-visible,
.tkk-webchat input:focus-visible {
    outline: 2px solid #f4b64d;
    outline-offset: 2px;
}

.tkk-webchat-panel {
    position: absolute;
    right: 0;
    bottom: 64px;
    width: min(360px, calc(100vw - 26px));
    height: min(560px, calc(100dvh - 105px));
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border: 1px solid #d9e6f4;
    border-radius: 16px;
    box-shadow: 0 18px 52px rgba(16, 45, 83, .24);
}
.tkk-webchat-head {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    background: #f5f9ff;
    border-bottom: 1px solid #dae5f3;
}
.tkk-webchat-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 35px;
    height: 35px;
    border-radius: 10px;
    background: #166ac8;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}
.tkk-webchat-head-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.tkk-webchat-head-text strong { font-size: 13.5px; line-height: 1.25; }
.tkk-webchat-head-text small { color: #58708c; font-size: 10.5px; line-height: 1.25; }
.tkk-webchat-close {
    padding: 2px 5px;
    border: 0;
    background: transparent;
    color: #425a72;
    font-size: 23px;
    line-height: 1;
    cursor: pointer;
}
.tkk-webchat-messages {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 7px;
    overflow-y: auto;
    padding: 11px;
    scrollbar-width: thin;
}
.tkk-webchat-bubble {
    align-self: flex-start;
    max-width: 94%;
    padding: 8px 10px;
    border-radius: 12px;
    background: #f0f5fb;
    font-size: 12.5px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.tkk-webchat-bubble--visitor { align-self: flex-end; background: #176ac7; color: #fff; }
.tkk-webchat-bubble--staff { background: #e8f6ed; border: 1px solid #cde9d6; }
.tkk-webchat-bubble a { color: #0457c2; text-decoration: underline; }
.tkk-webchat-bubble--visitor a { color: #fff; }
.tkk-webchat-status {
    min-height: 12px;
    margin: 0;
    padding: 0 11px;
    color: #8a5816;
    font-size: 10.5px;
}
.tkk-webchat-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
}
.tkk-webchat-actions button {
    padding: 5px 7px;
    border: 1px solid #c8dbed;
    border-radius: 7px;
    background: #fff;
    color: #1c5b9b;
    font: inherit;
    font-size: 10.5px;
    line-height: 1.25;
    cursor: pointer;
}
.tkk-webchat-contact {
    display: grid;
    gap: 4px;
    padding: 7px 10px;
    border-top: 1px solid #e4ecf6;
    background: #f8fbff;
}
.tkk-webchat-contact label { font-size: 10.5px; color: #52657c; }
.tkk-webchat-contact input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #cad8e6;
    border-radius: 7px;
    background: #fff;
    color: #172b4d;
    font: inherit;
    font-size: 12px;
}
.tkk-webchat-contact button {
    padding: 7px 9px;
    border: 0;
    border-radius: 7px;
    background: #176ac7;
    color: #fff;
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}
.tkk-webchat-compose {
    display: flex;
    align-items: end;
    gap: 7px;
    padding: 8px 10px 5px;
    border-top: 1px solid #e3eaf4;
}
.tkk-webchat-compose textarea {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    max-height: 85px;
    resize: none;
    padding: 8px 9px;
    border: 1px solid #cddbe9;
    border-radius: 9px;
    background: #fff;
    color: #162f50;
    font: inherit;
    font-size: 12.5px;
    line-height: 1.35;
}
.tkk-webchat-compose button {
    flex: 0 0 37px;
    height: 37px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: #1569c7;
    color: #fff;
    font-size: 17px;
    cursor: pointer;
}
.tkk-webchat-compose button:disabled { opacity: .5; cursor: wait; }
.tkk-webchat-consent {
    margin: 0;
    padding: 0 11px 7px;
    color: #7c8898;
    font-size: 9.5px;
    line-height: 1.35;
}
.tkk-webchat-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
@media (max-width: 480px) {
    .tkk-webchat { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
    /* Always show the launcher text on phones, not just the blue icon. */
    .tkk-webchat-launcher-label { display: inline; white-space: nowrap; }
    .tkk-webchat-launcher {
        width: auto;
        height: 54px;
        min-width: 0;
        padding: 0 17px;
        gap: 8px;
        font-size: 13px;
        white-space: nowrap;
    }
    .tkk-webchat-launcher svg { width: 22px; height: 22px; flex-basis: 22px; }
    .tkk-webchat-panel {
        bottom: 65px;
        width: calc(100vw - 24px);
        height: min(560px, calc(100dvh - 94px - env(safe-area-inset-bottom)));
        min-height: 0;
        border-radius: 14px;
    }
    .tkk-webchat-actions button { font-size: 10px; padding: 5px 6px; }
}
@media (prefers-reduced-motion: reduce) {
    .tkk-webchat-launcher[aria-expanded="false"] { animation: none; }
    .tkk-webchat-launcher:hover { transform: none; }
}
