/* Staff assistant FAB — desk and field app. Independent of portal AI. */

.sai-root {
	--sai-green: #1f6b45;
	--sai-green-dark: #14532d;
	--sai-ink: #10281c;
	--sai-muted: #4b6356;
	--sai-line: #d4e0d6;
	--sai-wash: #e8efe9;
	--sai-footer-lift: 0px;
	position: fixed;
	right: 24px;
	bottom: calc(24px + env(safe-area-inset-bottom, 0px));
	z-index: 1035;
	transition: bottom 0.18s ease;
	font-family: inherit;
}

.sai-root .sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
}

.sai-fab {
	width: 52px;
	height: 52px;
	border: 0;
	border-radius: 50%;
	background: var(--sai-green);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 8px 18px rgba(16, 40, 28, 0.28);
	display: flex;
	align-items: center;
	justify-content: center;
}

.sai-fab svg {
	width: 34px;
	height: 34px;
	display: block;
}

.sai-panel {
	position: absolute;
	right: 0;
	bottom: 64px;
	width: min(22rem, calc(100vw - 24px));
	height: min(30rem, calc(100dvh - 8rem - var(--sai-footer-lift, 0px)));
	background: #fff;
	border: 1px solid var(--sai-line);
	border-radius: 14px;
	box-shadow: 0 12px 32px rgba(16, 40, 28, 0.18);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	color: var(--sai-ink);
}

.sai-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 10px 10px 10px 12px;
	background: #10281c;
	color: #e7f0ea;
}

.sai-kicker {
	margin: 0;
	font-size: 0.68rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #8fb49d;
	font-weight: 700;
}

.sai-head h2 {
	margin: 2px 0 0;
	font-size: 1rem;
	color: #fff;
}

.sai-sub {
	margin: 2px 0 0;
	font-size: 0.78rem;
	color: #b7cfc2;
}

.sai-close {
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
}

.sai-thread {
	flex: 1;
	overflow: auto;
	padding: 10px;
	background: var(--sai-wash);
}

.sai-row {
	display: flex;
	margin-bottom: 8px;
}

.sai-row-user {
	justify-content: flex-end;
}

.sai-bubble {
	max-width: 90%;
	padding: 8px 10px;
	border-radius: 12px;
	font-size: 0.9rem;
	line-height: 1.4;
	overflow-wrap: anywhere;
}

.sai-row-assistant .sai-bubble {
	background: #fff;
	border: 1px solid var(--sai-line);
}

.sai-row-user .sai-bubble {
	background: #10281c;
	color: #fff;
}

.sai-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 8px 10px 0;
	background: #fff;
	border-top: 1px solid var(--sai-line);
}

.sai-chip {
	border: 1px solid var(--sai-line);
	background: #f3faf5;
	border-radius: 999px;
	padding: 4px 10px;
	font-size: 0.78rem;
	font-weight: 650;
	cursor: pointer;
	color: var(--sai-ink);
}

.sai-composer {
	display: flex;
	gap: 6px;
	padding: 8px 10px 10px;
	background: #fff;
}

.sai-composer textarea {
	flex: 1;
	min-height: 2.4rem;
	max-height: 6rem;
	resize: none;
	border: 1px solid var(--sai-line);
	border-radius: 8px;
	padding: 6px 8px;
	font: inherit;
}

.sai-send {
	border: 0;
	border-radius: 8px;
	background: var(--sai-green);
	color: #fff;
	font-weight: 700;
	padding: 0 12px;
	cursor: pointer;
}

.sai-dots i {
	display: inline-block;
	width: 5px;
	height: 5px;
	margin: 0 2px;
	border-radius: 50%;
	background: #7a9588;
	animation: sai-blink 1s infinite;
}

.sai-dots i:nth-child(2) {
	animation-delay: 0.15s;
}

.sai-dots i:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes sai-blink {
	0%,
	80%,
	100% {
		opacity: 0.3;
	}
	40% {
		opacity: 1;
	}
}

.sai-root.sai-compact {
	right: 12px;
	bottom: calc(12px + env(safe-area-inset-bottom, 0px));
	z-index: 50;
}

.sai-compact .sai-fab {
	width: 40px;
	height: 40px;
}

.sai-compact .sai-fab svg {
	width: 26px;
	height: 26px;
}

.sai-compact .sai-panel {
	width: min(17.5rem, calc(100vw - 24px));
	height: min(22rem, calc(100dvh - 7.5rem - var(--sai-footer-lift, 0px)));
	bottom: 50px;
}

body.tech-app-page .sai-root.sai-compact {
	right: 12px;
	left: auto;
}

.sai-root.sai-desk {
	z-index: 1035;
}

@media (max-width: 640px) {
	.sai-desk {
		right: 12px;
		bottom: calc(12px + env(safe-area-inset-bottom, 0px));
	}
}
