/*
 * Геостарт, дизайн v2 (application/views/v2).
 * Подключается в views/v2/tpl/head.php. Классы с префиксом g- — чтобы не пересекаться
 * со старыми style2.min.css и Bootstrap, которые грузятся на страницах без шаблона v2.
 */

:root {
	/* Цвета логотипа: индиго #0c0ca2 (полосы и надпись) и градиент #00ccfc → #0078fc */
	--bg: #f4f6fb;
	--surface: #ffffff;
	--surface-2: #eceff7;
	--ink: #12142e;
	--ink-2: #343857;
	--muted: #646a86;
	--line: #dfe3ee;
	--brand: #1414a6;
	--brand-2: #0c0c7c;
	--brand-soft: #e8e9ff;
	--on-brand: #ffffff;
	--accent: #0071e3;
	--accent-soft: #e0f2ff;
	--cyan: #00ccfc;
	--azure: #0078fc;
	--grad: linear-gradient(135deg, #00ccfc 0%, #0078fc 100%);
	--nav-bg: #0d0f3d;
	--hero-bg: #eef1fd;
	--nav-ink: #eceefc;
	--nav-muted: #a6abd6;
	--shadow: 0 1px 2px rgba(18, 20, 46, .06), 0 4px 16px rgba(18, 20, 46, .07);
	--radius: 12px;
	--radius-sm: 8px;
	--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
	color-scheme: light;
}

:root[data-theme="dark"] {
	--bg: #0b0c1f;
	--surface: #13152b;
	--surface-2: #1b1e38;
	--ink: #e7e9f6;
	--ink-2: #c3c7e0;
	--muted: #9097bb;
	--line: #272b4a;
	--brand: #8f92ff;
	--brand-2: #b0b2ff;
	--brand-soft: #1f2152;
	--on-brand: #0b0c1f;
	--accent: #3cc6ff;
	--accent-soft: #0f2a46;
	--nav-bg: #07081a;
	--hero-bg: #12143a;
	--nav-ink: #e7e9f6;
	--nav-muted: #8d93bd;
	--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
	color-scheme: dark;
}

/* ---------- База ---------- */

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }

body.g {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font: 16px/1.55 var(--font);
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}

.g a { color: var(--brand); text-decoration: none; }
.g a:hover { color: var(--brand-2); text-decoration: underline; text-underline-offset: 3px; }
.g img { max-width: 100%; height: auto; }
.g h1, .g h2, .g h3, .g h4 { color: var(--ink); line-height: 1.25; letter-spacing: -.01em; }
.g button { font: inherit; }

.g-container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.g-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.g-skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); }
.g-skip:focus { left: 8px; }

/* ---------- Шапка ---------- */

.g-head { background: var(--surface); }
.g-head__row { display: flex; align-items: center; gap: 16px; height: 64px; }

.g-logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink) !important; text-decoration: none !important; flex-shrink: 0; }
.g-logo__mark { width: 36px; height: 36px; flex-shrink: 0; display: block; }
.g-foot .g-logo__mark, [data-theme="dark"] .g-logo__mark { background: #fff; border-radius: 50%; padding: 3px; }
.g-logo__name { font-weight: 800; font-size: 20px; letter-spacing: -.02em; line-height: 1; color: var(--brand); }
.g-logo__tag { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin-top: 3px; }

.g-search { flex: 1; max-width: 520px; margin-left: auto; position: relative; }
.g-search input {
	width: 100%; height: 42px; padding: 0 44px 0 16px;
	border: 1px solid var(--line); border-radius: 999px;
	background: var(--surface-2); color: var(--ink); font: inherit; font-size: 15px;
	transition: border-color .15s, background .15s;
}
.g-search input::placeholder { color: var(--muted); }
.g-search input:focus { outline: none; border-color: var(--brand); background: var(--surface); }
.g-search button {
	position: absolute; right: 4px; top: 4px; width: 34px; height: 34px;
	border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer;
	display: grid; place-items: center;
}
.g-search button:hover { color: var(--brand); }

.g-actions { display: flex; align-items: center; gap: 4px; }
.g-icon-btn {
	width: 40px; height: 40px; display: grid; place-items: center;
	border: 0; border-radius: 50%; background: transparent; color: var(--ink-2) !important; cursor: pointer;
}
.g-icon-btn:hover { background: var(--surface-2); text-decoration: none !important; }
.g-icon-btn svg { width: 20px; height: 20px; }
.g-theme-dark { display: none; }
[data-theme="dark"] .g-theme-dark { display: block; }
[data-theme="dark"] .g-theme-light { display: none; }

.g-admin-info { font: 11px/1.3 var(--font-mono); color: var(--muted); }

/* Тёмная полоса разделов, как жанры на megaknigi */
.g-nav { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.g-nav__list { display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; height: 46px; }
.g-nav__list > li { flex-shrink: 0; position: relative; }
.g-nav a, .g-nav summary {
	display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
	border-radius: var(--radius-sm); color: var(--ink-2) !important; font-size: 14.5px; font-weight: 500;
	text-decoration: none !important; white-space: nowrap; cursor: pointer;
}
.g-nav a:hover, .g-nav summary:hover { background: var(--brand-soft); color: var(--brand) !important; }
.g-nav a.is-active { background: var(--grad); color: #fff !important; }
.g-nav__all { margin-left: auto; }
.g-nav__all a { color: var(--muted) !important; }
.g-nav details > summary { list-style: none; }
.g-nav details > summary::-webkit-details-marker { display: none; }
.g-nav details > summary::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg) translateY(-2px); opacity: .7; }
.g-nav__drop {
	position: absolute; top: 40px; left: 0; min-width: 240px; padding: 6px;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.g-nav__drop a { color: var(--ink) !important; height: 38px; font-weight: 400; }
.g-nav__drop a:hover { background: var(--surface-2); }

@media (max-width: 860px) {
	.g-head__row { height: auto; flex-wrap: wrap; padding: 10px 0; gap: 10px; }
	.g-search { order: 3; max-width: none; flex-basis: 100%; }
	.g-actions { margin-left: auto; }
	.g-logo__tag { display: none; }
	.g-nav__list { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
	.g-nav__list::-webkit-scrollbar { display: none; }
	.g-nav__all { margin-left: 0; }
	/* выпадающий список в прокручиваемой полосе обрезался бы — на телефоне калькуляторы ведут на подвал */
	.g-nav details { display: none; }
	.g-nav__calc-m { display: block !important; }
}
.g-nav__calc-m { display: none; }

/* ---------- Заголовок страницы и крошки ---------- */

.g-pagehead { padding: 28px 0 8px; }
.g-crumbs { display: flex; flex-wrap: wrap; gap: 4px 0; margin: 0 0 12px; padding: 0; list-style: none; font-size: 13.5px; color: var(--muted); }
.g-crumbs li + li::before { content: "/"; margin: 0 8px; opacity: .5; }
.g-crumbs a { color: var(--muted); }
.g-crumbs a:hover { color: var(--brand); }
.g-h1 { margin: 0; font-size: clamp(26px, 3.4vw, 38px); font-weight: 800; max-width: 900px; }
.g-h1 .str-num { color: var(--muted); font-weight: 500; }
.g-lead { margin: 12px 0 0; color: var(--muted); font-size: 17px; max-width: 760px; }
/* вводный текст страницы (layout/lead): рубрика, тег, калькулятор */
.g-page-lead { margin: 0 0 4px; }
.g-page-about { display: inline-block; margin-bottom: 4px; font-size: 15px; }
.g-page-lead + :not(.g-page-about), .g-page-about + * { margin-top: 16px; }
@media (max-width: 640px) {
	.g-page-lead { font-size: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
}

/* ---------- Сетка страницы ---------- */

.g-main { padding-bottom: 48px; min-height: 50vh; }
.g-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; padding-top: 20px; }
.g-layout--aside { grid-template-columns: minmax(0, 1fr) 300px; }
.g-aside { min-width: 0; }
.g-sticky { position: sticky; top: 16px; }
@media (max-width: 1000px) {
	.g-layout--aside { grid-template-columns: minmax(0, 1fr); }
	.g-aside { display: none; }
}

.g-section { margin: 40px 0 0; }
.g-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.g-section__title { margin: 0; font-size: 22px; font-weight: 800; }
.g-section__more { font-size: 14px; white-space: nowrap; }

/* ---------- Реклама: резерв высоты против CLS ---------- */

.g-ad { margin: 24px 0; min-height: 250px; }
.g-ad--top { min-height: 250px; }
.g-ad--side { min-height: 600px; margin: 0; }
.g-ad--compact { min-height: 120px; }
/* нижние блоки рубрик и тегов: под ними нет контента, резерв не нужен (rubricTop1/tagTop1 могут не заполняться) */
.g-ad--bottom { min-height: 0; }
.g-ad--bottom:empty { margin: 0; }
/* реклама пришла — блок по высоте баннера: abs-rendered ставит Abs (common.js) в момент отрисовки,
   is-filled — запасной вариант из js/v2.js для блоков, которые отрисовались без колбэка */
.g-ad.is-filled, .g-ad.abs-rendered, .g-ad:has(.abs-rendered) { min-height: 0; }
/* РСЯ ответила, что рекламы нет (Abs в common.js ставит abs-empty), — блок не занимает места */
.g-ad:has(.abs-empty):not(:has(.abs-rendered)), .g-ad.abs-empty:not(.abs-rendered) { min-height: 0; margin: 0; }
.g-ad:empty::before, .g-ad > script:only-child::before { content: ""; }

/* ---------- Карточки статей ---------- */

.g-cards { display: grid; gap: 16px; }
.g-cards--grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }

.g-card {
	position: relative; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
	transition: border-color .15s, box-shadow .15s, transform .15s;
}
.g-card:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); box-shadow: var(--shadow); }
.g-card__img {
	display: block; aspect-ratio: 4 / 3; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2);
}
.g-card__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-card__body { display: flex; flex-direction: column; min-width: 0; padding: 2px 4px 2px 0; }
.g-card__rubric { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.g-card__title { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.3; }
.g-card__title a { color: var(--ink); }
.g-card__title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.g-card__title a:hover { color: var(--brand); text-decoration: none; }
.g-card__text { margin: 8px 0 0; color: var(--ink-2); font-size: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.g-card__meta { margin-top: auto; padding-top: 10px; display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.g-card__meta a { position: relative; z-index: 1; }
.g-card__meta span { display: inline-flex; align-items: center; gap: 5px; }
.g-card__meta svg { width: 15px; height: 15px; opacity: .8; }
.g-card__stat { margin-top: 8px; font: 12px var(--font-mono); color: var(--muted); }

.g-cards--grid .g-card, .g-card--v { grid-template-columns: 1fr; gap: 12px; }
.g-cards--grid .g-card__title, .g-card--v .g-card__title { font-size: 17px; }

/* Компактные: похожие статьи */
.g-card--mini { grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 10px; }
.g-card--mini .g-card__title { font-size: 15px; font-weight: 600; }
.g-card--mini .g-card__meta { padding-top: 6px; }
.g-aside .g-card--mini { grid-template-columns: 84px minmax(0, 1fr); }

@media (max-width: 640px) {
	.g-card { grid-template-columns: 112px minmax(0, 1fr); gap: 12px; padding: 10px; }
	.g-card__title { font-size: 16px; }
	.g-card__text { display: none; }
	.g-cards--grid { grid-template-columns: 1fr; gap: 12px; }
	.g-cards--grid .g-card { grid-template-columns: 112px minmax(0, 1fr); }
}

/* ---------- Главная ---------- */

.g-hero {
	position: relative; overflow: hidden;
	/* светлый: лёгкое голубое свечение из градиента логотипа */
	background:
		radial-gradient(900px 420px at 88% -10%, rgba(0, 204, 252, .20), transparent 65%),
		radial-gradient(700px 360px at 60% 120%, rgba(20, 20, 166, .08), transparent 70%),
		var(--hero-bg);
	padding: 48px 0 64px;
}
.g-hero::before {
	/* миллиметровка — отсылка к инженерному чертежу */
	content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
	background-image:
		linear-gradient(rgba(20, 20, 166, .07) 1px, transparent 1px),
		linear-gradient(90deg, rgba(20, 20, 166, .07) 1px, transparent 1px),
		linear-gradient(rgba(20, 20, 166, .035) 1px, transparent 1px),
		linear-gradient(90deg, rgba(20, 20, 166, .035) 1px, transparent 1px);
	background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
	mask-image: linear-gradient(100deg, transparent 20%, #000 75%);
	-webkit-mask-image: linear-gradient(100deg, transparent 20%, #000 75%);
}
.g-hero .g-container { position: relative; }
.g-hero__kicker { font: 600 12px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.g-hero h1 { color: var(--ink); margin: 14px 0 0; font-size: clamp(28px, 4.4vw, 48px); font-weight: 800; max-width: 760px; line-height: 1.1; }
.g-hero p { margin: 14px 0 0; color: var(--muted); font-size: 17px; max-width: 620px; }
.g-hero .g-search { margin: 28px 0 0; max-width: 620px; }
.g-hero .g-search input { height: 54px; font-size: 16px; padding-left: 20px; background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow); }
.g-hero .g-search button { width: 46px; height: 46px; top: 4px; right: 4px; background: var(--grad); color: #fff; }
.g-hero .g-search button:hover { background: var(--azure); color: #fff; }
.g-hero__hints { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.g-hero__hints a { color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
.g-hero__hints a:hover { border-color: var(--brand); text-decoration: none; color: var(--brand); }

.g-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-top: -28px; position: relative; }
.g-tile {
	display: flex; flex-direction: column; gap: 10px; padding: 16px;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
	color: var(--ink) !important; text-decoration: none !important;
	transition: transform .15s, border-color .15s;
}
.g-tile:hover { transform: translateY(-2px); border-color: var(--brand); }
.g-tile__ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.g-tile__ic svg { width: 22px; height: 22px; }
.g-tile b { font-size: 15px; line-height: 1.25; }
.g-tile small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
@media (max-width: 1000px) { .g-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) {
	.g-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
	.g-tile { padding: 12px; }
	.g-tile small { display: none; }
}

.g-calcs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.g-calc {
	display: flex; align-items: center; gap: 10px; padding: 12px 14px;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
	color: var(--ink) !important; font-weight: 600; font-size: 14.5px; text-decoration: none !important;
}
.g-calc:hover { border-color: var(--accent); }
.g-calc::before {
	content: "="; flex-shrink: 0; width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center;
	background: var(--accent-soft); color: var(--accent); font: 700 16px/1 var(--font-mono);
}

.g-about { margin-top: 48px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-2); }
.g-about h2 { margin: 0 0 10px; font-size: 20px; }
.g-about p { margin: 0; }

/* ---------- Статья ---------- */

.g-article { min-width: 0; }
.g-article__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.g-chip {
	display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px;
	background: var(--brand-soft); color: var(--brand) !important; font-size: 13.5px; font-weight: 600; text-decoration: none !important;
}
.g-chip:hover { background: var(--brand); color: var(--on-brand) !important; }
.g-chip--ghost { background: transparent; border: 1px solid var(--line); color: var(--ink-2) !important; font-weight: 500; }
.g-chip--ghost:hover { border-color: var(--brand); background: transparent; color: var(--brand) !important; }

.g .g-toc { margin: 4px 0 28px; padding: 14px 18px 10px; background: var(--surface-2); border-radius: var(--radius); }
.g .g-toc__title { margin-bottom: 4px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.g .g-toc ol { list-style: none; counter-reset: toc; margin: 0; padding: 0; }
.g .g-toc li { counter-increment: toc; display: flex; align-items: baseline; gap: 10px; margin: 0; padding: 6px 0; font-size: 15px; line-height: 1.4; break-inside: avoid; }
.g .g-toc li::before {
	content: counter(toc); flex: 0 0 22px; height: 22px; border-radius: 6px; text-align: center;
	background: var(--surface); color: var(--brand); font: 600 12px/22px var(--font-mono);
}
.g .g-toc a { color: var(--ink-2); }
.g .g-toc a:hover { color: var(--brand); }
/* две колонки — только для длинного оглавления (класс ставит js/v2.js) */
.g .g-toc--cols ol { columns: 2 260px; column-gap: 28px; }

.g-body { font-size: 18px; line-height: 1.7; color: var(--ink); overflow-wrap: break-word; }
.g-body > *:first-child { margin-top: 0; }
.g-body p { margin: 0 0 1.05em; }
.g-body h2 { font-size: 27px; font-weight: 800; margin: 1.8em 0 .6em; scroll-margin-top: 16px; }
.g-body h3 { font-size: 21px; font-weight: 700; margin: 1.5em 0 .5em; scroll-margin-top: 16px; }
.g-body h4 { font-size: 18px; margin: 1.3em 0 .4em; }
.g-body ul, .g-body ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.g-body li { margin: .3em 0; }
.g-body li::marker { color: var(--brand); }
.g-body img { display: block; margin: 1.2em auto; border-radius: var(--radius-sm); }
.g-body figure { margin: 1.4em 0; }
.g-body figcaption { font-size: 14px; color: var(--muted); text-align: center; margin-top: 6px; }
.g-body blockquote { margin: 1.4em 0; padding: 14px 20px; background: var(--brand-soft); border-left: 4px solid var(--brand); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.g-body blockquote p:last-child { margin-bottom: 0; }
.g-body hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.g-body code { font: .88em var(--font-mono); background: var(--surface-2); padding: 2px 5px; border-radius: 4px; }
.g-body iframe, .g-body video { max-width: 100%; }
.g-body table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: 15.5px; line-height: 1.45; background: var(--surface); }
.g-body th, .g-body td { padding: 10px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.g-body th, .g-body thead td { background: var(--surface-2); font-weight: 700; }
.g-body .table-responsive, .g-body .table-wrap, .g-body .article_table_wrapper { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1.2em 0; }
.g-body .table-responsive table, .g-body .table-wrap table, .g-body .article_table_wrapper table { margin: 0; min-width: 520px; }
/* блоки из шаблона обновлённых статей (docs/content/TEMPLATE.md) */
.g-body .toc { margin: 1.2em 0 1.6em; padding: 14px 18px; background: var(--surface-2); border-radius: var(--radius); font-size: 15.5px; line-height: 1.5; }
.g-body .toc > p:first-child { margin: 0 0 4px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.g-body .toc ol { list-style: none; counter-reset: toc; margin: 0; padding: 0; }
.g-body .toc ol > li { counter-increment: toc; display: flex; align-items: baseline; gap: 10px; margin: 0; padding: 6px 0; font-size: 15px; line-height: 1.4; break-inside: avoid; }
.g-body .toc ol > li::before {
	content: counter(toc); flex: 0 0 22px; height: 22px; border-radius: 6px; text-align: center;
	background: var(--surface); color: var(--brand); font: 600 12px/22px var(--font-mono);
}
.g-body .toc a { color: var(--ink-2); }
.g-body .toc a:hover { color: var(--brand); }
.g-body .toc ul { margin: 6px 0 0; }
@media (min-width: 700px) { .g-body .toc ol:has(> li:nth-child(7)) { columns: 2 260px; column-gap: 28px; } }
.g-body .article-meta { font-size: 14px; color: var(--muted); margin-bottom: 1.2em; }
.g-body .text-danger { color: #c0392b; }
@media (max-width: 640px) {
	.g-body { font-size: 17px; }
	.g-body h2 { font-size: 23px; }
	.g-body h3 { font-size: 19px; }
}

.g-author { display: flex; align-items: center; gap: 12px; margin: 32px 0 0; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.g-author .block-ava, .g-author .ava-arial { width: 48px; height: 48px; border-radius: 50%; overflow: hidden; }
.g-author .ava-arial img { width: 48px; height: 48px; object-fit: cover; }
.g-author small { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.g-author b a { color: var(--ink); }
.g-author__logo img { width: 48px; height: 48px; object-fit: contain; }

/* «Поделиться» в строке мета статьи: только кнопка, сервисы — во всплывающем списке */
.g-share-top { margin-left: auto; }
.g-share-top .ya-share2__container_size_s .ya-share2__badge { border-radius: 50%; }

/* Опрос «Статья была полезной?» */
.g-useful { margin: 28px 0 0; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-size: 15px; }
.g-useful__q, .g-useful__why { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.g-useful__q span, .g-useful__why span { font-weight: 600; color: var(--ink); margin-right: 4px; }
.g-useful .g-btn { height: 36px; padding: 0 18px; }
.g-useful .g-chip { cursor: pointer; font-family: inherit; }
.g-useful__thanks { font-weight: 600; color: var(--brand); }
.g-useful[hidden], .g-useful [hidden] { display: none; }
@media (max-width: 640px) { .g-useful__q span, .g-useful__why span { flex-basis: 100%; } }

/* Липкое оглавление в правой колонке (десктоп): текущий раздел, по клику — весь список */
.g-toc-mini { margin: 0 0 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; }
.g-toc-mini__btn {
	display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 14px; border: 0; background: none; cursor: pointer;
	font: inherit; color: var(--ink); text-align: left;
}
.g-toc-mini__btn small { flex: none; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.g-toc-mini__cur { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.g-toc-mini__btn::after { content: "▾"; flex: none; color: var(--muted); transition: transform .15s; }
.g-toc-mini.is-open .g-toc-mini__btn::after { transform: rotate(180deg); }
.g-toc-mini ol { list-style: none; margin: 0; padding: 4px 14px 10px; max-height: 50vh; overflow-y: auto; border-top: 1px solid var(--line); }
.g-toc-mini li a { display: block; padding: 5px 0; color: var(--ink-2); line-height: 1.35; }
.g-toc-mini li a:hover, .g-toc-mini li a.is-active { color: var(--brand); }

.g-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 0; }

.g-share { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 24px 0 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.g-share__label { font-weight: 600; font-size: 15px; }
.g-admin-links { display: flex; gap: 16px; font-size: 14px; }

.g-related { margin-top: 36px; }
.g-related .g-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .g-cat-more .g-cards { grid-template-columns: 1fr; } }

/* Калькулятор по теме статьи */
.g-calc-cta {
	display: flex; align-items: center; gap: 14px; margin: 28px 0 0; padding: 16px 18px;
	background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); border-radius: var(--radius);
	color: var(--ink) !important; text-decoration: none !important; transition: border-color .15s, box-shadow .15s;
}
.g-calc-cta:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.g-calc-cta svg { flex: none; width: 32px; height: 32px; color: var(--brand); }
.g-calc-cta span { flex: 1; font-size: 15px; color: var(--ink-2); }
.g-calc-cta b { display: block; color: var(--ink); font-size: 16px; }
.g-calc-cta .g-calc-cta__go { flex: none; font-size: 22px; color: var(--brand); }

/* Прогресс чтения и «Наверх» (статья) */
.g-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; pointer-events: none; }
.g-progress span { display: block; height: 100%; width: 100%; background: var(--brand); transform-origin: 0 50%; transform: scaleX(0); }
.g-to-top {
	position: fixed; right: 16px; bottom: 20px; z-index: 55; width: 44px; height: 44px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center; cursor: pointer;
	background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.g-to-top[hidden] { display: none; }
.g-to-top:hover { color: var(--brand); border-color: var(--brand); }
.g-to-top svg { width: 20px; height: 20px; }
@media (max-width: 640px) { .g-related .g-cards { grid-template-columns: 1fr; } }

.g-aside__title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 12px; }
.g-aside .g-cards { gap: 10px; }

/* ---------- Рубрики ---------- */

.g-subnav { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 20px; }
.g-subnav .g-chip { flex: none; white-space: nowrap; }
.g-rubric-all { margin-top: 20px; }

.g-sub { margin-top: 36px; }
.g-sub .g-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .g-sub .g-cards { grid-template-columns: 1fr; } }

/* Мобильный: чипы подразделов в одну строку с прокруткой, блоки подразделов — лентой по 3 карточки */
@media (max-width: 640px) {
	.g-subnav {
		flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
		margin-left: -16px; margin-right: -16px; padding: 0 16px 4px; scroll-padding: 0 16px;
	}
	.g-subnav::-webkit-scrollbar { display: none; }
	.g-sub { margin-top: 28px; }
	.g-sub .g-cards {
		grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 72%;
		overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain;
		margin: 0 -16px; padding: 0 16px 4px; scroll-padding: 0 16px;
	}
	.g-sub .g-cards::-webkit-scrollbar { display: none; }
	.g-sub .g-cards .g-card { grid-template-columns: 1fr; gap: 10px; scroll-snap-align: start; }
	.g-sub .g-cards .g-card__title { font-size: 15px; }
}

.g-rubrics { columns: 3 280px; column-gap: 20px; }
.g-rubric {
	break-inside: avoid; margin: 0 0 20px; padding: 18px 20px;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.g-rubric__title { display: block; font-size: 18px; font-weight: 700; color: var(--ink) !important; margin-bottom: 8px; }
.g-rubric__title:hover { color: var(--brand) !important; }
.g-rubric ul { list-style: none; margin: 0; padding: 0; }
.g-rubric li a { display: block; padding: 5px 0; color: var(--ink-2); font-size: 15px; border-top: 1px dashed var(--line); }
.g-rubric li:first-child a { border-top: 0; }
.g-rubric li a:hover { color: var(--brand); }

/* Правовые страницы (views/v2/tpl/privacy, use_legal): текст из v1, заголовок — в H1 страницы */
.g-legal { max-width: 820px; font-size: 16px; }
.g-legal .post > h4:first-child { display: none; }
.g-legal h5 { font-size: 19px; font-weight: 700; margin: 1.6em 0 .5em; }
.g-legal ol > li > strong { font-size: 19px; }
.g-legal ol:has(> li > strong:only-child) { padding-left: 1.2em; margin: 1.6em 0 .5em; }

.g-text-bottom { margin-top: 36px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-2); font-size: 16px; }
.g-text-bottom h2 { font-size: 20px; margin-top: 0; }

/* Пагинация (libraries/Pagin.php отдаёт ul.pagination) */
.g .pagination { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 32px 0 0; padding: 0; }
.g .pagination li a {
	display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 12px;
	background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
	color: var(--ink); font-weight: 600; font-size: 15px; text-decoration: none;
}
.g .pagination li a:hover { border-color: var(--brand); color: var(--brand); }
.g .pagination li.active a, .g .pagination li a.active { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.g .pagination li.disabled a { opacity: .45; pointer-events: none; }

/* ---------- Профиль автора ---------- */

.g-author-page { padding-top: 24px; }
.g-author-page__crumbs { margin-bottom: 16px; }
.g-author-card {
	display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 28px; align-items: center;
	padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
	background-image: radial-gradient(600px 220px at 100% 0%, rgba(0, 204, 252, .10), transparent 70%);
}
.g-author-card__ava { position: relative; width: 112px; height: 112px; }
.g-author-card__ava img { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; background: var(--surface-2); box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--brand-soft); }
.g-author-card__ava-edit {
	position: absolute; right: 0; bottom: 0; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
	background: var(--brand); color: var(--on-brand) !important; box-shadow: 0 0 0 3px var(--surface);
}
.g-author-card__ava-edit svg { width: 16px; height: 16px; }
.g-author-card__role { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.g-author-card__name { margin: 6px 0 0; font-size: clamp(24px, 3vw, 34px); font-weight: 800; }
.g-author-card__descr { margin-top: 10px; color: var(--ink-2); max-width: 720px; }
.g-author-card__descr p { margin: 0 0 .5em; }
.g-author-card__stats { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 14px; font-size: 14.5px; color: var(--muted); }
.g-author-card__stats b { color: var(--ink); font-size: 16px; }
.g-author-card__actions { align-self: start; }
@media (max-width: 760px) {
	.g-author-card { grid-template-columns: 1fr; gap: 16px; padding: 22px 18px; text-align: center; justify-items: center; }
	.g-author-card__ava, .g-author-card__ava img { width: 96px; height: 96px; }
	.g-author-card__stats { justify-content: center; }
	.g-author-card__actions { align-self: auto; }
}

.g-tabs { display: flex; gap: 4px; margin: 20px 0 0; border-bottom: 1px solid var(--line); }
.g-tabs a {
	display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: -1px;
	color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; text-decoration: none !important;
}
.g-tabs a:hover { color: var(--brand); }
.g-tabs a.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.g-tabs a span { min-width: 24px; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12.5px; line-height: 22px; text-align: center; }
.g-tabs a.is-active span { background: var(--brand-soft); color: var(--brand); }

.g-author-page__list { padding-top: 24px; }
.g-author-page__own { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.g-author-page__own p { margin: 0; color: var(--ink-2); }
.g-companies { display: flex; flex-wrap: wrap; gap: 10px; }
.g-company { padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink) !important; font-weight: 600; }
.g-company:hover { border-color: var(--brand); text-decoration: none !important; }
.g-muted { color: var(--muted); }

/* ---------- Калькуляторы ---------- */

.g-calc-box { padding: 20px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; font-size: 15px; }
/* форма калькулятора приходит со стороннего скрипта calc.breegs.ru — приводим поля к общему виду */
.g-calc-box h1, .g-calc-box h2, .g-calc-box h3 { margin: 0 0 12px; font-size: 20px; }
.g-calc-box label, .g-calc-box b { color: var(--ink-2); }
.g-calc-box input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]), .g-calc-box select {
	display: block; width: 100%; max-width: 380px; height: 40px; margin: 4px 0 12px; padding: 0 12px;
	border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink); font: inherit;
}
.g-calc-box button, .g-calc-box input[type="button"], .g-calc-box input[type="submit"] {
	height: 44px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--grad); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
/* сетка виджета размечена классами Bootstrap (col-sm-5 / col-sm-7, hidden-xs / visible-xs), а Bootstrap в v2 не подключён */
.g-calc-box .form-params .caption { font-size: 14px; color: var(--ink-2); }
.g-calc-box .table-order { width: 100%; border-collapse: collapse; font-size: 14px; }
.g-calc-box .table-order td { padding: 7px 8px; border: 1px solid var(--line); vertical-align: top; }
.g-calc-box .table-order thead td, .g-calc-box .table-order tfoot td { background: var(--surface-2) !important; color: var(--ink) !important; font-weight: 600; }
.g-calc-box .text-center { text-align: center; }
.g-calc-box .g-ad--calc { margin: 20px 0 0; }
.g-calc-box .form-info { margin-top: 8px; font-size: 14px; color: var(--muted); }
@media (min-width: 900px) {
	.g-calc-box { overflow: visible; } /* иначе не работает sticky у сметы */
	.g-calc-box .visible-s, .g-calc-box .visible-m, .g-calc-box .visible-xs { display: none !important; }
	.g-calc-box #calc > .row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px; align-items: start; }
	.g-calc-box #calc > .row > * { min-width: 0; }
	.g-calc-box .col-result { position: sticky; top: 16px; }
	.g-calc-box .form-params .field { display: block; } /* у последних полей виджет задаёт свою раскладку */
	.g-calc-box .form-params .field input:not([type="checkbox"]):not([type="radio"]), .g-calc-box .form-params .field select { max-width: none; }
}
@media (max-width: 899px) {
	.g-calc-box .hidden-s, .g-calc-box .hidden-m, .g-calc-box .hidden-xs { display: none !important; }
	.g-calc-box .col-result { margin-top: 20px; overflow-x: auto; }
}
.g-note { margin: 16px 0 0; padding: 12px 16px; background: var(--accent-soft); border-radius: var(--radius-sm); font-size: 15px; color: var(--ink-2); }

/* ---------- 404 ---------- */

.g-404 { text-align: center; padding: 48px 0 24px; }
.g-404__code { font: 800 clamp(72px, 14vw, 140px)/1 var(--font-mono); color: var(--brand); letter-spacing: -.04em; }
.g-404 h1 { font-size: clamp(22px, 3vw, 30px); margin: 12px 0 8px; }
.g-404 p { color: var(--muted); margin: 0 auto; max-width: 520px; }
.g-404 .g-search { margin: 28px auto 0; }

/* ---------- Поиск (welcome/search) ---------- */

.g-searchpage { max-width: 860px; }
.g-search--page { max-width: 640px; margin: 8px 0 0; }
.g-search--page input { height: 54px; font-size: 16px; padding-left: 20px; background: var(--surface); box-shadow: var(--shadow); }
.g-search--page button { width: 46px; height: 46px; top: 4px; right: 4px; background: var(--grad); color: #fff; }
.g-search--page button:hover { background: var(--azure); color: #fff; }
.g-searchpage__hint { margin: 10px 0 0 20px; font-size: 14px; color: var(--muted); }
.g-searchpage__result { margin-top: 28px; }
.g-searchpage__result > .g-note { margin: 0 0 16px; }
.g-searchpage__count { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.g-searchpage__empty { padding: 24px; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.g-searchpage__empty p { margin: 0 0 8px; }
.g-searchpage__empty p:last-child { margin: 16px 0 0; }
.g-btn {
	display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 20px;
	border: 0; border-radius: 999px; background: var(--brand); color: var(--on-brand) !important; font-weight: 600; cursor: pointer; text-decoration: none !important;
}
.g-btn:hover { background: var(--brand-2); }
.g-btn--ghost { background: transparent; border: 1px solid var(--line); color: var(--ink) !important; }
.g-btn--ghost:hover { background: var(--surface-2); }

/* ---------- Подвал ---------- */

.g-foot { background: var(--nav-bg); color: var(--nav-muted); padding: 44px 0 24px; font-size: 14.5px; }
.g-foot a { color: var(--nav-ink); }
.g-foot a:hover { color: #fff; }
.g-foot__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
.g-foot h3 { color: #fff; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 12px; }
.g-foot ul { list-style: none; margin: 0; padding: 0; }
.g-foot li { margin: 7px 0; }
.g-foot .g-logo { color: #fff !important; }
.g-foot .g-logo__name { color: #fff; }
.g-foot .g-logo__tag { color: var(--nav-muted); display: block; }
.g-foot__about { margin: 14px 0 0; max-width: 320px; line-height: 1.5; }
.g-foot__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 36px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 13px; }
@media (max-width: 860px) { .g-foot__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .g-foot__grid { grid-template-columns: 1fr; gap: 24px; } }

/* ---------- Уведомления, cookie ---------- */

.g-cookie {
	position: fixed; left: 16px; bottom: 16px; z-index: 50; max-width: 400px;
	display: flex; flex-direction: column; gap: 12px; padding: 18px 20px;
	background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
	font-size: 14px;
}
.g-cookie .g-btn { height: 40px; }
@media (max-width: 480px) { .g-cookie { left: 8px; right: 8px; bottom: 8px; max-width: none; } }

/* Старые шаблоны внутри нового каркаса (страницы без версии v2) */
.g-legacy { padding-top: 20px; }
.g-legacy .container { width: auto; padding: 0; }

/* Модальные окна Bootstrap (вход, формы; шаблон tpl/tpl_modal) — под дизайн v2 и тему */
.modal-backdrop.in { opacity: .5; background: #0b0c22; }
@supports (backdrop-filter: blur(4px)) { .modal-backdrop.in { opacity: 1; background: rgba(11, 12, 34, .5); backdrop-filter: blur(4px); } }
.modal-dialog { margin: 16px; }
.modal-content {
	background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 20px;
	box-shadow: 0 24px 64px rgba(10, 12, 40, .28); font-family: var(--font); overflow: hidden;
}
.modal.in .modal-dialog { animation: g-modal-in .22s cubic-bezier(.2, .8, .3, 1); }
@keyframes g-modal-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@media (prefers-reduced-motion: reduce) { .modal.in .modal-dialog { animation: none; } }
.modal-header { display: flex; flex-direction: row-reverse; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 16px 24px; border-bottom: 1px solid var(--line); }
.modal-header .close, .g-login__close {
	flex: none; display: grid; place-items: center; width: 36px; height: 36px; margin: 0; padding: 0;
	border: 0; border-radius: 50%; background: transparent; color: var(--muted); opacity: 1; text-shadow: none; cursor: pointer;
	transition: background .15s, color .15s;
}
.modal-header .close:hover, .g-login__close:hover { background: var(--surface-2); color: var(--ink); }
.modal-header .close svg, .g-login__close svg { width: 20px; height: 20px; }
.modal-title { margin: 0; font-size: 18px; font-weight: 700; color: var(--ink); }
.modal-body { padding: 20px 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line); }
.modal-footer .hide { display: none; }
.modal-footer:not(:has(> :not(.hide))) { display: none; }
.modal-footer .btn {
	height: 40px; padding: 0 18px; border: 1px solid var(--line); border-radius: 999px;
	background: var(--surface); color: var(--ink); font: 600 15px var(--font); cursor: pointer;
}
.modal-footer .btn:hover { background: var(--surface-2); }
@media (min-width: 768px) {
	.modal-dialog { margin: 8vh auto 30px; }
	.modal-xs { width: 420px; }
	.modal-md { width: 600px; }
}

/* ---------- Комментарии ---------- */

.g-comments { margin: 32px 0 0; padding: 22px 24px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.g-comments__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.g-comments__title { margin: 0; font-size: 22px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.g-comments__count { min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font: 700 13px/26px var(--font); text-align: center; }

/* список: разметку комментария строит Com.tpl в common.js (таблица user-preview) */
.g-comments .list { margin: 12px 0 0; }
.g-comments .com { padding: 16px 0; border-top: 1px solid var(--line); }
.g-comments .com:first-child { border-top: 0; padding-top: 8px; }
.g-comments .com .user-preview, .g-comments .com .user-preview tbody, .g-comments .com .user-preview tr { display: flex; align-items: center; gap: 12px; border: 0; margin: 0; }
.g-comments .com .user-preview td { display: block; padding: 0; border: 0; }
.g-comments .com .ava img { display: block; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.g-comments .com .user a { color: var(--ink); font-weight: 700; font-size: 15px; }
.g-comments .com .date { color: var(--muted); font-size: 13px; }
.g-comments .com > .body { margin: 10px 0 0 52px; font-size: 16px; line-height: 1.6; color: var(--ink-2); overflow-wrap: break-word; }
.g-comments .com > .body p { margin: 0 0 .6em; }
.g-comments .com > .body p:last-child { margin-bottom: 0; }
@media (max-width: 560px) { .g-comments .com > .body { margin-left: 0; } }

.g-comments__empty { display: flex; align-items: center; gap: 14px; margin: 14px 0 0; padding: 16px 18px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink-2); font-size: 15px; }
.g-comments__empty[hidden] { display: none; }
.g-comments__empty svg { width: 28px; height: 28px; flex-shrink: 0; color: var(--brand); }
.g-comments__empty b { display: block; color: var(--ink); }

/* Поле ввода как в мессенджере */
.g-composer { display: flex; align-items: flex-end; gap: 10px; margin-top: 18px; }
.g-composer__ava { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; margin-bottom: 4px; background: var(--surface-2); }
.g-composer__box {
	flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 6px;
	padding: 5px 5px 5px 16px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-2);
	transition: border-color .15s, background .15s, box-shadow .15s;
}
.g-composer__box:focus-within { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px var(--brand-soft); }
.g-composer__input {
	flex: 1; min-width: 0; min-height: 34px; max-height: 180px; padding: 6px 0; resize: none; overflow-y: auto;
	border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 16px; line-height: 22px;
}
.g-composer__input::placeholder { color: var(--muted); }
.g-composer__send {
	width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer;
	background: var(--grad); color: #fff; transition: opacity .15s, transform .1s;
}
.g-composer__send svg { width: 17px; height: 17px; margin-left: -2px; }
.g-composer__send:disabled { opacity: .35; cursor: default; }
.g-composer__send:not(:disabled):active { transform: scale(.92); }
.g-composer.is-sending .g-composer__send { opacity: .5; }
.g-composer__hint { margin: 6px 0 0 46px; font-size: 12px; color: var(--muted); }
.g-composer__error { margin: 6px 0 0 46px; font-size: 13px; color: #c0392b; }
.g-composer__error[hidden] { display: none; }
@media (pointer: coarse) { .g-composer__hint { display: none; } }

.g-comments__auth { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 15px; }
.g-comments__auth-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.g-comments__auth .g-btn { height: 40px; }
@media (max-width: 640px) { .g-comments { padding: 18px 16px 20px; } }

/* ---------- Вход: Яндекс ID (/login/yandex), VK ID (/login/vk) и страница входа ---------- */

.g-ya-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 48px; padding: 0 22px;
	border-radius: 999px; background: #000; color: #fff !important; font-weight: 600; text-decoration: none !important; white-space: nowrap;
}
.g-ya-btn:hover { background: #26262b; }
.g-ya-btn__logo { width: 24px; height: 24px; flex: none; }
.g-ya-btn--sm { height: 40px; padding: 0 18px; gap: 8px; font-size: 15px; }
.g-ya-btn--sm .g-ya-btn__logo { width: 20px; height: 20px; }
[data-theme="dark"] .g-ya-btn { background: #fff; color: #000 !important; }
[data-theme="dark"] .g-ya-btn:hover { background: #e6e6ea; }

.g-vk-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 48px; padding: 0 22px;
	border-radius: 999px; background: #0077ff; color: #fff !important; font-weight: 600; text-decoration: none !important; white-space: nowrap;
}
.g-vk-btn:hover { background: #0066db; }
.g-vk-btn__logo { width: 24px; height: 24px; flex: none; }
.g-vk-btn--sm { height: 40px; padding: 0 18px; gap: 8px; font-size: 15px; }
.g-vk-btn--sm .g-vk-btn__logo { width: 20px; height: 20px; }

.g-login {
	position: relative; max-width: 420px; margin: 8px auto 40px; padding: 32px 28px 24px;
	display: flex; flex-direction: column; gap: 20px;
	background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
}
.g-login .g-ya-btn, .g-login .g-vk-btn { width: 100%; height: 52px; font-size: 16px; transition: background .15s, transform .1s; }
.g-login .g-ya-btn:active, .g-login .g-vk-btn:active { transform: scale(.98); }
.g-login__close { position: absolute; top: 12px; right: 12px; }
.g-login__head { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.g-login__mark { width: 56px; height: 56px; padding: 8px; border-radius: 18px; background: var(--brand-soft); box-sizing: content-box; }
.g-login__title { margin: 6px 0 0; font-size: 24px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); line-height: 1.2; }
.g-login__lead { margin: 0; max-width: 320px; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.g-login__providers { display: flex; flex-direction: column; gap: 10px; }
.g-login__note {
	display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px;
	background: var(--surface-2); border-radius: 12px; color: var(--ink-2); font-size: 13.5px; line-height: 1.45;
}
.g-login__note svg { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--accent); }
.g-login__note p { margin: 0; }
.g-login__note b { color: var(--ink); font-weight: 600; }
.g-login__legal { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; text-align: center; }
.g-login__legal a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.g-login__legal a:hover { color: var(--ink); }
/* В модальном окне карточка — само окно: шапку и подвал tpl_modal прячем */
.g-login--modal { margin: 0; max-width: none; padding: 36px 28px 24px; border: 0; border-radius: 0; box-shadow: none; background: none; }
.modal-content:has(.g-login--modal) > .modal-header,
.modal-content:has(.g-login--modal) > .modal-footer { display: none; }
.modal-content:has(.g-login--modal) > .modal-body { padding: 0; }
@media (max-width: 480px) { .g-login { padding: 28px 18px 20px; } .g-login--modal { padding: 36px 20px 20px; } }
