@import url('https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;500;600&family=Fira+Code:wght@400;500&display=swap');

.support-widget {
	--support-primary: #18181b;
	--support-primary-hover: #27272a;
	--support-border: #e4e4e7;
	--support-muted: #71717a;
	--support-surface: #ffffff;
	--support-canvas: #f4f4f5;
	--support-launcher-color: #18181b;
	--support-launcher-foreground: #ffffff;
}

body.support-standalone-page {
	margin: 0;
	min-height: 100dvh;
	background: #fafafa;
	font-family: "Fira Sans", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
	color: #18181b;
}

body.support-standalone-page > header,
body.support-standalone-page > footer {
	display: none;
}

body.support-standalone-page .support-web-page {
	min-height: 100dvh;
}

.support-widget__launcher {
	position: fixed;
	right: 20px;
	bottom: 24px;
	z-index: 1001;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 1px solid var(--support-launcher-color);
	border-radius: 50%;
	background: var(--support-launcher-color);
	box-shadow: 0 8px 24px rgba(9, 9, 11, 0.2);
	color: #ffffff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	transition: filter 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.support-widget__launcher:hover {
	background: var(--support-launcher-color);
	filter: brightness(0.9);
	box-shadow: 0 10px 28px rgba(9, 9, 11, 0.26);
	transform: translateY(-2px);
}

.support-widget__launcher:focus-visible,
.support-icon-button:focus-visible,
.support-tool-button:focus-visible,
.support-primary-button:focus-visible {
	outline: 3px solid rgba(37, 99, 235, 0.28);
	outline-offset: 2px;
}

.support-widget__panel {
	position: fixed;
	right: 24px;
	bottom: 84px;
	z-index: 1000;
	display: flex;
	flex-direction: column;
	width: 380px;
	height: min(620px, calc(100dvh - 108px));
	min-height: 420px;
	border: 1px solid var(--support-border);
	border-radius: 8px;
	background: var(--support-surface);
	box-shadow: 0 18px 48px rgba(9, 9, 11, 0.18);
	overflow: hidden;
	box-sizing: border-box;
	transform-origin: right bottom;
	animation: support-panel-in 180ms ease-out;
}

.support-widget__panel[hidden] {
	display: none;
}

.support-widget__header {
	flex: 0 0 52px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-width: 0;
	padding: 0 10px 0 14px;
	border-bottom: 1px solid var(--support-border);
	background: #ffffff;
	box-sizing: border-box;
}

.support-widget__title,
.support-widget__header-actions {
	display: flex;
	align-items: center;
}

.support-widget__title {
	gap: 9px;
	min-width: 0;
}

.support-widget__title h1 {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: 0;
}

.support-widget__title span:not(.support-widget__status-dot) {
	display: block;
	margin-top: 2px;
	font-size: 11px;
	line-height: 1.2;
	color: var(--support-muted);
}

.support-widget__status-dot {
	flex: 0 0 auto;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #16a34a;
	box-shadow: 0 0 0 3px #dcfce7;
}

.support-widget__header-actions {
	gap: 2px;
}

.support-icon-button,
.support-tool-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: #52525b;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	transition: background 160ms ease, color 160ms ease;
}

.support-icon-button:hover,
.support-tool-button:hover {
	background: #f4f4f5;
	color: #18181b;
}

.support-tool-button:disabled {
	cursor: not-allowed;
	opacity: 0.45;
}

.support-message-list {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-height: 0;
	padding: 14px;
	background: var(--support-canvas);
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-gutter: stable;
	box-sizing: border-box;
}

.support-prechat {
	position: absolute;
	inset: 52px 0 0;
	z-index: 30;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(244, 244, 245, 0.96);
}

.support-prechat[hidden] {
	display: none;
}

.support-prechat__card {
	width: min(100%, 300px);
	padding: 20px;
	border: 1px solid var(--support-border);
	border-radius: 8px;
	background: #ffffff;
	box-shadow: 0 12px 30px rgba(9, 9, 11, 0.12);
}

.support-prechat__card h2 {
	margin: 0;
	font-size: 17px;
	line-height: 1.3;
}

.support-prechat__card p {
	margin: 8px 0 16px;
	font-size: 12px;
	line-height: 1.5;
	color: var(--support-muted);
}

.support-prechat__field {
	display: block;
	margin-top: 12px;
}

.support-prechat__field span {
	display: block;
	margin-bottom: 5px;
	font-size: 12px;
	font-weight: 600;
}

.support-prechat__field input {
	display: block;
	width: 100%;
	height: 36px;
	padding: 0 10px;
	border: 1px solid #d4d4d8;
	border-radius: 6px;
	background: #ffffff;
	font: inherit;
	font-size: 13px;
	box-sizing: border-box;
}

.support-prechat__field input:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.support-prechat__feedback {
	min-height: 18px;
	margin: 10px 0 8px;
	font-size: 12px;
	line-height: 1.4;
	color: #dc2626;
}

.support-prechat .support-primary-button {
	width: 100%;
}

.support-message {
	align-self: flex-start;
	width: fit-content;
	max-width: 82%;
	padding: 9px 11px;
	border: 1px solid var(--support-border);
	border-radius: 8px;
	background: #ffffff;
	box-sizing: border-box;
}

.support-message.is-self {
	align-self: flex-end;
	border-color: #bfdbfe;
	background: #eff6ff;
}

.support-message.is-agent {
	align-self: flex-start;
	background: #ffffff;
}

.support-message__meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 5px;
}

.support-message__author {
	font-size: 11px;
	font-weight: 600;
}

.support-message__time,
.support-composer__tips,
.support-empty {
	font-size: 11px;
	line-height: 1.4;
	color: var(--support-muted);
}

.support-message__content {
	margin: 0;
	font-size: 13px;
	line-height: 1.55;
	color: #18181b;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.support-message__image-link {
	display: block;
	max-width: min(260px, 100%);
	line-height: 0;
}

.support-message__image {
	display: block;
	max-width: 100%;
	max-height: 220px;
	border-radius: 6px;
	object-fit: contain;
	background: #ffffff;
}

.support-message__file {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	max-width: 100%;
	color: #18181b;
	text-decoration: none;
}

.support-message__file > i {
	flex: 0 0 auto;
	font-size: 20px;
	color: #2563eb;
}

.support-message__file > span {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.support-message__file strong {
	font-size: 13px;
	font-weight: 600;
	overflow-wrap: anywhere;
}

.support-message__file small {
	margin-top: 2px;
	font-size: 11px;
	color: var(--support-muted);
}

.support-empty {
	margin: auto 0;
	padding: 18px;
	text-align: center;
}

.support-composer {
	position: relative;
	flex: 0 0 auto;
	padding: 10px;
	border-top: 1px solid var(--support-border);
	background: #ffffff;
}

.support-field {
	display: block;
}

.support-field textarea {
	display: block;
	width: 100%;
	height: 68px;
	min-height: 68px;
	max-height: 68px;
	padding: 9px 10px;
	border: 1px solid #d4d4d8;
	border-radius: 6px;
	background: #ffffff;
	font: inherit;
	font-size: 13px;
	line-height: 1.5;
	color: #18181b;
	resize: none;
	box-sizing: border-box;
	transition: border-color 160ms ease, box-shadow 160ms ease;
}

.support-field textarea:focus {
	outline: none;
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.support-composer__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 8px;
}

.support-composer__tools {
	position: relative;
	display: flex;
	align-items: center;
	gap: 2px;
}

.support-primary-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: 32px;
	padding: 0 12px;
	border: 1px solid var(--support-launcher-color);
	border-radius: 6px;
	background: var(--support-launcher-color);
	color: #ffffff;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: filter 160ms ease;
}

.support-primary-button:hover {
	border-color: var(--support-launcher-color);
	background: var(--support-launcher-color);
	filter: brightness(0.9);
}

.support-composer__tips {
	min-height: 15px;
	margin-top: 6px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.support-emoji-picker {
	position: absolute;
	left: 0;
	bottom: calc(100% + 8px);
	z-index: 20;
	display: grid;
	grid-template-columns: repeat(6, 34px);
	gap: 3px;
	width: max-content;
	max-width: calc(100vw - 48px);
	padding: 8px;
	border: 1px solid #d4d4d8;
	border-radius: 8px;
	background: #ffffff;
	box-shadow: 0 12px 30px rgba(9, 9, 11, 0.16);
}

.support-emoji-picker[hidden] {
	display: none;
}

.support-emoji-picker__item {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 5px;
	background: transparent;
	font-size: 19px;
	line-height: 1;
	cursor: pointer;
}

.support-emoji-picker__item:hover,
.support-emoji-picker__item:focus-visible {
	outline: none;
	background: #f4f4f5;
}

.support-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@keyframes support-panel-in {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@media (max-width: 520px) {
	.support-widget__launcher {
		right: 12px;
		bottom: 12px;
	}

	.support-widget__panel {
		right: 12px;
		bottom: 72px;
		width: calc(100vw - 24px);
		height: calc(100dvh - 84px);
		min-height: 360px;
	}

	.support-message {
		max-width: 88%;
	}

	.support-emoji-picker {
		grid-template-columns: repeat(6, 32px);
		max-width: calc(100vw - 44px);
	}

	.support-emoji-picker__item {
		width: 32px;
		height: 32px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.support-widget__panel {
		animation: none;
	}

	.support-widget__launcher {
		transition: none;
	}
}
