#kt-visitor-chat {
    --ktvc-accent: #194e75;
    --ktvc-ink: #192f44;
    --ktvc-muted: #506475;
    --ktvc-edge: max(16px, env(safe-area-inset-right));
    --ktvc-panel-bottom: max(14px, env(safe-area-inset-bottom));
    --ktvc-panel-height: 370px;
    --ktvc-font: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    color: var(--ktvc-ink);
    font: 400 14px/1.45 var(--ktvc-font);
    color-scheme: light;
}
#kt-visitor-chat [hidden] { display: none !important; }
#kt-visitor-chat *, #kt-visitor-chat *::before, #kt-visitor-chat *::after { box-sizing: border-box; }
#kt-visitor-chat button, #kt-visitor-chat textarea, #kt-visitor-chat input { font: inherit; }
#kt-visitor-chat button { cursor: pointer; }
#kt-visitor-chat button:disabled { cursor: default; }
#kt-visitor-chat :focus-visible { outline: 2px solid #3677aa; outline-offset: 2px; }
#kt-visitor-chat .ktvc-sr, #kt-visitor-chat .ktvc-continuation .ktvc-meta {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    white-space: nowrap; overflow: hidden; clip-path: inset(50%); border: 0;
}

#kt-visitor-chat .ktvc-open {
    position: fixed; z-index: 44;
    right: var(--ktvc-edge); bottom: calc(72px + env(safe-area-inset-bottom));
    display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 11px 4px 9px;
    border: 1px solid #ffffffa1; border-radius: 999px;
    background: var(--ktvc-accent); color: #fff;
    font: 600 12.5px/1.2 var(--ktvc-font);
    box-shadow: 0 2px 7px #102e4933;
}
.ktvc-open::after { content: ""; position: absolute; inset: -6px 0; border-radius: inherit; }
.ktvc-open .ic { width: 16px; height: 16px; }
body.ktvc-ready .totop { bottom: calc(122px + env(safe-area-inset-bottom)); }
body.ktvc-ready.co-kbot #kt-visitor-chat .ktvc-open { bottom: calc(126px + env(safe-area-inset-bottom)); }
body.ktvc-ready.co-kbot .totop { bottom: calc(174px + env(safe-area-inset-bottom)); }
body.ktvc-ready.kb-co-chao #kt-visitor-chat .ktvc-open {
    bottom: calc(18px + env(safe-area-inset-bottom)); right: calc(var(--ktvc-edge) + 97px);
}

.ktvc-panel {
    position: fixed; z-index: 76; right: var(--ktvc-edge); bottom: var(--ktvc-panel-bottom);
    display: flex; flex-direction: column; min-height: 0; overflow: hidden;
    width: min(320px, calc(100vw - var(--ktvc-edge) - max(10px, env(safe-area-inset-left))));
    height: min(var(--ktvc-panel-height), calc(100vh - var(--ktvc-panel-bottom) - 12px));
    height: min(var(--ktvc-panel-height), calc(100dvh - var(--ktvc-panel-bottom) - max(12px, env(safe-area-inset-top))));
    text-align: start; background: #fff; color: var(--ktvc-ink);
    border: 1px solid #c5d2dc; border-radius: 15px;
    box-shadow: 0 10px 34px -8px #15314d45, 0 2px 8px #17354d15;
}
.ktvc-panel:has(.ktvc-items:empty) { --ktvc-panel-height: 300px; }
.ktvc-panel:has(.ktvc-items:empty):has(.ktvc-form[hidden]),
.ktvc-panel:has(.ktvc-history[hidden]) { height: auto; }
.ktvc-panel:has(.ktvc-items:empty):has(.ktvc-form[hidden]) .ktvc-history { display: none; }
.ktvc-head {
    display: flex; flex: none; align-items: center; gap: 9px; min-height: 48px; padding: 5px 7px 5px 12px;
    color: #173750; background: #fff; border-bottom: 1px solid #dce5ec;
}
.ktvc-head-icon {
    display: grid; place-items: center; flex: none; width: 28px; height: 28px;
    border-radius: 9px; background: var(--ktvc-accent); color: #fff;
}
.ktvc-head-icon .ic { width: 16px; height: 16px; }
.ktvc-head h2 { flex: 1; min-width: 0; margin: 0; color: inherit; font: 650 15.5px/1.25 var(--ktvc-font); }
.ktvc-close, .ktvc-send {
    display: grid; flex: none; place-items: center; padding: 0; border: 0; border-radius: 8px;
}
.ktvc-close { position: relative; width: 35px; height: 35px; background: transparent; color: #4d6275; }
.ktvc-close::after { content: ""; position: absolute; inset: -4px; }
.ktvc-close .ic { width: 17px; height: 17px; }

.ktvc-history {
    flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    padding: 12px; background: linear-gradient(155deg, #f2f6f9 0%, #f7f9fb 65%);
    scrollbar-width: thin; scrollbar-color: #bfced9 transparent;
}
#kt-visitor-chat .ktvc-history:focus-visible { outline-offset: -2px; }
.ktvc-items { display: flex; flex-direction: column; gap: 9px; list-style: none; margin: 0; padding: 0; }
.ktvc-item { display: flex; align-items: flex-start; align-self: flex-start; flex-direction: column; max-width: 89%; min-width: 0; }
.ktvc-item.ktvc-own { align-items: flex-end; align-self: flex-end; }
.ktvc-item.ktvc-continuation { margin-top: -5px; }
.ktvc-meta {
    margin: 0 2px 3px; max-width: 100%; overflow-wrap: anywhere;
    font-size: 11px; font-weight: 600; line-height: 1.3; color: var(--ktvc-muted);
}
.ktvc-meta time { font-weight: 400; font-variant-numeric: tabular-nums; }
.ktvc-text, .ktvc-empty {
    margin: 0; max-width: 100%; padding: 7px 10px;
    border: 1px solid #dbe4eb; border-radius: 11px 11px 11px 4px;
    background: #fff; color: var(--ktvc-ink); line-height: 1.45;
}
.ktvc-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.ktvc-own .ktvc-text { border-color: var(--ktvc-accent); border-radius: 11px 11px 4px 11px; background: var(--ktvc-accent); color: #fff; }
.ktvc-empty { width: fit-content; max-width: 88%; }
.ktvc-earlier, .ktvc-retry {
    padding: 4px 1px; border: 0; color: var(--ktvc-accent); background: transparent; text-decoration: underline; text-underline-offset: 2px;
}
.ktvc-earlier { display: block; margin: 0 auto 7px; }
.ktvc-alert {
    display: flex; flex: none; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; padding: 9px 12px;
    color: var(--ktvc-muted); background: #f5f8fa; font-size: 12px; line-height: 1.45;
}
.ktvc-status { margin: 0; overflow-wrap: anywhere; }
.ktvc-contact, .ktvc-privacy { color: var(--ktvc-accent); text-decoration: underline; text-underline-offset: 2px; }

.ktvc-form {
    flex: none; padding: 8px 10px 5px; border-top: 1px solid #dce5ec;
    background: #fff; text-align: end;
}
.ktvc-name {
    display: block; width: 100%; margin: 0 0 6px; padding: 5px 9px; min-height: 31px;
    border: 1px solid #d7e1e8; border-radius: 8px; color: var(--ktvc-ink); background: #fff;
}
.ktvc-compose {
    display: flex; gap: 3px; align-items: flex-end; padding: 0 4px 0 0; min-width: 0;
    border: 1px solid #bfceda; border-radius: 11px; background: #fff;
}
.ktvc-compose:focus-within { border-color: #5483a6; box-shadow: 0 0 0 1px #5483a632; }
#kt-visitor-chat .ktvc-input {
    display: block; flex: 1; min-width: 0; height: 40px; max-height: 100px; padding: 10px 8px 10px 10px;
    resize: none; border: 0; border-radius: inherit; background: transparent; color: var(--ktvc-ink);
    line-height: 20px; outline: 0;
}
.ktvc-name::placeholder, .ktvc-input::placeholder { color: #586d7e; opacity: 1; }
.ktvc-send { width: 32px; height: 32px; margin: 4px 0; background: var(--ktvc-accent); color: #fff; }
.ktvc-send svg { width: 17px; height: 17px; }
.ktvc-send:disabled { background: #e5edf2; color: #617687; }
.ktvc-privacy { display: inline-block; margin: 2px 3px 0; padding: 2px 0; color: var(--ktvc-muted); font-size: 11px; }
@media (hover: hover) {
    #kt-visitor-chat .ktvc-open:hover, .ktvc-send:hover:enabled { background: #123d5c; }
    .ktvc-close:hover { background: #eef3f7; color: #172f46; }
    .ktvc-contact:hover, .ktvc-privacy:hover, .ktvc-retry:hover, .ktvc-earlier:hover { color: #123d5c; }
}
@media (max-width: 640px) {
    #kt-visitor-chat {
        --ktvc-edge: max(10px, env(safe-area-inset-right));
        --ktvc-panel-bottom: max(8px, env(safe-area-inset-bottom));
        --ktvc-panel-height: 360px;
    }
    #kt-visitor-chat .ktvc-open { bottom: calc(66px + env(safe-area-inset-bottom)); }
    body.ktvc-ready.kb-co-chao #kt-visitor-chat .ktvc-open {
        bottom: calc(12px + env(safe-area-inset-bottom)); right: calc(var(--ktvc-edge) + 90px);
    }
}
@media (max-width: 640px), (pointer: coarse) {
    #kt-visitor-chat .ktvc-input, #kt-visitor-chat .ktvc-name { font-size: 16px; }
}
@media (max-height: 480px) {
    #kt-visitor-chat .ktvc-input { max-height: 64px; }
    .ktvc-history { padding-block: 8px; }
}
@media print { #kt-visitor-chat { display: none; } }
