/* ── Переменные ─────────────────────────────────────── */
:root {
	--kdc-accent:       #1a1a2e;
	--kdc-accent2:      #16213e;
	--kdc-gold:         #c9a84c;
	--kdc-gold-light:   #e8c870;
	--kdc-white:        #ffffff;
	--kdc-bg:           #f5f6fa;
	--kdc-border:       rgba(0,0,0,.07);
	--kdc-shadow:       0 24px 72px rgba(26,26,46,.18);
	--kdc-radius: 12px;
	--kdc-font:         'DM Sans', system-ui, sans-serif;
}
.kdc-chat-finished {
	padding: 8px 4px 2px;
}
.kdc-lead-form {
	padding: 10px;
	border-top: 1px solid #eee;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.kdc-lead-form input {
	padding: 10px;
	border-radius: 10px;
	border: 1px solid #ddd;
	font-size: 14px;
}

.kdc-lead-form button {
	background: #2b7cff;
	color: #fff;
	border: none;
	border-radius: 10px;
	padding: 10px;
	cursor: pointer;
}

.kdc-lead-error {
	color: red;
	font-size: 12px;
}
.kdc-chat-finished-text {
	font-size: 13px;
	line-height: 1.45;
	color: #4b5563;
	margin-bottom: 10px;
	text-align: center;
}

.kdc-chat-reset-btn {
	width: 100%;
	border: none;
	border-radius: 14px;
	padding: 12px 14px;
	background: linear-gradient(135deg, var(--kdc-accent) 0%, #0f3460 100%);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: transform .18s ease, opacity .18s ease;
}

.kdc-chat-reset-btn:hover {
	transform: translateY(-1px);
	opacity: .96;
}
/* ── Шрифт ──────────────────────────────────────────── */
 

/* ── Виджет-обёртка ─────────────────────────────────── */
.kdc-chat-widget {
	position: fixed;
	right: 24px;
	bottom: 182px;
	z-index: 99999;
	/* width: 43px; */
}

/* ── Кнопка-триггер ─────────────────────────────────── */
.kdc-chat-toggle {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 5px 12px 5px 6px;
	border-radius: 999px;
	cursor: pointer;
	background: #ffffff;
	color: #000000;
	box-shadow: 0 6px 15px rgb(26 26 46 / 19%);
	transition: transform .22s ease, box-shadow .22s ease;
	border: 2px solid #19bc56;
}
.kdc-chat-toggle:hover {
	transform: translateY(-3px);
	box-shadow: 0 18px 50px rgba(26,26,46,.38);
}

.kdc-toggle-avatar {
	position: relative;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	overflow: visible;
	flex-shrink: 0;
	background: #fff;
	border: 1px solid #eee;
}
.kdc-toggle-avatar img {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	object-fit: cover;
	display: block;
}
.kdc-toggle-fallback {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: var(--kdc-gold);
	color: var(--kdc-accent);
	font-weight: 700;
	font-size: 18px;
	align-items: center;
	justify-content: center;
	border: 2px solid var(--kdc-gold);
}
.kdc-toggle-online {
	position: absolute;
	bottom: 3px;
	right: -3px;
	width: 13px;
	height: 13px;
	border-radius: 50%;
	background: #22c55e;
	border: 2.5px solid #ffffff;
	animation: kdcPulse 2s infinite;
}

.kdc-toggle-label {
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.kdc-toggle-name {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .1px;
	line-height: 1.2;
	text-align: left;
}
.kdc-toggle-sub {
	font-size: 11.5px;
	font-weight: 400;
	opacity: .7;
	white-space: nowrap;
}

.kdc-toggle-chevron {
	display: flex;
	align-items: center;
	opacity: .55;
}

/* ── Окно чата ──────────────────────────────────────── */
.kdc-chat-box {
	position: absolute;
	right: -9px;
	bottom: -8px;
	width: 400px;
	height: 700px;
	max-height: calc(100vh - 110px);
	background: var(--kdc-white);
	border-radius: var(--kdc-radius);
	box-shadow: var(--kdc-shadow);
	overflow: hidden;
	border: 1px solid rgba(255,255,255,.6);
	animation: kdcOpen .26s cubic-bezier(.32,.72,0,1);
	transform-origin: bottom right;
}

@keyframes kdcOpen {
	from { opacity: 0; transform: translateY(16px) scale(.96); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Хедер ──────────────────────────────────────────── */
.kdc-chat-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	background: linear-gradient(135deg, var(--kdc-accent) 0%, var(--kdc-accent2) 100%);
	position: relative;
	overflow: hidden;
}
.kdc-chat-header::after {
	content: '';
	position: absolute;
	inset: 0;
	background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='30' cy='30' r='28' fill='none' stroke='rgba(201,168,76,.08)' stroke-width='1'/%3E%3C/svg%3E") center/120px repeat;
	pointer-events: none;
}

.kdc-chat-header-photo {
	position: relative;
	flex-shrink: 0;
}
.kdc-header-avatar-img {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	object-fit: cover;
	display: block;
	background: #fff;
}
.kdc-header-avatar-fallback {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: var(--kdc-gold);
	color: var(--kdc-accent);
	font-weight: 700;
	font-size: 20px;
	align-items: center;
	justify-content: center;
	border: 2.5px solid var(--kdc-gold);
}
.kdc-header-online-dot {
	position: absolute;
	bottom: 2px;
	right: 2px;
	width: 13px;
	height: 13px;
	border-radius: 50%;
	background: #22c55e;
	border: 2.5px solid var(--kdc-accent);
	animation: kdcPulse 2s infinite;
}
@keyframes kdcPulse {
	0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
	50%      { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

.kdc-chat-header-info {
	flex: 1;
	min-width: 0;
	position: relative;
	z-index: 1;
}
.kdc-header-name {
	font-size: 14px;
	color: #fff;
	line-height: 1.2;
	font-weight: 700;
}
.kdc-header-role {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 4px;
	font-size: 12px;
	color: rgba(255,255,255,.65);
	font-weight: 400;
}
.kdc-header-status-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #4ade80;
	flex-shrink: 0;
}

.kdc-chat-close {
	position: relative;
	z-index: 1;
	border: none;
	background: rgb(255 255 255 / 99%);
	width: 34px;
	height: 34px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: rgb(0 0 0 / 70%);
	transition: background .2s, color .2s;
	flex-shrink: 0;
}
.kdc-chat-close:hover {
	background: rgba(255,255,255,.2);
	color: #fff;
}

/* ── Зона сообщений ─────────────────────────────────── */
.kdc-chat-messages {
	height: calc(100% - 189px);
	padding: 20px 16px 86px;
	overflow-y: auto;
	background: #f0f2f8;
	background-image:
		radial-gradient(ellipse at 20% 0%, rgba(201,168,76,.06) 0%, transparent 50%),
		radial-gradient(ellipse at 80% 100%, rgba(26,26,46,.04) 0%, transparent 50%);
	scroll-behavior: smooth;
}
.kdc-chat-messages::-webkit-scrollbar { width: 6px; }
.kdc-chat-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,.1); border-radius: 999px; }
.kdc-chat-messages::-webkit-scrollbar-track { background: transparent; }

/* ── Разделитель даты ───────────────────────────────── */
.kdc-date-divider {
	display: flex;
	justify-content: center;
	margin-bottom: 16px;
}
.kdc-date-divider span {
	display: inline-block;
	padding: 5px 12px;
	font-size: 11px;
	font-weight: 600;
	color: #8a93a8;
	background: rgba(255,255,255,.8);
	border: 1px solid rgba(0,0,0,.06);
	border-radius: 999px;
	letter-spacing: .3px;
}

/* ── Строки и пузыри ────────────────────────────────── */
.kdc-chat-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	margin-bottom: 14px;
	animation: kdcBubble .2s ease;
}
.kdc-chat-row.user { justify-content: flex-end; }
.kdc-chat-row.bot  { justify-content: flex-start; }

@keyframes kdcBubble {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* Мини-аватар у бота */
.kdc-bot-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	overflow: hidden;
	flex-shrink: 0;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 13px;
	align-self: flex-end;
	margin-bottom: 2px;
	box-shadow: rgba(0, 0, 0, 0.05) 0px 4px 6px 0px, rgba(0, 0, 0, 0.06) 0px 2px 7px -1px;
}
.kdc-bot-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.kdc-chat-bubble {
	max-width: 78%;
	padding: 12px 15px;
	border-radius: 20px;
	font-size: 14px;
	line-height: 1.5;
	word-break: break-word;
	white-space: pre-wrap;
}
.kdc-chat-bubble.bot {
	background: var(--kdc-white);
	color: #1a1a2e;
	border-bottom-left-radius: 6px;
	box-shadow: 0 4px 18px rgba(0,0,0,.06);
}
.kdc-chat-bubble.user {
	background: linear-gradient(135deg, var(--kdc-accent) 0%, #0f3460 100%);
	color: var(--kdc-white);
	border-bottom-right-radius: 6px;
	box-shadow: 0 4px 18px rgba(26,26,46,.22);
}

/* ── Кнопки-ссылки ──────────────────────────────────── */
.kdc-link-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	margin-top: 10px;
}
 
.kdc-link-btn:hover {
	background: rgba(201,168,76,.22);
	border-color: var(--kdc-gold);
	transform: translateY(-1px);
	color: var(--kdc-accent);
	text-decoration: none;
}
.kdc-link-btn svg {
	flex-shrink: 0;
}

/* ── Печатает… ──────────────────────────────────────── */
.kdc-chat-bubble.typing { padding: 14px 16px 12px; min-width: 64px; }
.kdc-typing-dots { display: flex; align-items: center; gap: 5px; height: 16px; }
.kdc-typing-dots span {
	width: 7px; height: 7px; border-radius: 50%;
	background: #b0b8cc;
	animation: kdcDot 1s infinite ease-in-out;
}
.kdc-typing-dots span:nth-child(2) { animation-delay: .15s; }
.kdc-typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes kdcDot {
	0%,80%,100% { transform: translateY(0); opacity: .4; }
	40%          { transform: translateY(-5px); opacity: 1; }
}

/* ── Футер / форма ──────────────────────────────────── */
.kdc-chat-footer {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	padding: 10px 12px 14px;
	background: rgba(255,255,255,.95);
	backdrop-filter: blur(14px);
	border-top: 1px solid var(--kdc-border);
}
.kdc-chat-form { margin: 0; }

.kdc-chat-input-wrap {
	display: flex;
	align-items: flex-end;
	gap: 10px;
	padding: 9px 9px 9px 14px;
	background: var(--kdc-white);
	border: 1.5px solid rgba(26,26,46,.1);
	border-radius: 9px;
	box-shadow: 0 4px 18px rgba(0,0,0,.05);
	transition: border-color .2s;
}
.kdc-chat-input-wrap:focus-within {
	border-color: #b4b4b4;
}

.kdc-chat-input {
	flex: 1;
	border: none;
	outline: none;
	resize: none;
	background: transparent;
	font-size: 16px;
	line-height: 1.45;
	color: #1a1a2e;
	height: 35px !important;
	padding: 4px 0;
}
.kdc-chat-input::placeholder { color: #a0a8bc; }

.kdc-chat-send {
	width: 40px; height: 40px; flex-shrink: 0;
	border: none; border-radius: 50%;
	background: linear-gradient(135deg, var(--kdc-accent) 0%, #0f3460 100%);
	color: var(--kdc-white);
	display: flex; align-items: center; justify-content: center;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(26,26,46,.28);
	transition: transform .18s, box-shadow .18s;
}
.kdc-chat-send:hover {
	transform: translateY(-1px) scale(1.05);
	box-shadow: 0 10px 24px rgba(26,26,46,.35);
}
.kdc-chat-hint {
	margin-top: 7px;
	padding-left: 6px;
	font-size: 11px;
	color: #aab0c0;
}

/* ── Мобайл ─────────────────────────────────────────── */
@media (max-width: 768px) {
	.kdc-chat-hint {
    display: none;
}
	.kdc-chat-widget {/* right: 12px; *//* left: 12px; */bottom: 12px;}
	.kdc-chat-toggle {width: 100%;justify-content: flex-start;border-radius: 18px;padding: 8px 10px 8px 8px;}
	.kdc-chat-box {
		position: fixed;
		left: 8px; right: 8px; bottom: 8px;
		width: auto; height: min(80vh, 680px);
		max-height: none; border-radius: 24px;
	}
	.kdc-chat-messages { height: calc(100% - 156px); }
	.kdc-chat-bubble { max-width: 86%; }
}
@media (max-width: 480px) {
	.kdc-chat-widget {right: 20px;/* left: 0; */bottom: 0;}
	.kdc-chat-toggle {margin: 0 10px 10px;border-radius: 16px;gap: 9px;}
	.kdc-chat-box {
		left: 0;
		right: 0;
		bottom: 0;
		height: 100dvh;
		border-radius: 0px 0px 0 0;
	}
	.kdc-chat-header { padding-top: max(14px, env(safe-area-inset-top)); }
	.kdc-chat-messages {height: calc(100dvh - 176px);}
	.kdc-chat-footer { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}
/* общие кнопки */
.kdc-link-btn {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	border-radius: 12px;
	background: #f5f7fb;
	text-decoration: none;
	color: #222;
	font-size: 14px;
	margin-top: 6px;
	transition: all 0.2s ease;
}

.kdc-link-btn:hover {
	background: #e9eef7;
}

/* 🦷 услуги */
.kdc-link-btn.service {
	font-weight: 500;
}

.kdc-link-icon {
	font-size: 16px;
}

/* 👨‍⚕️ врач */
.kdc-link-btn.doctor {
	background: #eef6ff;
	padding: 12px;
}

.kdc-doctor-card {
	display: flex;
	align-items: center;
	gap: 10px;
}

.kdc-doctor-icon {
	font-size: 22px;
}

.kdc-doctor-name {
	font-weight: 600;
	font-size: 14px;
}

.kdc-doctor-sub {
	font-size: 12px;
	color: #666;
}
/* текст */
.kdc-doctor-name {
	font-weight: 600;
	font-size: 14px;
}

.kdc-doctor-sub {
	font-size: 12px;
	color: #666;
	margin-top: 2px;
}

/* кнопка */
.kdc-doctor-btn {
	margin-top: 6px;
	font-size: 12px;
	background: #2b7cff;
	color: #fff;
	padding: 4px 10px;
	border-radius: 8px;
	display: none;
}
.kdc-doc-photo {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
	display: block;
}

.kdc-doc-photo-placeholder {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #e0e7ff;
	display: none;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	flex-shrink: 0;
}