.pla-chatbot-widget {
	--pla-burgundy: #7f1e1b;
	--pla-brown: #280901;
	--pla-cream: #fffaf7;
	--pla-border: rgba(40, 9, 1, 0.14);
	--pla-shadow: 0 12px 32px rgba(40, 9, 1, 0.16);
	--pla-radius: 16px;

	position: fixed;
	right: 1.25rem;
	bottom: 1.25rem;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
	color: var(--pla-brown);
}

.pla-chatbot-widget *,
.pla-chatbot-widget *::before,
.pla-chatbot-widget *::after {
	box-sizing: border-box;
}

.pla-chatbot__launcher {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	border: 0;
	border-radius: 999px;
	background: var(--pla-burgundy);
	color: #fffaf7;
	padding: 0.85rem 1.1rem;
	box-shadow: var(--pla-shadow);
	cursor: pointer;
	transition: transform 0.15s ease, background 0.15s ease;
}

.pla-chatbot__launcher:hover,
.pla-chatbot__launcher:focus {
	background: #6d1a17;
	outline: none;
	transform: translateY(-1px);
}

.pla-chatbot__launcher-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.pla-chatbot__launcher-text {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	text-align: left;
	line-height: 1.2;
}

.pla-chatbot__launcher-label {
	font-size: 0.95rem;
	font-weight: 700;
}

.pla-chatbot__launcher-hint {
	margin-top: 0.15rem;
	font-size: 0.75rem;
	font-weight: 400;
	opacity: 0.92;
}

.pla-chatbot__panel {
	position: absolute;
	right: 0;
	bottom: calc(100% + 0.75rem);
	width: min(400px, calc(100vw - 2rem));
	max-height: min(72vh, 640px);
	display: flex;
	flex-direction: column;
	border: 1px solid var(--pla-border);
	border-radius: var(--pla-radius);
	background: var(--pla-cream);
	box-shadow: var(--pla-shadow);
	overflow: hidden;
	transform-origin: bottom right;
	animation: pla-chatbot-open 0.2s ease;
}

.pla-chatbot__panel[hidden] {
	display: none !important;
}

@keyframes pla-chatbot-open {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.98);
	}

	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.pla-chatbot__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.75rem 0.85rem 0.7rem;
	background: var(--pla-burgundy);
}

.pla-chatbot__header-text {
	min-width: 0;
}

.pla-chatbot__title {
	margin: 0 0 0.2rem;
	font-size: 1rem;
	font-weight: 700;
	color: #fffaf7;
}

.pla-chatbot__subtitle {
	margin: 0;
	font-size: 0.78rem;
	line-height: 1.4;
	color: #fffaf7;
}

.pla-chatbot__close {
	flex-shrink: 0;
	width: 1.85rem;
	height: 1.85rem;
	border: 0;
	border-radius: 999px;
	background: rgba(255, 250, 247, 0.14);
	color: #fffaf7;
	font-size: 1.3rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s ease;
}

.pla-chatbot__close:hover,
.pla-chatbot__close:focus {
	background: rgba(255, 250, 247, 0.24);
	outline: none;
}

.pla-chatbot__body {
	display: flex;
	flex-direction: column;
	min-height: 0;
	flex: 1;
	background: #ffffff;
}

.pla-chatbot__messages {
	flex: 1 1 auto;
	min-height: 200px;
	max-height: 300px;
	overflow-y: auto;
	padding: 0.85rem;
	background: #fffdf9;
}

.pla-chatbot__message {
	display: flex;
	margin-bottom: 0.55rem;
}

.pla-chatbot__message--user {
	justify-content: flex-end;
}

.pla-chatbot__message--assistant,
.pla-chatbot__message--system {
	justify-content: flex-start;
}

.pla-chatbot__bubble {
	max-width: 88%;
	padding: 0.55rem 0.75rem;
	border-radius: 12px;
	line-height: 1.45;
	font-size: 0.88rem;
	white-space: pre-wrap;
	word-break: break-word;
}

.pla-chatbot__message--user .pla-chatbot__bubble {
	background: var(--pla-burgundy);
	color: #fffaf7;
	border-bottom-right-radius: 4px;
}

.pla-chatbot__message--assistant .pla-chatbot__bubble {
	background: var(--pla-cream);
	color: var(--pla-brown);
	border: 1px solid var(--pla-border);
	border-bottom-left-radius: 4px;
}

.pla-chatbot__message--system .pla-chatbot__bubble {
	background: #fff1e8;
	color: var(--pla-brown);
	border-bottom-left-radius: 4px;
}

.pla-chatbot__starters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	padding: 0.5rem 0.85rem 0.45rem;
	background: #ffffff;
}

.pla-chatbot__quick {
	border: 1px solid var(--pla-burgundy);
	background: var(--pla-cream);
	color: var(--pla-burgundy);
	border-radius: 999px;
	padding: 0.28rem 0.62rem;
	font-size: 0.74rem;
	font-weight: 500;
	line-height: 1.3;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.pla-chatbot__quick:hover,
.pla-chatbot__quick:focus {
	background: var(--pla-burgundy);
	color: #fffaf7;
	outline: none;
}

.pla-chatbot__followup {
	padding: 0.35rem 0.85rem 0.55rem;
	background: #ffffff;
}

.pla-chatbot__followup-prompt {
	margin: 0 0 0.4rem;
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--pla-brown);
}

.pla-chatbot__followup-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
}

.pla-chatbot__followup-chip {
	border: 1px solid var(--pla-burgundy);
	background: var(--pla-cream);
	color: var(--pla-burgundy);
	border-radius: 999px;
	padding: 0.28rem 0.62rem;
	font-size: 0.74rem;
	font-weight: 500;
	line-height: 1.3;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.pla-chatbot__followup-chip:hover,
.pla-chatbot__followup-chip:focus {
	background: var(--pla-burgundy);
	color: #fffaf7;
	outline: none;
}

.pla-chatbot__compose {
	border-top: 1px solid var(--pla-border);
	background: #ffffff;
}

.pla-chatbot__rx-status {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.45rem 0.85rem 0;
	font-size: 0.78rem;
	color: var(--pla-brown);
}

.pla-chatbot__rx-status[hidden] {
	display: none !important;
}

.pla-chatbot__rx-filename {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pla-chatbot__rx-read {
	flex-shrink: 0;
	border: 1px solid var(--pla-burgundy);
	background: #ffffff;
	color: var(--pla-burgundy);
	border-radius: 999px;
	padding: 0.25rem 0.65rem;
	font-size: 0.74rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.pla-chatbot__rx-read:hover,
.pla-chatbot__rx-read:focus {
	background: var(--pla-burgundy);
	color: #fffaf7;
	outline: none;
}

.pla-chatbot__rx-read:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.pla-chatbot__form {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.55rem 0.85rem 0.75rem;
}

.pla-chatbot__file {
	display: none;
}

.pla-chatbot__upload {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.15rem;
	height: 2.15rem;
	border: 0;
	border-radius: 999px;
	background: var(--pla-burgundy);
	color: #fffaf7;
	cursor: pointer;
	transition: background 0.15s ease, transform 0.15s ease;
}

.pla-chatbot__upload svg {
	display: block;
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.pla-chatbot__upload:hover,
.pla-chatbot__upload:focus {
	background: #6d1a17;
	outline: none;
	transform: translateY(-1px);
}

.pla-chatbot__upload:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.pla-chatbot__input {
	flex: 1;
	min-width: 0;
	border: 1px solid var(--pla-border);
	border-radius: 10px;
	padding: 0.55rem 0.7rem;
	font-size: 0.88rem;
	color: var(--pla-brown);
	background: var(--pla-cream);
}

.pla-chatbot__input:focus {
	border-color: var(--pla-burgundy);
	outline: none;
	box-shadow: 0 0 0 3px rgba(127, 30, 27, 0.1);
}

.pla-chatbot__send {
	flex-shrink: 0;
	border: 0;
	border-radius: 10px;
	background: var(--pla-burgundy);
	color: #fffaf7;
	padding: 0.55rem 0.85rem;
	font-size: 0.88rem;
	font-weight: 600;
	cursor: pointer;
}

.pla-chatbot__send:disabled {
	opacity: 0.65;
	cursor: not-allowed;
}

.pla-chatbot__send:hover:not(:disabled),
.pla-chatbot__send:focus:not(:disabled) {
	background: #6d1a17;
	outline: none;
}

@media (max-width: 600px) {
	.pla-chatbot-widget {
		right: 0.75rem;
		bottom: 0.75rem;
		left: 0.75rem;
	}

	.pla-chatbot__launcher {
		margin-left: auto;
	}

	.pla-chatbot__launcher-hint {
		display: none;
	}

	.pla-chatbot__panel {
		position: fixed;
		right: 0.75rem;
		left: 0.75rem;
		bottom: 5.25rem;
		width: auto;
		max-height: calc(100vh - 6rem);
	}

	.pla-chatbot__messages {
		min-height: 160px;
		max-height: none;
		flex: 1 1 auto;
	}

	.pla-chatbot__bubble {
		max-width: 92%;
	}

	.pla-chatbot__starters {
		padding-top: 0.4rem;
		padding-bottom: 0.35rem;
	}
}

@media (max-width: 380px) {
	.pla-chatbot__launcher-text {
		display: none;
	}

	.pla-chatbot__launcher {
		width: 3.5rem;
		height: 3.5rem;
		padding: 0;
		justify-content: center;
		border-radius: 999px;
	}

	.pla-chatbot__send {
		padding-left: 0.7rem;
		padding-right: 0.7rem;
	}
}
