:root {
    color-scheme: light;
    --bg: #f4f6fb;
    --panel: #ffffff;
    --panel-soft: #f9fbff;
    --text: #172033;
    --muted: #667085;
    --border: #d9e0ea;
    --accent: #2457c5;
    --accent-soft: #eaf0ff;
    --green: #087443;
    --green-soft: #e9f8f1;
    --orange: #a15c00;
    --orange-soft: #fff4df;
    --red: #b42318;
    --red-soft: #fff1f0;
    --code-bg: #111827;
    --code-text: #e5e7eb;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

h2 {
    scroll-margin-top: 20px;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    line-height: 1.58;
}

a {
    color: var(--accent);
}

.layout {
    display: grid;
    grid-template-columns: 310px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
    padding: 24px 20px;
    background: var(--panel);
    border-right: 1px solid var(--border);
}

.brand {
    display: block;
    font-size: 20px;
    font-weight: 800;
}

.version {
    display: block;
    margin: 4px 0 18px;
    color: var(--muted);
    font-size: 13px;
}

.doc-switch {
    display: block;
    margin: 0 0 16px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.doc-switch:hover {
    border-color: var(--accent);
}

.search {
    width: 100%;
    margin: 4px 0 18px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-soft);
    color: var(--text);
    font-size: 14px;
}

.nav-title {
    display: block;
    margin: 18px 0 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.sidebar a {
    display: block;
    padding: 7px 0;
    color: var(--text);
    font-size: 14px;
    text-decoration: none;
}

.sidebar a:hover,
.sidebar a.active {
    color: var(--accent);
}

.role-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 18px;
}

.role-switch button,
.chip {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--panel-soft);
    color: var(--text);
    padding: 5px 9px;
    font-size: 12px;
}

.role-switch button {
    cursor: pointer;
}

.role-switch button.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
}

main {
    width: min(1180px, 100%);
    padding: 36px 44px 80px;
}

.breadcrumbs {
    margin-bottom: 14px;
    color: var(--muted);
    font-size: 13px;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    line-height: 1.22;
}

h1 {
    margin-bottom: 12px;
    font-size: 34px;
}

h2 {
    margin-top: 44px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 24px;
}

h3 {
    margin-top: 26px;
    font-size: 19px;
}

h4 {
    margin-top: 20px;
    font-size: 16px;
}

p {
    margin: 12px 0;
}

.lead {
    max-width: 900px;
    color: var(--muted);
    font-size: 17px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.card,
.process,
.notice,
.warning,
.danger,
.checklist {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
}

.card h3,
.process h3 {
    margin-top: 0;
}

.card p:last-child,
.process p:last-child,
.notice p:last-child,
.warning p:last-child,
.danger p:last-child,
.checklist p:last-child {
    margin-bottom: 0;
}

a.card {
    color: inherit;
    text-decoration: none;
}

a.card:hover {
    border-color: var(--accent);
    box-shadow: 0 6px 18px rgba(36, 87, 197, .08);
}

.notice {
    background: var(--accent-soft);
}

.warning {
    background: var(--orange-soft);
}

.danger {
    background: var(--red-soft);
}

.checklist {
    background: var(--green-soft);
}

.ok {
    background: var(--green-soft);
}

.role-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 8px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
}

.badge.worker {
    background: var(--green-soft);
    color: var(--green);
}

.badge.client {
    background: var(--orange-soft);
    color: var(--orange);
}

.badge.admin {
    background: #f2edff;
    color: #673ab7;
}

.step-list {
    counter-reset: steps;
    padding-left: 0;
    list-style: none;
}

.step-list li {
    position: relative;
    margin: 10px 0;
    padding-left: 38px;
}

.step-list li::before {
    counter-increment: steps;
    content: counter(steps);
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    line-height: 24px;
    text-align: center;
}

table {
    width: 100%;
    margin: 16px 0;
    border-collapse: collapse;
    background: var(--panel);
    border: 1px solid var(--border);
}

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

th {
    width: 220px;
    background: var(--panel-soft);
    font-weight: 800;
}

code {
    padding: 1px 4px;
    border-radius: 4px;
    background: #eef2f7;
    color: #182235;
}

pre {
    overflow: auto;
    padding: 16px;
    border-radius: 8px;
    background: var(--code-bg);
    color: var(--code-text);
}

pre code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.toc {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
    margin: 16px 0;
}

.toc a {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    text-decoration: none;
}

.flow {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    margin: 18px 0;
}

.flow > span {
    flex: 1 1 150px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    font-weight: 700;
    text-align: center;
}

.flow > i {
    align-self: center;
    color: var(--muted);
    font-style: normal;
    font-weight: 800;
}

.doc-figure {
    margin: 22px 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel);
}

.doc-figure img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.doc-figure figcaption {
    margin-top: 9px;
    color: var(--muted);
    font-size: 13px;
}

.doc-figure figcaption::after {
    content: " · Нажмите на изображение, чтобы увеличить";
    color: var(--accent);
}

.compact-list li {
    margin: 6px 0;
}

.path {
    display: inline-block;
    padding: 3px 7px;
    border-radius: 5px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
}

.doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 22px;
}

.hidden-by-role,
.hidden-by-search {
    display: none !important;
}

.page-toc {
    margin: 22px 0 30px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: linear-gradient(135deg, var(--panel), var(--panel-soft));
}

.page-toc > strong {
    display: block;
    margin-bottom: 10px;
    font-size: 15px;
}

.page-toc .toc {
    margin: 0;
}

.page-toc .toc a {
    position: relative;
    padding: 8px 10px;
    font-size: 13px;
}

.figure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 14px;
    margin: 20px 0 24px;
}

.figure-grid.single {
    grid-template-columns: minmax(0, 1fr);
}

.figure-grid .doc-figure {
    min-width: 0;
    margin: 0;
}

.doc-image-button {
    display: block;
    width: 100%;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 6px;
    background: transparent;
    cursor: zoom-in;
}

.doc-image-button:focus-visible {
    outline: 3px solid rgba(36, 87, 197, .35);
    outline-offset: 3px;
}

.doc-image-button img {
    transition: transform .18s ease, filter .18s ease;
}

.doc-image-button:hover img {
    filter: contrast(1.02);
    transform: scale(1.008);
}

.image-lightbox {
    width: min(96vw, 1800px);
    max-width: none;
    max-height: 94vh;
    padding: 44px 18px 16px;
    border: 0;
    border-radius: 12px;
    background: var(--panel);
    box-shadow: 0 24px 80px rgba(16, 24, 40, .28);
}

.image-lightbox::backdrop {
    background: rgba(10, 16, 28, .82);
}

.image-lightbox img {
    display: block;
    width: 100%;
    max-height: 78vh;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.image-lightbox p {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.lightbox-close {
    position: absolute;
    top: 7px;
    right: 10px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: var(--panel-soft);
    color: var(--text);
    cursor: pointer;
    font-size: 26px;
    line-height: 32px;
}

.page-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 12px;
}

.page-tools button,
.sidebar-toggle {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--panel);
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
}

.page-tools button:hover,
.sidebar-toggle:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.sidebar-toggle {
    display: none;
    width: 100%;
    margin: 12px 0 14px;
    font-size: 14px;
    text-align: left;
}

.search-results {
    max-height: 48vh;
    overflow: auto;
}

.search-results a {
    margin: 0 0 8px;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--panel-soft);
}

.search-results strong,
.search-results span,
.search-results small {
    display: block;
}

.search-results strong {
    color: var(--accent);
    font-size: 13px;
}

.search-results span {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 700;
}

.search-results small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.search-empty {
    display: block;
    padding: 8px 2px 14px;
    color: var(--muted);
    font-size: 13px;
}

.table-scroll {
    max-width: 100%;
    margin: 16px 0;
    overflow-x: auto;
    border-radius: 8px;
}

.table-scroll table {
    margin: 0;
}

.screenshots-hidden .figure-grid,
.screenshots-hidden .screenshot-count {
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .doc-image-button img {
        transition: none;
    }
}

@media (max-width: 900px) {
    .layout {
        display: block;
    }

    .sidebar {
        position: relative;
        height: auto;
        max-height: none;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-toggle {
        display: block;
    }

    .sidebar.nav-enhanced:not(.nav-open) > :not(.brand):not(.version):not(.sidebar-toggle) {
        display: none;
    }

    main {
        padding: 26px 20px 60px;
    }

    h1 {
        font-size: 28px;
    }

    th {
        width: auto;
    }

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

    .page-toc .toc {
        grid-template-columns: 1fr;
    }
}

@media print {
    body {
        background: #fff;
        color: #000;
        font-size: 11pt;
    }

    .layout {
        display: block;
    }

    .sidebar,
    .page-tools,
    .image-lightbox,
    .lightbox-close {
        display: none !important;
    }

    main {
        width: auto;
        padding: 0;
    }

    a {
        color: inherit;
        text-decoration: none;
    }

    section,
    .doc-figure,
    table,
    tr {
        break-inside: avoid;
    }

    .doc-figure {
        box-shadow: none;
    }

    .doc-figure figcaption::after {
        content: "";
    }
}

/* Readable process maps and screenshot provenance, September 2026 edition. */
.process-flow { display: flex; flex-wrap: wrap; gap: 12px; padding: 0; list-style: none; counter-reset: process; }
.process-flow li { counter-increment: process; flex: 1 1 150px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--accent-soft); }
.process-flow li::before { content: counter(process); display: block; color: var(--accent); font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.screenshot-provenance { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); }
.doc-figure img { max-width: 100%; height: auto; }
.screenshots-hidden .doc-figure { display: none !important; }
@media print { .process-flow li { break-inside: avoid; } .screenshot-provenance { color: #444; } }

/* Guide diagrams and long-document printing, October 2026. */
.process-diagram { margin: 24px 0; }
.process-diagram > figcaption { font-weight: 700; color: var(--muted); }
.legacy-anchor { display: block; height: 0; scroll-margin-top: 20px; }
.grid > a.card { display: block; color: inherit; text-decoration: none; }
.grid > a.card:hover { border-color: var(--accent); }
@media print {
  section, table { break-inside: auto; }
  h2, h3 { break-after: avoid; }
  .table-scroll { overflow: visible; }
  .page-toc { break-after: auto; }
  .doc-figure img { max-height: 21cm; object-fit: contain; }
}
