/* Общие стили правовых страниц */
* { margin: 0; padding: 0; box-sizing: border-box; }
/* Палитра ОАО «РЖД» по брендбуку:
   RZD-Red  Pantone 1795C · CMYK 0-94-100-0 · RGB 226-26-26 · RAL 3020
   White                                    · RGB 255-255-255 · RAL 9010
   Black    Process black · CMYK 0-0-0-100  · RGB 0-0-0       · RAL 9017
   Брендбук «Транспортная безопасность» (v.2026.10.15): Серый #4A4A4A, Светло-серый #D2D2D2 */
:root {
    --red: #e21a1a;
    --red-text: #c11616; /* красный для мелкого текста на светлом фоне — проходит контраст WCAG */
    --ink: #1c1c1c;
    --gray: #4a4a4a;
    --line: #e3e3e3;
    --bg: #f5f5f5;
}
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
body {
    font-family: 'Rubik', -apple-system, Segoe UI, Roboto, sans-serif;
    color: var(--ink); background: #fff; line-height: 1.65; font-size: 16px;
    overflow-wrap: break-word;
    -webkit-tap-highlight-color: rgba(226,26,26,.12);
}
a { color: var(--red-text); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 24px; }
.wrap {
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
}

.legal-header { background: var(--ink); color: #fff; padding: 22px 0; }
.legal-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.legal-header a { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 15px; }
.legal-logo { height: 46px; width: auto; display: block; flex-shrink: 0; }
.legal-header .back { font-weight: 500; font-size: 14px; color: #cccccc; }

main { padding: 48px 0 72px; }
h1 { font-size: clamp(26px, 4vw, 34px); line-height: 1.2; letter-spacing: -.5px; margin-bottom: 10px; }
.meta { color: var(--gray); font-size: 14px; margin-bottom: 36px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
h2 { font-size: 20px; margin: 36px 0 14px; line-height: 1.25; }
h3 { font-size: 17px; margin: 24px 0 10px; }
p, li { color: #333333; }
p { margin-bottom: 14px; }
ul, ol { margin: 0 0 16px 22px; }
li { margin-bottom: 8px; }
.table-scroll { overflow-x: auto; margin: 16px 0 22px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { border: 1px solid var(--line); padding: 11px 13px; text-align: left; vertical-align: top; }
th { background: var(--bg); font-weight: 600; }
tbody th { white-space: nowrap; width: 1%; }

.draft {
    background: #fff8e6; border: 1px solid #f0d48a; border-left: 4px solid #e0a800;
    border-radius: 10px; padding: 18px 20px; margin-bottom: 32px; font-size: 14.5px;
}
.draft b { display: block; margin-bottom: 6px; }
/* Без nowrap: в .fill попадают не только короткие метки вроде «ДД.ММ.ГГГГ»,
   но и длинные пояснения — с nowrap они выносили страницу за экран. */
.fill { background: #fdeaea; color: #a81414; padding: 1px 6px; border-radius: 4px; font-size: .92em; }
.fill-nb { white-space: nowrap; }

/* Опубликованные документы: ссылка на PDF, оглавление, глоссарий */
.nobr { white-space: nowrap; }
.doc-download { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: -12px 0 28px; }
.doc-download a {
    display: inline-block; background: var(--red); color: #fff; text-decoration: none;
    font-weight: 600; font-size: 15px; padding: 11px 20px; border-radius: 10px;
}
.doc-download a:hover { background: #a81414; }
.doc-download span { color: var(--gray); font-size: 14px; }
.toc { background: var(--bg); border-radius: 12px; padding: 20px 24px 8px; margin-bottom: 12px; }
.toc-title { font-weight: 700; margin-bottom: 10px; color: var(--ink); }
.toc ol { list-style: none; margin-left: 0; }
.toc li { margin-bottom: 8px; font-size: 15px; }
.toc a { color: #a81414; text-decoration: none; }
.toc a:hover { text-decoration: underline; }
h2[id] { scroll-margin-top: 16px; }
.terms { list-style: none; margin-left: 0; }
.terms li { margin-bottom: 12px; }
.terms b { color: var(--ink); }
h4 { font-size: 16px; margin: 20px 0 8px; }
.value-tag { font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--gray); margin: 26px 0 -4px; }
.lead-in { margin: 18px 0 8px; }
table.values td { font-size: 14px; }
table.values td[rowspan] { vertical-align: middle; font-weight: 600; }
@media (max-width: 480px) { .toc { padding: 16px 18px 6px; } }

.legal-footer {
    border-top: 1px solid var(--line);
    padding: 28px 0 60px;
    padding-bottom: calc(60px + env(safe-area-inset-bottom));
    font-size: 14px; color: var(--gray);
}
.legal-footer a { margin-right: 22px; display: inline-block; padding: 5px 0; }

@media (max-width: 600px) {
    main { padding: 32px 0 48px; }
    /* Таблицы прокручиваются внутри своего контейнера, страница — нет */
    .table-scroll { border: 1px solid var(--line); border-radius: 10px; }
    .table-scroll table { min-width: 520px; }
    .table-scroll th:first-child, .table-scroll td:first-child { border-left: none; }
    .table-scroll th:last-child, .table-scroll td:last-child { border-right: none; }
    tbody th { white-space: normal; }
    h2 { font-size: 18px; margin: 30px 0 12px; }
    .draft { padding: 16px; }
}

@media (max-width: 480px) {
    .wrap { padding: 0 16px; }
    .wrap {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
    .legal-header { padding: 16px 0; }
    .legal-header .wrap { gap: 10px; }
    .legal-header a { font-size: 14px; gap: 10px; }
    .legal-logo { height: 40px; }
    .legal-footer a { display: block; margin-right: 0; }
}

/* Страница с закреплённым перечнем подразделов слева (anti-corruption/) */
.wrap-wide { max-width: 1180px; }
.doc-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 48px; align-items: start; }
.doc-main { min-width: 0; max-width: 780px; }
.side-toc { position: sticky; top: 20px; margin: 0; max-height: calc(100vh - 40px); overflow-y: auto; padding: 18px 14px 10px; }
.side-toc .toc-title { margin-left: 8px; }
.side-toc li { margin-bottom: 2px; }
.side-toc a { display: block; padding: 7px 8px; border-radius: 8px; line-height: 1.35; }
.side-toc a:hover { background: #fff; text-decoration: none; }
.side-toc a.is-current { background: #fff; color: #a81414; font-weight: 600; box-shadow: inset 3px 0 0 var(--red); }
h2[id], h3[id] { scroll-margin-top: 20px; }
.status-note { color: var(--gray); font-style: italic; }
@media (max-width: 900px) {
    .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
    /* на телефоне — горизонтальная лента подразделов, прилипает к верху экрана */
    .side-toc {
        top: 0; z-index: 10; max-height: none; overflow: visible;
        margin: 0 -24px 18px; padding: 10px 24px; border-radius: 0;
        box-shadow: 0 1px 0 var(--line);
    }
    .side-toc .toc-title { display: none; }
    .side-toc ol { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
    .side-toc a { white-space: nowrap; background: #fff; font-size: 14px; }
    .side-toc a.is-current { box-shadow: inset 0 -2px 0 var(--red); }
    h2[id], h3[id] { scroll-margin-top: 64px; }
}
@media (max-width: 480px) {
    .side-toc { margin: 0 -16px 16px; padding: 8px 16px; }
}

/* Выключка по ширине для текста документов (решение 19.10.2026).
   Переносы слов отключены по требованию заказчика; последняя строка — влево.
   На узком экране строки короткие, растянутые пробелы заметнее — там влево. */
main p, main li { text-align: justify; text-align-last: left; hyphens: none; -webkit-hyphens: none; }
main .toc li, main .toc p, main .doc-download, main td p, main th p, main .doc-files li { text-align: left; }
@media (max-width: 600px) {
    main p, main li { text-align: left; }
}
.doc-files { margin-left: 22px; }
.doc-files li { margin-bottom: 10px; }
.doc-size { color: var(--gray); font-size: .88em; white-space: nowrap; margin-left: 4px; }
/* Приложения к документу — раскрывающийся список под ссылкой */
.doc-appx { margin-top: 8px; }
.doc-appx summary { cursor: pointer; color: var(--red-text); width: fit-content; }
.doc-appx summary:hover { text-decoration: underline; }
.doc-appx .doc-files { margin-top: 10px; }

/* Информация для контрагентов: список сообщений */
.notices { display: grid; gap: 14px; margin: 12px 0 26px; }
.notice { border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: 10px; padding: 16px 20px; background: #fff; }
.notice time { display: inline-block; font-weight: 700; color: var(--red-text); font-size: 14px; margin-bottom: 6px; }
.notice p { margin: 0; }

/* Итоговый вывод (например, результаты СОУТ) */
.result-note { background: #fafafa; border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: 10px; padding: 14px 18px; font-weight: 600; }

/* Утверждённый PDF-документ */
.wrap-document { max-width: 1080px; }
.doc-download a:focus-visible, .legal-header a:focus-visible, .legal-footer a:focus-visible,
main a:focus-visible { outline: 3px solid #e21a1a; outline-offset: 4px; }
.pdf-viewer {
    display: block; width: 100%; height: 72vh; min-height: 560px;
    border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
}

/* Информационно-профилактический материал */
.safety-hero {
    display: grid; grid-template-columns: minmax(0, 1fr) 140px; align-items: center; gap: 28px;
    margin: 4px 0 34px; padding: 28px 32px; border-radius: 12px;
    background: var(--ink); color: #fff;
}
.safety-hero h2 { margin: 0 0 10px; color: #fff; font-size: clamp(26px, 5vw, 38px); }
.safety-hero p { margin: 0; color: #f5f5f5; text-align: left; }
.safety-train { width: 140px; height: 140px; color: #ff6666; }
.safety-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px; }
.safety-list li { padding-left: 4px; }
.emergency-note {
    margin: 28px 0 32px; padding: 22px 24px 12px;
    border: 1px solid #efb5b5; border-radius: 12px; background: #fdeaea;
}
.emergency-note h2 { margin-top: 0; }
.emergency-note a { font-weight: 800; font-size: 1.2em; }
@media (max-width: 700px) {
    .safety-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .safety-hero { grid-template-columns: minmax(0, 1fr); padding: 24px; }
    .safety-train { display: none; }
    .pdf-viewer { height: 65vh; min-height: 420px; }
}
@media (max-width: 480px) {
    .doc-download { margin-top: -8px; }
    .doc-download a { width: 100%; text-align: center; padding: 12px 16px; }
    .emergency-note { padding: 18px 18px 8px; }
}


h1, h2, h3 { font-family: 'RussianRail G Pro', 'Rubik', sans-serif; }
h4, h5, h6 { font-family: 'Rubik', sans-serif; }
/* Reading pages retain a narrower scale than promotional headings. */
h1 { font-size: clamp(28px, 3.3vw, 44px); line-height: 1.22; }
h2 { font-size: clamp(22px, 2.2vw, 28px); line-height: 1.28; margin: 40px 0 16px; }
h3 { font-size: 20px; line-height: 1.4; margin: 28px 0 12px; }
