/* SFS Assistant chat widget */
.sfs-asst {
	--sfs-asst-color: #780a19;
	--sfs-asst-ink: #1f2328;
	--sfs-asst-muted: #5b6470;
	--sfs-asst-surface: #ffffff;
	--sfs-asst-soft: #f5f1f1;
	--sfs-asst-line: #e6dede;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.5;
	color: var(--sfs-asst-ink);
	box-sizing: border-box;
}
.sfs-asst *, .sfs-asst *::before, .sfs-asst *::after { box-sizing: border-box; }

.sfs-asst--floating { position: fixed; bottom: 20px; z-index: 99990; }
.sfs-asst--right { right: 20px; }
.sfs-asst--left { left: 20px; }

.sfs-asst-launcher {
	display: inline-flex; align-items: center; gap: 8px;
	border: 0; border-radius: 999px; padding: 12px 18px 12px 14px; cursor: pointer;
	background: var(--sfs-asst-color); color: #fff; font: inherit; font-weight: 600;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .22); transition: transform .15s ease, box-shadow .15s ease;
}
.sfs-asst-launcher:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0, 0, 0, .26); }
.sfs-asst-launcher:focus-visible, .sfs-asst button:focus-visible, .sfs-asst select:focus-visible, .sfs-asst a:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }
.sfs-asst--floating.is-open .sfs-asst-launcher { display: none; }

.sfs-asst-panel {
	display: flex; flex-direction: column; overflow: hidden;
	background: var(--sfs-asst-surface); border: 1px solid var(--sfs-asst-line); border-radius: 18px;
	box-shadow: 0 18px 48px rgba(0, 0, 0, .22);
}
.sfs-asst--floating .sfs-asst-panel { display: none; width: 390px; height: min(620px, calc(100vh - 40px)); }
.sfs-asst--floating.is-open .sfs-asst-panel { display: flex; animation: sfs-asst-in .18s ease-out; }
.sfs-asst--inline .sfs-asst-panel { height: 560px; max-width: 760px; box-shadow: none; }
@keyframes sfs-asst-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.sfs-asst-header {
	display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px;
	background: var(--sfs-asst-color); color: #fff;
}
.sfs-asst-avatar { width: 38px; height: 38px; border-radius: 50%; background: #fff; object-fit: contain; flex: none; }
.sfs-asst-avatar--text { display: grid; place-items: center; color: var(--sfs-asst-color); font-weight: 800; font-size: 12px; }
.sfs-asst-titles { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sfs-asst-titles strong { font-size: 16px; line-height: 1.2; }
.sfs-asst-titles span { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sfs-asst-lang { font: inherit; font-size: 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .15); color: #fff; padding: 3px 4px; max-width: 86px; }
.sfs-asst-lang option { color: #1f2328; }
.sfs-asst-icon-btn { border: 0; background: transparent; color: #fff; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.sfs-asst-icon-btn:hover { background: rgba(255, 255, 255, .16); }

.sfs-asst-log { flex: 1; overflow-y: auto; padding: 14px; background: var(--sfs-asst-soft); display: flex; flex-direction: column; gap: 10px; }
.sfs-asst-msg { display: flex; flex-direction: column; max-width: 88%; }
.sfs-asst-msg--user { align-self: flex-end; align-items: flex-end; }
.sfs-asst-msg--assistant { align-self: flex-start; }
.sfs-asst-bubble { padding: 9px 13px; border-radius: 14px; background: #fff; border: 1px solid var(--sfs-asst-line); overflow-wrap: anywhere; }
.sfs-asst-msg--user .sfs-asst-bubble { background: var(--sfs-asst-color); border-color: var(--sfs-asst-color); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.sfs-asst-msg--assistant .sfs-asst-bubble { border-bottom-left-radius: 4px; }
.sfs-asst-bubble p { margin: 0 0 6px; }
.sfs-asst-bubble p:last-child { margin-bottom: 0; }
.sfs-asst-bubble ul { margin: 4px 0 6px; padding-left: 20px; }
.sfs-asst-bubble a { color: var(--sfs-asst-color); text-decoration: underline; font-weight: 600; }
.sfs-asst-cite { font-size: 10px; font-weight: 700; color: var(--sfs-asst-muted); margin-left: 1px; }
.sfs-asst-msg--waiting .sfs-asst-bubble { color: var(--sfs-asst-muted); font-style: italic; }
.sfs-asst-msg--waiting .sfs-asst-bubble::after { content: ''; display: inline-block; width: 1.2em; text-align: left; animation: sfs-asst-dots 1.2s steps(4) infinite; }
@keyframes sfs-asst-dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

.sfs-asst-sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--sfs-asst-muted); align-items: center; }
.sfs-asst-sources a { display: inline-block; max-width: 100%; padding: 3px 9px; border-radius: 999px; background: #fff; border: 1px solid var(--sfs-asst-line); color: var(--sfs-asst-color); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sfs-asst-sources a:hover { border-color: var(--sfs-asst-color); }

.sfs-asst-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 0; background: var(--sfs-asst-soft); }
.sfs-asst-chips[hidden] { display: none; }
.sfs-asst-chip { font: inherit; font-size: 13px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--sfs-asst-color); background: #fff; color: var(--sfs-asst-color); cursor: pointer; }
.sfs-asst-chip:hover { background: var(--sfs-asst-color); color: #fff; }

.sfs-asst-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--sfs-asst-line); background: #fff; }
.sfs-asst-input { flex: 1; resize: none; font: inherit; border: 1px solid var(--sfs-asst-line); border-radius: 12px; padding: 9px 12px; max-height: 120px; min-height: 42px; color: var(--sfs-asst-ink); background: #fff; }
.sfs-asst-input:focus { outline: none; border-color: var(--sfs-asst-color); box-shadow: 0 0 0 3px rgba(120, 10, 25, .12); }
.sfs-asst-send { flex: none; width: 42px; height: 42px; border: 0; border-radius: 12px; background: var(--sfs-asst-color); color: #fff; cursor: pointer; display: grid; place-items: center; }
.sfs-asst-send:disabled { opacity: .5; cursor: progress; }
.sfs-asst-note { margin: 0; padding: 0 14px 10px; font-size: 11px; color: var(--sfs-asst-muted); background: #fff; }
.sfs-asst-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 640px) {
	.sfs-asst--floating { bottom: 14px; }
	.sfs-asst--right { right: 14px; }
	.sfs-asst--left { left: 14px; }
	.sfs-asst-launcher-label { display: none; }
	.sfs-asst-launcher { padding: 14px; }
	.sfs-asst--floating.is-open { inset: 0; }
	.sfs-asst--floating.is-open .sfs-asst-panel { width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
}
@media (prefers-reduced-motion: reduce) {
	.sfs-asst-launcher, .sfs-asst--floating.is-open .sfs-asst-panel { transition: none; animation: none; }
}
@media print { .sfs-asst--floating { display: none; } }
