/* Окно чата правового помощника. Цвета можно переопределить в теме через переменные. */
.ld-chat-button,
.ld-chat-panel {
	/* Фирменный цвет сайта — тот же, что у кнопок «Найти» и «Войти». */
	--ld-accent: #4e47ff;
	--ld-accent-text: #fff;
	--ld-bg: #fff;
	--ld-text: #1c2430;
	--ld-muted: #5d6877;
	--ld-line: #d9dee6;
	--ld-user: #f0efff;
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 99990;
	/* Тема сайта даёт всем <section> нижний отступ 40px; у закреплённого окна он сдвигал
	   его вверх, и на телефоне шапка уходила за край экрана. */
	margin: 0;
	font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	box-sizing: border-box;
}

.ld-chat-button {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	height: 56px;
	padding: 0 24px 0 20px;
	border: 0;
	border-radius: 28px;
	background: var(--ld-accent);
	color: var(--ld-accent-text);
	font-family: Gilroy, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	font-size: 17px;
	font-weight: 700;
	cursor: pointer;
	/* Фиолетовое свечение отрывает кнопку от страницы. */
	box-shadow: 0 8px 24px rgba(78, 71, 255, .45), 0 2px 6px rgba(0, 0, 0, .18);
	transition: transform .15s ease, box-shadow .15s ease;
}

.ld-chat-button:hover,
.ld-chat-button:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 12px 30px rgba(78, 71, 255, .55), 0 2px 6px rgba(0, 0, 0, .18);
}

.ld-chat-button-short {
	display: none;
}

/* Расходящееся кольцо, пока посетитель ни разу не открывал чат. */
.ld-chat-pulse::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	border: 2px solid var(--ld-accent);
	animation: ld-chat-pulse 2.6s ease-out infinite;
	pointer-events: none;
}

@keyframes ld-chat-pulse {
	0% {
		transform: scale(1);
		opacity: .8;
	}
	70%,
	100% {
		transform: scale(1.25, 1.6);
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ld-chat-pulse::after {
		animation: none;
		display: none;
	}

	.ld-chat-button {
		transition: none;
	}
}

.ld-chat-panel {
	/* Открытое окно — поверх плашки согласия на cookie: иначе она закрывает поле ввода. */
	z-index: 99995;
	display: flex;
	flex-direction: column;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	background: var(--ld-bg);
	color: var(--ld-text);
	border: 1px solid var(--ld-line);
	border-radius: 14px;
	box-shadow: 0 10px 34px rgba(0, 0, 0, .25);
	overflow: hidden;
}

.ld-chat-panel[hidden],
.ld-chat-button[hidden] {
	display: none;
}

.ld-chat-panel *,
.ld-chat-panel *::before {
	box-sizing: border-box;
}

.ld-chat-head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	background: var(--ld-accent);
	color: var(--ld-accent-text);
}

.ld-chat-title {
	flex: 1;
	display: flex;
	flex-direction: column;
	line-height: 1.25;
}

.ld-chat-title span {
	font-size: 12.5px;
	opacity: .85;
}

.ld-chat-lawyer {
	margin-top: 10px;
	padding: 9px 11px;
	border: 1px solid var(--ld-line);
	border-left: 3px solid var(--ld-accent);
	border-radius: 8px;
	background: var(--ld-user);
}

.ld-chat-lawyer-label,
.ld-chat-lawyer-facts {
	font-size: 12.5px;
	color: var(--ld-muted);
}

.ld-chat-lawyer-name {
	display: block;
	font-weight: 600;
	margin: 2px 0;
}

.ld-chat-head-btn,
.ld-chat-close {
	border: 0;
	background: transparent;
	color: inherit;
	cursor: pointer;
	font: inherit;
	padding: 4px 6px;
}

.ld-chat-head-btn {
	font-size: 12.5px;
	text-decoration: underline;
	white-space: nowrap;
}

.ld-chat-close {
	font-size: 22px;
	line-height: 1;
}

.ld-chat-log {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.ld-chat-msg {
	max-width: 92%;
	padding: 9px 12px;
	border-radius: 12px;
	overflow-wrap: anywhere;
}

.ld-chat-user {
	align-self: flex-end;
	background: var(--ld-user);
}

.ld-chat-assistant {
	align-self: flex-start;
	border: 1px solid var(--ld-line);
}

.ld-chat-wait {
	color: var(--ld-muted);
	font-style: italic;
}

.ld-chat-msg a {
	color: var(--ld-accent);
	text-decoration: underline;
}

.ld-chat-sources {
	margin: 8px 0 0;
	padding: 8px 0 0 18px;
	border-top: 1px solid var(--ld-line);
	font-size: 13.5px;
}

.ld-chat-sources li {
	margin: 0 0 4px;
}

.ld-chat-date {
	color: var(--ld-muted);
}

.ld-chat-form {
	display: flex;
	gap: 8px;
	padding: 10px 12px 6px;
	border-top: 1px solid var(--ld-line);
}

.ld-chat-input {
	flex: 1;
	min-width: 0;
	resize: none;
	padding: 8px 10px;
	border: 1px solid var(--ld-line);
	border-radius: 10px;
	font: inherit;
	color: inherit;
	background: var(--ld-bg);
}

.ld-chat-send {
	align-self: flex-end;
	padding: 9px 14px;
	border: 0;
	border-radius: 10px;
	background: var(--ld-accent);
	color: var(--ld-accent-text);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.ld-chat-send:disabled {
	opacity: .55;
	cursor: default;
}

.ld-chat-note {
	margin: 0;
	padding: 0 12px 10px;
	font-size: 12px;
	color: var(--ld-muted);
}

/* Кнопки с готовыми вопросами, уточнениями и вариантами действий. */
.ld-chat-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.ld-chat-msg .ld-chat-chips,
.ld-chat-share {
	margin-top: 8px;
}

.ld-chat-chip {
	display: inline-block;
	padding: 6px 11px;
	border: 1px solid var(--ld-accent);
	border-radius: 16px;
	background: var(--ld-bg);
	color: var(--ld-accent);
	font: inherit;
	font-size: 13.5px;
	line-height: 1.3;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
}

.ld-chat-msg a.ld-chat-chip {
	text-decoration: none;
}

.ld-chat-chip:hover,
.ld-chat-chip:focus-visible {
	background: var(--ld-user);
}

/* Строки «Отправить себе» и оценки под ответом. */
.ld-chat-actions,
.ld-chat-rate {
	margin-top: 8px;
	font-size: 13px;
}

.ld-chat-actions {
	padding-top: 7px;
	border-top: 1px solid var(--ld-line);
}

.ld-chat-rate {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 10px;
}

.ld-chat-rate-label {
	color: var(--ld-muted);
}

.ld-chat-action {
	border: 0;
	padding: 0;
	background: transparent;
	color: var(--ld-accent);
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

.ld-chat-share {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.ld-chat-share[hidden] {
	display: none;
}

/* Три точки, пока ищется ответ. */
.ld-chat-dots::after {
	content: "";
	animation: ld-chat-dots 1.2s steps(4, end) infinite;
}

@keyframes ld-chat-dots {
	0% { content: ""; }
	25% { content: "."; }
	50% { content: ".."; }
	75% { content: "..."; }
}

@media (prefers-reduced-motion: reduce) {
	.ld-chat-dots::after {
		animation: none;
		content: "...";
	}
}

/* Срочная плашка над ответом. */
.ld-chat-urgent {
	margin-bottom: 10px;
	padding: 9px 11px;
	border: 1px solid #e0a39e;
	border-left: 4px solid #b3261e;
	border-radius: 8px;
	background: #fdf0ef;
	color: #5c1410;
	font-size: 14px;
}

.ld-chat-urgent strong {
	display: block;
}

.ld-chat-urgent p {
	margin: 4px 0;
}

.ld-chat-urgent a {
	color: #8c1d18;
	text-decoration: underline;
}

.ld-chat-request-urgent {
	margin: 0;
	font-size: 13px;
	color: #8c1d18;
}

/* Форма заявки специалисту. */
.ld-chat-request {
	align-self: stretch;
	max-width: 100%;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.ld-chat-request-hint {
	margin: 0;
	font-size: 13px;
	color: var(--ld-muted);
}

.ld-chat-label {
	display: flex;
	flex-direction: column;
	gap: 3px;
	font-size: 13px;
	color: var(--ld-muted);
}

.ld-chat-field {
	width: 100%;
	padding: 7px 9px;
	border: 1px solid var(--ld-line);
	border-radius: 8px;
	font: inherit;
	font-size: 15px;
	color: var(--ld-text);
	background: var(--ld-bg);
}

textarea.ld-chat-field {
	resize: vertical;
}

.ld-chat-consent {
	font-size: 13px;
}

.ld-chat-trap {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.ld-chat-error {
	margin: 0;
	font-size: 13px;
	color: #b3261e;
}

.ld-chat-error:empty {
	display: none;
}

.ld-chat-request-buttons {
	display: flex;
	align-items: center;
	gap: 14px;
}

.ld-chat-lawyer-ask {
	margin-top: 8px;
}

.ld-chat-actions .ld-chat-action + .ld-chat-action {
	margin-left: 14px;
}

.ld-chat-note a {
	color: inherit;
	text-decoration: underline;
}

@media (max-width: 480px) {
	/* На телефоне — овальная кнопка с короткой подписью: по кружку со значком не понять, что это. */
	.ld-chat-button {
		height: 52px;
		padding: 0 20px 0 16px;
		font-size: 16px;
	}

	.ld-chat-button-text {
		display: none;
	}

	.ld-chat-button-short {
		display: inline;
	}

	.ld-chat-panel {
		/* Растягиваем по краям экрана, а не задаём высоту в vh: на телефоне высота в vh
		   бывает больше видимой области, и шапка окна уезжала за верхний край. */
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		width: auto;
		max-width: none;
		height: auto;
		max-height: none;
		border-radius: 0;
		border: 0;
	}
}

/* Кнопка темы «Наверх» стоит в правом нижнем углу — там же, где кнопка чата, и оказывалась под ней.
   Переносим её влево на всех экранах (решение владельца от 22.11.2026). */
#backtotop {
	right: auto;
	left: 10px;
}

/* Блок вызова ассистента на главной, под поиском специалиста. */
.ld-home-cta {
	max-width: 760px;
	margin: 26px auto 0;
	padding: 18px 20px;
	border-radius: 14px;
	background: linear-gradient(135deg, #4e47ff, #6a5cff);
	color: #fff;
	text-align: left;
	box-shadow: 0 10px 28px rgba(78, 71, 255, .28);
	font-family: inherit;
}

.ld-home-cta-row {
	display: flex;
	align-items: center;
	gap: 14px;
}

.ld-home-cta-icon {
	flex: none;
}

.ld-home-cta-text {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.ld-home-cta-text strong {
	font-size: 19px;
	font-weight: 800;
	line-height: 1.25;
}

.ld-home-cta-text span {
	font-size: 15px;
	line-height: 1.4;
	opacity: .92;
}

.ld-home-cta-btn {
	flex: none;
	height: 48px;
	padding: 0 24px;
	border: 0;
	border-radius: 10px;
	background: #fff;
	color: #4e47ff;
	font: inherit;
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	transition: transform .15s ease;
}

.ld-home-cta-btn:hover,
.ld-home-cta-btn:focus-visible {
	transform: translateY(-1px);
}

.ld-home-cta-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 14px;
}

.ld-home-cta-chip {
	padding: 7px 14px;
	border: 1px solid rgba(255, 255, 255, .55);
	border-radius: 999px;
	background: rgba(255, 255, 255, .12);
	color: #fff;
	font: inherit;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.3;
	cursor: pointer;
}

.ld-home-cta-chip:hover,
.ld-home-cta-chip:focus-visible {
	background: rgba(255, 255, 255, .24);
}

@media (max-width: 640px) {
	.ld-home-cta-row {
		flex-wrap: wrap;
	}

	.ld-home-cta-text strong {
		font-size: 17px;
	}

	/* Значок остаётся рядом с текстом, на новую строку уходит только кнопка. */
	.ld-home-cta-text {
		flex: 1 1 0;
	}

	.ld-home-cta-btn {
		flex: 1 1 100%;
	}

	.ld-home-cta-chips {
		justify-content: flex-start;
	}
}

/* Адрес службы рядом: кнопки названных в ответе служб и карточки из государственного справочника. */
.ld-chat-offices {
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid #e3e5ee;
}

.ld-chat-offices-label {
	display: block;
	margin-bottom: 6px;
	font-size: 13px;
	color: #5b6072;
}

.ld-chat-offices-row {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.ld-chat-office-btn {
	padding: 6px 12px;
	border: 1px solid var(--ld-accent, #4e47ff);
	border-radius: 999px;
	background: #fff;
	color: var(--ld-accent, #4e47ff);
	font: inherit;
	font-size: 13px;
	line-height: 1.3;
	cursor: pointer;
}

.ld-chat-office-btn:hover,
.ld-chat-office-btn:focus-visible {
	background: var(--ld-user, #f0efff);
}

.ld-chat-office-form {
	display: flex;
	gap: 6px;
	margin-top: 8px;
}

.ld-chat-office-input {
	flex: 1 1 auto;
	min-width: 0;
	height: 36px;
	padding: 0 10px;
	border: 1px solid #cfd2de;
	border-radius: 8px;
	font: inherit;
	font-size: 14px;
}

.ld-chat-office-go {
	flex: none;
	height: 36px;
	padding: 0 14px;
	border: 0;
	border-radius: 8px;
	background: var(--ld-accent, #4e47ff);
	color: #fff;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.ld-chat-office-list {
	margin-top: 8px;
	font-size: 14px;
	line-height: 1.4;
}

.ld-chat-office-card {
	margin-bottom: 8px;
	padding: 10px 12px;
	border-radius: 10px;
	background: #f6f7fb;
}

.ld-chat-office-card strong {
	display: block;
	margin-bottom: 2px;
}

.ld-chat-office-card a {
	color: var(--ld-accent, #4e47ff);
}

.ld-chat-office-links {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 14px;
	margin-top: 4px;
}

.ld-chat-office-source {
	font-size: 12px;
	color: #7a7f91;
}

/* Ссылка «Объяснить письмо» в подписи под полем ввода. */
.ld-chat-letter-link {
	padding: 0;
	border: 0;
	background: none;
	color: var(--ld-accent, #4e47ff);
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

/* Срок от даты: подпись над полем и поле времени. */
.ld-chat-deadline-hint {
	display: block;
	margin-top: 8px;
	font-size: 13px;
	color: #5b6072;
}

.ld-chat-deadline-form {
	flex-wrap: wrap;
	margin-top: 4px;
}

.ld-chat-deadline-form .ld-chat-office-input {
	flex: 1 1 130px;
}

.ld-chat-deadline-form .ld-chat-deadline-time {
	flex: 0 1 100px;
}

.ld-chat-deadlines .ld-chat-office-card strong {
	margin-bottom: 4px;
}

.ld-chat-deadlines .ld-chat-office-card div {
	margin-top: 2px;
}
