.zcrm-chat-widget,
.zcrm-chat-widget * {
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.zcrm-chat-widget {
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: 99999;
	--zcrm-chat-accent: #6f35e8;
	--zcrm-chat-accent-strong: #5520c7;
	--zcrm-chat-accent-soft: color-mix(in srgb, var(--zcrm-chat-accent) 12%, #fff);
	--zcrm-chat-border: #e7ecf4;
	--zcrm-chat-text: #151827;
	--zcrm-chat-muted: #667085;
	color: var(--zcrm-chat-text);
}

.zcrm-chat-toggle {
	display: inline-flex;
	align-items: center;
	min-height: 48px;
	padding: 10px 18px;
	color: #fff;
	border: 0;
	border-radius: 999px;
	background: var(--zcrm-chat-accent);
	cursor: pointer;
}

.zcrm-chat-toggle strong {
	font-size: 14px;
	line-height: 1;
}

.zcrm-chat-panel {
	position: absolute;
	right: 0;
	bottom: 70px;
	display: flex;
	flex-direction: column;
	width: min(380px, calc(100vw - 28px));
	max-height: min(620px, calc(100vh - 110px));
	overflow: hidden;
	border: 1px solid var(--zcrm-chat-border);
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.zcrm-chat-panel[hidden] {
	display: none;
}

.zcrm-chat-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 16px;
	color: var(--zcrm-chat-header-text);
	background: var(--zcrm-chat-header-bg);
	border-bottom: 1px solid var(--zcrm-chat-border);
}

.zcrm-chat-header strong,
.zcrm-chat-header span {
	display: block;
}

.zcrm-chat-header strong {
	font-size: 16px;
	line-height: 1.3;
}

.zcrm-chat-header span {
	margin-top: 4px;
	color: var(--zcrm-chat-header-text);
	font-size: 12px;
	line-height: 1.45;
	opacity: 0.72;
}

.zcrm-chat-widget .zcrm-chat-header button[data-zcrm-chat-close] {
	display: inline-flex !important;
	flex: 0 0 30px;
	align-items: center !important;
	justify-content: center !important;
	width: 30px;
	height: 30px;
	padding: 0 !important;
	color: var(--zcrm-chat-header-text);
	font-size: 22px;
	line-height: 1 !important;
	text-align: center;
	border: 1px solid var(--zcrm-chat-border);
	border-radius: 8px;
	background: transparent;
	cursor: pointer;
}

.zcrm-chat-body {
	min-height: 360px;
	overflow: auto;
	background: #fff;
}

.zcrm-chat-start {
	padding: 16px;
	background: transparent;
}

.zcrm-chat-tabs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	margin-bottom: 14px;
}

.zcrm-chat-tabs button {
	min-height: 38px;
	color: #475467;
	font-weight: 800;
	border: 1px solid var(--zcrm-chat-border);
	border-radius: 8px;
	background: #fff;
	cursor: pointer;
}

.zcrm-chat-tabs button.is-active {
	color: #fff;
	border-color: var(--zcrm-chat-accent);
	background: var(--zcrm-chat-accent);
}

.zcrm-chat-form {
	display: none;
	gap: 12px;
}

.zcrm-chat-form.is-active {
	display: grid;
}

.zcrm-chat-form label,
.zcrm-chat-form span {
	display: block;
}

.zcrm-chat-form span {
	margin-bottom: 6px;
	color: #475467;
	font-size: 12px;
	font-weight: 800;
}

.zcrm-chat-form input,
.zcrm-chat-compose input {
	width: 100%;
	min-height: 42px;
	padding: 8px 11px;
	color: var(--zcrm-chat-text);
	border: 1px solid var(--zcrm-chat-border);
	border-radius: 8px;
	background: #fff;
	outline: none;
}

.zcrm-chat-compose input {
	border-radius: 999px;
}

.zcrm-chat-form input:focus,
.zcrm-chat-compose input:focus {
	border-color: var(--zcrm-chat-accent);
}

.zcrm-chat-form button,
.zcrm-chat-compose button {
	min-height: 42px;
	padding: 8px 14px;
	color: #fff;
	font-weight: 800;
	border: 0;
	border-radius: 8px;
	background: var(--zcrm-chat-accent);
	cursor: pointer;
}

.zcrm-chat-widget .zcrm-chat-form[data-zcrm-chat-form="guest"] button[type="submit"],
.zcrm-chat-widget .zcrm-chat-form[data-zcrm-chat-form="guest"] button[type="submit"]:hover,
.zcrm-chat-widget .zcrm-chat-form[data-zcrm-chat-form="guest"] button[type="submit"]:focus-visible {
	color: #fff !important;
	background: #000 !important;
}

.zcrm-chat-room {
	display: flex;
	flex-direction: column;
	min-height: 430px;
}

.zcrm-chat-room[hidden] {
	display: none;
}

.zcrm-chat-messages {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 10px;
	min-height: 330px;
	max-height: min(410px, calc(100vh - 250px));
	padding: 16px;
	overflow: auto;
}

.zcrm-chat-message {
	max-width: 84%;
	padding: 10px 12px;
	border-radius: 8px;
	background: #fff;
	border: 1px solid var(--zcrm-chat-border);
}

.zcrm-chat-message.is-visitor {
	align-self: flex-end;
	color: #fff;
	border-color: var(--zcrm-chat-accent);
	background: var(--zcrm-chat-accent);
}

.zcrm-chat-message.is-agent {
	align-self: flex-start;
	color: #087443;
	border-color: #bfead2;
	background: #e8f7ef;
}

.zcrm-chat-message.is-system {
	align-self: center;
	max-width: 100%;
	color: var(--zcrm-chat-muted);
	font-size: 12px;
	text-align: center;
	border: 0;
	background: transparent;
}

.zcrm-chat-message.is-system strong {
	display: none;
}

.zcrm-chat-message strong,
.zcrm-chat-message span {
	display: block;
}

.zcrm-chat-message strong {
	margin-bottom: 3px;
	font-size: 12px;
	line-height: 1.3;
}

.zcrm-chat-message span {
	font-size: 13px;
	line-height: 1.5;
	white-space: pre-wrap;
}

.zcrm-chat-compose {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--zcrm-chat-border);
	background: #fff;
}

.zcrm-chat-compose[hidden] {
	display: none;
}

.zcrm-chat-ended {
	display: grid;
	gap: 10px;
	padding: 16px;
	border-top: 1px solid var(--zcrm-chat-border);
	background: #fff;
}

.zcrm-chat-ended[hidden] {
	display: none;
}

.zcrm-chat-ended span {
	color: var(--zcrm-chat-muted);
	font-size: 13px;
	line-height: 1.5;
}

.zcrm-chat-ended button {
	width: fit-content;
	min-height: 38px;
	padding: 8px 14px;
	color: #fff;
	font-weight: 800;
	border: 0;
	border-radius: 8px;
	background: var(--zcrm-chat-accent);
	cursor: pointer;
}

.zcrm-chat-status {
	min-height: 28px;
	padding: 7px 12px;
	color: var(--zcrm-chat-muted);
	font-size: 12px;
	border-top: 1px solid var(--zcrm-chat-border);
	background: #fff;
}

.zcrm-chat-status:empty {
	display: none;
}

.zcrm-chat-status.is-error {
	color: #b42318;
	background: #fff0ee;
}

.zcrm-order-thread,
.zcrm-order-thread * {
	box-sizing: border-box;
}

.zcrm-order-thread {
	margin-top: 28px;
	padding: 18px;
	color: #151827;
	border: 1px solid #e7ecf4;
	border-radius: 0;
	background: #fff;
}

.zcrm-order-thread h2 {
	margin: 0;
	font-size: 20px;
	line-height: 1.3;
}

.zcrm-order-thread-meta {
	margin: 6px 0 14px;
	color: #667085;
	font-size: 13px;
	line-height: 1.5;
}

.zcrm-order-message-status {
	margin-bottom: 12px;
	padding: 10px 12px;
	color: #087443;
	border: 1px solid #bfead2;
	border-radius: 8px;
	background: #e8f7ef;
}

.zcrm-order-message-status.is-error {
	color: #b42318;
	border-color: #ffd0ca;
	background: #fff0ee;
}

.zcrm-order-message-status.is-muted {
	color: #475467;
	border-color: #e7ecf4;
	background: #f7f8fb;
}

.zcrm-order-messages {
	display: grid;
	gap: 10px;
	margin-bottom: 14px;
	padding: 14px;
	border-radius: 0;
	background: #f7f8fb;
}

.zcrm-order-message {
	max-width: 78%;
	padding: 10px 12px;
	border: 1px solid #e7ecf4;
	border-radius: 8px;
	background: #fff;
}

.zcrm-order-message.is-visitor {
	justify-self: end;
	color: #fff;
	border-color: var(--zcrm-chat-accent);
	background: var(--zcrm-chat-accent);
}

.zcrm-order-message.is-agent {
	justify-self: start;
	color: #087443;
	border-color: #bfead2;
	background: #e8f7ef;
}

.zcrm-order-message.is-system {
	justify-self: center;
	max-width: 100%;
	color: #667085;
	font-size: 12px;
	text-align: center;
	border: 0;
	background: transparent;
}

.zcrm-order-message strong,
.zcrm-order-message span,
.zcrm-order-message time,
.zcrm-order-message-form span {
	display: block;
}

.zcrm-order-message-meta {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-bottom: 4px;
}

.zcrm-order-message strong {
	font-size: 12px;
	line-height: 1.3;
}

.zcrm-order-message time {
	color: #667085;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.3;
	white-space: nowrap;
}

.zcrm-order-message.is-visitor time {
	color: rgba(255, 255, 255, 0.78);
}

.zcrm-order-message.is-agent time {
	color: #12a25f;
}

.zcrm-order-message span {
	font-size: 13px;
	line-height: 1.55;
	white-space: pre-wrap;
}

.zcrm-order-message-form {
	display: grid;
	gap: 10px;
}

.zcrm-order-message-form span {
	margin-bottom: 6px;
	color: #475467;
	font-size: 12px;
	font-weight: 800;
}

.zcrm-order-message-form textarea {
	width: 100%;
	border: 1px solid #e7ecf4;
	border-radius: 8px;
	background: #fff;
}

.zcrm-order-message-form.is-disabled textarea,
.zcrm-order-message-form textarea:disabled {
	color: #667085;
	border-color: #e4e7ec;
	background: #f2f4f7;
	cursor: not-allowed;
}

.zcrm-order-message-form textarea:focus {
	border-color: var(--zcrm-chat-accent);
	outline: none;
}

.zcrm-order-message-form button {
	justify-self: end;
	width: fit-content;
	min-height: 42px;
	padding: 8px 14px;
	color: #fff;
	font-weight: 800;
	border: 0;
	border-radius: 8px;
	background: var(--zcrm-chat-accent);
	cursor: pointer;
}

.zcrm-order-message-form button:disabled {
	color: #98a2b3;
	background: #e4e7ec;
	cursor: not-allowed;
}

@media (max-width: 520px) {
	.zcrm-chat-widget {
		right: 14px;
		bottom: 14px;
	}

	.zcrm-chat-panel {
		right: -6px;
		bottom: 64px;
		width: calc(100vw - 28px);
	}
}
