/* Окно чата на сайте. Всё под #csc-root, чтобы тема сайта не ломала вид. */
#csc-root {
	--csc-accent: #f5a623;
	--csc-ink: #1d2127;
	--csc-muted: #6b7280;
	--csc-bg: #ffffff;
	--csc-soft: #f3f4f6;
	position: fixed;
	bottom: 20px;
	z-index: 2147483000;
	font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
	color: var(--csc-ink);
	text-align: left;
}
#csc-root.csc--right { right: 20px; }
#csc-root.csc--left { left: 20px; }
#csc-root *, #csc-root *::before, #csc-root *::after { box-sizing: border-box; }
#csc-root [hidden] { display: none !important; }
#csc-root button { font: inherit; margin: 0; text-transform: none; letter-spacing: normal; box-shadow: none; min-height: 0; }
#csc-root svg { display: block; width: 100%; height: 100%; }

/* Кнопка */
#csc-root .csc-btn {
	position: relative;
	width: 58px;
	height: 58px;
	padding: 15px;
	border: 0;
	border-radius: 50%;
	background: var(--csc-accent);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
	transition: transform .15s;
}
#csc-root .csc-btn:hover { transform: scale(1.06); }
#csc-root .csc-btn svg path { fill: #fff; }
#csc-root.csc--open .csc-btn svg { display: none; }
#csc-root.csc--open .csc-btn::before,
#csc-root.csc--open .csc-btn::after {
	content: "";
	position: absolute;
	left: 18px;
	top: 28px;
	width: 22px;
	height: 2px;
	background: #fff;
	transform: rotate(45deg);
}
#csc-root.csc--open .csc-btn::after { transform: rotate(-45deg); }
#csc-root .csc-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: #e11d48;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
}

/* Окно */
#csc-root .csc-panel {
	position: absolute;
	bottom: 72px;
	width: 360px;
	height: 520px;
	max-height: calc(100vh - 110px);
	display: flex;
	flex-direction: column;
	background: var(--csc-bg);
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
}
#csc-root.csc--right .csc-panel { right: 0; }
#csc-root.csc--left .csc-panel { left: 0; }

#csc-root .csc-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 14px 14px 18px;
	background: #131518;
	color: #fff;
	border-bottom: 3px solid var(--csc-accent);
}
#csc-root .csc-head-text { flex: 1; min-width: 0; }
#csc-root .csc-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#csc-root .csc-status { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: .8; }
#csc-root .csc-status i { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; }
#csc-root.csc--online .csc-status i { background: #22c55e; }
#csc-root .csc-close {
	width: 32px;
	height: 32px;
	padding: 7px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	cursor: pointer;
}
#csc-root .csc-close:hover { background: rgba(255, 255, 255, .1); }
#csc-root .csc-close path { stroke: #fff; stroke-width: 2; fill: none; }

/* Сообщения */
#csc-root .csc-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px 14px;
	background: var(--csc-soft);
	display: flex;
	flex-direction: column;
	gap: 8px;
}
#csc-root .csc-msg { max-width: 82%; }
#csc-root .csc-msg--op { align-self: flex-start; }
#csc-root .csc-msg--me { align-self: flex-end; }
#csc-root .csc-who { font-size: 11px; color: var(--csc-muted); margin: 0 0 2px 4px; }
#csc-root .csc-text {
	padding: 9px 12px;
	border-radius: 14px;
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}
#csc-root .csc-msg--op .csc-text { background: #fff; border-bottom-left-radius: 4px; }
#csc-root .csc-msg--me .csc-text { background: var(--csc-accent); color: #131518; border-bottom-right-radius: 4px; }
#csc-root .csc-time { font-size: 11px; color: var(--csc-muted); margin: 2px 6px 0; }
#csc-root .csc-msg--me .csc-time { text-align: right; }
#csc-root .csc-note {
	align-self: center;
	max-width: 92%;
	padding: 6px 10px;
	font-size: 12px;
	color: var(--csc-muted);
	text-align: center;
}

/* Анкета с контактом */
#csc-root .csc-contact {
	align-self: stretch;
	padding: 12px;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
}
#csc-root .csc-contact-title { font-weight: 600; margin-bottom: 8px; }
#csc-root .csc-field {
	display: block;
	width: 100%;
	margin: 0 0 8px;
	padding: 8px 10px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	background: #fff;
	color: var(--csc-ink);
	font: inherit;
}
#csc-root .csc-contact-actions { display: flex; align-items: center; gap: 12px; }
#csc-root .csc-btn-small {
	padding: 7px 14px;
	border: 0;
	border-radius: 8px;
	background: var(--csc-accent);
	color: #131518;
	font-weight: 600;
	cursor: pointer;
}
#csc-root .csc-link { padding: 0; border: 0; background: none; color: var(--csc-muted); text-decoration: underline; cursor: pointer; }

/* Поле ввода */
#csc-root .csc-form { padding: 10px 12px 12px; background: #fff; border-top: 1px solid #e5e7eb; margin: 0; }
#csc-root .csc-row { display: flex; align-items: flex-end; gap: 8px; }
#csc-root .csc-input {
	flex: 1;
	min-height: 40px;
	max-height: 120px;
	margin: 0;
	padding: 9px 12px;
	border: 1px solid #d1d5db;
	border-radius: 10px;
	background: #fff;
	color: var(--csc-ink);
	font: inherit;
	resize: none;
	outline: none;
}
#csc-root .csc-input:focus,
#csc-root .csc-field:focus { border-color: var(--csc-accent); }
#csc-root .csc-send {
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	padding: 10px;
	border: 0;
	border-radius: 10px;
	background: var(--csc-accent);
	cursor: pointer;
}
#csc-root .csc-send:disabled { opacity: .5; cursor: default; }
#csc-root .csc-send path { fill: #131518; }
#csc-root .csc-consent {
	display: flex;
	align-items: flex-start;
	gap: 6px;
	margin: 8px 0 0;
	font-size: 12px;
	color: var(--csc-muted);
	cursor: pointer;
}
#csc-root .csc-consent input { margin: 2px 0 0; width: auto; height: auto; }
#csc-root .csc-consent a { color: inherit; text-decoration: underline; }
#csc-root .csc-consent--warn { color: #e11d48; }
#csc-root .csc-error { margin-top: 6px; font-size: 12px; color: #e11d48; }
#csc-root .csc-trap { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

/* Телефон: окно на весь экран */
@media (max-width: 480px) {
	#csc-root { bottom: 14px; }
	#csc-root.csc--right { right: 14px; }
	#csc-root.csc--left { left: 14px; }
	#csc-root .csc-panel {
		position: fixed;
		inset: 0;
		width: auto;
		height: auto;
		max-height: none;
		border-radius: 0;
	}
	#csc-root.csc--open .csc-btn { display: none; }
	#csc-root .csc-input { font-size: 16px; } /* иначе iPhone увеличивает страницу */
}
