/*
 * ============================================================
 * PAC — DEFAULT SITE + DOCUMENT STYLE v8
 * ============================================================
 *
 * Единый общий CSS для типовых страниц объектов PAC.
 *
 * В этой версии:
 *   • удалены повторяющиеся правила;
 *   • объединены старые и новые стили документов;
 *   • добавлено полноценное раскрытие списка испытуемых;
 *   • исследовательская группа приведена к общей визуальной системе;
 *   • усилена шапка протокола допроса;
 *   • исправлен селектор .experiment-staff;
 *   • оставлена совместимость со старой HTML-разметкой;
 *   • нормально оформлены Цель / Задача / Оборудование;
 *   • согласованы Дополнительные детали и Теоретические просчёты;
 *   • главный исследователь может использовать тот же механизм
 *     раскрытия, что и обычные сотрудники.
 *   • единая шапка, выпадающее меню пользователя и боковая панель
 *     в стиле страницы веществ (блок в конце файла).
 *
 * Подключение в HTML:
 *   <link rel="stylesheet" href="{% static 'css/pac-document-default.css' %}">
 *
 * Уникальный <style> страницы можно добавлять ПОСЛЕ этого файла.
 * ============================================================
 */

/* ============================================================
   0. ПЕРЕМЕННЫЕ PAC
   ============================================================ */

:root {
    --pac-paper: #fbfbfa;
    --pac-paper-alt: #f3f5f7;
    --pac-paper-soft: #f7f8f9;
    --pac-ink: #252b31;
    --pac-ink-soft: #46515a;
    --pac-muted: #6c7780;
    --pac-line: #d7dde2;
    --pac-line-soft: #e8ecef;
    --pac-line-dark: #aeb7bf;

    --pac-blue: #2c3e50;
    --pac-blue-light: #eaf0f4;
    --pac-blue-accent: #3d7298;
    --pac-blue-dark: #1f2e3b;

    --pac-green: #347653;
    --pac-green-light: #edf5f0;
    --pac-amber: #967014;
    --pac-amber-light: #fbf5df;
    --pac-red: #8b1e2d;
    --pac-red-light: #f7ecee;
    --pac-red-strong: #6f1020;
    --pac-orange: #b66d1d;
    --pac-orange-light: #fbf2e8;

    --pac-sans: Arial, Helvetica, sans-serif;
    --pac-mono: "Courier New", Courier, monospace;
    --pac-serif: Georgia, "Times New Roman", serif;

    --pac-radius: 7px;
    --pac-radius-small: 4px;
    --pac-shadow: 0 5px 18px rgba(25, 34, 42, .065);
    --pac-shadow-soft: 0 2px 9px rgba(25, 34, 42, .045);
    --pac-shadow-hover: 0 9px 28px rgba(25, 34, 42, .10);
}

/* ============================================================
   A. ОБЩАЯ ОСНОВА САЙТА
   ============================================================ */
/* ============================================================
   ПОИСК ПО АРХИВУ
   ============================================================ */

.site-search {
    flex: 1 1 500px;
    max-width: 680px;

    min-width: 320px;

    display: flex;
    align-items: center;

    margin: 0 40px;

    background: #ffffff;
    border: 1px solid #b8b8b8;
    border-radius: 6px;

    overflow: hidden;
}

.site-search-icon {
    flex: 0 0 auto;

    padding: 0 10px;

    color: #555;
    font-size: 1.2rem;
}

.site-search input {
    flex: 1 1 auto;

    min-width: 0;

    padding: 10px 8px;

    border: 0;
    outline: none;

    background: transparent;

    font: inherit;
    color: #222;
}

.site-search input::placeholder {
    color: #888;
}

.site-search button {
    flex: 0 0 auto;

    padding: 10px 16px;

    border: 0;
    border-left: 1px solid #ccc;

    background: #e8e8e8;
    color: #333;

    font: inherit;

    cursor: pointer;
}

.site-search button:hover {
    background: #dcdcdc;
}
.old-document-header {
    display: none;
}
body {
    margin: 0;
    padding: 0;
    background-color: #f9f9f9;
    color: #333;
    font-family: var(--pac-sans);
}
body.pac-old-view .old-sidebar-toggle {
    display: block;
}

body:not(.pac-old-view) .old-sidebar-toggle {
    display: none;
}
/* Стили скроллбара */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(44, 62, 80, 0.5);
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.8);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #5bf, #2c82c9, #74b9ff);
    border-radius: 20px;
    border: 2px solid transparent;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #4f9, #0af);
}

/* Header */

header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: #2c3e50;
    color: white;
}

.logo-image {
    width: 75px;
    transition: transform 0.3s ease;
}

.logo-image:hover {
    transform: rotate(1deg) scale(1.05);
}

.user-info {
    position: relative;
    cursor: pointer;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    z-index: 1000;
    background: #34495e;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.dropdown-menu a {
    display: block;
    padding: 10px 20px;
    color: white;
    text-decoration: none;
    transition: background 0.3s;
}

.dropdown-menu a:hover {
    background: #3b536e;
}

.user-info:hover .dropdown-menu {
    display: block;
}

/* Бургер */

.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    padding: 10px;
    background: rgba(44, 62, 80, 0.9);
    border-radius: 5px;
    cursor: pointer;
}

.mobile-menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px 0;
    background: white;
    transition: transform 0.4s, opacity 0.4s;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* Контейнер и sidebar */

.container {
    display: flex;
    margin-top: 20px;
}

.left-sidebar {
    width: 250px;
    height: 100vh;
    position: sticky;
    top: 0;
    padding: 20px;
    background-color: #ecf0f1;
    border-right: 1px solid #ccc;
}

.left-sidebar h3 {
    margin-top: 0;
    font-size: 1.5em;
}

.left-sidebar ul {
    list-style-type: none;
    padding: 0;
}

.left-sidebar li {
    padding: 2px 0;
}

.object-link {
    display: block;
    padding: 10px 20px;
    background: #2b2b2b;
    border-radius: 8px;
    color: white;
    text-decoration: none;
    transition: background 0.3s ease;
}

.object-link:hover {
    background: #555;
}

/* Основной контент */

.main-content {
    flex: 1;
    position: relative;
    padding: 20px;
}

.block {
    margin: 10px 0;
    padding: 10px;
    background: #d1d1e2;
    border: 1px solid #4e4e4e;
    border-radius: 8px;
}

.toggle {
    color: rgb(62, 70, 104);
    cursor: pointer;
}

.hidden {
    display: none !important;
}

[hidden] {
    display: none !important;
}

.restricted {
    color: rgb(138, 0, 0);
    cursor: pointer;
}

.object-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.object-image {
    max-width: 300px;
    border-radius: 8px;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.object-image.zoomed {
    position: relative;
    z-index: 100;
    transform: scale(2);
    cursor: zoom-out;
}

figure {
    margin: 20px 0;
    text-align: center;
}

figcaption {
    color: #131313;
    font-size: 1em;
}

/* Анимации */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes protocolAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Модальное окно */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 30px;
    cursor: pointer;
}

/* ============================================================
   B. ОБЩИЕ ОСНОВЫ ДОКУМЕНТОВ PAC
   ============================================================ */

.incident-report,
.interrogation-protocol,
.directors-directive,
.communication-item,
.timeline-item {
    color: var(--pac-ink);
    font-family: var(--pac-sans);
}

.incident-report,
.interrogation-protocol,
.directors-directive {
    position: relative;
    border-radius: var(--pac-radius);
    box-shadow: var(--pac-shadow);
}

.incident-report p,
.interrogation-protocol p,
.directors-directive p,
.communication-item p,
.experiment-content p {
    line-height: 1.72;
}

.document-label {
    display: inline-block;
    margin-bottom: 7px;
    color: var(--pac-muted);
    font-family: var(--pac-mono);
    font-size: .70rem;
    letter-spacing: .10em;
    text-transform: uppercase;
}

.document-divider {
    height: 1px;
    margin: 24px 0;
    background: var(--pac-line);
}

/* ============================================================
   C. ОТЧЁТ ОБ АНОМАЛЬНОЙ АКТИВНОСТИ
   ============================================================ */

.incident-report {
    margin: 28px 0;
    padding: 28px 30px;
    background: var(--pac-paper);
    border: 1px solid var(--pac-line);
    border-top: 4px solid var(--pac-blue);
}

.incident-report:hover {
    box-shadow: var(--pac-shadow-hover);
}

.report-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--pac-line);
}

.report-title {
    margin: 0;
    color: var(--pac-blue);
    font-size: 1.35rem;
    line-height: 1.32;
    font-weight: 700;
    letter-spacing: .035em;
}

.report-id {
    color: var(--pac-muted);
    font-family: var(--pac-mono);
    font-size: .80rem;
    white-space: nowrap;
}

.report-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 9px;
    margin-bottom: 20px;
}

.report-meta > * {
    padding: 10px 12px;
    background: var(--pac-paper-alt);
    border: 1px solid var(--pac-line-soft);
    line-height: 1.5;
    font-size: .87rem;
}

.report-tag,
.evidence-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 7px;
    border-radius: 2px;
    color: #fff;
    font-family: var(--pac-mono);
    font-size: .70rem;
    font-weight: 700;
    letter-spacing: .035em;
    vertical-align: middle;
}

.report-tag {
    background: var(--pac-blue-accent);
}

.evidence-tag {
    background: var(--pac-red);
}

/* ============================================================
   D. ДОПРОС / ПРОТОКОЛ
   ============================================================ */

.interrogation-protocol {
    animation: protocolAppear 0.6s ease-out;
    margin: 24px 0;
    padding: 28px 30px;
    background: var(--pac-paper);
    border: 1px solid #dcc9cc;
    border-top: 4px solid var(--pac-red);
}

.protocol-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 9px;
    margin: 18px 0 24px;
    padding: 13px;
    background: var(--pac-red-light);
    border: 1px solid #ead5d8;
    border-left: 4px solid var(--pac-red);
}

.protocol-title {
    color: var(--pac-red);
}

.dialogue-container {
    margin: 18px 0;
}

.dialogue-line {
    display: grid;
    grid-template-columns: 72px minmax(120px, 180px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    margin: 9px 0;
    padding: 12px 14px;
    background: #fafafa;
    border: 1px solid var(--pac-line);
    border-left: 3px solid var(--pac-line-dark);
    border-radius: var(--pac-radius-small);
}

.dialogue-time {
    min-width: 0;
    padding-right: 10px;
    border-right: 1px solid var(--pac-line);
    color: var(--pac-red);
    font-family: var(--pac-mono);
    font-size: .87rem;
    font-weight: 700;
}

.dialogue-speaker {
    min-width: 0;
    color: var(--pac-blue);
    font-weight: 700;
}

.dialogue-text {
    min-width: 0;
    color: var(--pac-ink);
    line-height: 1.62;
}

.dialogue-garrison {
    background: var(--pac-blue-light);
    border-left-color: var(--pac-blue-accent);
}

.dialogue-subject {
    background: var(--pac-orange-light);
    border-left-color: var(--pac-orange);
}

.dialogue-action {
    background: #f2f3f4;
    border-left-color: #929aa1;
    color: var(--pac-muted);
    font-style: italic;
}

.protocol-note {
    margin: 18px 0;
    padding: 14px 16px;
    background: var(--pac-red-light);
    border: 1px solid #ead5d8;
    border-left: 4px solid var(--pac-red);
    border-radius: var(--pac-radius-small);
    line-height: 1.68;
    font-style: italic;
}

.protocol-stamp {
    margin-top: 25px;
    padding-top: 14px;
    border-top: 1px dashed var(--pac-red);
    text-align: right;
}

.stamp {
    display: inline-block;
    padding: 7px 15px;
    border: 2px solid var(--pac-red);
    color: var(--pac-red);
    background: rgba(139,30,45,.035);
    font-family: var(--pac-mono);
    font-size: .83rem;
    font-weight: 700;
    letter-spacing: .06em;
    transform: rotate(-2deg);
}

/* ============================================================
   E. ЭКСПЕРИМЕНТЫ / TIMELINE
   ============================================================ */

.timeline {
    position: relative;
    margin: 38px 0;
    padding-left: 30px;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 9px;
    top: 3px;
    bottom: 3px;
    width: 2px;
    background: linear-gradient(
        to bottom,
        var(--pac-blue-dark),
        var(--pac-blue-accent),
        var(--pac-line-dark)
    );
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
    padding: 18px 20px;
    background: var(--pac-paper);
    border: 1px solid var(--pac-line);
    border-left: 3px solid var(--pac-blue-accent);
    border-radius: var(--pac-radius-small);
    box-shadow: var(--pac-shadow-soft);
    transition: transform .25s ease, box-shadow .25s ease;
    animation: fadeIn 0.6s ease forwards;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -37px;
    top: 18px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--pac-blue);
    border: 3px solid var(--pac-paper);
    box-shadow: 0 0 0 1px var(--pac-blue);
}

.timeline-item:hover {
    transform: translateX(2px);
    box-shadow: var(--pac-shadow-hover);
}

.experiment-date {
    display: inline-flex;
    align-items: center;
    margin-bottom: 11px;
    padding: 5px 10px;
    color: var(--pac-blue);
    background: var(--pac-blue-light);
    border: 1px solid #d2dee7;
    border-radius: 3px;
    font-family: var(--pac-mono);
    font-size: .78rem;
    font-weight: 700;
}

.experiment-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin: 5px 0;
    color: var(--pac-blue);
    cursor: pointer;
    font-size: 1.18rem;
    line-height: 1.4;
}

.experiment-title:hover {
    color: var(--pac-blue-dark);
}

.experiment-toggle {
    flex: 0 0 auto;
    color: var(--pac-muted);
    transition: transform .25s ease;
}

.experiment-title.expanded .experiment-toggle {
    transform: rotate(180deg);
}

.experiment-content {
    margin-top: 17px;
    padding-top: 17px;
    border-top: 1px solid var(--pac-line);
}

.experiment-header,
.experiment-summary {
    margin: 0 0 18px;
    padding: 0;
}

.experiment-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 9px;
    margin: 0 0 18px;
}

.experiment-meta > * {
    padding: 9px 11px;
    background: var(--pac-paper-soft);
    border: 1px solid var(--pac-line-soft);
    font-size: .86rem;
    line-height: 1.5;
}

/* Главная панель деталей эксперимента */

.experiment-details {
    margin: 14px 0 18px;
    padding: 20px 21px;
    background: var(--pac-paper-alt);
    border: 1px solid var(--pac-line);
    border-radius: var(--pac-radius);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}

/*
 * Старый HTML может содержать подписи прямо внутри текста:
 *   <div class="experiment-goal">Цель: ...</div>
 * Поэтому мы НЕ добавляем псевдоэлементы "ЦЕЛЬ" / "ЗАДАЧА".
 */

.experiment-details > div,
.experiment-details > p {
    margin: 0;
    padding: 9px 0;
    border-bottom: 1px solid var(--pac-line-soft);
    line-height: 1.6;
}

.experiment-details > div:last-child,
.experiment-details > p:last-child {
    border-bottom: none;
}

/* Цель */

.experiment-goal {
    margin: 8px 0 !important;
    padding: 13px 15px 13px 18px !important;
    background: var(--pac-green-light) !important;
    border: 1px solid #d5e7db !important;
    border-left: 4px solid var(--pac-green) !important;
    border-radius: var(--pac-radius-small);
    color: var(--pac-ink) !important;
    font-weight: 400 !important;
    line-height: 1.6;
}

/* Задача */

.experiment-task {
    margin: 8px 0 !important;
    padding: 13px 15px 13px 18px !important;
    background: var(--pac-amber-light) !important;
    border: 1px solid #eadba0 !important;
    border-left: 4px solid var(--pac-amber) !important;
    border-radius: var(--pac-radius-small);
    color: var(--pac-ink) !important;
    font-weight: 400 !important;
    line-height: 1.6;
}

.experiment-subject,
.experiment-equipment,
.experiment-director {
    color: var(--pac-ink);
    font-weight: 400;
}

/* ============================================================
   F. СТРУКТУРИРОВАННЫЕ ПОЛЯ
   ============================================================ */

.experiment-field {
    display: grid;
    grid-template-columns: 145px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    padding: 13px 0;
    border-bottom: 1px solid var(--pac-line-soft);
    line-height: 1.6;
}

.experiment-field:last-child {
    border-bottom: none;
}

.experiment-field-label {
    color: var(--pac-muted);
    font-family: var(--pac-mono);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.experiment-field-value {
    color: var(--pac-ink);
}

.experiment-field.field-goal .experiment-field-label {
    color: var(--pac-green);
}

.experiment-field.field-task .experiment-field-label {
    color: var(--pac-amber);
}

.experiment-field.field-lead .experiment-field-label {
    color: var(--pac-blue);
}

/* Совместимость с вариантом строки руководителя */

.experiment-lead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--pac-line-soft);
}

.experiment-lead-main {
    min-width: 0;
}

.experiment-lead-label,
.details-label {
    display: block;
    margin-bottom: 3px;
    color: var(--pac-muted);
    font-family: var(--pac-mono);
    font-size: .69rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.experiment-lead-name {
    color: var(--pac-blue);
    font-weight: 700;
}

/* ============================================================
   G. РАСКРЫТИЯ / ДОПОЛНИТЕЛЬНЫЕ ДЕТАЛИ / ТЕОРИЯ
   ============================================================ */

.document-fold-toggle,
.experiment-staff-toggle,
.additional-details-toggle,
.theoretical-analysis-toggle,
.subject-toggle,
.subjects-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 11px 0;
    border: 0;
    background: transparent;
    color: var(--pac-blue);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    text-align: left;
}

.document-fold-toggle:hover,
.additional-details-toggle:hover,
.theoretical-analysis-toggle:hover,
.subjects-toggle:hover {
    color: var(--pac-blue-dark);
}

.document-fold-toggle .toggle-arrow,
.document-fold-toggle span:last-child,
.experiment-staff-toggle .toggle-arrow,
.experiment-staff-toggle .staff-toggle-icon,
.additional-details-toggle .toggle-arrow,
.additional-details-toggle span:last-child,
.theoretical-analysis-toggle .toggle-arrow,
.theoretical-analysis-toggle span:last-child,
.subject-toggle .toggle-arrow,
.subject-toggle span:last-child,
.subjects-toggle .toggle-arrow,
.subjects-toggle span:last-child {
    flex: 0 0 auto;
    color: var(--pac-muted);
    transition: transform .25s ease;
}

/* Работает и с aria-expanded, и с твоим существующим JS, который
   просто меняет ▼/▲. */

.document-fold-toggle[aria-expanded="true"] .toggle-arrow,
.experiment-staff-toggle[aria-expanded="true"] .toggle-arrow,
.experiment-staff-toggle[aria-expanded="true"] .staff-toggle-icon,
.additional-details-toggle[aria-expanded="true"] .toggle-arrow,
.theoretical-analysis-toggle[aria-expanded="true"] .toggle-arrow,
.subject-toggle[aria-expanded="true"] .toggle-arrow,
.subjects-toggle[aria-expanded="true"] .toggle-arrow {
    transform: rotate(180deg);
}

.additional-details,
.theoretical-analysis {
    margin: 18px 0;
    padding: 0 16px 4px;
    border-radius: var(--pac-radius);
}

.additional-details {
    background: #f8fafb;
    border: 1px solid var(--pac-line);
    border-left: 4px solid var(--pac-blue-accent);
}

.additional-details .document-fold-toggle,
.additional-details-toggle {
    color: var(--pac-blue);
}

.additional-details .document-fold-content,
.additional-details-content {
    padding: 4px 0 14px;
    border-top: 1px solid var(--pac-line-soft);
}

.theoretical-analysis {
    background: #faf8f1;
    border: 1px solid #e4dcc3;
    border-left: 4px solid var(--pac-amber);
}

.theoretical-analysis .document-fold-toggle,
.theoretical-analysis-toggle {
    color: #735b12;
}

.theoretical-analysis .document-fold-content,
.theoretical-analysis-content {
    padding: 4px 0 14px;
    border-top: 1px solid #eee7d4;
}

.theoretical-analysis p {
    margin: 10px 0;
    padding: 12px 14px;
    background: #fffdf7;
    border: 1px solid #eee7d4;
    border-radius: var(--pac-radius-small);
    color: var(--pac-ink-soft);
    line-height: 1.65;
}

.theoretical-analysis p:last-child {
    margin-bottom: 0;
}

/* Вложенные смысловые секции для новых страниц */

.detail-section {
    margin-top: 12px;
    padding: 13px 14px;
    background: #fff;
    border: 1px solid var(--pac-line-soft);
    border-radius: var(--pac-radius-small);
}

.detail-section + .detail-section {
    margin-top: 10px;
}

.detail-section-title {
    margin: 0 0 8px;
    color: var(--pac-blue);
    font-family: var(--pac-mono);
    font-size: .73rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* Отдельный заголовок списка испытуемых внутри
   раскрываемого блока. */
.additional-subjects {
    margin-top: 12px;
    padding: 13px 14px 14px;
    background: #fff;
    border: 1px solid var(--pac-line-soft);
    border-radius: var(--pac-radius-small);
}

.additional-subjects-title {
    margin: 0 0 10px;
    color: var(--pac-blue);
    font-family: var(--pac-mono);
    font-size: .73rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.additional-subjects .subjects-list,
.additional-subjects .subject-list {
    margin: 0;
}

.detail-section p,
.detail-section ul {
    margin: 0;
    line-height: 1.62;
}

.detail-section ul {
    padding-left: 19px;
}

/* ============================================================
   H. ИССЛЕДОВАТЕЛЬСКАЯ ГРУППА
   ============================================================ */

.experiment-staff {
    margin-top: 20px;
    color: var(--pac-ink);
    font-weight: 400;
}

.experiment-staff-toggle {
    padding: 13px 16px;
    background: #eef1f4;
    border: 1px solid #d6dbe1;
    border-radius: 7px;
    font-size: .95em;
}

.experiment-staff-toggle:hover {
    background: #e7ebef;
    border-color: #c7cdd4;
}

.experiment-staff-toggle .staff-toggle-icon {
    font-size: .85em;
}

.experiment-staff-content {
    margin-top: 10px;
}

/* Старый компактный вариант группы */

.experiment-staff-panel {
    margin: 10px 0 0;
    padding: 10px 0 2px 135px;
    border-top: 1px dashed var(--pac-line);
}

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

.staff-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--pac-line-soft);
    color: var(--pac-ink-soft);
    line-height: 1.5;
}

.staff-list li:last-child {
    border-bottom: 0;
}

.staff-role {
    margin-right: 8px;
    color: var(--pac-muted);
    font-size: .83em;
}

/* Карточка сотрудника */

.staff-card {
    margin: 8px 0;
    background: #fff;
    border: 1px solid #dce1e6;
    border-radius: 7px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.staff-card:hover {
    border-color: #cbd2d9;
    box-shadow: 0 3px 10px rgba(0,0,0,.06);
}

.staff-header {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto 28px;
    align-items: center;
    gap: 12px;
    padding: 13px 15px;
    border: 0;
    background: #f8f9fa;
    color: #2c3e50;
    text-align: left;
    cursor: pointer;
    font: inherit;
    transition: background .2s ease;
}

.staff-header:hover {
    background: #f1f3f5;
}

.staff-name {
    color: #2c3e50;
    font-weight: 700;
}

.staff-position {
    color: #6c757d;
    font-size: .88em;
}

.staff-toggle {
    text-align: right;
    color: #6c757d;
    transition: transform .25s ease;
}

.staff-header[aria-expanded="true"] .staff-toggle {
    transform: rotate(180deg);
}

.staff-details {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #e1e5e9;
}

.staff-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px 18px;
    margin-bottom: 15px;
}

.staff-field {
    padding: 8px 0;
    border-bottom: 1px solid #edf0f2;
}

.staff-field:last-child {
    border-bottom: none;
}

.staff-field-label {
    display: block;
    margin-bottom: 3px;
    color: #7a838c;
    font-size: .75em;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.staff-field-value {
    color: #30353a;
    font-size: .94em;
    line-height: 1.5;
}

.staff-characteristic {
    margin-top: 12px;
    padding: 13px 15px;
    background: #f6f8fa;
    border-left: 3px solid #6c7a89;
    color: #454b51;
    line-height: 1.65;
}

.staff-characteristic-title {
    display: block;
    margin-bottom: 5px;
    color: #59636d;
    font-size: .76em;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* Главный исследователь. Разметка может быть такой же, как у обычного staff-card. */

.lead-staff-card {
    margin-bottom: 12px;
    border-left: 4px solid var(--pac-blue);
}

.lead-staff-card .staff-header {
    background: #eaf3f8;
}

.lead-staff-card .staff-header:hover {
    background: #e2edf4;
}

.lead-staff-card .staff-name {
    color: var(--pac-blue-dark);
    font-size: 1.02em;
}

/* Старый нескрываемый блок руководителя оставляем для совместимости. */

.lead-researcher {
    margin-bottom: 12px;
    padding: 15px;
    background: #f3f6f8;
    border: 1px solid #d6dde3;
    border-left: 4px solid #2c3e50;
    border-radius: 7px;
}

.lead-researcher-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.lead-researcher-name {
    color: #2c3e50;
    font-size: 1.05em;
    font-weight: 700;
}

.lead-researcher-role {
    color: #6c757d;
    font-size: .88em;
}

/* Профиль */

.staff-profile-link {
    display: inline-flex;
    align-items: center;
    margin-top: 14px;
    padding: 7px 11px;
    border: 1px solid #cfd6dd;
    border-radius: 5px;
    background: #f8f9fa;
    color: #2c3e50;
    font-size: .82em;
    text-decoration: none;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.staff-profile-link:hover {
    background: #2c3e50;
    border-color: #2c3e50;
    color: #fff;
}

.staff-profile-error {
    display: inline-flex;
    align-items: center;
    margin-top: 14px;
    padding: 7px 11px;
    border: 1px solid #e3b8b8;
    border-radius: 5px;
    background: #fff7f7;
    color: #a33a3a;
    font-size: .82em;
}

/* ============================================================
   I. ПОДОПЫТНЫЕ / СУБЪЕКТЫ
   ============================================================ */

.subjects-block {
    margin: 0;
    padding: 0;
}

/* Поддержка обоих вариантов названия контейнера:
   старые страницы могли использовать .subject-list,
   новые — .subjects-list. */
.subjects-list,
.subject-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
}

/* Когда список находится внутри «Дополнительных деталей»,
   он занимает всю ширину и больше не наследует сетку
   .experiment-field (145px + содержимое). */
.additional-details .subjects-block {
    margin-top: 0;
}

.additional-details .subjects-list,
.additional-details .subject-list {
    width: 100%;
}

.subject-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--pac-line);
    border-radius: var(--pac-radius-small);
}

.subject-header,
.test-subject-header {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 13px;
    border: 0;
    background: #fff;
    color: var(--pac-ink);
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.subject-header:hover,
.test-subject-header:hover {
    background: var(--pac-paper-soft);
}

.subject-id {
    color: var(--pac-blue);
    font-family: var(--pac-mono);
    font-weight: 700;
}

.subject-summary {
    color: var(--pac-muted);
    font-size: .83rem;
}

.subject-toggle {
    color: var(--pac-muted);
    transition: transform .25s ease;
}

.subject-details,
.test-subject-details {
    padding: 12px 14px 14px;
    background: var(--pac-paper-soft);
    border-top: 1px solid var(--pac-line-soft);
}

.subject-details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.subject-field {
    padding: 9px 10px;
    background: #fff;
    border: 1px solid var(--pac-line-soft);
    border-radius: var(--pac-radius-small);
}

.subject-field.full {
    grid-column: 1 / -1;
}

.subject-field-label {
    display: block;
    margin-bottom: 3px;
    color: var(--pac-muted);
    font-family: var(--pac-mono);
    font-size: .68rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.subject-field-value {
    color: var(--pac-ink);
    line-height: 1.55;
}

.subjects-empty {
    padding: 10px 0 5px;
    color: var(--pac-muted);
    font-family: var(--pac-mono);
    font-size: .88rem;
}

/* ============================================================
   J. МНОГОДНЕВНЫЕ ОТЧЁТЫ
   ============================================================ */

.report-days {
    position: relative;
    margin-top: 22px;
}

.report-day {
    position: relative;
    margin: 0 0 22px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--pac-line);
    border-radius: var(--pac-radius);
    box-shadow: var(--pac-shadow-soft);
}

.report-day:last-child {
    margin-bottom: 0;
}

.report-day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 16px;
    background: var(--pac-paper-alt);
    border-bottom: 1px solid var(--pac-line);
}

.report-day-date {
    color: var(--pac-blue);
    font-family: var(--pac-mono);
    font-size: .90rem;
    font-weight: 700;
}

.report-day-number {
    color: var(--pac-muted);
    font-family: var(--pac-mono);
    font-size: .69rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.report-day-body {
    padding: 3px 0;
}

.report-day-body .report-log,
.report-day-body .experiment-log {
    margin: 0;
    border: 0;
    border-left: 3px solid var(--pac-blue-accent);
    border-radius: 0;
    box-shadow: none;
}

.report-day + .report-day::before {
    content: "";
    position: absolute;
    left: 18px;
    top: -23px;
    width: 2px;
    height: 23px;
    background: var(--pac-line-dark);
}

/* ============================================================
   K. ТЕХНИЧЕСКИЙ ЛОГ / ЖУРНАЛ
   ============================================================ */

.report-log,
.experiment-log {
    position: relative;
    margin: 16px 0;
    padding: 14px 17px;
    background: #f7f9fa;
    border: 1px solid var(--pac-line-soft);
    border-left: 3px solid var(--pac-blue-accent);
    border-radius: var(--pac-radius-small);
    font-family: var(--pac-mono);
    font-size: .92rem;
    line-height: 1.68;
    overflow-x: auto;
}

.report-log > div,
.experiment-log > div {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid rgba(0,0,0,.055);
}

.report-log > div:last-child,
.experiment-log > div:last-child {
    border-bottom: 0;
}

.log-time {
    min-width: 0;
    display: inline-block;
    margin: 0;
    color: var(--pac-blue);
    font-family: var(--pac-mono);
    font-size: .88rem;
    font-weight: 700;
    white-space: nowrap;
}

.log-event {
    color: var(--pac-ink-soft);
}

.log-warning {
    padding: 2px 4px;
    border-radius: 2px;
    color: var(--pac-red-strong);
    background: #f8e1e4;
    font-weight: 700;
}

.log-important {
    padding: 2px 4px;
    border-radius: 2px;
    color: #735800;
    background: #fbefb9;
    font-weight: 700;
}

/* ============================================================
   L. ПРИМЕЧАНИЯ / РЕЗУЛЬТАТЫ
   ============================================================ */

.experiment-note,
.report-note {
    margin: 18px 0;
    padding: 14px 16px;
    border-radius: var(--pac-radius-small);
    line-height: 1.68;
}

.experiment-note {
    background: var(--pac-amber-light);
    border: 1px solid #eadba0;
    border-left: 4px solid var(--pac-amber);
}

.report-note {
    background: var(--pac-blue-light);
    border: 1px solid #d2dee7;
    border-left: 4px solid var(--pac-blue-accent);
}

.experiment-note strong,
.report-note strong,
.protocol-note strong {
    color: var(--pac-blue);
}

/* ============================================================
   M. СЛУЖЕБНАЯ ПЕРЕПИСКА
   ============================================================ */

.communication-container {
    margin: 24px 0;
}

.communication-item {
    position: relative;
    margin-bottom: 20px;
    padding: 20px 22px;
    background: var(--pac-paper);
    border: 1px solid var(--pac-line);
    border-radius: var(--pac-radius);
    box-shadow: var(--pac-shadow-soft);
    animation: fadeIn 0.6s ease forwards;
}

.communication-item.request,
.request {
    margin-left: 5%;
    background: var(--pac-blue-light);
    border-left: 4px solid var(--pac-blue-accent);
}

.communication-item.response,
.response {
    margin-right: 5%;
    background: #fafafa;
    border-left: 4px solid #8f989f;
}

.communication-item.response.approved,
.response.approved {
    background: var(--pac-green-light);
    border-left-color: var(--pac-green);
}

.communication-item.response.denied,
.response.denied {
    background: var(--pac-red-light);
    border-left-color: var(--pac-red);
}

.comm-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0,0,0,.08);
}

.comm-title {
    margin: 0;
    color: var(--pac-blue);
    font-size: 1.10rem;
    font-weight: 700;
}

.comm-meta {
    color: var(--pac-muted);
    font-family: var(--pac-mono);
    font-size: .80rem;
    line-height: 1.5;
}

.comm-id {
    color: var(--pac-blue);
    font-family: var(--pac-mono);
    font-weight: 700;
}

.comm-content {
    color: var(--pac-ink);
    font-size: 1rem;
    line-height: 1.72;
}

.comm-content p {
    margin: 0 0 12px;
}

.comm-content p:last-child {
    margin-bottom: 0;
}

.comm-closing {
    margin-top: 18px;
    color: var(--pac-muted);
    font-style: italic;
}

.comm-signature {
    display: block;
    margin-top: 4px;
    color: var(--pac-blue);
    font-weight: 700;
}

.comm-stamp {
    position: absolute;
    top: 14px;
    right: 16px;
    color: var(--pac-red);
    opacity: .72;
    font-family: var(--pac-mono);
    font-size: 1.7rem;
    font-weight: 700;
    transform: rotate(6deg);
    pointer-events: none;
    user-select: none;
}

/* ============================================================
   N. ПРИКАЗ / ДИРЕКТИВА
   ============================================================ */

.directors-directive {
    position: relative;
    overflow: hidden;
    margin: 30px 0;
    padding: 30px;
    background: var(--pac-paper);
    border: 1px solid #cfb8bc;
    border-left: 5px solid var(--pac-red);
    font-family: var(--pac-serif);
}

.directive-title {
    position: relative;
    z-index: 2;
    margin: 0;
    color: var(--pac-red);
    font-size: 1.65rem;
    line-height: 1.3;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.directive-classification {
    position: relative;
    z-index: 2;
    display: inline-block;
    margin: 10px 0 18px;
    padding: 5px 11px;
    border: 1px solid var(--pac-red);
    color: var(--pac-red);
    background: rgba(139,30,45,.035);
    font-family: var(--pac-mono);
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .05em;
}

.directive-watermark {
    position: absolute;
    z-index: 0;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-35deg);
    color: var(--pac-red);
    opacity: .025;
    font-family: var(--pac-sans);
    font-size: 12rem;
    font-weight: 900;
    pointer-events: none;
    user-select: none;
}

/* ============================================================
   O. СТАТУСЫ / БЕЙДЖИ / ОБЩИЕ СОСТОЯНИЯ
   ============================================================ */

.document-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 8px;
    background: var(--pac-paper-alt);
    border: 1px solid var(--pac-line);
    border-radius: 2px;
    color: var(--pac-muted);
    font-family: var(--pac-mono);
    font-size: .70rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.document-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.document-status.status-active { color: var(--pac-blue-accent); }
.document-status.status-complete { color: var(--pac-green); }
.document-status.status-stopped { color: var(--pac-amber); }
.document-status.status-failed { color: var(--pac-red); }

.document-fold,
.additional-details,
.theoretical-analysis,
.subjects-block {
    transition: border-color .2s ease, box-shadow .2s ease;
}

.document-fold.open,
.additional-details.open,
.theoretical-analysis.open,
.subjects-block.open {
    border-color: var(--pac-line-dark);
    box-shadow: var(--pac-shadow-soft);
}

/* ============================================================
   P. МОБИЛЬНАЯ ВЕРСИЯ
   ============================================================ */

@media (max-width: 768px) {

    body {
        font-size: 16px;
    }

    header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 10px;
    }

    .logo-image {
        position: relative;
        z-index: 1002;
        display: block;
        margin: 0 auto;
        left: -25px;
        top: -15px;
    }

    .user-info {
        width: auto;
        padding-right: 10px;
        text-align: right;
        font-size: 1em;
    }

    .dropdown-menu {
        top: 40px;
        right: 10px;
    }

    .container {
        flex-direction: column;
        margin-top: 0;
        margin-left: 0;
    }

    .left-sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        z-index: 999;
        height: 100vh;
        background: #2c3e50;
        transition: 0.3s;
    }

    .left-sidebar.active {
        left: 0;
    }

    .left-sidebar h3 {
        margin-bottom: 20px;
        color: white;
        font-size: 1.4em;
        text-align: center;
    }

    .object-link {
        margin: 8px 0;
        padding: 12px 15px;
        background: rgba(255, 255, 255, 0.1);
        font-size: 1.1em;
    }

    .object-link:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    .mobile-menu-toggle {
        display: block;
    }

    .main-content {
        width: 100%;
        box-sizing: border-box;
        padding: 15px 10px;
    }

    .object-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .object-image {
        max-width: 100%;
        height: auto;
    }

    .block {
        margin: 10px 0;
        padding: 15px;
        font-size: 1em;
    }

    /* Эксперименты */

    .timeline {
        margin: 28px 0;
        padding-left: 20px;
    }

    .timeline::before {
        left: 6px;
    }

    .timeline-item {
        padding: 16px 14px;
        font-size: 1em;
    }

    .timeline-item::before {
        left: -28px;
        top: 17px;
        width: 11px;
        height: 11px;
    }

    .experiment-title {
        font-size: 1.05rem;
    }

    .experiment-details {
        padding: 15px;
    }

    .experiment-field {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .experiment-field-label {
        font-size: .68rem;
    }

    .experiment-staff-panel {
        padding-left: 0;
    }

    .experiment-staff-toggle {
        padding: 11px 12px;
    }

    .staff-header {
        grid-template-columns: minmax(0, 1fr) 28px;
        gap: 8px;
    }

    .staff-position {
        grid-column: 1 / -1;
        margin-top: -4px;
    }

    .staff-toggle {
        grid-column: 2;
        grid-row: 1 / span 2;
    }

    .staff-details {
        padding: 13px;
    }

    .staff-details-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .lead-researcher {
        padding: 13px;
    }

    .additional-details,
    .theoretical-analysis {
        padding-left: 12px;
        padding-right: 12px;
    }

    .additional-subjects {
        padding: 11px 10px 12px;
    }

    /* Логи */

    .report-log,
    .experiment-log {
        font-size: .86rem;
    }

    .report-log > div,
    .experiment-log > div {
        grid-template-columns: 58px minmax(0, 1fr);
        gap: 9px;
    }

    .log-time {
        font-size: .84rem;
    }

    .report-day-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
        padding: 10px 13px;
    }

    /* Отчёты */

    .incident-report,
    .interrogation-protocol,
    .directors-directive {
        margin: 18px 0;
        padding: 20px 16px;
    }

    .report-header,
    .comm-header {
        flex-direction: column;
    }

    .report-id {
        white-space: normal;
    }

    /* Допрос */

    .dialogue-line {
        grid-template-columns: 1fr;
        gap: 7px;
        padding: 11px 12px;
    }

    .dialogue-time {
        padding: 0 0 6px;
        border-right: 0;
        border-bottom: 1px solid var(--pac-line);
    }

    /* Переписка */

    .communication-item.request,
    .communication-item.response,
    .request,
    .response {
        margin-left: 0;
        margin-right: 0;
    }

    .comm-stamp {
        font-size: 1.35rem;
        top: 10px;
        right: 10px;
    }

    /* Субъекты */

    .subject-header,
    .test-subject-header {
        grid-template-columns: minmax(100px, 1fr) auto;
    }

    .subject-summary {
        display: none;
    }

    .subject-details-grid {
        grid-template-columns: 1fr;
    }

    .subject-field.full {
        grid-column: auto;
    }

    /* Директива */

    .directive-watermark {
        font-size: 7rem;
    }
}

@media (max-width: 480px) {

    body {
        font-size: 15px;
    }

    .logo-image {
        width: 50px;
        margin: 0 0 0 60px;
        left: 0;
        top: 0;
    }

    .main-content {
        padding: 10px 5px;
    }

    .timeline {
        padding-left: 10px;
    }

    .timeline-item::before {
        left: -21px;
        width: 14px;
        height: 14px;
    }

    .experiment-date {
        padding: 6px 12px;
        font-size: .74rem;
    }

    .report-log,
    .experiment-log {
        padding: 10px 11px;
        font-size: .80rem;
    }

    .report-log > div,
    .experiment-log > div {
        grid-template-columns: 52px minmax(0, 1fr);
        gap: 7px;
    }

    .log-time {
        font-size: .78rem;
    }

    .incident-report,
    .interrogation-protocol,
    .directors-directive {
        padding: 16px 13px;
    }

    .report-title {
        font-size: 1.14rem;
    }

    .directors-directive {
        margin: 15px 0;
    }

    .directive-title {
        font-size: 1.38rem;
    }

    .protocol-title {
        font-size: 1.3em;
    }

    .mobile-menu-toggle {
        top: 10px;
        left: 10px;
        padding: 8px;
    }
}

/* Десктопные правила */

/* Оформление боковой панели и шапки на десктопе — в блоке
   «ЕДИНАЯ ШАПКА И БОКОВАЯ ПАНЕЛЬ САЙТА» в конце файла
   (старые правила с !important для .left-sidebar, .object-link
   и .logo-image удалены: они перебивали новый вид). */
@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none !important;
    }
}


/* ============================================================
   R. ДОПОЛНИТЕЛЬНЫЕ СТИЛИ — ИСПЫТУЕМЫЕ / ГРУППА / ДОПРОС
   ------------------------------------------------------------
   Эти правила являются финальным desktop-слоем для новых
   компонентов PAC-002/PAC-098. Они намеренно стоят после
   базовых правил, чтобы переопределять старые варианты
   разметки без использования !important.
   ============================================================ */

/* ------------------------------------------------------------
   Список испытуемых — отдельное раскрытие
   ------------------------------------------------------------ */

.additional-subjects {
    margin: 10px 0 0;
    padding: 0;
    background: #fff;
    border: 1px solid var(--pac-line);
    border-radius: var(--pac-radius-small);
    overflow: hidden;
}

/* Кнопка «Испытуемые · N ▼» */
.additional-subjects-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 13px;
    border: 0;
    background: var(--pac-paper-soft);
    color: var(--pac-blue);
    font: inherit;
    font-size: .92rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.additional-subjects-toggle:hover {
    background: var(--pac-blue-light);
    color: var(--pac-blue-dark);
}

.additional-subjects-toggle-icon {
    flex: 0 0 auto;
    color: var(--pac-muted);
    transition: transform .25s ease;
}

.additional-subjects-toggle[aria-expanded="true"] .additional-subjects-toggle-icon {
    transform: rotate(180deg);
}

.subjects-count {
    color: var(--pac-muted);
    font-size: .86em;
    font-weight: 600;
}

/* Старый заголовок .additional-subjects-title остаётся
   совместимым, если страница ещё не перешла на кнопку. */
.additional-subjects-title {
    margin: 0;
    padding: 11px 13px;
    color: var(--pac-blue);
    background: var(--pac-paper-soft);
    border-bottom: 1px solid var(--pac-line-soft);
    font-family: var(--pac-mono);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .075em;
    text-transform: uppercase;
}

.additional-subjects-content {
    padding: 10px 11px 12px;
    background: #fff;
    border-top: 1px solid var(--pac-line-soft);
}

.additional-subjects .subject-list,
.additional-subjects .subjects-list {
    margin: 0;
}

/* Немного меньше воздуха между многочисленными карточками. */
.additional-subjects .subject-card + .subject-card {
    margin-top: 7px;
}

/* ------------------------------------------------------------
   Исследовательская группа — спокойнее остальных раскрытий
   ------------------------------------------------------------ */

.experiment-staff-toggle {
    width: 100%;
    margin-top: 9px;
    padding: 10px 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--pac-paper-soft);
    border: 1px solid var(--pac-line);
    border-left: 3px solid var(--pac-line-dark);
    border-radius: var(--pac-radius-small);
    color: var(--pac-blue);
    font: inherit;
    font-size: .91rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.experiment-staff-toggle:hover {
    background: #eef2f4;
    border-color: var(--pac-line-dark);
    color: var(--pac-blue-dark);
}

.experiment-staff-toggle .staff-toggle-icon {
    flex: 0 0 auto;
    color: var(--pac-muted);
    transition: transform .25s ease;
}

.experiment-staff-toggle[aria-expanded="true"] .staff-toggle-icon {
    transform: rotate(180deg);
}

.experiment-staff-content {
    margin-top: 7px;
}

/* ------------------------------------------------------------
   Более выразительная шапка протокола допроса
   ------------------------------------------------------------ */

.interrogation-protocol .protocol-header {
    margin: 0 0 21px;
    padding: 0 0 17px 14px;
    border-bottom: 1px solid var(--pac-line);
    border-left: 4px solid var(--pac-red);
}

.interrogation-protocol .protocol-title {
    margin: 0 0 7px;
    color: var(--pac-red-strong);
    font-size: 1.62rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: .02em;
}

.interrogation-protocol .protocol-subtitle {
    margin: 4px 0 0;
    color: var(--pac-muted);
    font-family: var(--pac-mono);
    font-size: .78rem;
    line-height: 1.5;
}

.interrogation-protocol .protocol-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0 0 24px;
    padding: 0;
    background: transparent;
    border: 0;
}

.interrogation-protocol .meta-item {
    min-width: 0;
    padding: 12px 13px;
    background: var(--pac-paper-alt);
    border: 1px solid var(--pac-line);
    border-left: 3px solid var(--pac-red);
    border-radius: var(--pac-radius-small);
}

.interrogation-protocol .meta-label {
    display: block;
    margin-bottom: 4px;
    color: var(--pac-red);
    font-family: var(--pac-mono);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .075em;
    text-transform: uppercase;
}

.interrogation-protocol .meta-value {
    display: block;
    color: var(--pac-ink);
    font-size: .91rem;
    font-weight: 600;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* Служебная строка без колонки «говорящий». */
.interrogation-protocol .dialogue-line.dialogue-action {
    grid-template-columns: 72px minmax(0, 1fr);
}

.interrogation-protocol .dialogue-line.dialogue-action .dialogue-text {
    grid-column: 2;
}

/* ============================================================
   Q. УМЕНЬШЕНИЕ ДВИЖЕНИЯ
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    .timeline-item,
    .experiment-toggle,
    .subject-toggle,
    .staff-toggle,
    .document-fold-toggle .toggle-arrow,
    .experiment-staff-toggle .toggle-arrow,
    .experiment-staff-toggle .staff-toggle-icon,
    .additional-details-toggle .toggle-arrow,
    .theoretical-analysis-toggle .toggle-arrow,
    .subject-toggle .toggle-arrow,
    .subjects-toggle .toggle-arrow {
        transition: none !important;
    }
}


/* ============================================================
   18. ПРИЛОЖЕНИЯ К ОТЧЁТАМ ОБ АНОМАЛЬНОЙ АКТИВНОСТИ
   Один раскрываемый блок вместо вложенного experiment-title.
   ============================================================ */

.report-appendix {
    margin: 26px 0 4px;
    border: 1px solid var(--pac-line);
    border-radius: var(--pac-radius);
    background: var(--pac-paper-soft);
    overflow: hidden;
}

.report-appendix-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 17px;
    border: 0;
    background: var(--pac-blue-light);
    color: var(--pac-blue);
    font: inherit;
    font-size: .96rem;
    font-weight: 700;
    line-height: 1.45;
    text-align: left;
    cursor: pointer;
}

.report-appendix-toggle:hover {
    background: #e3ebf0;
}

.report-appendix-toggle-icon {
    flex: 0 0 auto;
    color: var(--pac-muted);
    transition: transform .25s ease;
}

.report-appendix-toggle[aria-expanded="true"] .report-appendix-toggle-icon {
    transform: rotate(180deg);
}

.report-appendix-content {
    padding: 16px;
    border-top: 1px solid var(--pac-line);
    background: var(--pac-paper-soft);
}

/* В приложении протокол уже является главным документом,
   поэтому убираем лишний внешний отступ/ощущение двойной рамки. */
.report-appendix-content > .interrogation-protocol {
    margin: 0;
}

/* ------------------------------------------------------------
   Шапка протокола допроса
   ------------------------------------------------------------ */

.interrogation-protocol .protocol-header {
    margin: 0 0 20px;
    padding: 0 0 15px;
    border-bottom: 1px solid var(--pac-line);
}

.interrogation-protocol .protocol-title {
    margin: 0 0 6px;
    color: var(--pac-red);
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.3;
}

.interrogation-protocol .protocol-subtitle {
    margin: 3px 0;
    color: var(--pac-muted);
    font-family: var(--pac-mono);
    font-size: .80rem;
    line-height: 1.5;
}

/* ------------------------------------------------------------
   Служебная шапка: 4 аккуратные карточки
   ------------------------------------------------------------ */

.interrogation-protocol .protocol-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0 0 24px;
    padding: 0;
    background: transparent;
    border: 0;
}

.interrogation-protocol .meta-item {
    min-width: 0;
    padding: 12px 13px;
    background: var(--pac-paper-alt);
    border: 1px solid var(--pac-line);
    border-radius: var(--pac-radius-small);
}

.interrogation-protocol .meta-item .log-event {
    display: block;
    color: var(--pac-ink);
}

.interrogation-protocol .meta-label {
    display: block;
    margin-bottom: 4px;
    color: var(--pac-muted);
    font-family: var(--pac-mono);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .075em;
    text-transform: uppercase;
}

.interrogation-protocol .meta-value {
    display: block;
    color: var(--pac-ink);
    font-size: .91rem;
    font-weight: 600;
    line-height: 1.48;
    overflow-wrap: anywhere;
}

/* ------------------------------------------------------------
   Начальные строки без «пустой» колонки говорящего
   ------------------------------------------------------------ */

.interrogation-protocol .dialogue-line.dialogue-action {
    grid-template-columns: 72px minmax(0, 1fr);
}

.interrogation-protocol .dialogue-line.dialogue-action .dialogue-text {
    grid-column: 2;
    min-width: 0;
}

/* ------------------------------------------------------------
   На мобильном шапка становится одной колонкой
   ------------------------------------------------------------ */

@media (max-width: 768px) {
    .report-appendix {
        margin-top: 20px;
    }

    .report-appendix-toggle {
        padding: 13px 14px;
        font-size: .90rem;
    }

    .report-appendix-content {
        padding: 10px;
    }

    .interrogation-protocol .protocol-meta {
        grid-template-columns: 1fr;
    }

    .interrogation-protocol .protocol-title {
        font-size: 1.22rem;
    }
}

/* ============================================================
   R. УНИВЕРСАЛЬНЫЕ БЛОКИ СТРАНИЦЫ АНОМАЛИИ
   ============================================================
   Этот слой предназначен для типовых частей страницы объекта:
   заголовка, классификации, основного изображения/видео,
   процедур, описания, появления и встроенных медиа.
   Он стоит в конце файла намеренно: им можно безопасно
   переопределять старые базовые правила без переписывания
   существующих шаблонов.
   ============================================================ */

/* ------------------------------------------------------------
   Заголовочная область объекта
   ------------------------------------------------------------ */

.main-content > h1 {
    margin: 0 0 18px;
    padding-bottom: 14px;
    color: var(--pac-blue);
    border-bottom: 1px solid var(--pac-line);
    font-size: clamp(1.75rem, 2.5vw, 2.35rem);
    line-height: 1.22;
    font-weight: 700;
    letter-spacing: .01em;
}

.object-info {
    gap: 28px;
    margin: 0 0 24px;
    padding: 18px 20px;
    background: var(--pac-paper);
    border: 1px solid var(--pac-line);
    border-radius: var(--pac-radius);
    box-shadow: var(--pac-shadow-soft);
}

.object-info > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.object-info > div:first-child p {
    margin: 0;
    padding: 11px 13px;
    color: var(--pac-ink);
    background: var(--pac-paper-alt);
    border-bottom: 1px solid var(--pac-line-soft);
    line-height: 1.55;
}

.object-info > div:first-child p:first-child {
    border-radius: var(--pac-radius-small) var(--pac-radius-small) 0 0;
}

.object-info > div:first-child p:last-child {
    border-radius: 0 0 var(--pac-radius-small) var(--pac-radius-small);
    border-bottom: 0;
}

.object-info > div:first-child strong {
    color: var(--pac-blue);
}

.object-info figure {
    flex: 0 0 300px;
    width: min(300px, 34vw);
    margin: 0;
}

.object-info .object-image,
.object-info .object-video {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    border: 1px solid var(--pac-line);
    border-radius: var(--pac-radius);
    background: #fff;
    box-shadow: var(--pac-shadow-soft);
    object-fit: contain;
}

.object-info figcaption,
.document-media figcaption {
    margin-top: 7px;
    color: var(--pac-muted);
    font-size: .80rem;
    line-height: 1.45;
}

/* Универсальные классы для нового HTML. */

.object-header {
    margin-bottom: 24px;
}

.object-classification {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-top: 14px;
}

.object-classification-item {
    padding: 11px 13px;
    background: var(--pac-paper-alt);
    border: 1px solid var(--pac-line-soft);
    border-radius: var(--pac-radius-small);
}

.object-classification-label {
    display: block;
    margin-bottom: 3px;
    color: var(--pac-muted);
    font-family: var(--pac-mono);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.object-classification-value {
    color: var(--pac-blue);
    font-weight: 700;
    line-height: 1.45;
}

/* ------------------------------------------------------------
   Типовой документальный блок
   ------------------------------------------------------------ */

.document-section {
    margin: 18px 0;
    padding: 0;
    background: var(--pac-paper);
    border: 1px solid var(--pac-line);
    border-radius: var(--pac-radius);
    box-shadow: var(--pac-shadow-soft);
    overflow: hidden;
}

.document-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 13px 16px;
    color: var(--pac-blue);
    background: var(--pac-paper-alt);
    border-bottom: 1px solid var(--pac-line);
    font-size: 1.12rem;
    font-weight: 700;
}

.document-section-body {
    padding: 17px 18px;
}

/* Старые .block автоматически получают более документальный вид. */

.block {
    background: var(--pac-paper);
    border-color: var(--pac-line);
    box-shadow: var(--pac-shadow-soft);
}

.block > h2 {
    margin-top: 0;
    color: var(--pac-blue);
    line-height: 1.3;
}

.block > p:last-child {
    margin-bottom: 0;
}

/* ------------------------------------------------------------
   Встроенные изображения / видео / аудио
   ------------------------------------------------------------ */

.document-media {
    margin: 20px 0;
    padding: 12px;
    background: var(--pac-paper-alt);
    border: 1px solid var(--pac-line);
    border-radius: var(--pac-radius);
}

.document-media img,
.document-media video {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: var(--pac-radius-small);
    background: #fff;
    object-fit: contain;
}

.document-media.audio,
.document-media audio {
    width: 100%;
}

.document-media audio {
    display: block;
}

.document-media-side {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 38%);
    gap: 18px;
    align-items: start;
}

.document-media-small {
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.document-caption {
    margin-top: 8px;
    color: var(--pac-muted);
    font-size: .80rem;
    line-height: 1.45;
    text-align: center;
}

/* ------------------------------------------------------------
   Таблицы внутри документов
   ------------------------------------------------------------ */

.document-table-wrap {
    width: 100%;
    margin: 20px 0;
    overflow-x: auto;
    border: 1px solid var(--pac-line);
    border-radius: var(--pac-radius);
    background: #fff;
}

.document-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    color: var(--pac-ink);
    font-size: .90rem;
}

.document-table th {
    padding: 10px 12px;
    color: var(--pac-muted);
    background: var(--pac-paper-alt);
    border-bottom: 1px solid var(--pac-line);
    font-family: var(--pac-mono);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-align: left;
    text-transform: uppercase;
}

.document-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--pac-line-soft);
    line-height: 1.55;
    vertical-align: top;
}

.document-table tr:last-child td {
    border-bottom: 0;
}

.document-table tbody tr:hover {
    background: var(--pac-paper-soft);
}

/* ------------------------------------------------------------
   Универсальные акценты внутри описаний / процедур / появления
   ------------------------------------------------------------ */

.document-callout {
    margin: 18px 0;
    padding: 13px 15px;
    background: var(--pac-blue-light);
    border: 1px solid #d2dee7;
    border-left: 4px solid var(--pac-blue-accent);
    border-radius: var(--pac-radius-small);
    line-height: 1.65;
}

.document-warning {
    background: var(--pac-red-light);
    border-color: #ead5d8;
    border-left-color: var(--pac-red);
}

.document-note {
    background: var(--pac-amber-light);
    border-color: #eadba0;
    border-left-color: var(--pac-amber);
}

@media (max-width: 768px) {
    .main-content > h1 {
        margin-bottom: 15px;
        padding-bottom: 11px;
        font-size: 1.55rem;
    }

    .object-info {
        gap: 14px;
        padding: 13px;
    }

    .object-info figure {
        width: 100%;
        flex-basis: auto;
    }

    .object-classification {
        grid-template-columns: 1fr;
    }

    .document-section-body {
        padding: 13px;
    }

    .document-media-side {
        grid-template-columns: 1fr;
    }

    .document-table-wrap {
        margin: 15px 0;
    }
}


/* ============================================================
   S. САМОСТОЯТЕЛЬНЫЕ ПРИМЕЧАНИЯ И ЦИТАТЫ
   ============================================================
   Используются для материалов страницы объекта, которые не
   являются частью эксперимента или отчёта.

   В отличие от .experiment-note / .report-note они намеренно
   НЕ рисуют большую карточку с полной рамкой. Это позволяет
   помещать их внутрь .block или .document-section, не получая
   "рамку внутри рамки".
   ============================================================ */

.object-note {
    position: relative;
    margin: 18px 4px;
    padding: 11px 16px 11px 17px;
    color: var(--pac-ink-soft);
    background: linear-gradient(to right, var(--pac-amber-light), rgba(251,245,223,.35));
    border: 0;
    border-left: 3px solid var(--pac-amber);
    border-radius: 0 var(--pac-radius-small) var(--pac-radius-small) 0;
    line-height: 1.68;
}

.object-note::before {
    content: "ПРИМЕЧАНИЕ";
    display: block;
    margin-bottom: 4px;
    color: var(--pac-amber);
    font-family: var(--pac-mono);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
}

.object-note strong {
    color: var(--pac-blue);
}

.object-note.note-warning {
    background: linear-gradient(to right, var(--pac-red-light), rgba(247,236,238,.30));
    border-left-color: var(--pac-red);
}

.object-note.note-warning::before {
    color: var(--pac-red);
}

/* ------------------------------------------------------------
   Цитаты / высказывания
   ------------------------------------------------------------ */

.object-quote {
    position: relative;
    margin: 24px auto;
    padding: 9px 26px 9px 30px;
    max-width: 860px;
    color: var(--pac-blue);
    background: transparent;
    border: 0;
    border-left: 2px solid var(--pac-line-dark);
    font-family: var(--pac-serif);
    font-size: 1.02rem;
    font-style: italic;
    line-height: 1.72;
}

.object-quote::before {
    content: "“";
    position: absolute;
    left: 7px;
    top: -7px;
    color: var(--pac-line-dark);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.7rem;
    line-height: 1;
}

.object-quote cite {
    display: block;
    margin-top: 7px;
    color: var(--pac-muted);
    font-family: var(--pac-sans);
    font-size: .82rem;
    font-style: normal;
    font-weight: 700;
}

/* ------------------------------------------------------------
   В обычных блоках текст не должен неожиданно сужаться.
   Исключения вроде .document-media-side по-прежнему имеют
   собственную сетку.
   ------------------------------------------------------------ */

.block > p,
.block > ul,
.block > ol,
.document-section-body > p,
.document-section-body > ul,
.document-section-body > ol {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.block,
.document-section,
.document-section-body {
    box-sizing: border-box;
}

.block > p,
.document-section-body > p {
    margin-right: 0;
    margin-left: 0;
}

@media (max-width: 768px) {
    .object-note {
        margin: 15px 0;
        padding: 10px 12px 10px 14px;
    }

    .object-quote {
        margin: 18px 4px;
        padding: 8px 16px 8px 25px;
        font-size: .98rem;
    }
}
/* ============================================================
   ЕДИНАЯ ШАПКА И БОКОВАЯ ПАНЕЛЬ САЙТА
   (оформление как на странице веществ, substances.css)
   ------------------------------------------------------------
   Блок стоит В КОНЦЕ файла, чтобы перекрывать старые правила
   header / .left-sidebar / .object-link / .container без
   !important. Работает с двумя вариантами разметки:

     1) НОВАЯ  — <header class="site-header"> + <aside class="sidebar left-sidebar">
                 (готовые include: pac-header.html, pac-sidebar.html);
     2) СТАРАЯ — <header> с .logo-image и .user-info + .container >
                 .left-sidebar > .object-link. Так выглядят страницы,
                 которые ещё не переведены на include.

   Эталон значений: substances.css (шрифт, цвета, размеры).
   ============================================================ */

/* ---------- 1. Шапка ---------- */

.site-header,
body > header {
    position: relative;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-sizing: border-box;
    min-height: 76px;
    padding: 0 34px;
    background: #17232e;
    color: #f6f8fa;
    /* как у body на странице веществ: от line-height зависит высота строк в шапке */
    font: 16px/1.65 Arial, Helvetica, sans-serif;
}

/* Бренд: логотип + название (новая разметка) */
.brand {
    display: flex;
    align-items: center;
    gap: 13px;
    flex: 0 0 auto;
    color: inherit;
    text-decoration: none;
}

.brand-logo {
    width: 42px;
    height: 42px;
    margin: 0;
    object-fit: contain;
}

.brand-name {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .12em;
}

.brand-name small {
    display: block;
    font-size: 8px;
    letter-spacing: .16em;
    color: #9eb0bd;
}

/* Бренд: старая разметка <a><img class="logo-image"></a> —
   название дорисовывается псевдоэлементами, вид тот же */
body > header > a:has(> .logo-image) {
    display: grid;
    grid-template-columns: 42px auto;
    grid-template-rows: auto auto;
    column-gap: 13px;
    align-items: center;
    flex: 0 0 auto;
    color: inherit;
    text-decoration: none;
}

body > header > a > .logo-image {
    position: static;
    z-index: auto;
    grid-column: 1;
    grid-row: 1 / span 2;
    display: block;
    width: 42px;
    height: 42px;
    margin: 0;
    left: auto;
    top: auto;
    object-fit: contain;
    transform: none;
}

body > header > a:has(> .logo-image)::after {
    content: "PAC";
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .12em;
}

body > header > a:has(> .logo-image)::before {
    content: "PROTECT · ANALYZE · CONTAIN";
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .16em;
    color: #9eb0bd;
}

/* Поиск в шапке */
.site-header .site-search,
body > header > .site-search {
    flex: 1 1 auto;
    min-width: 200px;
    max-width: 680px;
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
}

/* ---------- 2. Пользователь и выпадающее меню ---------- */

.header-user {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 0 0 auto;
}

.user-details {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.user-greeting {
    font-size: 13px;
    font-weight: 700;
}

.user-access {
    font-size: 11px;
    color: #aab8c3;
}

.logout-link {
    display: inline-block;
    padding: 7px 12px;
    border: 1px solid #60717e;
    border-radius: 5px;
    color: #eaf0f4;
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    transition: background .18s, border-color .18s;
}

.logout-link:hover {
    background: #24313d;
    border-color: #7d94a2;
}

/* Старая разметка: два <p> в .user-info выглядят как .user-details */
body > header .user-info > p {
    margin: 0;
    text-align: right;
    line-height: 1.65;
}

body > header .user-info > p:first-of-type {
    font-size: 13px;
    font-weight: 700;
}

body > header .user-info > p:nth-of-type(2) {
    font-size: 11px;
    color: #aab8c3;
}

/* Обёртка меню */
.site-header .user-info,
body > header .user-info {
    position: relative;
    padding: 4px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    text-align: right;
    font-size: inherit;
    cursor: pointer;
    transition: background .18s, border-color .18s;
}

.site-header .user-info:hover,
.site-header .user-info.open,
body > header .user-info:hover {
    background: #1e2f3c;
    border-color: #34495a;
}

/* Кнопка-заголовок (новая разметка) */
.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: right;
    cursor: pointer;
}

.user-menu-trigger:focus-visible {
    outline: 2px solid #5eb1ce;
    outline-offset: 4px;
    border-radius: 4px;
}

.user-menu-caret {
    width: 6px;
    height: 6px;
    margin-top: -3px;
    border-right: 2px solid #9eb0bd;
    border-bottom: 2px solid #9eb0bd;
    transform: rotate(45deg);
    transition: transform .18s;
}

.user-info.open .user-menu-caret,
.user-info:hover .user-menu-caret {
    transform: translateY(3px) rotate(225deg);
}

/* Само меню */
.site-header .dropdown-menu,
body > header .dropdown-menu {
    display: block;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1000;
    box-sizing: border-box;
    min-width: 236px;
    margin-top: 8px;
    padding: 6px;
    background: #202f3b;
    border: 1px solid #34495a;
    border-radius: 8px;
    box-shadow: 0 14px 30px rgba(8, 14, 20, .38);
    text-align: left;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-4px);
    /* небольшая задержка закрытия: меню не исчезает, если курсор слегка соскользнул */
    transition: opacity .16s, transform .16s, visibility 0s linear .22s;
}

/* невидимый мостик между именем и меню, чтобы hover не обрывался */
.site-header .dropdown-menu::before,
body > header .dropdown-menu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -10px;
    height: 10px;
}

.site-header .user-info:hover > .dropdown-menu,
.site-header .user-info.open > .dropdown-menu,
body > header .user-info:hover > .dropdown-menu {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition-delay: 0s;
}

.site-header .dropdown-menu a,
.site-header .dropdown-menu .site-setting,
body > header .dropdown-menu a,
body > header .dropdown-menu .site-setting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    border-radius: 5px;
    background: none;
    color: #d3dde4;
    font-size: 13px;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition: background .16s, color .16s;
}

.site-header .dropdown-menu a:hover,
.site-header .dropdown-menu .site-setting:hover,
body > header .dropdown-menu a:hover,
body > header .dropdown-menu .site-setting:hover {
    background: #2d414f;
    color: #fff;
}

.dropdown-menu .menu-divider {
    height: 1px;
    margin: 6px 4px;
    background: #34495a;
}

.dropdown-menu .menu-item-danger:hover {
    background: #4a2d34;
}

/* Переключатель «Режим архива» (виден только там, где страница его поддерживает) */
.site-header .dropdown-menu .archive-toggle,
body > header .dropdown-menu .archive-toggle,
.site-header .dropdown-menu .view-setting-error,
body > header .dropdown-menu .view-setting-error {
    display: none;
}

body[data-old-view-available="true"] .site-header .dropdown-menu .archive-toggle,
body[data-old-view-available="true"] > header .dropdown-menu .archive-toggle {
    display: flex;
}

.dropdown-menu .site-setting-text {
    display: flex;
    flex-direction: column;
}

.dropdown-menu .site-setting-text small {
    color: #8ea1ae;
    font-size: 11px;
    line-height: 1.3;
}

.dropdown-menu .site-setting input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    flex: 0 0 auto;
    width: 34px;
    height: 18px;
    margin: 0;
    border-radius: 9px;
    background: #44596a;
    cursor: pointer;
    transition: background .18s;
}

.dropdown-menu .site-setting input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    transition: transform .18s;
}

.dropdown-menu .site-setting input[type="checkbox"]:checked {
    background: #5eb1ce;
}

.dropdown-menu .site-setting input[type="checkbox"]:checked::after {
    transform: translateX(16px);
}

.dropdown-menu .site-setting input[type="checkbox"]:focus-visible {
    outline: 2px solid #5eb1ce;
    outline-offset: 2px;
}

body[data-old-view-available="true"] .site-header .dropdown-menu .view-setting-error:not(.hidden),
body[data-old-view-available="true"] > header .dropdown-menu .view-setting-error:not(.hidden) {
    display: block;
    margin: 2px 6px 6px;
    padding: 8px 10px;
    border-radius: 4px;
    background: #4a2d34;
    color: #f3c4cb;
    font-size: 12px;
    line-height: 1.4;
}

/* ---------- 3. Сетка страницы и боковая панель ---------- */

.page-layout,
.container:has(> .left-sidebar) {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: calc(100vh - 76px);
    margin: 0;
}

.sidebar,
.left-sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    box-sizing: border-box;
    width: auto;
    height: 100vh;
    padding: 30px 18px;
    background: #202f3b;
    color: #dce5eb;
    border-right: 0;
}

.sidebar-heading,
.left-sidebar > h3 {
    margin: 0;
    padding: 0 11px 14px;
    color: #91a2af;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .16em;
    line-height: 1.65;
    text-align: left;
}

/* старая разметка: заголовок «Объекты» — капсом, как «НАВИГАЦИЯ» */
.left-sidebar > h3 {
    text-transform: uppercase;
}

.sidebar-nav,
.left-sidebar > ul {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.left-sidebar > ul > li {
    padding: 0;
}

/* Кнопки меню: .sidebar-nav a (новая) и .object-link (старая разметка) */
.sidebar-nav a,
.left-sidebar .object-link {
    display: flex;
    justify-content: space-between;
    box-sizing: border-box;
    margin: 0;
    padding: 12px;
    background: transparent;
    border-left: 3px solid transparent;
    border-radius: 5px;
    color: #d3dde4;
    font-size: 15px;
    line-height: 1.65;
    text-decoration: none;
    transition: background .18s;
}

.sidebar-nav a:hover,
.left-sidebar .object-link:hover {
    background: #2d414f;
}

.sidebar-nav a.active,
.left-sidebar .object-link.active,
.left-sidebar .object-link[aria-current="page"] {
    background: #314858;
    border-left-color: #5eb1ce;
    color: #fff;
}

.sidebar-nav a span {
    padding: 0 5px;
    border: 1px solid #607887;
    border-radius: 3px;
    color: #9eb4c1;
    font-size: 11px;
}

.sidebar-note {
    position: absolute;
    left: 26px;
    bottom: 23px;
    color: #8ea1ae;
    font-size: 10px;
    letter-spacing: .1em;
}

.status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 6px;
    background: #70b58a;
    border-radius: 50%;
}

/* В сетке .main-content не растягивается через flex */
.page-layout > .main-content,
.container:has(> .left-sidebar) > .main-content {
    min-width: 0;
}

/* ---------- 4. Мобильная версия ---------- */

@media (max-width: 768px) {
    .site-header,
    body > header {
        flex-wrap: wrap;
        gap: 10px 14px;
        min-height: 64px;
        /* слева место под кнопку-бургер */
        padding: 10px 14px 10px 62px;
    }

    .site-header .site-search,
    body > header > .site-search {
        order: 3;
        flex: 1 1 100%;
        min-width: 0;
        max-width: none;
    }

    .brand-name small,
    body > header > a:has(> .logo-image)::before {
        display: none;
    }

    .site-header .user-info,
    body > header .user-info {
        padding: 4px 8px;
    }

    /* на телефоне в шапке остаётся только имя, без «Добро пожаловать» */
    .user-greeting-prefix {
        display: none;
    }

    .site-header .header-user {
        margin-left: auto;
    }

    .site-header .dropdown-menu,
    body > header .dropdown-menu {
        right: 0;
        left: auto;
        max-width: calc(100vw - 28px);
    }

    .page-layout,
    .container:has(> .left-sidebar) {
        grid-template-columns: 1fr;
    }

    .sidebar,
    .left-sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        z-index: 999;
        width: 260px;
        background: #202f3b;
        transition: left .3s ease;
    }

    .sidebar.active,
    .left-sidebar.active {
        left: 0;
    }
}