/* Документы (templates/legal.html): «Справочник» (выбран 28.11.2026, варианты — /demo/docs).
   Как у Stripe, GitHub и Vercel: слева все документы, справа содержание, текущий раздел подсвечен.
   До 1280 px документы — плашками над заголовком; до 1024 px содержание — липкая строка под шапкой.
   Основа, шапка и подвал — site.css. */
:root { --paper: #F7F3EB; --line2: #EFEAE0; --soft: #77776F; }

.lg { padding: 1.25rem 0 4rem; }
.lg-docs, .lg-toc { display: none; }
.lg-chips { display: flex; gap: 0.5rem; margin: 0 -1rem 1.5rem; padding: 0 1rem 2px; overflow-x: auto; scrollbar-width: none; }
.lg-chips::-webkit-scrollbar { display: none; }
.lg-chips a { flex: none; display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 1rem; border-radius: 62.4375rem; background: var(--paper); color: #4A4A45; font-size: 0.875rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.lg-chips a:hover { color: var(--ink); }
.lg-chips a.on { background: var(--forest); color: #FFF; }
.lg h1 { margin: 0; font-size: clamp(1.75rem, 0.5rem + 7.5vw, 2.25rem); font-weight: 800; line-height: 1.05; letter-spacing: -.035em; text-wrap: balance; }
.lg-lead { margin: 0.75rem 0 0; font-size: 1.0625rem; line-height: 1.55; color: #4A4A45; }
.lg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin: 1.5rem 0 0; padding: 0.875rem 0; border-top: 1px solid var(--line2); border-bottom: 1px solid var(--line2); font-size: 0.875rem; color: var(--soft); }
.lg-meta .chip { padding: 0.25rem 0.625rem; border-radius: 62.4375rem; background: #E8F0EA; color: var(--forest); font-weight: 800; }
.lg-meta .btn-l { margin-left: auto; }
.btn-l { display: inline-flex; align-items: center; gap: 0.5rem; height: 2.75rem; padding: 0 0.875rem; border: 0; border-radius: 62.4375rem; background: #FFF; box-shadow: inset 0 0 0 1.5px #E6DECF; color: var(--ink); font: inherit; font-size: 0.875rem; font-weight: 700; cursor: pointer; transition: box-shadow .2s; }
.btn-l:hover { box-shadow: inset 0 0 0 1.5px var(--forest); }
.btn-l .i { width: 1rem; height: 1rem; }
.lg .doc { margin-top: 2.25rem; }
.lg-h { margin: 0 0 0.875rem; font-size: 0.75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #8A8A84; }
.lg-docs nav, .lg-toc ol { display: grid; margin: 0; padding: 0; list-style: none; border-left: 1.5px solid #EFEAE0; }
.lg-docs a, .lg-toc a { display: flex; gap: 0.25rem; margin-left: -1.5px; padding: 0.4375rem 0 0.4375rem 1rem; border-left: 1.5px solid transparent; color: #55554F; font-size: 0.9063rem; line-height: 1.35; text-decoration: none; transition: color .15s, border-color .15s; }
.lg-docs a:hover, .lg-toc a:hover { color: var(--ink); }
.lg-docs a.on, .lg-toc a.on { border-left-color: var(--peel); color: var(--ink); font-weight: 800; }
.lg-toc .tn { min-width: 1.5rem; color: #A3A39B; font-weight: 600; }
.lg-toc a.on .tn { color: var(--peel); }
.lg-help { margin-top: 2rem; padding: 1.125rem; border-radius: 1.125rem; background: var(--paper); font-size: 0.875rem; line-height: 1.45; color: #55554F; }
.lg-help a { display: inline-flex; align-items: center; gap: 0.375rem; margin-top: 0.5rem; color: var(--forest); font-weight: 700; text-decoration: none; }
.lg-help a:hover { text-decoration: underline; }
.lg-up { display: inline-flex; align-items: center; gap: 0.375rem; margin-top: 1.25rem; padding-left: 1rem; font-size: 0.875rem; font-weight: 700; color: var(--soft); text-decoration: none; }
.lg-up:hover { color: var(--ink); }
.lg-up .i { width: 1rem; height: 1rem; }

/* ---------- текст документа ---------- */
.doc { font-size: 1.0625rem; line-height: 1.68; color: #2B2B27; }
.doc p, .doc ul, .doc ol, .doc blockquote, .doc .tw { margin: 0 0 1rem; }
.doc ul, .doc ol { padding-left: 1.375rem; }
.doc ul ul { margin: 0.25rem 0 0; }
.doc li { margin: 0.3rem 0; padding-left: 0.25rem; }
.doc li::marker { color: var(--peel); font-weight: 800; }
.doc a:not(.cn) { color: var(--forest); text-decoration: underline; text-decoration-color: rgba(31, 77, 54, .35); text-decoration-thickness: 1.5px; text-underline-offset: 0.2em; overflow-wrap: anywhere; }
.doc a:not(.cn):hover { text-decoration-color: currentColor; }
.doc strong { font-weight: 800; color: var(--ink); }
.doc code { font: inherit; font-weight: 700; }
.doc h2 { margin: 0 0 1.125rem; font-size: 1.625rem; font-weight: 800; line-height: 1.2; letter-spacing: -.022em; color: var(--ink); text-wrap: balance; }
.doc h3 { margin: 2rem 0 0.75rem; font-size: 1.25rem; font-weight: 800; line-height: 1.3; letter-spacing: -.015em; color: var(--ink); }
.doc > h3:first-child, .doc > p:first-child { margin-top: 0; }
/* до 64em сверху липкие шапка (4rem) и строка «Содержание» (до ≈ 7,5rem) — пункт встаёт под ними */
.doc .sec { margin-bottom: 2.5rem; scroll-margin-top: 8.5rem; }
.cl { scroll-margin-top: 9rem; border-radius: 0.5rem; }
.cn { margin: -0.25rem -0.375rem; padding: 0.25rem 0.375rem; border-radius: 0.375rem; font-weight: 800; color: var(--ink); text-decoration: none; font-variant-numeric: tabular-nums; cursor: copy; }
.cn:hover { color: var(--peel); }
.cl:target { animation: hl 2.8s ease-out; }
@keyframes hl { 0%, 40% { background: #FFE9C9; box-shadow: 0 0 0 0.5rem #FFE9C9; } 100% { background: transparent; box-shadow: 0 0 0 0.5rem transparent; } }
.doc blockquote { margin-left: 0; margin-right: 0; padding: 1rem 1.25rem; border-radius: 1rem; background: var(--paper); font-weight: 700; }
.doc blockquote p { margin: 0; }
/* таблицы: на телефоне карточками; из четырёх и больше колонок — карточками везде (в колонку текста не помещаются) */
.doc .tw { overflow-x: auto; }
.doc table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; line-height: 1.5; }
.doc th { padding: 0.625rem 0.875rem; text-align: left; vertical-align: bottom; font-size: 0.8125rem; font-weight: 700; color: var(--soft); border-bottom: 1.5px solid #E6DECF; }
.doc td { padding: 0.875rem; vertical-align: top; border-bottom: 1px solid var(--line2); }
.doc th:first-child, .doc td:first-child { padding-left: 0; }
.doc .t-cards td:first-child { font-weight: 800; color: var(--ink); }
.doc .t-req { margin: 0 0 1rem; border-top: 1px solid var(--line2); }
.doc .t-req td { padding: 0.75rem 0; }
.doc .t-req td:first-child { width: 40%; padding-right: 1.5rem; color: var(--soft); font-size: 0.875rem; font-weight: 600; }
.doc .t-rows thead { display: none; }
.doc .t-rows, .doc .t-rows tbody, .doc .t-rows tr, .doc .t-rows td { display: block; width: auto; }
.doc .t-rows tr { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 1.5rem; margin-bottom: 0.75rem; padding: 1.125rem 1.25rem; border-radius: 1.125rem; background: var(--paper); }
.doc .t-rows td { padding: 0; border: 0; }
.doc .t-rows td::before { content: attr(data-label); display: block; margin-bottom: 0.125rem; font-size: 0.75rem; font-weight: 700; line-height: 1.35; color: var(--soft); }
.doc .t-rows td:first-child { grid-column: 1 / -1; font-size: 1.0625rem; line-height: 1.4; }
.doc .t-rows td:first-child::before { display: none; }
mark.ph { padding: 0 0.3em; border-radius: 0.3em; background: #FFE9C2; color: #7A4A0B; font-weight: 600; }

/* содержание на телефоне: липкая строка под шапкой с текущим разделом, раскрывается списком */
.mtoc { position: sticky; top: 4.5rem; z-index: 5; margin: 1.25rem 0 1.75rem; border-radius: 1.125rem; background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: inset 0 0 0 1.5px #E6DECF, 0 0.5rem 1.5rem -1rem rgba(31, 77, 54, .3); }
.mtoc summary { display: flex; align-items: center; gap: 0.75rem; padding: 0.8125rem 1rem; list-style: none; cursor: pointer; font-size: 0.9375rem; font-weight: 800; }
.mtoc summary::-webkit-details-marker { display: none; }
.mtoc summary small { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.875rem; font-weight: 600; color: var(--soft); }
.mtoc summary .i { transform: rotate(90deg); transition: transform .2s; color: var(--soft); }
.mtoc[open] summary .i { transform: rotate(-90deg); }
.mtoc ol { max-height: 60vh; overflow: auto; margin: 0; padding: 0 0.5rem 0.5rem; list-style: none; }
.mtoc ol a { display: flex; gap: 0.5rem; padding: 0.5rem 0.625rem; border-radius: 0.75rem; color: var(--ink); text-decoration: none; font-size: 0.9375rem; line-height: 1.35; }
.mtoc ol a.on { background: var(--paper); font-weight: 700; }
.mtoc .tn { min-width: 1.375rem; color: var(--peel); font-weight: 800; font-variant-numeric: tabular-nums; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; z-index: 80; max-width: calc(100% - 2rem); padding: 0.75rem 1.125rem; border-radius: 62.4375rem; background: var(--ink); color: #FFF; font-size: 0.9375rem; font-weight: 700; transform: translate(-50%, 1rem); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 47.99em) {
  .doc { font-size: 1rem; }
  .doc h2 { font-size: 1.375rem; }
  .doc h3 { font-size: 1.125rem; }
  .doc .t-cards thead { display: none; }
  .doc .t-cards, .doc .t-cards tbody, .doc .t-cards tr, .doc .t-cards td { display: block; width: auto; }
  .doc .t-cards tr { margin-bottom: 0.625rem; padding: 0.875rem 1rem; border-radius: 1rem; background: var(--paper); }
  .doc .t-cards td { padding: 0.25rem 0; border: 0; }
  .doc .t-cards td::before { content: attr(data-label); display: block; font-size: 0.75rem; font-weight: 700; color: var(--soft); }
  .doc .t-cards td:first-child { font-size: 1.0625rem; }
  .doc .t-cards td:first-child::before { display: none; }
  .doc .t-rows tr { grid-template-columns: 1fr; gap: 0.5rem; }
  .doc .t-req tr { display: block; padding: 0.625rem 0; border-bottom: 1px solid var(--line2); }
  .doc .t-req td { display: block; width: auto !important; padding: 0 !important; border: 0; }
}
@media (min-width: 64em) {
  .lg { padding: 2.5rem 0 6rem; }
  .lg h1 { font-size: 3rem; }
  .lg-main { max-width: 46rem; }
  .lg-grid.has-toc { display: grid; grid-template-columns: minmax(0, 1fr) 14rem; gap: 4rem; align-items: start; }
  .lg-toc { display: block; position: sticky; top: 7rem; max-height: calc(100vh - 8rem); overflow: auto; }
  .mtoc { display: none; }
  .doc .sec { scroll-margin-top: 6.5rem; }
  .cl { scroll-margin-top: 7rem; }
}
@media (min-width: 80em) {
  .lg-grid { display: grid; grid-template-columns: 15rem minmax(0, 46rem); gap: 3.5rem; align-items: start; }
  .lg-grid.has-toc { grid-template-columns: 15rem minmax(0, 1fr) 14rem; }
  .lg-docs { display: block; position: sticky; top: 7rem; }
  .lg-chips { display: none; }
}
@media print {
  .site-header, .ft, .no-print, .toast, .skip { display: none !important; }
  .lg { padding: 0; }
  .lg-grid { display: block !important; }
  .lg-meta { border: 0; padding: 0; }
  .doc { font-size: 11pt; }
  .doc a { color: inherit !important; text-decoration: none !important; }
  .doc .t-rows tr, .doc blockquote { break-inside: avoid; }
}
