/* ═══════════════════════════════════════════════ */
/* ПЕРЕМЕННЫЕ И БАЗА — из проекта «Тренажёр счёта» */
/* ═══════════════════════════════════════════════ */

:root {
	--bg: #f1f5f9;
	--card: #ffffff;
	--text: #0f172a;
	--muted: #64748b;
	--accent: #0284c7;
	--accent-dark: #0369a1;
	--accent-light: #e0f2fe;
	--key: #e2e8f0;
	--border: #dce7ef;
	--border-hover: #b0c8d8;
	--shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
	--shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.06);
	--shadow-md: 0 4px 14px rgba(15, 23, 42, 0.07);
	--shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.2);
	--shadow-accent: rgba(2, 132, 199, 0.18);
	--font-family: 'Segoe UI', Arial, sans-serif;
	--transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	--header-height: 72px;
	--policy-toc-width: 350px;
	--scrollbar-width: 0;
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

body {
	font-family: var(--font-family);
	background: var(--bg);
	color: var(--text);
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	line-height: 1.6;
}

	body.is-locked {
		position: fixed;
		left: 0;
		right: 0;
		width: 100%;
		overflow-y: scroll;
		padding-right: var(--scrollbar-width);
	}

	body.has-modal {
		overflow: hidden;
	}

.container {
	max-width: 100%;
	margin: 0 auto;
	padding: 0 10px;
	width: 100%;
}

/* ═══════════════════════════════════════════════ */
/* ХЕДЕР */
/* ═══════════════════════════════════════════════ */

.header {
	background: var(--card);
	border-bottom: 1px solid var(--border);
	position: sticky;
	top: 0;
	z-index: 1000;
	height: var(--header-height);
	box-shadow: var(--shadow-xs);
}

.header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 100%;
	padding: 0 24px;
	gap: 12px;
}

.logo {
	display: flex;
	align-items: center;
	gap: 12px;
	text-decoration: none;
	color: var(--text);
	flex-shrink: 1;
	min-width: 0;
}

.logo-icon {
	width: 48px;
	height: 48px;
	flex-shrink: 0;
	object-fit: contain;
}

.logo-text {
	font-size: 22px;
	font-weight: 800;
	color: var(--accent);
	letter-spacing: 0.3px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	min-width: 0;
}

.header-actions {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
}

.icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	flex-shrink: 0;
	background: transparent;
	border: 0;
	border-radius: 12px;
	color: var(--accent);
	cursor: pointer;
	padding: 0;
	transition: background 0.2s, color 0.2s;
}

	.icon-btn:hover {
		background: var(--accent-light);
		color: var(--accent-dark);
	}

	.icon-btn:focus-visible {
		outline: 2px solid var(--accent);
		outline-offset: 2px;
	}

.icon-btn__icon {
	display: block;
}

.burger {
	display: none;
	position: relative;
	width: 44px;
	height: 44px;
	flex-shrink: 0;
	background: transparent;
	border: 0;
	border-radius: 12px;
	cursor: pointer;
	padding: 0;
	transition: background 0.2s;
}

	.burger:hover {
		background: var(--accent-light);
	}

.burger__line {
	position: absolute;
	left: 50%;
	width: 20px;
	height: 2px;
	background: var(--accent);
	border-radius: 2px;
	transform: translateX(-50%);
	transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease;
}

	.burger__line:nth-child(1) {
		top: 14px;
	}

	.burger__line:nth-child(2) {
		top: 21px;
	}

	.burger__line:nth-child(3) {
		top: 28px;
	}

.burger.is-active .burger__line:nth-child(1) {
	top: 21px;
	transform: translateX(-50%) rotate(45deg);
}

.burger.is-active .burger__line:nth-child(2) {
	opacity: 0;
}

.burger.is-active .burger__line:nth-child(3) {
	top: 21px;
	transform: translateX(-50%) rotate(-45deg);
}

/* ═══════════════════════════════════════════════ */
/* BACKDROP ЗА БУРГЕР-МЕНЮ */
/* ═══════════════════════════════════════════════ */

.toc-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	right: var(--scrollbar-width);
	bottom: 0;
	z-index: 998;
	background: rgba(241, 245, 249, 0.8);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	opacity: 0;
	transition: opacity 0.3s ease;
}

	.toc-backdrop.is-visible {
		opacity: 1;
	}

	.toc-backdrop[hidden] {
		display: none;
	}

/* ═══════════════════════════════════════════════ */
/* ОСНОВНОЙ КОНТЕНТ */
/* ═══════════════════════════════════════════════ */

.main {
	flex: 1;
	padding: 10px 0;
	width: 100%;
}

.main-container {
	max-width: 100%;
	margin: 0 auto;
	padding: 0 10px;
	width: 100%;
}

/* ═══════════════════════════════════════════════ */
/* ФУТЕР */
/* ═══════════════════════════════════════════════ */

.footer {
	background: var(--card);
	border-top: 1px solid var(--border);
	padding: 20px 0;
	margin-top: auto;
	width: 100%;
}

	.footer .container {
		max-width: 100%;
		margin: 0 auto;
		padding: 0 24px;
	}

.footer-text {
	text-align: center;
	font-size: 13px;
	color: var(--muted);
}

/* ═══════════════════════════════════════════════ */
/* LAYOUT + TOC + POLICY */
/* ═══════════════════════════════════════════════ */

.layout {
	display: grid;
	grid-template-columns: var(--policy-toc-width) 1fr;
	gap: 10px;
	align-items: start;
}

.toc {
	position: sticky;
	top: calc(var(--header-height) + 10px);
}

.toc__inner {
	background: var(--card);
	border-radius: 16px;
	box-shadow: var(--shadow-sm);
	padding: 18px 16px;
	border-top: 5px solid var(--accent);
}

.toc__title {
	margin: 0 0 12px;
	font-size: 0.95rem;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--accent-dark);
	padding-bottom: 8px;
	border-bottom: 2px solid var(--accent-light);
}

.toc__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

	.toc__list li {
		margin-bottom: 4px;
	}

	.toc__list a {
		display: block;
		padding: 6px 8px;
		border-radius: 8px;
		font-size: 0.9rem;
		line-height: 1.35;
		color: var(--muted);
		text-decoration: none;
		transition: background 0.15s, color 0.15s;
	}

		.toc__list a:hover {
			background: var(--accent-light);
			color: var(--accent-dark);
		}

		.toc__list a.is-active {
			background: var(--accent);
			color: #fff;
			font-weight: 600;
		}

.policy {
	background: var(--card);
	border-radius: 16px;
	box-shadow: var(--shadow-sm);
	padding: 32px 28px;
	border-top: 5px solid var(--accent);
	min-width: 0;
	overflow-x: hidden;
}

	.policy h1 {
		font-size: 1.75rem;
		line-height: 1.3;
		color: var(--accent);
		margin: 0 0 24px;
		padding-bottom: 16px;
		border-bottom: 2px solid var(--accent-light);
	}

	.policy h2 {
		font-size: 1.25rem;
		line-height: 1.35;
		color: var(--accent-dark);
		margin: 36px 0 14px;
		padding-left: 12px;
		border-left: 4px solid var(--accent);
		scroll-margin-top: calc(var(--header-height) + 24px);
	}

	.policy p {
		margin: 0 0 12px;
	}

	.policy strong {
		color: var(--text);
	}

	.policy ul {
		margin: 0 0 16px;
		padding-left: 22px;
	}

	.policy li {
		margin-bottom: 8px;
	}

	.policy a {
		color: var(--accent);
		text-decoration: none;
		border-bottom: 1px solid rgba(2, 132, 199, 0.3);
		transition: border-color 0.2s, color 0.2s;
		word-wrap: break-word;
	}

		.policy a:hover {
			color: var(--accent-dark);
			border-bottom-color: var(--accent-dark);
		}

.table-wrap {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	margin: 16px 0 8px;
	border-radius: 12px;
	border: 1px solid var(--border);
}

.policy table {
	width: 100%;
	min-width: 520px;
	border-collapse: collapse;
	font-size: 0.95rem;
}

.policy th,
.policy td {
	padding: 12px 14px;
	text-align: left;
	vertical-align: top;
	border-bottom: 1px solid var(--border);
}

.policy tr:last-child td {
	border-bottom: none;
}

.policy td:first-child {
	width: 24%;
	font-weight: 700;
	color: var(--accent-dark);
	background: var(--accent-light);
}

.policy tr:nth-child(even) td:last-child {
	background: #fafbfc;
}

@media (max-width: 560px) {
	.table-wrap {
		border: none;
		overflow: visible;
	}

	.policy table, .policy thead, .policy tbody, .policy tr, .policy td {
		display: block;
		width: 100%;
		min-width: 0;
	}

	.policy tr {
		margin-bottom: 14px;
		border: 1px solid var(--border);
		border-radius: 12px;
		overflow: hidden;
		background: var(--card);
	}

	.policy td {
		border-bottom: 1px solid var(--border);
	}

	.policy tr td:last-child {
		border-bottom: none;
	}

	.policy td:first-child {
		width: 100%;
		display: block;
		background: var(--accent-light);
	}
}

.footer-note {
	margin-top: 36px;
	padding-top: 18px;
	border-top: 1px solid var(--border);
	font-size: 0.9rem;
	color: var(--muted);
}

.footer-note p {
	margin: 0 0 6px;
}

.footer-note p:last-child {
	margin-bottom: 0;
}

.print-stamp {
	display: none;
}

/* ═══════════════════════════════════════════════ */
/* МОДАЛЬНОЕ ОКНО */
/* ═══════════════════════════════════════════════ */

.modal-backdrop {
	position: fixed;
	inset: 0;
	z-index: 2000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(15, 23, 42, 0.45);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	opacity: 0;
	transition: opacity 0.25s ease;
}

	.modal-backdrop.is-visible {
		opacity: 1;
	}

	.modal-backdrop[hidden] {
		display: none;
	}

.modal {
	width: 100%;
	max-width: 420px;
	background: var(--card);
	border-radius: 20px;
	border-top: 5px solid var(--accent);
	box-shadow: var(--shadow-lg);
	padding: 22px 22px 20px;
	transform: translateY(10px) scale(0.98);
	opacity: 0;
	transition: transform 0.25s ease, opacity 0.25s ease;
}

.modal-backdrop.is-visible .modal {
	transform: translateY(0) scale(1);
	opacity: 1;
}

.modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 8px;
}

.modal__title {
	font-size: 1.15rem;
	font-weight: 800;
	color: var(--accent-dark);
	margin: 0;
}

.modal__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background: transparent;
	border: none;
	border-radius: 10px;
	color: var(--muted);
	cursor: pointer;
	padding: 0;
	transition: background 0.2s, color 0.2s;
}

	.modal__close:hover {
		background: var(--accent-light);
		color: var(--accent-dark);
	}

	.modal__close:focus-visible {
		outline: 2px solid var(--accent);
		outline-offset: 2px;
	}

.modal__text {
	font-size: 0.92rem;
	color: var(--muted);
	margin: 0 0 16px;
}

.modal__options {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.format-btn {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	padding: 14px 16px;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: 14px;
	cursor: pointer;
	text-decoration: none;
	text-align: left;
	font-family: inherit;
	transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}

	.format-btn:hover {
		border-color: var(--accent);
		background: var(--accent-light);
		box-shadow: 0 4px 14px var(--shadow-accent);
	}

	.format-btn:active {
		transform: scale(0.99);
	}

	.format-btn:focus-visible {
		outline: 2px solid var(--accent);
		outline-offset: 2px;
	}

.format-btn__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	flex-shrink: 0;
	border-radius: 12px;
	color: var(--accent);
	background: var(--accent-light);
	transition: background 0.2s, color 0.2s;
}

.format-btn:hover .format-btn__icon {
	background: var(--accent);
	color: #fff;
}

.format-btn__letter {
	display: block;
	font-family: var(--font-family);
	font-weight: 800;
	font-size: 22px;
	line-height: 1;
	letter-spacing: -0.5px;
	color: inherit;
}

.format-btn__body {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.format-btn__title {
	font-size: 1rem;
	font-weight: 700;
	color: var(--text);
	line-height: 1.2;
}

.format-btn__ext {
	font-size: 0.82rem;
	color: var(--muted);
	margin-top: 2px;
}

/* ═══════════════════════════════════════════════ */
/* АДАПТИВНОСТЬ */
/* ═══════════════════════════════════════════════ */

@media (max-width: 1024px) {
	.container {
		padding: 0 16px;
	}
}

@media (max-width: 960px) {
	.burger {
		display: block;
	}

	.layout {
		grid-template-columns: 1fr;
	}

	.toc {
		position: fixed;
		top: calc(var(--header-height) - 8px);
		left: 0;
		right: var(--scrollbar-width);
		max-height: calc(100vh - var(--header-height));
		overflow-y: auto;
		z-index: 999;
		padding: 10px;
		transform: translateY(-110%);
		opacity: 0;
		visibility: hidden;
		transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s;
	}

		.toc.is-open {
			transform: translateY(0);
			opacity: 1;
			visibility: visible;
		}

	.toc__list {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
		gap: 4px 8px;
	}

		.toc__list li {
			margin-bottom: 0;
		}
}

@media (max-width: 768px) {
	.container {
		padding: 0 12px;
	}

	.header-inner {
		padding: 0 12px;
	}

	.header {
		height: 64px;
	}

	.logo-icon {
		width: 40px;
		height: 40px;
	}

	.logo-text {
		font-size: 18px;
	}

	.main {
		padding: 10px 0;
	}

	.main-container {
		padding: 0 12px;
	}
}

@media (max-width: 640px) {
	.policy {
		padding: 20px 16px;
	}

		.policy h1 {
			font-size: 1.4rem;
		}

		.policy h2 {
			font-size: 1.1rem;
		}

	.toc__list {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 480px) {
	.container {
		padding: 0 8px;
	}

	.logo-icon {
		width: 32px;
		height: 32px;
	}

	.logo-text {
		font-size: 15px;
	}

	.policy {
		padding: 20px;
	}

		.policy h1 {
			font-size: 1.2rem;
		}

		.policy h2 {
			font-size: 1rem;
		}
}

@media (max-width: 360px) {
	.logo-text {
		font-size: 13px;
	}

	.logo-icon {
		width: 28px;
		height: 28px;
	}
}

/* ═══════════════════════════════════════════════ */
/* ПЕЧАТЬ */
/* ═══════════════════════════════════════════════ */

@media print {
	.header,
	.footer,
	.toc,
	.toc-backdrop,
	.print-btn,
	.download-btn,
	.burger,
	.modal-backdrop {
		display: none !important;
	}

	html, body {
		background: #fff !important;
		color: #000 !important;
		overflow: visible !important;
		height: auto !important;
		min-height: 0 !important;
		width: auto !important;
		max-width: none !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	body {
		display: block !important;
	}

		body.is-locked {
			position: static !important;
			overflow: visible !important;
			padding-right: 0 !important;
		}

	.main,
	.main-container,
	.container {
		padding: 0 !important;
		margin: 0 !important;
		max-width: none !important;
		width: auto !important;
		overflow: visible !important;
	}

	.layout {
		display: block !important;
	}

	.policy {
		box-shadow: none !important;
		border: none !important;
		padding: 0 !important;
		margin: 0 !important;
		max-width: none !important;
		width: auto !important;
		background: #fff !important;
		overflow: visible !important;
		border-radius: 0 !important;
	}

		.policy h1 {
			color: #000 !important;
			border-bottom: 1px solid #999 !important;
			font-size: 18pt !important;
			margin-bottom: 12pt !important;
			padding-bottom: 6pt !important;
		}

		.policy h2 {
			color: #000 !important;
			border-left: 3px solid #666 !important;
			font-size: 13pt !important;
			margin: 16pt 0 8pt !important;
			padding-left: 8pt !important;
			page-break-after: avoid;
		}

		.policy p,
		.policy li {
			font-size: 11pt !important;
			line-height: 1.45 !important;
			orphans: 2;
			widows: 2;
		}

		.policy ul {
			padding-left: 18pt !important;
		}

		.policy a {
			color: #000 !important;
			border-bottom: none !important;
			text-decoration: none !important;
		}

	.table-wrap {
		border: 1px solid #999 !important;
		overflow: visible !important;
		width: auto !important;
		max-width: none !important;
		border-radius: 0 !important;
	}

	.policy table {
		min-width: 0 !important;
		width: 100% !important;
		max-width: none !important;
		table-layout: fixed !important;
		font-size: 10pt !important;
	}

	.policy th, .policy td {
		border: 1px solid #999 !important;
		padding: 6pt 8pt !important;
		word-wrap: break-word !important;
		overflow-wrap: break-word !important;
	}

		.policy td:first-child {
			background: #eee !important;
			color: #000 !important;
			width: 24% !important;
		}

	.policy tr:nth-child(even) td:last-child {
		background: #fff !important;
	}

	.policy h2, .policy h3 {
		page-break-inside: avoid;
	}

	.footer-note {
		border-top: 1px solid #999 !important;
		color: #000 !important;
		font-size: 10pt !important;
	}

	.print-stamp {
		display: block !important;
		text-align: right !important;
		font-size: 9pt !important;
		line-height: 1.3 !important;
		color: #444 !important;
		margin: 4pt 0 10pt !important;
		padding-top: 2pt !important;
		border-top: 1px dotted #bbb !important;
		page-break-inside: avoid;
	}

	@page {
		margin: 16mm 14mm;
	}
}