/* Анонимная помощь — публичная часть */

.ah {
	--ah-accent: #6c5ce7;
	--ah-accent-dark: #5443c9;
	--ah-accent-rgb: 108, 92, 231;
	--ah-bg: #ffffff;
	--ah-surface: #f5f6fb;
	--ah-text: #1c2133;
	--ah-muted: #6a7389;
	--ah-border: #e3e6f0;
	--ah-danger: #e5484d;
	--ah-ok: #27a86a;
	--ah-shadow: 0 18px 40px -24px rgba(28, 33, 51, .4), 0 2px 6px rgba(28, 33, 51, .05);
	--ah-radius: 18px;
	--ah-ease: cubic-bezier(.22, .8, .3, 1);
	color: var(--ah-text);
	font-size: 15px;
	line-height: 1.55;
	text-align: left;
}

.ah[data-ah-theme="dark"] {
	--ah-bg: #171a27;
	--ah-surface: #21253a;
	--ah-text: #eef0f8;
	--ah-muted: #9aa3bb;
	--ah-border: #2d3350;
	--ah-shadow: 0 18px 40px -22px rgba(0, 0, 0, .7);
}

@media (prefers-color-scheme: dark) {
	.ah[data-ah-theme="auto"] {
		--ah-bg: #171a27;
		--ah-surface: #21253a;
		--ah-text: #eef0f8;
		--ah-muted: #9aa3bb;
		--ah-border: #2d3350;
		--ah-shadow: 0 18px 40px -22px rgba(0, 0, 0, .7);
	}
}

.ah *,
.ah *::before,
.ah *::after { box-sizing: border-box; }

.ah button,
.ah input,
.ah select,
.ah textarea { font: inherit; color: inherit; margin: 0; }

.ah [hidden] { display: none !important; }

.ah-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.ah-hp {
	position: absolute !important;
	left: -9999px;
	width: 1px; height: 1px;
	overflow: hidden;
}

/* ---------- Карточка-форма ---------- */

.ah-widget {
	position: relative;
	overflow: hidden;
	max-width: 100%;
	padding: 22px;
	background: var(--ah-bg);
	border: 1px solid var(--ah-border);
	border-radius: var(--ah-radius);
	box-shadow: var(--ah-shadow);
}

.ah-widget::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 4px;
	background: linear-gradient(90deg, var(--ah-accent), var(--ah-accent-dark));
}

.ah-widget.ah-plain {
	padding: 0;
	background: transparent;
	border: 0;
	box-shadow: none;
}
.ah-widget.ah-plain::before { display: none; }

.ah-head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 16px;
}

.ah-icon {
	position: relative;
	flex: none;
	display: grid;
	place-items: center;
	width: 42px; height: 42px;
	color: #fff;
	border-radius: 14px;
	background: linear-gradient(135deg, var(--ah-accent), var(--ah-accent-dark));
	box-shadow: 0 8px 18px -8px rgba(var(--ah-accent-rgb), .85);
}
.ah-icon svg { width: 22px; height: 22px; }

.ah-title {
	margin: 0 !important;
	padding: 0 !important;
	font-size: 1.15em !important;
	line-height: 1.25 !important;
	font-weight: 700 !important;
	color: var(--ah-text) !important;
}

/* ---------- Поля ---------- */

.ah-field { position: relative; margin: 0 0 12px; }

.ah-textarea,
.ah-select select,
.ah-check-form input,
.ah-search input {
	display: block;
	width: 100%;
	padding: 12px 14px;
	color: var(--ah-text);
	background: var(--ah-surface);
	border: 1.5px solid transparent;
	border-radius: 14px;
	outline: 0;
	box-shadow: none;
	transition: border-color .2s, box-shadow .2s, background .2s;
}

.ah-textarea {
	min-height: 112px;
	max-height: 360px;
	resize: none;
	overflow: auto;
	line-height: 1.5;
}

.ah-textarea::placeholder,
.ah-check-form input::placeholder,
.ah-search input::placeholder { color: var(--ah-muted); opacity: .85; }

.ah-textarea:focus,
.ah-select select:focus,
.ah-check-form input:focus,
.ah-search input:focus {
	background: var(--ah-bg);
	border-color: var(--ah-accent);
	box-shadow: 0 0 0 4px rgba(var(--ah-accent-rgb), .15);
}

.ah-select { position: relative; }
.ah-select select {
	appearance: none;
	-webkit-appearance: none;
	padding-right: 42px;
	cursor: pointer;
	text-overflow: ellipsis;
}
.ah-select select option { color: #1c2133; background: #fff; }
.ah-select-icon {
	position: absolute;
	top: 50%; right: 14px;
	display: grid;
	width: 18px; height: 18px;
	color: var(--ah-muted);
	pointer-events: none;
	transform: translateY(-50%);
	transition: transform .25s var(--ah-ease), color .2s;
}
.ah-select-icon svg { width: 100%; height: 100%; }
.ah-select select:focus + .ah-select-icon { color: var(--ah-accent); transform: translateY(-50%) rotate(180deg); }

.ah-meta {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	margin-top: 6px;
	font-size: .82em;
	color: var(--ah-muted);
}
.ah-meta:empty { display: none; }
.ah-counter { margin-left: auto; font-variant-numeric: tabular-nums; transition: color .2s; }
.ah-counter.is-near { color: var(--ah-danger); }

.ah-error { display: none; color: var(--ah-danger); font-weight: 500; }
.ah-field.has-error .ah-error { display: block; }
.ah-field.has-error .ah-textarea,
.ah-field.has-error .ah-select select {
	border-color: var(--ah-danger);
	background: rgba(229, 72, 77, .07);
}

.ah-shake { animation: ah-shake .45s cubic-bezier(.36, .07, .19, .97); }

/* ---------- Кнопки ---------- */

.ah-btn,
.ah-more {
	position: relative;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 13px 18px;
	font-weight: 600;
	line-height: 1.2;
	color: #fff;
	cursor: pointer;
	border: 0;
	border-radius: 14px;
	background: linear-gradient(135deg, var(--ah-accent), var(--ah-accent-dark));
	box-shadow: 0 12px 22px -12px rgba(var(--ah-accent-rgb), .9);
	transition: transform .2s var(--ah-ease), box-shadow .2s, filter .2s;
}

.ah-btn:hover,
.ah-more:hover {
	transform: translateY(-2px);
	filter: saturate(1.1);
	box-shadow: 0 16px 26px -12px rgba(var(--ah-accent-rgb), .95);
}
.ah-btn:active,
.ah-more:active { transform: translateY(0); }
.ah-btn:focus-visible,
.ah-more:focus-visible,
.ah-chip:focus-visible,
.ah-item-head:focus-visible,
.ah-check-toggle:focus-visible {
	outline: 3px solid rgba(var(--ah-accent-rgb), .45);
	outline-offset: 2px;
}

.ah-btn-ico svg { display: block; width: 18px; height: 18px; transition: transform .3s var(--ah-ease); }
.ah-btn:hover .ah-btn-ico svg { transform: translate(3px, -3px); }

.ah-spin {
	display: none;
	width: 18px; height: 18px;
	border: 2px solid rgba(255, 255, 255, .4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: ah-rot .7s linear infinite;
}
.ah-btn.is-loading .ah-spin { display: inline-block; }
.ah-btn.is-loading .ah-btn-ico { display: none; }
.ah-btn[disabled] { cursor: progress; opacity: .88; transform: none; }

.ah-ripple {
	position: absolute;
	width: 20px; height: 20px;
	margin: -10px 0 0 -10px;
	pointer-events: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, .38);
	transform: scale(0);
	animation: ah-ripple .65s ease-out forwards;
}

.ah-btn-sm { width: auto; padding: 11px 16px; flex: none; }

.ah-privacy {
	display: flex;
	align-items: flex-start;
	gap: 7px;
	margin: 12px 0 0;
	font-size: .8em;
	line-height: 1.45;
	color: var(--ah-muted);
}
.ah-privacy svg { flex: none; width: 14px; height: 14px; margin-top: 2px; }

.ah-link {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 14px;
	font-weight: 600;
	color: var(--ah-accent) !important;
	text-decoration: none !important;
	box-shadow: none !important;
}
.ah-link::after {
	content: "";
	position: absolute;
	left: 0; right: 22px; bottom: -2px;
	height: 2px;
	background: currentColor;
	transform: scaleX(0);
	transform-origin: left;
	transition: transform .3s var(--ah-ease);
}
.ah-link:hover::after { transform: scaleX(1); }
.ah-link svg { width: 16px; height: 16px; transition: transform .25s var(--ah-ease); }
.ah-link:hover svg { transform: translateX(4px); }

/* ---------- Успешная отправка ---------- */

.ah-form.is-leaving { opacity: 0; transform: translateY(-8px); transition: opacity .25s, transform .25s; pointer-events: none; }

.ah-success { padding: 6px 0 2px; text-align: center; }

.ah-check { width: 74px; height: 74px; margin: 0 auto 12px; }
.ah-check svg { display: block; width: 100%; height: 100%; }
.ah-check circle {
	fill: rgba(var(--ah-accent-rgb), .08);
	stroke: var(--ah-ok);
	stroke-width: 2.5;
	stroke-dasharray: 151;
	stroke-dashoffset: 151;
}
.ah-check path {
	fill: none;
	stroke: var(--ah-ok);
	stroke-width: 3.5;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-dasharray: 40;
	stroke-dashoffset: 40;
}
.ah-success.is-shown .ah-check circle { animation: ah-draw .6s .1s var(--ah-ease) forwards; }
.ah-success.is-shown .ah-check path { animation: ah-draw .4s .55s var(--ah-ease) forwards; }
.ah-success.is-shown > :not(.ah-check) { animation: ah-up .55s var(--ah-ease) both; }
.ah-success.is-shown > :nth-child(3) { animation-delay: .15s; }
.ah-success.is-shown > :nth-child(4) { animation-delay: .25s; }
.ah-success.is-shown > :nth-child(5) { animation-delay: .35s; }
.ah-success.is-shown > :nth-child(6) { animation-delay: .45s; }

.ah-success-title { margin: 0 0 6px !important; padding: 0 !important; font-size: 1.15em !important; font-weight: 700 !important; color: var(--ah-text) !important; }
.ah-success-text { margin: 0; color: var(--ah-muted); }

.ah-code {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 6px 10px;
	margin: 16px 0 4px;
	padding: 12px;
	background: var(--ah-surface);
	border: 1.5px dashed rgba(var(--ah-accent-rgb), .5);
	border-radius: 14px;
}
.ah-code-label { width: 100%; font-size: .75em; letter-spacing: .05em; text-transform: uppercase; color: var(--ah-muted); }
.ah-code code {
	padding: 0;
	font-size: 1.3em;
	font-weight: 700;
	letter-spacing: .14em;
	color: var(--ah-text);
	background: none;
}
.ah-copy {
	padding: 6px 12px;
	font-size: .85em;
	font-weight: 600;
	color: var(--ah-accent);
	cursor: pointer;
	background: var(--ah-bg);
	border: 1px solid var(--ah-border);
	border-radius: 10px;
	transition: border-color .2s, transform .2s var(--ah-ease);
}
.ah-copy:hover { border-color: var(--ah-accent); transform: translateY(-1px); }

.ah-again {
	margin-top: 12px;
	padding: 6px 10px;
	font-weight: 600;
	color: var(--ah-accent);
	cursor: pointer;
	background: none;
	border: 0;
}
.ah-again:hover { text-decoration: underline; }

/* ---------- Страница «Вопросы и ответы» ---------- */

.ah-qa { container-type: inline-size; width: 100%; max-width: 1100px; margin: 0 auto; }

.ah-qa-head { margin: 0 0 22px; }
.ah-qa-title { margin: 0 0 4px !important; font-size: 1.9em !important; line-height: 1.2 !important; font-weight: 800 !important; color: var(--ah-text) !important; }
.ah-qa-sub { margin: 0; color: var(--ah-muted); }

.ah-qa-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.ah-qa-main { min-width: 0; }
.ah-qa-aside { display: grid; gap: 16px; min-width: 0; }

@container (min-width: 820px) {
	.ah-qa-layout:not(.ah-no-aside) { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
	.ah-qa-aside { position: sticky; top: 24px; }
}

.ah-toolbar { display: grid; gap: 12px; margin: 0 0 16px; }

.ah-search { position: relative; display: block; }
.ah-search svg { position: absolute; top: 50%; left: 14px; width: 18px; height: 18px; color: var(--ah-muted); pointer-events: none; transform: translateY(-50%); }
.ah-search input { padding-left: 42px; background: var(--ah-bg); border-color: var(--ah-border); }

.ah-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ah-chip {
	padding: 7px 15px;
	font-size: .9em;
	font-weight: 600;
	color: var(--ah-muted);
	cursor: pointer;
	background: var(--ah-bg);
	border: 1.5px solid var(--ah-border);
	border-radius: 999px;
	transition: all .25s var(--ah-ease);
}
.ah-chip:hover { color: var(--ah-accent); border-color: var(--ah-accent); transform: translateY(-1px); }
.ah-chip.is-active {
	color: #fff;
	border-color: transparent;
	background: linear-gradient(135deg, var(--ah-accent), var(--ah-accent-dark));
	box-shadow: 0 8px 16px -10px rgba(var(--ah-accent-rgb), .9);
}

.ah-list { display: grid; gap: 12px; transition: opacity .2s; }
.ah-list.is-loading { opacity: .45; pointer-events: none; }

.ah-item {
	overflow: hidden;
	background: var(--ah-bg);
	border: 1px solid var(--ah-border);
	border-radius: 16px;
	transition: box-shadow .3s, border-color .3s;
}
.ah-item:hover { border-color: rgba(var(--ah-accent-rgb), .45); }
.ah-item.is-open { border-color: rgba(var(--ah-accent-rgb), .55); box-shadow: var(--ah-shadow); }

.ah-item-head {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	width: 100%;
	padding: 16px 18px;
	text-align: left;
	cursor: pointer;
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	text-transform: none;
	letter-spacing: normal;
}
.ah-item-main { flex: 1; min-width: 0; }
.ah-item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 0 6px; }

.ah-badge {
	display: inline-block;
	padding: 2px 10px;
	font-size: .78em;
	font-weight: 700;
	color: var(--ah-accent);
	background: rgba(var(--ah-accent-rgb), .12);
	border-radius: 999px;
}
.ah-date { font-size: .8em; color: var(--ah-muted); }

.ah-q {
	display: -webkit-box;
	overflow: hidden;
	font-weight: 600;
	color: var(--ah-text);
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow-wrap: anywhere;
}
.ah-item.is-open .ah-q { display: block; }

.ah-chev {
	flex: none;
	display: grid;
	width: 22px; height: 22px;
	margin-top: 2px;
	color: var(--ah-muted);
	transition: transform .35s var(--ah-ease), color .2s;
}
.ah-chev svg { width: 100%; height: 100%; }
.ah-item.is-open > .ah-item-head .ah-chev,
.ah-checkbox.is-open .ah-chev { transform: rotate(180deg); color: var(--ah-accent); }

.ah-item-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .4s var(--ah-ease); }
.ah-item-inner { min-height: 0; overflow: hidden; }

.ah-js .ah-item-body { grid-template-rows: 0fr; }
.ah-js .ah-item.is-open .ah-item-body { grid-template-rows: 1fr; }
.ah-js .ah-item-inner { visibility: hidden; transition: visibility 0s linear .4s; }
.ah-js .ah-item.is-open .ah-item-inner { visibility: visible; transition-delay: 0s; }

.ah-answer {
	margin: 0 18px 18px;
	padding: 14px 16px;
	background: var(--ah-surface);
	border-left: 4px solid var(--ah-accent);
	border-radius: 4px 14px 14px 4px;
	overflow-wrap: anywhere;
}
.ah-answer-label {
	display: block;
	margin: 0 0 6px;
	font-size: .72em;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--ah-accent);
}
.ah-answer p { margin: 0 0 .7em; }
.ah-answer > :last-child { margin-bottom: 0; }

.ah-more { width: auto; margin: 18px auto 0; padding: 11px 26px; }
.ah-more.is-loading { opacity: .7; cursor: progress; }

.ah-empty {
	padding: 42px 16px;
	text-align: center;
	color: var(--ah-muted);
	border: 1.5px dashed var(--ah-border);
	border-radius: 16px;
}
.ah-empty p { margin: 0; }
.ah-empty-ico { display: inline-grid; width: 46px; height: 46px; margin: 0 0 10px; color: var(--ah-accent); }
.ah-empty-ico svg { width: 100%; height: 100%; }

.ah-skel {
	height: 86px;
	border-radius: 16px;
	background: linear-gradient(100deg, var(--ah-surface) 30%, rgba(var(--ah-accent-rgb), .1) 50%, var(--ah-surface) 70%);
	background-size: 220% 100%;
	animation: ah-shimmer 1.2s linear infinite;
}

/* ---------- Проверка по коду ---------- */

.ah-checkbox {
	overflow: hidden;
	background: var(--ah-bg);
	border: 1px solid var(--ah-border);
	border-radius: var(--ah-radius);
}

.ah-check-toggle {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 14px 16px;
	font-weight: 600;
	text-align: left;
	color: var(--ah-text);
	cursor: pointer;
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	text-transform: none;
}
.ah-check-toggle > span:nth-child(2) { flex: 1; }
.ah-check-ico { display: grid; width: 20px; height: 20px; color: var(--ah-accent); }
.ah-check-ico svg { width: 100%; height: 100%; }
.ah-check-toggle .ah-chev { margin: 0; width: 20px; height: 20px; }

.ah-check-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .4s var(--ah-ease); }
.ah-checkbox.is-open .ah-check-panel { grid-template-rows: 1fr; }
.ah-check-inner { min-height: 0; overflow: hidden; padding: 0 16px; visibility: hidden; transition: visibility 0s linear .4s; }
.ah-checkbox.is-open .ah-check-inner { padding-bottom: 16px; visibility: visible; transition-delay: 0s; }

.ah-check-form { display: flex; gap: 8px; }
.ah-check-form input { flex: 1; min-width: 0; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }

.ah-check-result { margin-top: 12px; }
.ah-result {
	padding: 14px;
	background: var(--ah-surface);
	border-radius: 14px;
	animation: ah-up .45s var(--ah-ease) both;
}
.ah-result.is-error { color: var(--ah-danger); background: rgba(229, 72, 77, .09); font-weight: 500; }
.ah-result-q { margin: 8px 0 12px; font-weight: 600; overflow-wrap: anywhere; }
.ah-result-wait { margin: 0; color: var(--ah-muted); }
.ah-result .ah-answer { margin: 0; background: var(--ah-bg); }

/* ---------- Появление при прокрутке (включается скриптом) ---------- */

.ah-js.ah-anim.ah-widget:not(.is-in),
.ah-js.ah-anim .ah-item:not(.is-in) { opacity: 0; transform: translateY(14px); }

.ah-js.ah-anim.ah-widget.is-in,
.ah-js.ah-anim .ah-item.is-in {
	opacity: 1;
	transform: none;
	transition:
		opacity .55s var(--ah-ease) calc(var(--i, 0) * 60ms),
		transform .55s var(--ah-ease) calc(var(--i, 0) * 60ms),
		box-shadow .3s,
		border-color .3s;
}

.ah-anim .ah-icon::after {
	content: "";
	position: absolute;
	inset: 0;
	border: 2px solid rgba(var(--ah-accent-rgb), .55);
	border-radius: inherit;
	animation: ah-pulse 2.8s ease-out infinite;
}
.ah-anim .ah-empty-ico { animation: ah-float 3s ease-in-out infinite; }

/* ---------- Анимации ---------- */

@keyframes ah-pulse { 0% { transform: scale(1); opacity: .8; } 70%, 100% { transform: scale(1.6); opacity: 0; } }
@keyframes ah-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes ah-rot { to { transform: rotate(360deg); } }
@keyframes ah-draw { to { stroke-dashoffset: 0; } }
@keyframes ah-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes ah-ripple { to { transform: scale(18); opacity: 0; } }
@keyframes ah-shimmer { to { background-position: -220% 0; } }
@keyframes ah-shake {
	10%, 90% { transform: translateX(-1px); }
	20%, 80% { transform: translateX(3px); }
	30%, 50%, 70% { transform: translateX(-5px); }
	40%, 60% { transform: translateX(5px); }
}

@media (prefers-reduced-motion: reduce) {
	.ah *,
	.ah *::before,
	.ah *::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
		transition-delay: 0s !important;
	}
}

@media (max-width: 480px) {
	.ah-widget { padding: 18px; }
	.ah-item-head { padding: 14px; }
	.ah-answer { margin: 0 14px 14px; }
	.ah-check-form { flex-direction: column; }
	.ah-btn-sm { width: 100%; }
}
