/* Site assistant chat window (inc/assistant.php, assets/js/assistant.js) */

.cn-ai__open { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 70; display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 20px 0 16px; border: 0; border-radius: 999px; background: var(--cn-deep); color: #fff; font: 600 15px/1 inherit; font-family: inherit; cursor: pointer; box-shadow: 0 14px 34px -12px rgba(0, 20, 40, .6), 0 0 0 1px rgba(143, 227, 255, .28); transition: transform .3s var(--cn-pop), background .3s; }
.cn-ai__open:hover { background: var(--cn-navy); transform: translateY(-2px); }
.cn-ai__open svg { width: 22px; height: 22px; fill: none; stroke: var(--cn-glow); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cn-ai-open .cn-ai__open { opacity: 0; pointer-events: none; }

.cn-ai { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 80; width: min(400px, calc(100vw - 40px)); height: min(620px, calc(100dvh - 120px)); display: flex; flex-direction: column; background: #fff; color: var(--cn-ink); border-radius: var(--cn-r); box-shadow: 0 30px 70px -20px rgba(0, 20, 40, .45), 0 0 0 1px var(--cn-line); overflow: hidden; opacity: 0; transform: translateY(14px) scale(.98); transform-origin: bottom right; transition: opacity .3s var(--cn-ease), transform .35s var(--cn-ease); }
.cn-ai.is-in { opacity: 1; transform: none; }
.cn-ai[hidden] { display: none; }

.cn-ai__head { display: flex; align-items: center; gap: 4px; padding: 14px 10px 14px 20px; background: radial-gradient(120% 140% at 100% 0%, rgba(26, 161, 214, .35), transparent 60%), var(--cn-deep); color: #fff; }
.cn-ai__ttl { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cn-ai__ttl strong { font-size: 16px; }
.cn-ai__ttl span { font-size: 12.5px; color: var(--cn-cyan-hi); }
.cn-ai__icon { width: 38px; height: 38px; border: 0; border-radius: 50%; background: transparent; color: #fff; display: grid; place-items: center; cursor: pointer; }
.cn-ai__icon:hover { background: rgba(255, 255, 255, .12); }
.cn-ai__icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.cn-ai__log { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px; background: var(--cn-surface); overscroll-behavior: contain; }
.cn-ai__msg { max-width: 88%; padding: 11px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.cn-ai__msg p { margin: 0; }
.cn-ai__msg p + p, .cn-ai__msg p + ul, .cn-ai__msg ul + p { margin-top: 8px; }
.cn-ai__msg ul { margin: 4px 0 0; padding-left: 18px; }
.cn-ai__msg li + li { margin-top: 3px; }
.cn-ai__msg a { color: var(--cn-cyan-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.cn-ai__msg--bot { align-self: flex-start; background: #fff; border: 1px solid var(--cn-line); border-bottom-left-radius: 6px; }
.cn-ai__msg--me { align-self: flex-end; background: var(--cn-navy); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.cn-ai__msg.is-wait { color: var(--cn-muted); font-style: italic; animation: cn-ai-pulse 1.4s ease-in-out infinite; }
.cn-ai__msg.is-error { border-color: rgba(190, 60, 40, .35); }
@keyframes cn-ai-pulse { 50% { opacity: .55; } }

.cn-ai__chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px 12px; background: var(--cn-surface); }
.cn-ai__chips[hidden] { display: none; }
.cn-ai__chip { border: 1px solid rgba(0, 63, 107, .25); background: #fff; color: var(--cn-navy); border-radius: 999px; padding: 7px 12px; font-size: 13px; cursor: pointer; text-align: left; }
.cn-ai__chip:hover { border-color: var(--cn-cyan); background: var(--cn-soft); }

.cn-ai__form { display: flex; align-items: flex-end; gap: 8px; padding: 12px 12px 6px; border-top: 1px solid var(--cn-line); }
.cn-ai__input { flex: 1; resize: none; border: 1px solid rgba(0, 63, 107, .22); border-radius: 14px; padding: 11px 14px; font: inherit; font-size: 15px; line-height: 1.4; color: var(--cn-ink); max-height: 120px; background: #fff; }
.cn-ai__input:focus { outline: 2px solid var(--cn-focus, #1798CB); outline-offset: 1px; border-color: var(--cn-focus, #1798CB); }
.cn-ai__send { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--cn-cyan); color: #fff; display: grid; place-items: center; cursor: pointer; }
.cn-ai__send:disabled { opacity: .5; cursor: default; }
.cn-ai__send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cn-ai__note { margin: 0; padding: 4px 16px 12px; font-size: 11.5px; line-height: 1.45; color: var(--cn-muted); }
.cn-ai__note a { color: var(--cn-cyan-ink); }

/* Phones: a bottom sheet, and the back-to-top button moves above the launcher. */
@media (max-width: 600px) {
	.cn-ai__open { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); height: 48px; padding: 0 16px 0 13px; font-size: 14px; }
	.has-cn-ai .cn-top { bottom: calc(74px + env(safe-area-inset-bottom)); }
	.cn-ai { right: 0; bottom: 0; width: 100%; height: min(88dvh, 680px); border-radius: var(--cn-r) var(--cn-r) 0 0; }
	.cn-ai__form { padding-bottom: 6px; }
	.cn-ai__note { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
	.cn-ai__input { font-size: 16px; } /* no zoom on iOS */
}

@media (prefers-reduced-motion: reduce) {
	.cn-ai, .cn-ai__open { transition: none; }
	.cn-ai__msg.is-wait { animation: none; }
}
@media print { .cn-ai, .cn-ai__open { display: none !important; } }
