/* REIAuto AI Assistant – chat widget */
.rei-chat {
	--rei-accent: #0f766e;
	--rei-bg: #ffffff;
	--rei-fg: #1f2933;
	--rei-muted: #6b7280;
	--rei-line: #e5e7eb;
	--rei-bot-bg: #f3f4f6;
	position: fixed;
	bottom: 20px;
	z-index: 999999;
	font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--rei-fg);
}
.rei-chat *, .rei-chat *::before, .rei-chat *::after { box-sizing: border-box; }
.rei-pos-right { right: 20px; }
.rei-pos-left { left: 20px; }

.rei-launcher {
	width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
	background: var(--rei-accent); color: #fff;
	display: flex; align-items: center; justify-content: center;
	box-shadow: 0 6px 20px rgba(0,0,0,.22);
	transition: transform .15s ease;
	margin-left: auto;
}
.rei-pos-left .rei-launcher { margin-left: 0; }
.rei-launcher:hover { transform: scale(1.06); }
.rei-launcher:focus-visible { outline: 3px solid #fff; box-shadow: 0 0 0 5px var(--rei-accent); }

.rei-panel {
	width: 380px; height: 580px; max-height: calc(100vh - 110px);
	background: var(--rei-bg); border-radius: 16px; overflow: hidden;
	box-shadow: 0 12px 40px rgba(0,0,0,.25);
	display: flex; flex-direction: column;
	margin-bottom: 14px;
}
.rei-panel[hidden] { display: none; }

.rei-header {
	background: var(--rei-accent); color: #fff;
	padding: 14px 14px 14px 18px;
	display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.rei-title { display: flex; flex-direction: column; line-height: 1.25; }
.rei-title strong { font-size: 16px; }
.rei-sub { font-size: 12.5px; opacity: .85; }
.rei-head-btns { display: flex; gap: 4px; }
.rei-icon-btn {
	background: transparent; border: 0; color: inherit; cursor: pointer;
	font-size: 22px; line-height: 1; width: 32px; height: 32px; border-radius: 8px;
	padding: 0;
}
.rei-icon-btn:hover { background: rgba(255,255,255,.18); }

.rei-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.rei-msg { max-width: 88%; padding: 10px 13px; border-radius: 14px; word-wrap: break-word; overflow-wrap: anywhere; }
.rei-msg p { margin: 0 0 8px; }
.rei-msg p:last-child { margin-bottom: 0; }
.rei-msg ul, .rei-msg ol { margin: 4px 0 8px 18px; padding: 0; }
.rei-msg li { margin: 2px 0; }
.rei-msg code { background: rgba(0,0,0,.06); padding: 1px 4px; border-radius: 4px; font-size: 13px; }
.rei-msg a { color: var(--rei-accent); text-decoration: underline; }
.rei-user { align-self: flex-end; background: var(--rei-accent); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.rei-bot { align-self: flex-start; background: var(--rei-bot-bg); border-bottom-left-radius: 4px; }
.rei-error { background: #fef2f2; color: #991b1b; }
.rei-nudge { background: #ecfdf5; }

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

.rei-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.rei-chips[hidden] { display: none; }
.rei-chip {
	border: 1px solid var(--rei-accent); color: var(--rei-accent); background: #fff;
	border-radius: 999px; padding: 6px 11px; font-size: 13px; cursor: pointer; text-align: left;
}
.rei-chip:hover { background: var(--rei-accent); color: #fff; }

.rei-leadbar { padding: 0 16px 8px; display: flex; justify-content: flex-end; }
.rei-lead-btn, .rei-link-btn {
	background: none; border: 0; padding: 0; cursor: pointer;
	color: var(--rei-accent); font-weight: 600; font-size: 13.5px; text-decoration: underline;
}

.rei-input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--rei-line); align-items: flex-end; }
.rei-input textarea {
	flex: 1; resize: none; border: 1px solid var(--rei-line); border-radius: 10px;
	padding: 9px 11px; font: inherit; color: var(--rei-fg); background: #fff; min-height: 40px; max-height: 120px;
}
.rei-input textarea:focus { outline: none; border-color: var(--rei-accent); box-shadow: 0 0 0 2px rgba(0,0,0,.05); }
.rei-send {
	background: var(--rei-accent); color: #fff; border: 0; border-radius: 10px;
	padding: 0 16px; height: 40px; font: inherit; font-weight: 600; cursor: pointer;
}
.rei-send:disabled { opacity: .55; cursor: default; }
.rei-full { width: 100%; margin-top: 4px; }

.rei-disclaimer { font-size: 11.5px; color: var(--rei-muted); text-align: center; padding: 0 12px 10px; }

.rei-lead { flex: 1; padding: 14px 16px; background: #fafafa; overflow-y: auto; }
.rei-leading .rei-log, .rei-leading .rei-chips, .rei-leading .rei-leadbar, .rei-leading .rei-input { display: none; }
.rei-lead-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.rei-lead-head .rei-icon-btn { color: var(--rei-muted); }
.rei-lead-head .rei-icon-btn:hover { background: var(--rei-line); }
.rei-lead label { display: block; font-size: 13px; color: var(--rei-muted); margin-bottom: 7px; }
.rei-lead input, .rei-lead select, .rei-lead textarea {
	display: block; width: 100%; margin-top: 2px; padding: 7px 9px;
	border: 1px solid var(--rei-line); border-radius: 8px; font: inherit; font-size: 14px; color: var(--rei-fg); background: #fff;
}
.rei-lead .rei-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.rei-lead-msg { font-size: 13px; color: #991b1b; margin-top: 6px; min-height: 1em; }

@media (max-width: 480px) {
	.rei-chat { bottom: 12px; }
	.rei-pos-right { right: 12px; }
	.rei-pos-left { left: 12px; }
	.rei-open { left: 0; right: 0; bottom: 0; }
	.rei-open .rei-panel { width: 100vw; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; margin: 0; }
	.rei-open .rei-launcher { display: none; }
}
