/* Site asistanı: her temada aynı, temadan bağımsız küçük bileşen. Renk: --ks-chat-accent */
.ksc, .ksc * { box-sizing: border-box; }
.ksc {
  --ink: #19232D; --muted: #526273; --line: #DCE3EA; --soft: #F2F5F8; --paper: #FFFFFF;
  position: fixed; z-index: 9998; right: 16px; bottom: 16px;
  font: 400 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink);
}
.ksc.has-switch { bottom: 72px; }
.ksc.is-open { z-index: 10000; }

.ksc__fab {
  display: inline-flex; align-items: center; gap: 8px; height: 52px; padding: 0 20px 0 16px;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--ks-chat-accent); color: var(--ks-chat-on-accent);
  font: 600 15px/1 inherit; font-family: inherit;
  box-shadow: 0 8px 24px rgba(17, 26, 34, .22);
  transition: transform .15s ease, box-shadow .15s ease;
}
.ksc__fab:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(17, 26, 34, .28); }
.ksc__fab:focus-visible, .ksc button:focus-visible, .ksc textarea:focus-visible, .ksc a:focus-visible { outline: 3px solid #F2CD57; outline-offset: 2px; }
.ksc__fab svg { flex: none; }
.ksc.is-open .ksc__fab { display: none; }

.ksc__panel {
  position: absolute; right: 0; bottom: 0; width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100dvh - 32px)); display: none; flex-direction: column;
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  box-shadow: 0 18px 48px rgba(17, 26, 34, .24);
}
.ksc.has-switch .ksc__panel { height: min(560px, calc(100dvh - 88px)); }
.ksc.is-open .ksc__panel { display: flex; animation: ksc-in .18s ease-out; }
@keyframes ksc-in { from { opacity: 0; transform: translateY(8px); } }

.ksc__head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 16px; border-bottom: 1px solid var(--line); }
.ksc__title { flex: 1; min-width: 0; margin: 0; font-size: 15px; font-weight: 650; line-height: 1.25; }
.ksc__title small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.ksc__dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--ks-chat-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ks-chat-accent) 18%, transparent); }
.ksc__close { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.ksc__close:hover { background: var(--soft); color: var(--ink); }

.ksc__log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.ksc__msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ksc__msg--bot { align-self: flex-start; background: var(--soft); border-bottom-left-radius: 4px; }
.ksc__msg--me { align-self: flex-end; background: var(--ks-chat-accent); color: var(--ks-chat-on-accent); border-bottom-right-radius: 4px; }
.ksc__msg--err { align-self: flex-start; background: #FDECEA; color: #8A1C12; }
.ksc__msg a { color: inherit; font-weight: 600; text-underline-offset: 2px; }
.ksc__typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.ksc__typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: ksc-dot 1s infinite ease-in-out; }
.ksc__typing i:nth-child(2) { animation-delay: .15s; } .ksc__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ksc-dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.ksc__chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.ksc__chip { min-height: 36px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.ksc__chip:hover { border-color: var(--ks-chat-accent); color: var(--ks-chat-accent); }

.ksc__form { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--line); }
.ksc__input { flex: 1; min-height: 44px; max-height: 120px; padding: 10px 12px; border: 1px solid #7F8C9A; border-radius: 10px; font: inherit; color: var(--ink); background: var(--paper); resize: none; }
.ksc__send { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; border-radius: 10px; background: var(--ks-chat-accent); color: var(--ks-chat-on-accent); cursor: pointer; }
.ksc__send[aria-disabled="true"] { opacity: .45; cursor: default; }
.ksc__note { margin: 0; padding: 0 12px 10px; font-size: 12px; color: var(--muted); }

@media (max-width: 480px) {
  .ksc.is-open { inset: 0; }
  .ksc.is-open .ksc__panel { inset: 0; width: 100%; height: 100%; border-radius: 0; border: 0; }
  .ksc__fab span { display: none; }
  .ksc__fab { width: 52px; padding: 0; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .ksc *, .ksc { animation: none !important; transition: none !important; } }
@media print { .ksc { display: none; } }
.ksc__chips[hidden] { display: none; }
