/* AI Support Agent widget */
.sbai {
	--sbai-accent: #b9853f;
	--sbai-ink: #231a15;
	--sbai-muted: #6f675f;
	--sbai-line: #e4e1db;
	--sbai-bg: #ffffff;
	--sbai-soft: #f5f4f1;
	position: fixed;
	bottom: 20px;
	z-index: 9990;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.5;
	color: var(--sbai-ink);
}
.sbai--right { right: 20px; }
.sbai--left { left: 20px; }
.sbai *, .sbai *::before, .sbai *::after { box-sizing: border-box; }

.sbai-launcher {
	display: inline-flex; align-items: center; gap: 10px;
	height: 56px; padding: 0 22px 0 18px;
	border: 0; border-radius: 999px;
	background: var(--sbai-ink); color: #fff;
	font: inherit; font-weight: 600; cursor: pointer;
	box-shadow: 0 10px 30px rgba(35, 26, 21, .28);
	transition: transform .2s ease, box-shadow .2s ease;
}
.sbai-launcher svg { color: var(--sbai-accent); }
.sbai-launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(35, 26, 21, .32); }
.sbai-launcher:focus-visible, .sbai button:focus-visible, .sbai a:focus-visible, .sbai textarea:focus-visible { outline: 2px solid var(--sbai-accent); outline-offset: 2px; }
.sbai.is-open .sbai-launcher { display: none; }
@media (max-width: 480px) { .sbai-launcher { padding: 0; width: 56px; justify-content: center; } .sbai-launcher__label { display: none; } }

.sbai-panel {
	position: absolute; bottom: 0;
	width: 392px; height: min(640px, calc(100vh - 40px));
	display: flex; flex-direction: column;
	background: var(--sbai-bg);
	border: 1px solid var(--sbai-line);
	border-radius: 18px;
	box-shadow: 0 24px 60px rgba(35, 26, 21, .22);
	overflow: hidden;
	animation: sbai-in .22s ease;
}
.sbai--right .sbai-panel { right: 0; }
.sbai--left .sbai-panel { left: 0; }
.sbai-panel[hidden] { display: none; }
@keyframes sbai-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sbai-panel { animation: none; } .sbai-launcher { transition: none; } }

.sbai-head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 16px; background: var(--sbai-ink); color: #fff; }
.sbai-avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--sbai-accent); color: var(--sbai-ink); font-weight: 700; font-size: 16px; }
.sbai-head__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sbai-head__name { font-size: 15px; line-height: 1.25; }
.sbai-head__status { font-size: 12px; color: #c9bfb2; }
.sbai-icon { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: #fff; cursor: pointer; }
.sbai-icon:hover { background: rgba(255, 255, 255, .12); }

.sbai-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--sbai-soft); overscroll-behavior: contain; }
.sbai-msg { display: flex; flex-direction: column; max-width: 88%; }
.sbai-msg--user { align-self: flex-end; align-items: flex-end; }
.sbai-msg--assistant { align-self: flex-start; }
.sbai-bubble { padding: 10px 14px; border-radius: 16px; word-wrap: break-word; overflow-wrap: anywhere; }
.sbai-msg--assistant .sbai-bubble { background: var(--sbai-bg); border: 1px solid var(--sbai-line); border-bottom-left-radius: 6px; }
.sbai-msg--user .sbai-bubble { background: var(--sbai-ink); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.sbai-msg.is-error .sbai-bubble { border-color: #e2b4a9; background: #fbf1ee; }
.sbai-bubble p { margin: 0 0 6px; }
.sbai-bubble p:last-child { margin-bottom: 0; }
.sbai-bubble ul, .sbai-bubble ol { margin: 4px 0 6px; padding-left: 18px; }
.sbai-bubble li { margin: 2px 0; }
.sbai-bubble a { color: inherit; text-decoration: underline; text-decoration-color: var(--sbai-accent); text-underline-offset: 2px; }
.sbai-bubble strong { font-weight: 600; }

.sbai-typing .sbai-bubble { display: inline-flex; gap: 4px; padding: 14px 16px; }
.sbai-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--sbai-muted); opacity: .4; animation: sbai-dot 1.2s infinite ease-in-out; }
.sbai-typing span:nth-child(2) { animation-delay: .15s; }
.sbai-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes sbai-dot { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }

.sbai-suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.sbai-chip { border: 1px solid var(--sbai-line); background: var(--sbai-bg); color: var(--sbai-ink); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.sbai-chip:hover { border-color: var(--sbai-ink); }

.sbai-cards { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; width: 100%; min-width: 260px; }
.sbai-card { display: flex; align-items: center; gap: 10px; padding: 8px; background: var(--sbai-bg); border: 1px solid var(--sbai-line); border-radius: 12px; }
.sbai-card__link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--sbai-ink); }
.sbai-card__link:hover .sbai-card__name { text-decoration: underline; }
.sbai-card__img { flex: none; width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--sbai-soft); }
.sbai-card__info { min-width: 0; display: flex; flex-direction: column; }
.sbai-card__name { font-weight: 600; font-size: 14px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sbai-card__price { font-size: 13px; color: var(--sbai-muted); }
.sbai-card__was { opacity: .7; }
.sbai-card__btn { flex: none; border: 0; border-radius: 999px; padding: 8px 12px; background: var(--sbai-accent); color: var(--sbai-ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.sbai-card__btn:hover { filter: brightness(1.06); color: var(--sbai-ink); }
.sbai-card__btn.is-done { background: #dfe9e1; }
.sbai-card__btn.is-muted { background: var(--sbai-soft); color: var(--sbai-muted); cursor: default; }
.sbai-card__btn:disabled { opacity: .7; cursor: default; }

.sbai-form { display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid var(--sbai-line); background: var(--sbai-bg); }
.sbai-input { flex: 1; resize: none; min-height: 44px; max-height: 120px; padding: 11px 14px; border: 1px solid var(--sbai-line); border-radius: 14px; font: inherit; font-size: 15px; color: var(--sbai-ink); background: var(--sbai-soft); outline: none; }
.sbai-input:focus { border-color: var(--sbai-ink); background: #fff; }
.sbai-send { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--sbai-ink); color: #fff; display: grid; place-items: center; cursor: pointer; }
.sbai-send:disabled { opacity: .5; cursor: default; }
.sbai-foot { margin: 0; padding: 0 14px 10px; background: var(--sbai-bg); font-size: 11.5px; color: var(--sbai-muted); text-align: center; }

@media (max-width: 640px) {
	.sbai { bottom: 16px; }
	.sbai--right { right: 16px; }
	.sbai--left { left: 16px; }
	.sbai.is-open { inset: 0; }
	.sbai-panel { position: fixed; inset: 0; width: 100%; height: 100%; border-radius: 0; border: 0; }
	.sbai-input { font-size: 16px; }
}
