#ksai-box,#ksai-box *,#ksai-launch{box-sizing:border-box}
#ksai-launch{position:fixed;right:18px;bottom:var(--ksai-bottom,90px);z-index:9998;border:0;border-radius:999px;padding:14px 19px;background:var(--main,#36577c);color:#fff;font-family:inherit;font-size:15px;font-weight:700;line-height:1.4;box-shadow:0 8px 28px #0003;cursor:pointer}
#ksai-box{position:fixed;right:18px;bottom:var(--ksai-bottom,90px);width:min(410px,calc(100vw - 24px));height:min(740px,var(--ksai-available-height,calc(100vh - 120px)));max-height:var(--ksai-available-height,calc(100vh - 120px));z-index:9999;background:#fff;color:#243649;border-radius:16px;box-shadow:0 16px 50px #0004;overflow:hidden;display:flex;flex-direction:column;font:15px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
#ksai-box[hidden],#ksai-launch[hidden],#ksai-contact-panel[hidden],#ksai-callback-form[hidden]{display:none!important}
#ksai-box .ksai-header{flex:0 0 auto;background:var(--main,#36577c);color:#fff;padding:12px;display:flex;justify-content:space-between;align-items:center;gap:8px}
.ksai-identity{display:flex;align-items:center;gap:9px;min-width:0}.ksai-avatar{width:46px;height:46px;border-radius:50%;object-fit:cover;border:2px solid #ffffffbf;flex:0 0 46px}
#ksai-box header strong,#ksai-box header small{display:block}#ksai-box header small{opacity:.95;line-height:1.3;font-size:10px}#ksai-close{background:none;border:0;color:#fff;font-size:27px;padding:4px 8px;min-width:40px;min-height:40px;cursor:pointer}
.ksai-notice{flex:0 0 auto;padding:8px 12px;background:#f0f4f8;font-size:11px;color:#3c4e60}
#ksai-scroll{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:10px 12px;scroll-padding:12px}
#ksai-messages{height:auto;overflow:visible;padding:0}.ksai-msg{max-width:94%;padding:10px 12px;margin:9px 0;border-radius:12px;white-space:pre-wrap;overflow-wrap:anywhere}.ksai-msg.bot{background:#eef3f8}.ksai-msg.user{background:var(--main,#36577c);color:#fff;margin-left:auto}.ksai-msg.red{background:#fff0f0;border:1px solid #c62828}.ksai-msg.orange{background:#fff7e6;border:1px solid #c58400}
.ksai-quick-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;padding:0 0 10px}.ksai-quick-grid button{min-height:54px;border:1px solid #cbd9e7;background:#fff;border-radius:10px;padding:7px;display:flex;align-items:center;gap:7px;text-align:left;color:var(--main,#36577c);font-size:11px;font-weight:700;line-height:1.25;cursor:pointer}.ksai-quick-grid img{width:30px;height:30px;object-fit:contain;flex:0 0 30px}.ksai-quick-grid span{min-width:0;overflow-wrap:break-word}
.ksai-compose{flex:0 0 auto;max-height:48%;overflow-y:auto;padding:8px 12px;border-top:1px solid #dbe3ec;background:#fff}.ksai-privacy{font-size:11px;line-height:1.4}.ksai-privacy summary{cursor:pointer;font-weight:600}.ksai-privacy p{margin:6px 0}.ksai-check{display:flex;align-items:flex-start;gap:7px;font-size:11px;line-height:1.4;margin:7px 0}.ksai-check input[type=checkbox]{flex:0 0 auto;margin-top:2px}
#ksai-form{display:flex;gap:7px;padding:0;margin:8px 0 0}#ksai-input{flex:1;min-width:0;resize:vertical;min-height:48px;max-height:100px;border:1px solid #a7b7c7;border-radius:8px;padding:8px;font:inherit;font-size:16px}#ksai-form button,#ksai-callback-form button[type=submit]{border:0;border-radius:8px;background:var(--main,#36577c);color:#fff;padding:8px 12px;cursor:pointer;font-size:13px}
#ksai-reset{display:block;margin:6px 0 0 auto;padding:3px 0;border:0;background:transparent;color:var(--main,#36577c);text-decoration:underline;font-size:11px;cursor:pointer}
#ksai-contact-panel{margin:10px 0;padding:10px;border:1px solid #d9e2ec;border-radius:10px;background:#f8fbfd}.ksai-contact-actions{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin:8px 0}.ksai-contact-actions a,.ksai-contact-actions button{border:1px solid #cbd9e7;background:#fff;border-radius:8px;padding:9px;text-decoration:none;color:#36577c;font-family:inherit;font-size:12px;font-weight:600;line-height:1.3;text-align:center;cursor:pointer}.ksai-contact-actions a:last-child{grid-column:1/-1}
#ksai-callback-form{display:grid;gap:7px;margin-top:10px}#ksai-callback-form>label:not(.ksai-check){font-size:12px}#ksai-callback-form input:not([type=checkbox]){width:100%;padding:8px;border:1px solid #a7b7c7;border-radius:6px;font-size:16px}#ksai-cb-status{font-size:12px;margin:0}
.ksai-approved{white-space:normal}.ksai-approved h4{margin:0 0 8px;font-size:15px}.ksai-approved p{margin:8px 0}.ksai-approved ul{margin:7px 0 7px 18px;padding:0}.ksai-approved li{margin:4px 0}.ksai-approved a,.ksai-related{color:#36577c;text-decoration:underline}.ksai-related{display:block;margin-top:8px;font-size:12px}
#ksai-box button:focus-visible,#ksai-box a:focus-visible,#ksai-launch:focus-visible{outline:3px solid #2c8ec6;outline-offset:2px}#ksai-box button:disabled{opacity:.6;cursor:wait}.ksai-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media(max-width:520px){#ksai-box{right:12px;width:calc(100vw - 24px)}#ksai-launch{right:12px;font-size:13px;padding:12px 15px}.ksai-compose{max-height:48%}}
@media(max-height:520px){#ksai-box .ksai-header{padding:6px 10px}.ksai-avatar{width:32px;height:32px;flex-basis:32px}.ksai-notice{font-size:10px;padding:4px 10px}.ksai-compose{max-height:55%}}
@media print{#ksai-box,#ksai-launch{display:none!important}}

/* Keep chat above the sticky header. */
html body #ksai-box,html body #ksai-launch{z-index:999999!important}

/* v0.18: compact launcher and dedicated contact view. Existing viewport and sticky-bar offsets remain authoritative. */
html body #ksai-launch{display:flex;align-items:center;justify-content:center;width:64px;height:64px;padding:0;background:#fff;border:3px solid #fff;overflow:visible}
#ksai-launch img{width:100%;height:100%;object-fit:cover;border-radius:50%;display:block}
#ksai-launch .ksai-launch-dots{position:absolute;right:-5px;bottom:-3px;background:#2c8ec6;color:#fff;border:2px solid #fff;border-radius:18px;font-size:12px;line-height:1;letter-spacing:1px;padding:7px 6px}
#ksai-box.ksai-contact-mode #ksai-messages,#ksai-box.ksai-contact-mode .ksai-quick-grid,#ksai-box.ksai-contact-mode .ksai-compose{display:none!important}
#ksai-box.ksai-contact-mode #ksai-contact-panel{margin:0;border:0;border-radius:0;padding:0;background:#fff}
#ksai-box .ksai-back{display:block;width:100%;padding:10px 12px;margin:0 0 12px;background:#e9f1f9;border:1px solid #cbd9e7;border-radius:9px;color:#36577c;font-family:inherit;font-weight:700;font-size:13px;line-height:1.3;cursor:pointer}
@media(max-width:520px){
 html body #ksai-launch{width:58px;height:58px;right:14px;padding:0}
 #ksai-box{right:8px;width:calc(100vw - 16px);height:var(--ksai-available-height,calc(100dvh - 120px));border-radius:14px}
 #ksai-box .ksai-header{padding:9px 10px}
 #ksai-box .ksai-avatar{width:38px;height:38px;flex-basis:38px}
 #ksai-box header small{display:none}
 #ksai-box .ksai-notice{padding:6px 10px;font-size:10px}
 #ksai-scroll{padding:8px}
 #ksai-box .ksai-quick-grid{gap:5px;padding-bottom:7px}
 #ksai-box .ksai-quick-grid button{min-height:44px;padding:5px}
 #ksai-box .ksai-quick-grid img{width:27px;height:27px;flex-basis:27px}
 #ksai-box .ksai-compose{padding:6px 8px}
 #ksai-input{min-height:38px;max-height:65px}
}
