.bshb-chat-auth[hidden],
.bshb-chat-workspace[hidden],
.bshb-chat-history__content[hidden],
.bshb-chat-history__empty[hidden],
.bshb-chat-conversation__empty[hidden],
.bshb-chat-error[hidden],
.bshb-chat-history__error[hidden],
.bshb-chat-history [data-bshb-history-list] button[hidden],
.bshb-chat-form button[hidden] { display: none !important; }

.bshb-chat-auth { background: #fff; inset: 0; position: fixed; z-index: 100002; }
.bshb-chat-auth iframe { border: 0; display: block; height: 100%; width: 100%; }

.bshb-widget .bshb-popup.bshb-popup--chat {
	box-sizing: border-box;
	max-height: min(690px, calc(100dvh - 24px));
	max-width: calc(100vw - 24px);
	min-width: 0;
	overflow: hidden;
	padding: 18px;
	width: min(960px, calc(100vw - 24px));
}
.bshb-popup--chat .bshb-popup__content {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 184px;
	min-height: 0;
}
.bshb-popup--chat .bshb-popup__links-column {
	border-left: 1px solid #e4e9ee;
	min-width: 0;
	padding-left: 16px;
}
.bshb-popup--chat .bshb-links { margin-top: 0; }
.bshb-popup--chat .bshb-chat-link-item { display: none; }
.bshb-chat-link { justify-content: flex-start; gap: 8px; }
.bshb-chat-link svg { fill: none; flex: 0 0 18px; height: 18px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; width: 18px; }
.bshb-chat-link svg,
.bshb-chat-history__actions [data-bshb-new-chat] svg,
.bshb-chat-history__search svg,
.bshb-chat-form button svg { position: static !important; }
.bshb-popup--chat .bshb-popup__text { display: none; }
.bshb-chat-workspace {
	display: grid;
	grid-template-columns: 176px minmax(0, 1fr);
	height: min(570px, calc(100dvh - 126px));
	min-height: 310px;
	min-width: 0;
}
.bshb-chat-workspace--history-collapsed { grid-template-columns: 52px minmax(0, 1fr); }
.bshb-chat-history {
	background: #f6f8fa;
	border-radius: 12px 0 0 12px;
	min-width: 0;
	overflow-y: auto;
	padding: 12px 8px;
}
.bshb-chat-history__actions { align-items: stretch; display: flex; flex-direction: column; gap: 4px; }
.bshb-chat-workspace--history-collapsed .bshb-chat-history__actions { align-items: center; }
.bshb-chat-history__actions button {
	background: transparent;
	border: 0;
	border-radius: 8px;
	box-sizing: border-box;
	color: #1b3650;
	cursor: pointer;
	font: inherit;
	font-size: 13px;
	min-height: 34px;
	padding: 6px;
}
.bshb-chat-history__actions button:hover,
.bshb-chat-history [data-bshb-history-list] button:hover { background: #e8eef3; }
.bshb-chat-history__actions [data-bshb-history-toggle] { align-self: flex-start; flex: 0 0 34px; font-size: 18px; }
.bshb-chat-history__actions [data-bshb-new-chat] { align-items: center; display: inline-flex; gap: 9px; text-align: left; white-space: nowrap; width: 100%; }
.bshb-chat-history__actions [data-bshb-new-chat] svg { fill: none; flex: 0 0 22px; height: 22px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; width: 22px; }
.bshb-chat-workspace--history-collapsed .bshb-chat-history__actions [data-bshb-new-chat] { justify-content: center; padding: 6px; width: 36px; }
.bshb-chat-workspace--history-collapsed .bshb-chat-history__actions [data-bshb-new-chat] span { display: none; }
.bshb-chat-history__content { margin-top: 12px; }
.bshb-chat-history__search { align-items: center; background: #fff; border: 1px solid #dce4ec; border-radius: 15px; box-sizing: border-box; display: flex; gap: 6px; padding: 6px 8px; width: 100%; }
.bshb-chat-history__search svg { fill: none; flex: 0 0 17px; height: 17px; stroke: #617184; stroke-linecap: round; stroke-width: 1.8; width: 17px; }
.bshb-chat-history__search input { background: transparent !important; border: 0 !important; box-shadow: none !important; color: #263746; flex: 1 1 auto; font: inherit; font-size: 12px; min-width: 0; outline: 0 !important; padding: 0; width: 100%; }
.bshb-chat-history__search + h3 { margin-top: 18px; }
.bshb-chat-history h3 { color: #617184; font-size: 13px; font-weight: 600; margin: 0 8px 10px; }
.bshb-chat-history [data-bshb-history-list] { display: grid; gap: 3px; }
.bshb-chat-history [data-bshb-history-list] button {
	background: transparent;
	border: 0;
	border-radius: 8px;
	color: #263746;
	cursor: pointer;
	display: block;
	font: inherit;
	font-size: 13px;
	overflow: hidden;
	padding: 9px;
	text-align: left;
	text-overflow: ellipsis;
	white-space: nowrap;
	width: 100%;
}
.bshb-chat-history [data-bshb-history-list] button[aria-current="true"] { background: #dce9f5; color: #155b96; font-weight: 600; }
.bshb-chat-history__empty,
.bshb-chat-history__error { color: #68788a; font-size: 13px; line-height: 1.4; margin: 10px 8px; }
.bshb-chat-conversation { display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 12px 18px 4px; }
.bshb-chat-conversation__empty { color: #68788a; font-size: 15px; margin: auto; text-align: center; }
.bshb-chat-messages { display: flex; flex: 1 1 auto; flex-direction: column; gap: 20px; min-height: 0; overflow-y: auto; padding: 12px 4px 18px; }
.bshb-chat-message { box-sizing: border-box; max-width: 92%; overflow-wrap: anywhere; }
.bshb-chat-message--question { align-self: flex-end; background: #edf1f4; border-radius: 18px 18px 5px 18px; padding: 12px 16px; }
.bshb-chat-message--answer,
.bshb-chat-message--answer p { background: transparent !important; border: 0 !important; box-shadow: none !important; }
.bshb-chat-message--answer { align-self: flex-start; color: #202a35; line-height: 1.6; padding: 0 2px; }
.bshb-chat-message p { font-size: 15px; margin: 0; white-space: pre-wrap; }
.bshb-chat-pending { align-items: center; align-self: flex-start; color: #617184; display: flex; font-size: 13px; gap: 9px; line-height: 1.4; padding: 0 2px; }
.bshb-chat-pending__spinner { animation: bshb-chat-spin .8s linear infinite; border: 2px solid #d8e7f5; border-radius: 50%; border-top-color: #1e73be; box-sizing: border-box; display: inline-block; flex: 0 0 17px; height: 17px; width: 17px; }
@keyframes bshb-chat-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .bshb-chat-pending__spinner { animation: none; } }
.bshb-chat-sources { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 10px 0 0; padding: 0; }
.bshb-chat-sources a { background: #eef2f6; border-radius: 14px; color: #225c91; display: inline-block; font-size: 12px; padding: 4px 8px; text-decoration: none; }
.bshb-chat-sources a:hover { text-decoration: underline; }
.bshb-chat-form { align-items: end; background: #fff; border: 1px solid #d6dfe8; border-radius: 26px; display: flex; gap: 8px; padding: 10px 12px; }
.bshb-chat-form textarea { background: transparent !important; border: 0 !important; box-shadow: none !important; box-sizing: border-box; flex: 1 1 auto; font: inherit; max-height: 140px; min-height: 58px; outline: 0; resize: vertical; width: 100%; }
.bshb-chat-form textarea:focus,
.bshb-chat-form textarea:focus-visible { border: 0 !important; box-shadow: none !important; outline: 0 !important; }
.bshb-chat-form button { align-items: center; background: #326bff; border: 0; border-radius: 50%; color: #fff; cursor: pointer; display: inline-flex; flex: 0 0 44px; height: 44px; justify-content: center; padding: 0; width: 44px; }
.bshb-chat-form button svg { fill: none; height: 24px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; width: 24px; }
.bshb-chat-form button:disabled { cursor: wait; opacity: .6; }
.bshb-chat-error { color: #a32a2a; font-size: 13px; margin: 0 0 8px; }
.bshb-chat-sr-only { clip: rect(0,0,0,0); clip-path: inset(50%); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; }
.bshb-chat-history button:focus-visible,
.bshb-history-header-toggle:focus-visible,
.bshb-links-toggle:focus-visible,
.bshb-chat-form button:focus-visible,
.bshb-chat-history__search:focus-within,
.bshb-chat-sources a:focus-visible { outline: 2px solid #1e73be; outline-offset: 2px; }
.bshb-links-toggle,
.bshb-history-header-toggle { display: none; }

@media (max-width: 760px) {
	html.bshb-chat-mobile-open,
	html.bshb-chat-mobile-open body { overflow: hidden !important; }
	.bshb-widget .bshb-popup.bshb-popup--chat {
		border: 0;
		border-radius: 0;
		bottom: 0;
		display: flex;
		flex-direction: column;
		height: 100dvh;
		left: 0;
		max-height: none;
		max-width: none;
		padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
		position: fixed;
		right: 0;
		top: 0;
		transform: none;
		width: 100vw;
		z-index: 99999;
	}
	body.admin-bar .bshb-widget .bshb-popup.bshb-popup--chat {
		height: calc(100dvh - 46px);
		top: 46px;
	}
	.bshb-popup--chat .bshb-popup__header {
		align-items: center;
		display: grid;
		flex: 0 0 auto;
		grid-template-columns: 38px minmax(0, 1fr) 38px;
		min-height: 40px;
		padding: 0 4px 4px;
		position: relative;
		z-index: 6;
	}
	.bshb-popup--chat .bshb-popup__header h2 { justify-self: center; min-width: 0; text-align: center; }
	.bshb-popup--chat .bshb-popup__close { justify-self: end; }
	.bshb-popup--chat .bshb-history-header-toggle {
		align-items: center;
		background: #f6f8fa;
		border: 0;
		border-radius: 8px;
		color: #1b3650;
		cursor: pointer;
		display: grid;
		height: 36px;
		justify-items: center;
		line-height: 0;
		padding: 0;
		width: 36px;
	}
	.bshb-popup--chat .bshb-history-header-toggle svg,
	.bshb-popup--chat .bshb-links-toggle svg { display: block; fill: none; height: 21px; margin: 0 auto; position: static !important; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; width: 21px; }
	.bshb-popup--chat .bshb-links-toggle svg { height: 24px; min-width: 24px; width: 24px; }
	.bshb-popup--chat .bshb-popup__content { display: block; flex: 1 1 auto; min-height: 0; position: relative; width: 100%; }
	.bshb-chat-workspace { display: block; height: 100%; min-height: 0; position: relative; width: 100%; }
	.bshb-chat-workspace--history-collapsed .bshb-chat-history { display: none; }
	.bshb-chat-history {
		bottom: 0;
		box-sizing: border-box;
		left: 0;
		padding: 4px 8px;
		position: absolute;
		top: 0;
		width: min(270px, calc(100vw - 56px));
		z-index: 4;
	}
	.bshb-chat-history { box-shadow: 8px 0 20px rgba(17, 41, 64, .16); }
	.bshb-chat-history__actions [data-bshb-history-toggle] { display: none; }
	.bshb-chat-conversation { box-sizing: border-box; height: 100%; margin-left: 0; padding: 0 3px 2px; width: 100%; }
	.bshb-chat-messages { gap: 12px; padding: 42px 2px 8px; }
	.bshb-chat-message { max-width: 98%; }
	.bshb-chat-message--question { padding: 8px 10px; }
	.bshb-chat-message--answer { padding: 0 1px; }
	.bshb-chat-message p { font-size: 14px; }
	.bshb-chat-form { align-items: flex-end; box-sizing: border-box; flex-direction: row; gap: 4px; padding: 5px 6px; width: 100%; }
	.bshb-chat-form textarea { flex: 1 1 0; font-size: 16px; line-height: 1.35; max-height: 110px; min-height: 38px; min-width: 0; padding: 4px 2px; resize: none; width: auto; }
	.bshb-chat-form button { align-self: flex-end; flex: 0 0 38px; height: 38px; width: 38px; }
	.bshb-popup--chat .bshb-popup__links-column {
		background: #f6f8fa;
		border: 0;
		border-radius: 10px;
		box-sizing: border-box;
		height: 40px;
		overflow: hidden;
		padding: 0;
		position: absolute;
		right: 4px;
		top: 0;
		width: 40px;
		z-index: 5;
	}
	.bshb-popup--chat .bshb-links-toggle {
		align-items: center;
		background: transparent;
		border: 0;
		border-radius: 8px;
		color: #1b3650;
		cursor: pointer;
		display: grid;
		height: 40px;
		justify-items: center;
		line-height: 0;
		padding: 0;
		width: 40px;
	}
	.bshb-popup--chat .bshb-popup__links-column .bshb-links { display: none; }
	.bshb-popup--chat.bshb-popup--links-open .bshb-popup__links-column {
		box-shadow: -8px 0 20px rgba(17, 41, 64, .16);
		height: 100%;
		overflow-y: auto;
		padding: 4px 8px;
		width: min(260px, calc(100vw - 56px));
	}
	.bshb-popup--chat.bshb-popup--links-open .bshb-popup__links-column .bshb-links { display: grid; }
	.bshb-popup--chat .bshb-link { font-size: 13px; padding: 9px; }
}
