.wpai-widget {
	position: fixed;
	z-index: 99990;
	bottom: 20px;
	font-family: inherit;
	font-size: 16px;
	line-height: 1.45;
}

.wpai-widget [hidden] {
	display: none !important;
}

.wpai-widget--right {
	right: 20px;
}

.wpai-widget--left {
	left: 20px;
}

.wpai-launcher,
.wpai-composer button,
.wpai-panel__close,
.wpai-panel__new {
	font: inherit;
	cursor: pointer;
}

.wpai-launcher {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	border: 0;
	border-radius: 999px;
	padding: 10px 18px 10px 10px;
	background: var(--wpai-accent, #17324d);
	color: var(--wpai-ink, #fff);
	box-shadow: 0 10px 24px rgba(16, 24, 40, 0.18);
}

.wpai-widget .wpai-panel {
	display: none;
}

.wpai-widget .wpai-panel.is-open {
	display: flex;
	flex-direction: column;
	width: min(380px, calc(100vw - 32px));
	height: min(560px, calc(100vh - 110px));
	margin-bottom: 12px;
	overflow: hidden;
	background: #fff;
	color: #1d2430;
	border-radius: 18px;
	box-shadow: 0 16px 40px rgba(16, 24, 40, 0.2);
}

.wpai-panel__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	background: var(--wpai-accent, #17324d);
	color: var(--wpai-ink, #fff);
}

.wpai-launcher:not(:has(.wpai-logo)) {
	padding-left: 18px;
}

.wpai-logo {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	object-fit: cover;
	background: #fff;
}

.wpai-logo--initials {
	color: var(--wpai-accent, #17324d);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.wpai-panel__brand {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.wpai-panel__bar strong {
	min-width: 0;
	overflow: hidden;
	font-size: 15px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpai-panel__actions {
	display: flex;
	flex: none;
	align-items: center;
	gap: 2px;
}

.wpai-panel__new,
.wpai-panel__close {
	border: 0;
	background: transparent;
	color: inherit;
}

.wpai-panel__new {
	border-radius: 8px;
	padding: 4px 8px;
	font-size: 13px;
	line-height: 1.2;
}

.wpai-panel__close {
	width: 32px;
	font-size: 24px;
	line-height: 1;
}

.wpai-panel__new:hover,
.wpai-panel__close:hover,
.wpai-panel__new[aria-pressed="true"] {
	background: rgba(255, 255, 255, 0.14);
}

.wpai-contact,
.wpai-history {
	flex: 1;
	overflow: auto;
	padding: 18px 16px;
	background: #f6f7f9;
}

.wpai-contact__form {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.wpai-contact__lead {
	margin: 0 0 4px;
	padding: 12px 14px;
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

.wpai-contact__form label {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 13px;
	font-weight: 600;
}

.wpai-contact__form input {
	border: 1px solid #d7dbe2;
	border-radius: 12px;
	padding: 10px 12px;
	background: #fff;
	font: inherit;
	font-weight: 400;
}

.wpai-contact__form input:focus,
.wpai-composer textarea:focus {
	border-color: var(--wpai-accent, #17324d);
	outline: 2px solid rgba(23, 50, 77, 0.15);
}

.wpai-contact__form button,
.wpai-retry,
.wpai-history__back {
	border: 0;
	border-radius: 12px;
	padding: 11px 14px;
	background: var(--wpai-accent, #17324d);
	color: var(--wpai-ink, #fff);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.wpai-contact__form small {
	color: #667085;
	font-size: 12px;
}

.wpai-contact__error {
	margin: 0;
	color: #b42318;
	font-size: 13px;
}

.wpai-history__title {
	margin: 0 0 10px;
	font-weight: 700;
}

.wpai-history__empty {
	margin: 0 0 12px;
	color: #667085;
	font-size: 14px;
}

.wpai-history__row {
	display: flex;
	align-items: stretch;
	gap: 6px;
	margin: 0 0 8px;
}

.wpai-history__item {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	margin: 0;
	padding: 10px 12px;
	border: 1px solid #e6e8ee;
	border-radius: 12px;
	background: #fff;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.wpai-history__item:hover {
	border-color: var(--wpai-accent, #17324d);
}

.wpai-history__item strong {
	overflow: hidden;
	font-size: 14px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpai-history__item span {
	color: #667085;
	font-size: 12px;
}

.wpai-history__delete {
	flex: none;
	border: 1px solid #e6e8ee;
	border-radius: 12px;
	padding: 0 10px;
	background: #fff;
	color: #b42318;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.wpai-history__delete:hover {
	border-color: #b42318;
}

.wpai-history__back {
	width: 100%;
	margin-top: 4px;
}

.wpai-bubble--error p {
	background: #fef3f2;
	color: #7a271a;
}

.wpai-retry {
	margin-top: 6px;
	padding: 6px 12px;
	font-size: 13px;
}

.wpai-composer button:disabled,
.wpai-composer textarea:disabled {
	opacity: 0.6;
	cursor: default;
}

.wpai-log {
	flex: 1;
	overflow: auto;
	padding: 14px;
	background: #f6f7f9;
}

.wpai-bubble {
	max-width: 88%;
	margin: 0 0 10px;
}

.wpai-bubble p {
	margin: 0;
	padding: 10px 12px;
	border-radius: 16px;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.wpai-bubble--assistant {
	margin-right: auto;
}

.wpai-bubble--assistant p {
	background: #fff;
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

.wpai-bubble--user {
	margin-left: auto;
}

.wpai-bubble--user p {
	background: var(--wpai-accent, #17324d);
	color: var(--wpai-ink, #fff);
}

.wpai-bubble ul {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 8px 0 0;
	padding: 0;
	list-style: none;
}

.wpai-bubble .wpai-link {
	display: inline-block;
	max-width: 100%;
	margin: 4px 4px 0 0;
	padding: 6px 12px;
	border-radius: 999px;
	background: #e7eef6;
	color: #17324d;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
}

.wpai-bubble ul .wpai-link {
	margin: 0;
}

.wpai-bubble--user .wpai-link {
	background: rgba(255, 255, 255, 0.18);
	color: inherit;
}

.wpai-bubble .wpai-link:hover {
	background: #d7e4f2;
}

.wpai-bubble--quote {
	max-width: 100%;
}

.wpai-quote {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 8px;
	padding: 12px;
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

.wpai-bubble--quote .wpai-quote p,
.wpai-bubble--quote .wpai-quote__sent {
	margin: 0;
	padding: 0;
	background: transparent;
	box-shadow: none;
	white-space: normal;
}

.wpai-quote__service {
	color: #667085;
	font-size: 13px;
}

.wpai-bubble--assistant.wpai-bubble--quote .wpai-quote__sent {
	margin: 8px 0 0;
	padding: 10px 12px;
	border-radius: 12px;
	background: #ecfdf3;
	color: #067647;
	font-weight: 600;
	box-shadow: none;
}

.wpai-quote label {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 13px;
	font-weight: 600;
}

.wpai-quote input,
.wpai-quote textarea {
	border: 1px solid #d7dbe2;
	border-radius: 12px;
	padding: 10px 12px;
	background: #fff;
	font: inherit;
	font-weight: 400;
}

.wpai-quote textarea {
	min-height: 72px;
	resize: vertical;
}

.wpai-quote input:focus,
.wpai-quote textarea:focus {
	border-color: var(--wpai-accent, #17324d);
	outline: 2px solid rgba(23, 50, 77, 0.15);
}

.wpai-quote__phone {
	display: flex;
	align-items: center;
	gap: 8px;
}

.wpai-quote__phone > span {
	color: #667085;
	font-weight: 600;
}

.wpai-quote__phone input {
	flex: 1;
	min-width: 0;
}

.wpai-quote button {
	border: 0;
	border-radius: 12px;
	padding: 11px 14px;
	background: var(--wpai-accent, #17324d);
	color: var(--wpai-ink, #fff);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.wpai-quote button:disabled {
	opacity: 0.6;
	cursor: default;
}

.wpai-quote__error {
	color: #b42318;
	font-size: 13px;
}

.wpai-hp {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.wpai-typing p {
	display: flex;
	align-items: center;
	gap: 5px;
	min-width: 54px;
	min-height: 22px;
}

.wpai-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #8b93a1;
	animation: wpai-dot 1.05s infinite ease-in-out;
}

.wpai-typing span:nth-child(2) {
	animation-delay: 0.15s;
}

.wpai-typing span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes wpai-dot {
	0%,
	80%,
	100% {
		transform: translateY(0);
		opacity: 0.35;
	}

	40% {
		transform: translateY(-4px);
		opacity: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wpai-typing span {
		animation: none;
		opacity: 0.7;
	}
}

.wpai-composer {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid #e6e8ee;
	background: #fff;
}

.wpai-composer textarea {
	flex: 1;
	min-height: 46px;
	max-height: 120px;
	resize: none;
	border: 1px solid #d7dbe2;
	border-radius: 12px;
	padding: 10px 12px;
	font: inherit;
}

.wpai-composer button {
	border: 0;
	border-radius: 12px;
	padding: 0 14px;
	background: var(--wpai-accent, #17324d);
	color: var(--wpai-ink, #fff);
}

.wpai-widget .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}
