.ksj-kai-site {
    --ksj-kai-accent: #b7ff35;
    --ksj-kai-accent-ink: #10150a;
    --ksj-kai-surface: #0d1117;
    --ksj-kai-surface-raised: #151b23;
    --ksj-kai-border: rgba(255, 255, 255, 0.14);
    --ksj-kai-text: #f7f9fb;
    --ksj-kai-muted: #b6c0cb;
    --ksj-kai-viewport-height: 100dvh;
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 99990;
    color: var(--ksj-kai-text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.45;
    text-align: left;
}
.ksj-kai-site--enquiryfit {
    --ksj-kai-accent: #f2b84b;
    --ksj-kai-accent-ink: #241600;
}

.ksj-kai-site--diyseo {
    --ksj-kai-accent: #46d37e;
    --ksj-kai-accent-ink: #071c10;
}

.ksj-kai-site--dutynest {
    --ksj-kai-accent: #8292ff;
    --ksj-kai-accent-ink: #080b25;
}

.ksj-kai-site--ai-operator {
    --ksj-kai-accent: #b7ff35;
    --ksj-kai-accent-ink: #10150a;
}

.ksj-kai-site *,
.ksj-kai-site *::before,
.ksj-kai-site *::after {
    box-sizing: border-box;
}

.ksj-kai-site [hidden] {
    display: none !important;
}

.ksj-kai-site button,
.ksj-kai-site textarea,
.ksj-kai-site a {
    font: inherit;
}

.ksj-kai-site button,
.ksj-kai-site a {
    -webkit-tap-highlight-color: transparent;
}

.ksj-kai-site .ksj-whatsapp-floating {
    display: inline-flex;
    position: fixed;
    left: max(20px, env(safe-area-inset-left));
    bottom: max(76px, calc(60px + env(safe-area-inset-bottom)));
    z-index: 99989;
    max-width: calc(100vw - 40px);
    min-height: 50px;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    overflow: hidden;
    border: 1px solid #25d366;
    border-radius: 6px;
    background: #25d366;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    color: #07170d;
    font: 800 15px/1.2 Arial, Helvetica, sans-serif;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ksj-kai-site .ksj-whatsapp-floating:hover {
    background: #1fb85a;
    color: #07170d;
}

.ksj-kai-site .ksj-whatsapp-floating:focus-visible {
    background: #1fb85a;
    box-shadow: 0 0 0 6px #111;
    color: #07170d;
    outline: 3px solid #fff;
    outline-offset: 3px;
}

.ksj-kai-site .ksj-whatsapp-floating__icon {
    display: inline-flex;
    position: relative;
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.ksj-kai-site .ksj-whatsapp-floating__icon::before {
    position: absolute;
    right: 3px;
    bottom: -4px;
    width: 7px;
    height: 7px;
    border-bottom: 2px solid currentColor;
    border-left: 2px solid currentColor;
    background: #25d366;
    content: "";
    transform: rotate(-18deg);
}

.ksj-kai-site .ksj-whatsapp-floating__icon::after {
    width: 8px;
    height: 8px;
    border: 2px solid currentColor;
    border-top: 0;
    border-left: 0;
    border-radius: 1px;
    content: "";
    transform: rotate(38deg);
}

.ksj-kai-site.is-open .ksj-whatsapp-floating {
    visibility: hidden;
    pointer-events: none;
}

body.menu-open .ksj-kai-site,
body.dn-menu-open .ksj-kai-site {
    visibility: hidden;
    pointer-events: none;
}

.ksj-kai-site__launcher {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    max-width: calc(100vw - 32px);
    padding: 7px 16px 7px 8px;
    border: 1px solid var(--ksj-kai-border);
    border-radius: 999px;
    background: var(--ksj-kai-surface);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.28);
    color: var(--ksj-kai-text);
    cursor: pointer;
}

.ksj-kai-site__launcher-copy {
    display: grid;
    gap: 1px;
    text-align: left;
}

.ksj-kai-site__launcher-copy strong {
    font-size: 0.98rem;
    line-height: 1.2;
}

.ksj-kai-site__launcher-copy small {
    color: var(--ksj-kai-muted);
    font-size: 0.74rem;
}

.ksj-kai-site__mark {
    display: inline-grid;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 50%;
    background: var(--ksj-kai-accent);
    box-shadow: 0 0 22px color-mix(in srgb, var(--ksj-kai-accent) 42%, transparent);
    color: var(--ksj-kai-accent-ink);
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: -0.03em;
}

.ksj-kai-site__panel {
    display: flex;
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: min(400px, calc(100vw - 24px));
    height: min(680px, calc(var(--ksj-kai-viewport-height, 100dvh) - 24px));
    max-height: calc(100dvh - 24px);
    overflow: hidden;
    flex-direction: column;
    border: 1px solid var(--ksj-kai-border);
    border-radius: 22px;
    background: var(--ksj-kai-surface);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
    color: var(--ksj-kai-text);
}

.ksj-kai-site.is-open .ksj-kai-site__launcher {
    visibility: hidden;
}

.ksj-kai-site__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    border-bottom: 1px solid var(--ksj-kai-border);
    background: var(--ksj-kai-surface-raised);
}

.ksj-kai-site__identity {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.ksj-kai-site__identity .ksj-kai-site__mark {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
    font-size: 0.72rem;
}

.ksj-kai-site__identity > span:last-child {
    display: grid;
    min-width: 0;
    gap: 1px;
}

.ksj-kai-site__identity strong {
    overflow: hidden;
    font-size: 0.92rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ksj-kai-site__identity small {
    color: var(--ksj-kai-muted);
    font-size: 0.71rem;
}

.ksj-kai-site__header-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
}

.ksj-kai-site__reset,
.ksj-kai-site__close {
    min-height: 38px;
    border: 1px solid var(--ksj-kai-border);
    border-radius: 999px;
    background: transparent;
    color: var(--ksj-kai-text);
    cursor: pointer;
}

.ksj-kai-site__reset {
    padding: 7px 11px;
    font-size: 0.75rem;
}

.ksj-kai-site__close {
    width: 38px;
    padding: 0;
    font-size: 1.5rem;
    line-height: 1;
}

.ksj-kai-site__conversation {
    flex: 1 1 auto;
    min-height: 96px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 16px;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.ksj-kai-site__message {
    width: fit-content;
    max-width: 88%;
    margin: 0 0 12px;
    padding: 11px 13px;
    overflow-wrap: anywhere;
    border-radius: 16px;
    background: var(--ksj-kai-surface-raised);
}

.ksj-kai-site__message--visitor {
    margin-left: auto;
    border-bottom-right-radius: 5px;
    background: var(--ksj-kai-accent);
    color: var(--ksj-kai-accent-ink);
}

.ksj-kai-site__message--kai {
    margin-right: auto;
    border: 1px solid var(--ksj-kai-border);
    border-bottom-left-radius: 5px;
}

.ksj-kai-site__message p {
    margin: 0;
    color: inherit;
    font-size: 0.9rem;
    line-height: 1.48;
    white-space: pre-line;
}

.ksj-kai-site__message small {
    display: block;
    margin-top: 8px;
    color: var(--ksj-kai-muted);
    font-size: 0.72rem;
    line-height: 1.42;
}

.ksj-kai-site__prompts {
    display: flex;
    flex: 0 0 auto;
    gap: 7px;
    overflow-x: auto;
    padding: 0 14px 11px;
    scrollbar-width: thin;
}

.ksj-kai-site__prompts button {
    flex: 0 0 auto;
    min-height: 36px;
    max-width: 230px;
    padding: 7px 11px;
    overflow: hidden;
    border: 1px solid var(--ksj-kai-border);
    border-radius: 999px;
    background: transparent;
    color: var(--ksj-kai-text);
    font-size: 0.75rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.ksj-kai-site__form {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
    padding: 11px 14px;
    border-top: 1px solid var(--ksj-kai-border);
    background: var(--ksj-kai-surface-raised);
}

.ksj-kai-site__input-wrap {
    position: relative;
    min-width: 0;
}

.ksj-kai-site__form textarea {
    display: block;
    width: 100%;
    min-height: 48px;
    max-height: 112px;
    resize: vertical;
    padding: 10px 46px 10px 11px;
    border: 1px solid var(--ksj-kai-border);
    border-radius: 13px;
    outline: 0;
    background: #080b10;
    color: var(--ksj-kai-text);
    font-size: 16px;
    line-height: 1.35;
}

.ksj-kai-site__form textarea::placeholder {
    color: #8e99a6;
}

.ksj-kai-site__count {
    position: absolute;
    right: 9px;
    bottom: 7px;
    color: var(--ksj-kai-muted);
    font-size: 0.65rem;
    pointer-events: none;
}

.ksj-kai-site__form > button {
    min-width: 62px;
    min-height: 48px;
    padding: 9px 13px;
    border: 0;
    border-radius: 13px;
    background: var(--ksj-kai-accent);
    color: var(--ksj-kai-accent-ink);
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
}

.ksj-kai-site button:disabled,
.ksj-kai-site textarea:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.ksj-kai-site__footer {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 14px max(9px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--ksj-kai-border);
    background: var(--ksj-kai-surface);
    color: var(--ksj-kai-muted);
    font-size: 0.66rem;
}

.ksj-kai-site__footer-links {
    display: flex;
    flex: 0 0 auto;
    gap: 9px;
}

.ksj-kai-site__footer a {
    color: var(--ksj-kai-text);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--ksj-kai-accent) 55%, transparent);
    text-underline-offset: 2px;
}

.ksj-kai-site button:focus-visible,
.ksj-kai-site textarea:focus-visible,
.ksj-kai-site a:focus-visible {
    outline: 3px solid var(--ksj-kai-accent);
    outline-offset: 2px;
}

.ksj-kai-site .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ksj-kai-site.has-compact-viewport .ksj-kai-site__panel {
    bottom: max(6px, env(safe-area-inset-bottom));
    height: calc(var(--ksj-kai-viewport-height, 100dvh) - 12px);
}

.ksj-kai-site.has-compact-viewport .ksj-kai-site__prompts {
    display: none;
}

.ksj-kai-site.has-compact-viewport .ksj-kai-site__conversation {
    min-height: 48px;
    padding-top: 10px;
    padding-bottom: 10px;
}

.ksj-kai-site.has-compact-viewport .ksj-kai-site__header,
.ksj-kai-site.has-compact-viewport .ksj-kai-site__form {
    padding-top: 8px;
    padding-bottom: 8px;
}

.ksj-kai-site.has-tiny-viewport .ksj-kai-site__conversation {
    min-height: 30px;
}

.ksj-kai-site.has-tiny-viewport .ksj-kai-site__footer {
    display: none;
}

.ksj-kai-site.has-tiny-viewport .ksj-kai-site__identity small {
    display: none;
}

@media (max-width: 420px) {
    .ksj-kai-site {
        right: max(10px, env(safe-area-inset-right));
        bottom: max(10px, env(safe-area-inset-bottom));
    }

    .ksj-kai-site__panel {
        right: max(6px, env(safe-area-inset-right));
        bottom: max(6px, env(safe-area-inset-bottom));
        width: calc(100vw - 12px);
        height: min(660px, calc(var(--ksj-kai-viewport-height, 100dvh) - 12px));
        max-height: calc(100dvh - 12px);
        border-radius: 18px;
    }

    .ksj-kai-site__header,
    .ksj-kai-site__conversation {
        padding-right: 12px;
        padding-left: 12px;
    }

    .ksj-kai-site__prompts {
        padding-right: 12px;
        padding-left: 12px;
    }

    .ksj-kai-site__form {
        padding-right: 12px;
        padding-left: 12px;
    }

    .ksj-kai-site__footer {
        align-items: flex-start;
        padding-right: 12px;
        padding-left: 12px;
    }
}

@media (max-width: 600px) {
    .ksj-kai-site .ksj-whatsapp-floating {
        left: max(14px, env(safe-area-inset-left));
        bottom: max(76px, calc(60px + env(safe-area-inset-bottom)));
        max-width: calc(100vw - 28px);
        min-height: 46px;
        padding: 10px 12px;
        font-size: 14px;
    }
}

@media (max-width: 390px) {
    .ksj-kai-site .ksj-whatsapp-floating {
        width: 48px;
        height: 48px;
        min-height: 48px;
        justify-content: center;
        padding: 10px;
    }

    .ksj-kai-site .ksj-whatsapp-floating__label {
        display: none;
    }
}

@media (max-width: 340px) {
    .ksj-kai-site__launcher-copy small,
    .ksj-kai-site__identity small {
        display: none;
    }

    .ksj-kai-site__message {
        max-width: 94%;
    }

    .ksj-kai-site__footer {
        display: grid;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ksj-kai-site *,
    .ksj-kai-site *::before,
    .ksj-kai-site *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}
