.kn-chat [hidden], .kn-chat-desk [hidden] { display: none !important; }
.kn-chat {
  position: fixed; z-index: 90; inset-inline-end: max(14px, env(safe-area-inset-right)); 
  inset-block-end: max(14px, env(safe-area-inset-bottom));
  display: flex; align-items: flex-end; flex-direction: column; gap: 8px;
  color: #edf7ff; font: 400 15px/1.4 system-ui, sans-serif; 
}
.kn-chat button, .kn-chat-desk button {
  border: 1px solid #31546c; border-radius: 10px; background: #142d42; color: #ebf9ff;
  padding: .5rem .75rem; font: inherit; font-weight: 650; cursor: pointer;
}
.kn-chat button:hover, .kn-chat-desk button:hover, .kn-chat-desk button[aria-pressed="true"] {
  background: #20445c; border-color: #79dfea;
}
.kn-chat button:focus-visible, .kn-chat-desk button:focus-visible, .kn-chat textarea:focus-visible,
.kn-chat-desk textarea:focus-visible { outline: 2px solid #86eaff; outline-offset: 2px; }
.kn-chat .kn-chat-launch {
  display: inline-flex; align-items: center; gap: .48rem; min-height: 49px; border-radius: 999px;
  padding: .62rem 1rem; background: #79e4ef; color: #071a29; border-color: #a0f4ff;
  box-shadow: 0 8px 23px #07172599;
}
.kn-chat .kn-chat-launch:hover { background: #a7f1f7; }
.kn-chat-launch svg { width: 23px; height: 23px; flex: none; }
.kn-chat-window {
  box-sizing: border-box; width: min(365px, calc(100vw - 28px));
  max-height: calc(100vh - 90px); max-height: calc(100dvh - 90px);
  display: flex; flex-direction: column; overflow: hidden; border-radius: 16px;
  background: #0e1d2d; border: 1px solid #395a73; box-shadow: 0 14px 52px #040910b5;
}
.kn-chat-window > header {
  position: static; display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  padding: .72rem .85rem; background: #152a41; border-bottom: 1px solid #395a73;
}
.kn-chat-window h2 { margin: 0; color: #edf7ff; font: 700 1rem/1.2 system-ui, sans-serif; }
.kn-chat-window > header button { padding: 0 .42rem; font-size: 1.25rem; }
.kn-chat-log {
  display: flex; flex-direction: column; align-items: flex-start; gap: .55rem;
  min-height: 64px; overflow: auto; overscroll-behavior: contain; padding: .75rem;
}
.kn-chat-window .kn-chat-log { height: min(270px, 34dvh); }
.kn-chat-message {
  display: grid; gap: .24rem; margin: 0; padding: .48rem .64rem; max-width: 92%;
  background: #17334a; border-radius: 10px; color: #edf7ff; text-align: start; overflow-wrap: anywhere;
}
.kn-chat-message strong { font-size: .76rem; color: #a7eafa; }
.kn-chat-message span { white-space: pre-wrap; line-height: 1.4; }
.kn-chat-mine { align-self: flex-end; background: #23576b; }
.kn-chat-tools { padding: .7rem; border-top: 1px solid #31546c; }
.kn-chat-tools small { display: block; color: #beccde; margin-top: .45rem; line-height: 1.3; }
.kn-chat-notice { color: #b6d7e5; margin: 0 0 .45rem; }
.kn-chat-notice:empty { display: none; }
.kn-chat-compose { display: grid; gap: .25rem; margin-top: .5rem; }
.kn-chat-compose > div { display: flex; gap: .4rem; align-items: center; }
.kn-chat-compose label { color: inherit; }
.kn-chat-compose .kn-chat-consent { display: flex; gap: .4rem; align-items: flex-start; font-size: .8rem; }
.kn-chat-consent input[type="checkbox"] { width: auto; margin: .2rem 0 0; accent-color: #79e4ef; }
.kn-chat-compose textarea {
  flex: 1; width: 0; min-width: 0; resize: vertical; max-height: 8rem;
  background: #081624; color: #f0f8ff; border: 1px solid #48677b; border-radius: 8px;
  padding: .42rem; font: inherit; 
}
.kn-chat-desk { display: grid; grid-template-columns: minmax(12rem, 1fr) minmax(0, 2fr); gap: 1rem; }
.kn-chat-desk .kn-chat-queue { display: grid; align-content: start; gap: .45rem; max-height: 65vh; overflow: auto; }
.kn-chat-desk .kn-chat-log { max-height: 53vh; }
.kn-chat-desk [data-chat-end] { margin-top: .65rem; }
@media (max-width: 640px) {
  .kn-chat-desk { grid-template-columns: minmax(0, 1fr); }
  .kn-chat-desk .kn-chat-queue { max-height: 24vh; }
  .kn-chat-desk .kn-chat-log { max-height: 42vh; }
  .kn-chat-compose textarea { font-size: 16px; }
}
@media (max-height: 480px) {
  .kn-chat-window .kn-chat-log { height: min(170px, 28dvh); }
  .kn-chat-tools { overflow: auto; }
}
