* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 9pt;
    background-color: #f0f0f0;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------- всплывающее уведомление ---------- */
.app-toast-wrap {
    position: fixed;
    top: 48px;
    right: 18px;
    z-index: 3000;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.app-toast-wrap.app-toast-hide {
    opacity: 0;
    transform: translateY(-10px);
}

.app-toast {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 240px;
    max-width: 420px;
    padding: 9px 12px;
    font-size: 9pt;
    color: #1d2b1d;
    background: #eaf7ea;
    border: 1px solid #79b479;
    border-left: 4px solid #2e7d32;
    border-radius: 5px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}

.app-toast-danger {
    color: #3b1a1a;
    background: #fdecec;
    border-color: #d99a9a;
    border-left-color: #c62828;
}

.app-toast-info {
    color: #17324a;
    background: #eaf4fd;
    border-color: #94bde0;
    border-left-color: #1e6fd7;
}

.app-toast-info .app-toast-mark {
    background: #1e6fd7;
}

.app-toast-mark {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    font-size: 10pt;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    color: #fff;
    background: #2e7d32;
    border-radius: 50%;
}

.app-toast-danger .app-toast-mark {
    background: #c62828;
}

.app-toast-text {
    flex: 1 1 auto;
}

.app-toast-close {
    flex: 0 0 auto;
    padding: 0 3px;
    font-size: 13pt;
    line-height: 1;
    color: inherit;
    background: none;
    border: none;
    opacity: 0.6;
    cursor: pointer;
}

.app-toast-close:hover {
    opacity: 1;
}

.top-panel {
    height: 40px;
    background: linear-gradient(to bottom, #f6f6f6, #e5e5e5);
    border-bottom: 1px solid #a0a0a0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    flex-shrink: 0;
}

.main-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.left-panel {
    width: 350px;
    background: #f9f9f9;
    border-right: 1px solid #a0a0a0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    transition: width .18s ease, background-color .18s ease;
}

/* ---------- автоматически схлопываемая левая панель ---------- */
.panel-rail {
    display: none;
}

.left-panel.is-collapsed {
    width: 56px;
    min-width: 56px;
    max-width: 56px;
    background: #102a43;
    border-right-color: #081d30;
    color: #fff;
    overflow: visible;
    z-index: 5;
}

.left-panel.is-collapsed .panel-section {
    display: none;
}

.left-panel.is-collapsed .panel-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 5px;
    flex: 1 1 auto;
}

.panel-rail-settings {
    margin-top: auto;
}

.panel-rail-btn {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #cfe2f3;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    text-decoration: none;
    transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}

.panel-rail-btn i {
    font-size: 1.2rem;
}

.panel-rail-btn::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    padding: 5px 9px;
    background: #102a43;
    color: #fff;
    border: 1px solid #6fa8d6;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .1s ease, visibility .1s ease;
    z-index: 1000;
}
.panel-rail-btn:hover::after,
.panel-rail-btn:focus-visible::after {
    opacity: 1;
    visibility: visible;
}

.panel-rail-btn:hover,
.panel-rail-btn:focus-visible {
    background: #1b4f7a;
    border-color: #6fa8d6;
    color: #fff;
    outline: none;
}

/* мигающий индикатор невыполненных задач: один цикл в 3 секунды */
@keyframes aidTaskBlink {
    0%, 49%   { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 193, 7, .7); }
    50%, 100% { opacity: .35; box-shadow: 0 0 12px 4px rgba(255, 193, 7, .35); }
}
.panel-rail-task-alert {
    background: #d13b2f !important;
    border-color: #ffb3a7 !important;
    color: #fff !important;
    animation: aidTaskBlink 3s step-end infinite;
}
.panel-rail-task-count {
    position: absolute;
    top: -5px; right: -5px;
    min-width: 17px; height: 17px;
    padding: 0 3px;
    border-radius: 9px;
    background: #ffc107;
    color: #212529;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
}
.panel-tasks-footer { padding: 6px 8px; border-top: 1px solid #dee2e6; }

/* ---------- задачи в левой панели ---------- */
.panel-tasks-section { flex: 0 0 auto; min-height: 120px; }
.panel-task-counter {
    background: #e9ecef;
    border-radius: 9px;
    padding: 0 6px;
    font-size: 9pt;
    font-weight: 600;
}
.list-item.panel-task-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    padding: 4px 8px;
}
.panel-task-check { margin: 2px 0 0; flex: 0 0 auto; }
.panel-task-text { min-width: 0; flex: 1 1 auto; }
.panel-task-title {
    display: block;
    overflow-wrap: anywhere;
    line-height: 1.25;
}
.panel-task-meta {
    display: block;
    color: #777;
    font-size: 8pt;
    overflow-wrap: anywhere;
}
.list-item.panel-task-item.is-done .panel-task-title {
    text-decoration: line-through;
}
html[data-theme="dark"] .panel-task-meta { color: #9aa9b8; }

/* личные задачи: замок в рельсе и в таблицах */
.task-private-badge {
    display: inline-block;
    padding: 1px 6px;
    margin-right: 4px;
    border-radius: 999px;
    font-size: .78em;
    font-weight: 700;
    line-height: 1.2;
    color: #6d4ba8;
    background: #efe8fb;
    border: 1px solid #ddcef5;
    vertical-align: baseline;
}
.list-item.panel-task-item.is-private { border-left: 3px solid #7b5cd6; padding-left: 5px; }
tr.is-private > td:first-child { box-shadow: inset 3px 0 0 #7b5cd6; }
html[data-theme="dark"] .task-private-badge {
    color: #d9c9ff; background: #352a52; border-color: #594484;
}

/* кнопка схлопывания видна только на раскрытой панели */
.panel-toggle-btn {
    display: none;
    position: sticky;
    top: 0;
    z-index: 3;
    align-self: flex-end;
    flex: 0 0 auto;
    width: 28px;
    height: 24px;
    margin: 3px 4px 2px 0;
    padding: 0;
    font-size: 14px;
    line-height: 1;
    color: #445;
    background: #f9f9f9;
    border: 1px solid #c0c0c0;
    border-radius: 4px;
    cursor: pointer;
}
.left-panel:not(.is-collapsed) .panel-toggle-btn {
    display: block;
}
.panel-toggle-btn:hover {
    background: #e5e5e5;
}

.pin-object-btn {
    text-decoration: none;
    font-size: 1rem;
    line-height: 1;
    opacity: .65;
}
.pin-object-btn:hover,
.pin-object-btn.is-pinned {
    opacity: 1;
}

.panel-section {
    border-bottom: 1px solid #d0d0d0;
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 104px;
}

.panel-header {
    background: linear-gradient(to bottom, #f0f0f0, #e0e0e0);
    padding: 4px 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #c0c0c0;
    font-size: 9pt;
}

.panel-body {
    flex: 1 1 auto;
    overflow-y: auto;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.panel-actions form {
    display: inline-flex;
}

.panel-actions .btn {
    padding: 0 5px;
    font-size: 11px;
    line-height: 1.6;
}

.panel-actions .btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* ---------- реестры: наименование, статус, дата, примечание ---------- */
.list-item.registry-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.registry-item .reg-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.registry-item .reg-link {
    flex: 0 0 auto;
    font-size: 9pt;
}

.registry-item .reg-status {
    flex: 0 0 auto;
    font-size: 8pt;
    font-weight: 600;
    white-space: nowrap;
}

.registry-item .reg-date {
    flex: 0 0 auto;
    font-size: 7.5pt;
    color: #6b6b6b;
    white-space: nowrap;
}

.registry-item .reg-notes {
    flex: 0 0 100%;
    min-width: 0;
    font-size: 7.5pt;
    color: #555;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.25;
    margin-top: 1px;
}

.reg-status.st-signed {
    color: #007a00;
}

.reg-status.st-unsigned {
    color: #cc0000;
}

.reg-status.st-progress {
    color: #cc8800;
}

.reg-status.st-review {
    color: #0055cc;
}

.reg-status.st-pause {
    color: #6f42c1;
}

.reg-status.st-none {
    color: #909090;
}

.registry-item.active .reg-status,
.registry-item.active .reg-date,
.registry-item.active .reg-link,
.registry-item.active .reg-notes {
    color: #ffffff;
}

.btn-xs {
    padding: 0 6px;
    font-size: 11px;
    line-height: 1.4;
}

.list-group-item {
    padding: 3px 8px;
    font-size: 9pt;
    border: none;
    border-radius: 0;
}

.list-group-item:hover {
    background-color: #e5f1fb;
}

.list-group-item.active {
    background-color: #0078d4;
    color: white;
}

.right-panel {
    flex: 1;
    background: white;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nav-tabs {
    background: #f0f0f0;
    border-bottom: 1px solid #a0a0a0;
    padding: 4px 4px 0 4px;
    flex-shrink: 0;
}

.nav-tabs .nav-link {
    font-size: 9pt;
    padding: 4px 12px;
    border: 1px solid transparent;
    color: #333;
}

.nav-tabs .nav-link.active {
    background: white;
    border-color: #a0a0a0 #a0a0a0 white;
}

.tab-content {
    flex: 1;
    overflow: auto;
}

.table {
    font-size: 9pt;
}

.table th {
    background: #f0f0f0;
    font-weight: 600;
    padding: 4px 6px;
}

.table td {
    padding: 3px 6px;
}

.modal-dialog {
    font-size: 9pt;
}

.form-label {
    font-size: 9pt;
    margin-bottom: 2px;
}

.form-control {
    font-size: 9pt;
    padding: 3px 6px;
}

/* ---------- левая панель: элементы списков ---------- */
.list-item {
    display: block;
    padding: 3px 10px;
    font-size: 9pt;
    color: #222;
    text-decoration: none;
    border-bottom: 1px solid #ededed;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item:hover {
    background: #e5f1fb;
    color: #000;
}

.list-item.active {
    background: #0078d4;
    color: #fff;
}

.empty-hint {
    padding: 6px 10px;
    color: #888;
    font-size: 8.5pt;
    font-style: italic;
}

/* ---------- правая панель ---------- */
.tab-content-area {
    flex: 1;
    overflow: auto;
    padding: 6px 8px 12px;
}

.sub-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    border-bottom: 1px solid #a0a0a0;
    padding: 4px 4px 0;
    margin-bottom: 6px;
    background: #f7f7f7;
    flex-shrink: 0;
}

.sub-tab {
    display: inline-block;
    font-size: 8.5pt;
    padding: 3px 9px;
    border: 1px solid #c4c4c4;
    border-bottom: none;
    border-radius: 3px 3px 0 0;
    background: #ececec;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
}

.sub-tab:hover {
    background: #e0efff;
    color: #000;
}

.sub-tab.active {
    background: #fff;
    color: #000;
    font-weight: 600;
    border-color: #a0a0a0;
    position: relative;
    top: 1px;
}

/* ---------- Данные объекта: сетка подвкладок как в образце ---------- */
.objdata-groups {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 2px;
    padding: 2px;
    margin-bottom: 6px;
    background: #f0f0f0;
    flex-shrink: 0;
}

.objdata-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 200px;
    max-width: 320px;
    min-width: 0;
}

.objdata-tab {
    display: block;
    font-family: "Segoe UI", Tahoma, sans-serif;
    font-size: 9pt;
    padding: 3px 8px;
    border: 1px solid #8b8b8b;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    border-radius: 2px;
    background: linear-gradient(#ffffff, #ececec);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
    color: #333333;
    text-align: center;
    text-decoration: none;
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: break-word;
    cursor: pointer;
}

.objdata-tab:hover {
    background: linear-gradient(#ffffff, #dceafa);
    border-color: #7eb4ea;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    color: #000;
}

.objdata-tab:active {
    background: #d6d6d6;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
}

.objdata-tab.active {
    background: linear-gradient(#1490e6, #0078d4);
    border-color: #005a9e;
    border-top-color: #7cc4f5;
    border-left-color: #7cc4f5;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 1px rgba(0, 0, 0, 0.2);
    color: #ffffff;
    font-weight: 600;
}

.tab-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 2px 8px;
}

.toolbar-hint {
    color: #6c757d;
    font-size: 8.5pt;
}

.toolbar-select {
    width: auto;
    min-width: 170px;
    max-width: 320px;
    font-size: 8.5pt;
    padding: 2px 6px;
}

.act-picker {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px;
    margin: 0 0 8px;
    background: #f1f5f1;
    border: 1px solid #d4ddd4;
    border-radius: 4px;
}

.act-picker-label {
    font-size: 8.5pt;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.act-picker-select {
    width: auto;
    min-width: 320px;
    max-width: 560px;
    font-size: 8.5pt;
}

.act-picker-state {
    font-size: 8.5pt;
}

/* ---------- таблицы ---------- */
.data-table {
    margin-bottom: 0;
}

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f0f0f0;
    vertical-align: middle;
    white-space: nowrap;
}

.data-table td {
    vertical-align: middle;
}

.data-table tbody tr {
    cursor: default;
}

.grid-scroll {
    max-height: calc(100vh - 210px);
    overflow: auto;
}

.grid-table input.grid-input {
    min-width: 90px;
    border-color: #e2e2e2;
}

.grid-table input.grid-input:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.1rem rgba(13, 110, 253, .15);
}

/* ---------- таблица-сетка актов ОСР (как в образце) ---------- */
.grid-toolbar {
    padding-bottom: 4px;
}

.grid-status {
    margin-left: 6px;
    font-size: 8.5pt;
    color: #6c757d;
}

.grid-status-dirty {
    color: #9a6500;
    font-weight: 600;
}

.grid-sections {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 2px 6px;
}

.grid-sections-label {
    margin-right: 2px;
    font-size: 8.5pt;
    color: #555;
}

.grid-sections-hint {
    margin-left: 6px;
    font-size: 8pt;
    color: #aaaaaa;
}

.grid-section-btn {
    padding: 2px 10px;
    font-size: 8.5pt;
    color: #222;
    background: #f0f0f0;
    border: 1px solid #b9b9b9;
    border-radius: 3px;
    cursor: pointer;
}

.grid-section-btn:hover {
    background: #e4e4e4;
}

.grid-section-btn.active {
    background: #d0f0c0;
    border-color: #7aae6a;
    font-weight: 600;
}

.grid-hidden {
    display: none !important;
}

.grid-table {
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
}

.grid-table th,
.grid-table td {
    min-width: 135px;
    padding: 2px 3px;
    vertical-align: top;
}

.grid-table thead th {
    font-size: 8pt;
    line-height: 1.15;
    white-space: normal;
}

.grid-table th.grid-fixed,
.grid-table td.grid-fixed {
    position: sticky;
    z-index: 1;
    background: #f7f7f7;
}

.grid-table thead th.grid-fixed {
    z-index: 4;
    background: #f0f0f0;
}

.grid-table th.grid-idx,
.grid-table td.grid-idx {
    left: 0;
    width: 40px;
    min-width: 40px;
    max-width: 40px;
}

.grid-table th.grid-act,
.grid-table td.grid-act {
    left: 40px;
    width: 120px;
    min-width: 120px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.grid-act-link {
    font-weight: 600;
    text-decoration: none;
}

.grid-table .grid-input {
    width: 100%;
    min-width: 110px;
    padding: 2px 3px;
    font-size: 8.5pt;
    line-height: 1.25;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 2px;
}

.grid-table textarea.grid-input {
    min-height: 24px;
    height: auto;
    overflow: hidden;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    resize: none;
    field-sizing: content;
}

.grid-table .grid-input:hover {
    background: #fff;
    border-color: #d5d5d5;
}

.grid-table .grid-input:focus {
    background: #fff;
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.1rem rgba(13, 110, 253, .15);
}

.grid-table .combo-wrap {
    gap: 0;
    align-items: stretch;
}

.grid-table .combo-toggle {
    width: 18px;
    height: 24px;
    align-self: flex-start;
    font-size: 8px;
}

.grid-table tr.grid-dirty > td.grid-fixed {
    background: #fff3cd;
}

.grid-table td.grid-cell-dirty {
    background: #fff3cd !important;
}

.grid-table tr.grid-row-selected > td {
    box-shadow: inset 0 1px 0 #1e6fd7, inset 0 -1px 0 #1e6fd7;
}

.grid-table td.grid-col-selected {
    background: #eef6ff;
}

.grid-table.grid-fit th,
.grid-table.grid-fit td {
    min-width: 92px;
    max-width: 120px;
}

.grid-table.grid-fit .grid-input {
    min-width: 82px;
    font-size: 8pt;
}

.grid-table.grid-fit textarea.grid-input {
    min-height: 22px;
}

.row-selected > td {
    background: #dceaff !important;
}

.row-done > td {
    background: #e9f7ec;
    color: #4a6b50;
}

.row-done > td:nth-child(3) {
    text-decoration: line-through;
}

/* ---------- материалы ---------- */
/* сводка занятых ID (модалки добавления/копирования) */
.mat-idinfo-block {
    background: #fff8e1;
    border: 1px solid #ffe08a;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 9pt;
    line-height: 1.55;
}

.mat-idinfo-title {
    font-weight: 600;
}

.mat-id-blink {
    display: inline-block;
    min-width: 1.6em;
    font-weight: 700;
    font-size: 15pt;
    line-height: 1.1;
    color: #c40000;
    animation: matIdBlink 5s infinite;
}

@keyframes matIdBlink {
    0%, 55% { opacity: 1; }
    56%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .mat-id-blink { animation: none; }
}

#materialsTable tr.selected > td {
    background: #dceaff !important;
}
.mat-link-btn.btn-success {
    background: #28a745;
    border-color: #1e7e34;
}
.mat-cols-panel {
    padding: 6px 10px;
    background: #f7f7f7;
    border: 1px solid #d5d5d5;
    border-radius: 4px;
    margin: 4px 0;
    display: inline-flex;
    gap: 10px;
    align-items: center;
    font-size: 8.5pt;
}
.mat-cols-label {
    font-weight: 600;
    margin-right: 6px;
}
.mat-cols-item {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 6px 0 0;
    cursor: pointer;
    white-space: nowrap;
}
.mat-cols-close {
    margin-left: 8px;
}
/* кнопка + для добавления материала к акту в режиме 📦 */
.mat-add-one {
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 10px;
    line-height: 1;
    background: #d4edda;
    border: 1px solid #28a745;
    color: #28a745;
    border-radius: 3px;
    cursor: pointer;
}
.mat-add-one:hover {
    background: #28a745;
    color: #fff;
}
/* отметка «дата документа позже окончания работ» (осознанное исключение) */
.mat-date-warn {
    color: #dc3545;
    font-weight: 700;
    margin-left: 3px;
    cursor: help;
}
.mat-date-warn-row .mat-col-docdate {
    background: #fff3cd;
}
.mat-date-warn-list td, .mat-date-warn-list th {
    vertical-align: middle;
}
/* в режиме добавления скрываем столбец действий там, где нет кнопки + */
.mat-add-mode .mat-col-actions {
    display: none;
}
/* столбцы ✓ и Кол-во присутствуют всегда; содержимое — только в режимах 📦 и 🔗 */
#materialsTable th.mat-col-sel, #materialsTable td.mat-col-sel {
    width: 40px; min-width: 40px; max-width: 40px; text-align: center;
}
#materialsTable th.mat-col-qty, #materialsTable td.mat-col-qty {
    width: 70px; min-width: 70px; max-width: 70px;
}
.mat-link-check { color: #28a745; font-weight: bold; cursor: default; }
/* заливка ячейки «Остаток» по принципу образца (Образец/main.py:5699-5704, 5233-5253, 6003-6013) */
#materialsTable td.mat-col-balance.bal-neg  { background-color: #FFC7CE !important; } /* остаток < 0.005 (дефицит/ноль) */
#materialsTable td.mat-col-balance.bal-zero { background-color: #C6EFCE !important; } /* расход 0 */
#materialsTable td.mat-col-balance.bal-part { background-color: #FFEB9C !important; } /* расход есть, минуса нет */
#materialsTable td.mat-col-balance.bal-doc  { background-color: #E0D6F2 !important; } /* ОП/ИП/СС/ДС (документы) */

/* «Кол-во в акте» при включённой 🔗 и выбранном акте — крупнее, жирным, красным */
#materialsTable td.mat-col-qty.mat-qty-linked {
    font-weight: bold;
    color: #c00;
    font-size: 11pt;
}
.mat-link-mode #materialsTable {
    table-layout: fixed !important;
    width: 100% !important;
}
.mat-link-mode .mat-qty-input {
    width: 100% !important;
    max-width: none !important;
    padding: 0 3px;
    text-align: right;
    box-sizing: border-box;
    height: 24px;
    font-size: 8.5pt;
}
.mat-link-mode #materialsTable th.mat-col-qty,
.mat-link-mode #materialsTable td.mat-col-qty {
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
}
.mat-link-mode #materialsTable th.mat-col-sel,
.mat-link-mode #materialsTable td.mat-col-sel {
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
}

/* в режиме привязки показываем только материалы, связанные с актом */
.mat-link-mode #materialsTable tbody tr:not([data-linked="1"]) {
    display: none !important;
}
.mat-link-mode #materialsTable tbody tr:not([data-linked="1"]) .mat-col-actions {
    display: none !important;
}

/* ---------- пустые состояния ---------- */
.empty-state {
    border: 1px dashed #c9c9c9;
    background: #fbfbfb;
    border-radius: 6px;
    padding: 28px 18px;
    text-align: center;
    color: #777;
    margin: 18px 4px;
}

.empty-state-title {
    font-size: 11pt;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

/* ---------- форма акта ---------- */
.act-editor .card-header {
    font-weight: 600;
    padding: 6px 10px;
    background: #f3f6fa;
}

.act-editor .card-body {
    max-height: 58vh;
    overflow-y: auto;
    background: #f0f2f5;
}

/* Заполняемые поля — светло-жёлтая «экселевская» заливка + чёткая рамка,
   чтобы сразу было видно, куда вводить данные */
.act-editor .form-control,
.act-editor textarea.form-control,
.act-editor input.form-control,
.act-editor select.form-control {
    background-color: #fffdf0;
    border: 1px solid #b9a86b;
    border-top-color: #a08e4e;
    border-radius: 3px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07);
    color: #1c2430;
}

.act-editor .form-control:hover {
    background-color: #fffbe0;
    border-color: #8d7a3c;
}

.act-editor .form-control:focus {
    background-color: #ffffff;
    border-color: #0078d4;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.18), inset 0 1px 2px rgba(0, 0, 0, 0.06);
    outline: none;
}

.act-editor .form-label {
    display: block;
    font-size: 8pt;
    font-weight: 700;
    color: #33465a;
    margin-bottom: 2px;
    line-height: 1.2;
}

/* Каждое поле — отдельная ячейка с рамкой: строки не сливаются */
.act-editor .form-section .row > [class*="col-"],
.act-editor .registry-fields .row > [class*="col-"] {
    background: #ffffff;
    border: 1px solid #d3dbe4;
    border-radius: 4px;
    padding: 4px 6px 6px;
}

.act-editor .form-section .row > [class*="col-"]:hover,
.act-editor .registry-fields .row > [class*="col-"]:hover {
    border-color: #8fb4d6;
    box-shadow: 0 1px 3px rgba(0, 80, 160, 0.12);
}

.act-editor .form-section .row > [class*="col-"]:focus-within,
.act-editor .registry-fields .row > [class*="col-"]:focus-within {
    border-color: #0078d4;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.15);
}

/* ---------- раскрывающиеся списки (▼) в форме акта ---------- */
.combo-wrap {
    display: flex;
    align-items: stretch;
    gap: 3px;
}

.combo-wrap .form-control {
    flex: 1 1 auto;
    min-width: 0;
}

.combo-wrap.combo-wrap-textarea,
.combo-wrap:has(textarea) {
    align-items: flex-start;
}

.combo-wrap.combo-wrap-textarea .combo-toggle,
.combo-wrap:has(textarea) .combo-toggle {
    align-self: flex-start;
}

.combo-toggle {
    flex: 0 0 auto;
    width: 24px;
    padding: 0;
    font-size: 10px;
    line-height: 1;
    color: #6b5a1f;
    background: #fffbe0;
    border: 1px solid #b9a86b;
    border-radius: 3px;
    cursor: pointer;
}

.combo-toggle:hover {
    background: #fff3bf;
    border-color: #8d7a3c;
}

.doc-combo-wrap {
    align-items: flex-start;
}

.doc-combo-wrap .combo-toggle {
    height: 31px;
}

.combo-popup {
    position: fixed;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    max-width: 92vw;
    max-height: 360px;
    padding: 3px;
    background: #ffffff;
    border: 1px solid #7a8b9c;
    border-radius: 4px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.combo-title {
    padding: 3px 7px 4px;
    font-size: 8pt;
    font-weight: 700;
    color: #17406e;
    border-bottom: 1px solid #e3e8ee;
    margin-bottom: 3px;
}

.combo-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.combo-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
    padding: 4px 8px;
    font-family: inherit;
    font-size: 9pt;
    color: #22303c;
    text-align: left;
    background: none;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    white-space: normal;
    word-break: break-word;
}

.combo-item:hover,
.combo-option.hovered {
    background: #e5f1fb;
}

.combo-option.selected {
    background: #cfe6fa;
    font-weight: 600;
}

.combo-item input[type="checkbox"] {
    margin-top: 2px;
}

.combo-hint,
.combo-empty {
    padding: 4px 8px;
    font-size: 8pt;
    color: #6f7a84;
}

/* ---------- импорт данных из другого акта ---------- */
.import-acts {
    max-height: 52vh;
    overflow-y: auto;
    border: 1px solid #d3dbe4;
    border-radius: 4px;
}

.import-acts .table {
    font-size: 8.5pt;
    margin-bottom: 0;
}

.import-acts thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #eef3f9;
    font-size: 8pt;
    font-weight: 700;
    color: #33465a;
    white-space: nowrap;
}

.import-acts tbody tr {
    cursor: pointer;
}

.import-acts tbody tr:hover {
    background: #e5f1fb;
}

.import-acts label {
    cursor: pointer;
    margin-bottom: 0;
}

.combo-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding: 6px 4px 2px;
    border-top: 1px solid #e3e8ee;
    margin-top: 3px;
}

.form-section {
    background: #e9eef4;
    border: 1px solid #c3cfdb;
    border-radius: 4px;
    padding: 6px 10px 9px;
    margin-bottom: 10px;
}

.form-section legend {
    float: none;
    width: auto;
    font-size: 8.5pt;
    font-weight: 700;
    color: #ffffff;
    background: #2f6ea5;
    border: 1px solid #245a89;
    border-radius: 3px;
    padding: 1px 8px;
    margin: 0 0 8px;
}

.field-key {
    color: #a9b2bb;
    font-size: 7pt;
    font-weight: 400;
    margin-left: 6px;
}

.registry-fields {
    background: #e9eef4;
    border: 1px solid #c3cfdb;
    border-radius: 4px;
    padding: 6px 8px;
    margin-bottom: 10px;
}

/* ---------- сводные данные ---------- */
.summary-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.summary-card {
    flex: 1 1 150px;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    background: #f7fafc;
    padding: 10px 14px;
    text-align: center;
}

.summary-card-value {
    font-size: 18pt;
    font-weight: 700;
    color: #2b579a;
    line-height: 1.1;
}

.summary-card-label {
    font-size: 8.5pt;
    color: #666;
    margin-top: 2px;
}

.section-subtitle {
    font-weight: 600;
    font-size: 9.5pt;
    margin: 14px 0 6px;
    color: #444;
}

/* ---------- вход ---------- */
.login-tabs {
    font-size: 9pt;
}

.login-tabs .nav-link {
    padding: 4px 14px;
    color: #444;
}

.login-tabs .nav-link.active {
    font-weight: 600;
    color: #000;
}

/* ---------- админ-панель ---------- */
.admin-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 8px 12px 12px;
    background: #f2f2f2;
}

.admin-wrap > .alert {
    flex-shrink: 0;
    margin-bottom: 6px;
}

.admin-wrap .nav-tabs {
    flex-shrink: 0;
}

.admin-content {
    flex: 1;
    overflow: auto;
    background: #fff;
    border: 1px solid #a0a0a0;
    border-top: none;
    padding: 8px 10px 14px;
}

.object-list {
    max-height: 210px;
    overflow-y: auto;
    border: 1px solid #d8d8d8;
    border-radius: 4px;
    padding: 6px 8px;
    margin-top: 6px;
    background: #fafafa;
}

.object-list.disabled {
    opacity: 0.55;
}

.object-item {
    display: block;
    padding: 2px 0;
    font-size: 9pt;
    cursor: pointer;
}

.object-item:hover {
    color: #0d6efd;
}

.row-expired > td {
    background: #fdeaea;
}

.row-blocked > td {
    background: #f1f1f1;
    color: #888;
}

.pwd-value {
    font-family: Consolas, monospace;
    font-size: 8.5pt;
    letter-spacing: 0.5px;
}

.journal-table td {
    font-size: 8.5pt;
    vertical-align: middle;
}

/* ---------- адаптация под мобильные (Android/iOS) ---------- */
@media (max-width: 991.98px) {
    html, body {
        height: auto !important;
        min-height: 100%;
        min-height: 100dvh;
        overflow-x: hidden;
        overflow-y: auto !important;
        -webkit-text-size-adjust: 100%;
        font-size: 14px;
    }
    .app-container {
        height: auto !important;
        min-height: 100vh;
        min-height: 100dvh;
    }
    .main-layout {
        flex-direction: column !important;
        overflow: visible !important;
        height: auto !important;
    }
    .left-panel {
        width: 100% !important;
        max-width: 100% !important;
        border-right: 0 !important;
        border-bottom: 1px solid #a0a0a0;
        overflow: visible !important;
        flex-shrink: 0;
    }
    .left-panel.is-collapsed {
        width: 56px !important;
        min-width: 56px !important;
        max-width: 56px !important;
        border-right: 1px solid #081d30 !important;
        border-bottom: 0 !important;
        overflow: visible !important;
    }
    .left-panel .panel-section {
        flex: 0 0 auto;
        min-height: 0;
    }
    .left-panel .panel-body {
        max-height: 180px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .right-panel {
        width: 100% !important;
        min-width: 0;
        overflow: visible !important;
        height: auto !important;
    }
    .top-panel {
        height: auto !important;
        min-height: 40px;
        flex-wrap: wrap;
        gap: 6px;
        padding: 6px 8px;
    }
    .top-panel > div {
        flex-wrap: wrap;
    }
    .nav-tabs, .main-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        padding-bottom: 2px;
    }
    .nav-tabs .nav-link, .main-tabs .nav-link {
        flex: 0 0 auto;
        font-size: 13px;
        padding: 6px 10px;
    }
    .sub-tabs {
        flex-wrap: wrap !important;
        gap: 4px;
        padding: 4px;
    }
    .sub-tab {
        font-size: 13px;
        padding: 5px 8px;
        white-space: normal;
    }
    .tab-content, .tab-content-area {
        overflow: visible !important;
        height: auto !important;
        min-height: 200px;
    }
    .tab-toolbar {
        flex-wrap: wrap;
        gap: 4px;
    }
    .tab-toolbar .btn {
        margin-bottom: 2px;
    }
    .table {
        font-size: 13px;
    }
    .table th, .table td {
        padding: 6px;
    }
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .modal-dialog {
        margin: .5rem;
        max-width: calc(100% - 1rem);
    }
    .modal-dialog.modal-xl, .modal-dialog.modal-lg {
        max-width: calc(100% - 1rem);
    }
    .form-control, .form-select, .btn {
        font-size: 16px; /* предотвращает авто-зум iOS */
    }
    .btn-sm, .btn-xs, .form-control-sm, .form-select-sm {
        font-size: 14px;
        padding: .35rem .5rem;
    }
    .list-item {
        padding: 8px 10px;
        font-size: 14px;
    }
    .app-toast-wrap {
        left: 10px;
        right: 10px;
        top: 8px;
    }
    .app-toast {
        max-width: 100%;
        min-width: 0;
    }
    /* формы акта/редакторы — чтобы не вылезали */
    .act-editor, .act-form, .form-grid, .osr-grid {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* конструктор реестра на папку уже fixed fullscreen — уточним для мобилок */
    #frConstructorPanel .fr-ctor-body {
        font-size: 13px;
    }
    #frConstructorPanel .row.g-1 {
        flex-direction: column;
        height: auto !important;
        overflow: visible;
    }
    #frConstructorPanel .row.g-1 > [class*="col-"] {
        max-width: 100%;
        flex: 0 0 100%;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
    #frConstructorPanel .fr-ctor-body {
        overflow: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    .docid-req-box {
        font-size: 13px;
    }
    .docid-req-box .d-flex {
        flex-wrap: wrap;
    }
}
@media (max-width: 575.98px) {
    .top-panel h5 { font-size: 1rem; }
    .nav-tabs .nav-link, .main-tabs .nav-link { font-size: 12px; padding: 6px 8px; }
    .sub-tab { font-size: 12px; padding: 4px 6px; }
}

/* ---------- печать ---------- */
@media print {
    body {
        overflow: visible;
        height: auto;
        background: #fff;
    }

    .app-container {
        height: auto;
    }

    .top-panel,
    .left-panel,
    .nav-tabs,
    .sub-tabs,
    .tab-toolbar,
    .no-print,
    .modal {
        display: none !important;
    }

    .main-layout {
        display: block;
        overflow: visible;
    }

    .right-panel {
        overflow: visible;
        display: block;
    }

    .tab-content-area {
        overflow: visible;
        padding: 0;
    }

    .data-table thead th {
        position: static;
    }

    .table-responsive {
        overflow: visible !important;
    }
}



/* ---------- проверка текста в форме акта ОСР (орфография/пробелы) ---------- */
.act-check-preview {
    margin-top: 4px;
    padding: 4px 6px;
    font-size: 8.5pt;
    line-height: 1.35;
    background: #fff8f8;
    border: 1px solid #f1c0c0;
    border-radius: 3px;
    white-space: pre-wrap;
    word-break: break-word;
}
.act-check-preview .spell-err,
.act-check-preview .ws-err {
    color: #c00;
    font-weight: 700;
}
.act-check-preview .ws-err {
    background: #ffe3e3;
    border-radius: 2px;
    padding: 0 1px;
}
.act-check-preview .act-check-label {
    color: #a00;
    font-weight: 600;
    margin-right: 4px;
}
.act-field-has-issues > .form-control,
.act-field-has-issues > .combo-wrap > .form-control,
.act-field-has-issues > textarea.form-control,
.act-field-has-issues > .combo-wrap > textarea.form-control {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.1rem rgba(220,53,69,.12);
}

/* act highlight */
.act-hl-wrap{position:relative;display:block;width:100%}.combo-wrap .act-hl-wrap{display:flex;flex:1 1 auto;align-items:stretch;min-width:0}
.act-hl-back{position:absolute;inset:0;pointer-events:none;overflow:hidden;white-space:pre-wrap;overflow-wrap:break-word;color:#212529;background:#fff;border:1px solid transparent;box-sizing:border-box;margin:0}
.act-hl-wrap>input.act-hl-field~.act-hl-back{white-space:pre;overflow-wrap:normal}
.act-hl-field{position:relative;background:transparent!important;color:transparent!important;-webkit-text-fill-color:transparent;caret-color:#212529}
.act-hl-field::selection{background:rgba(13,110,253,.25);color:transparent}
.act-hl-back .spell-err,.act-hl-back .ws-err{color:#c00;font-weight:700}.act-hl-back .ws-err{background:#ffe3e3;border-radius:2px}

/* Интерактивный помощник заполнения акта ОСР */
.act-wizard-suggest-list{
  max-height: 220px;
  overflow: auto;
  border: 1px solid #dee2e6;
  border-radius: .25rem;
  padding: .25rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.act-wizard-suggest-item{
  white-space: normal;
  line-height: 1.25;
  border: 1px solid #f1f3f5;
}
.act-wizard-suggest-item:hover{
  background: #e7f1ff;
  border-color: #b6d4fe;
}

.act-wizard-label{
  font-size: 2em;
  color: #c00;
  animation: actWizardBlink 2s steps(1, end) infinite;
}

@keyframes actWizardBlink{
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* Кнопка «Интерактивный помощник»: плавное дыхание один цикл в 5 секунд. */
@keyframes actWizardPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(13,110,253,0); }
  50% { opacity: .55; box-shadow: 0 0 0 3px rgba(13,110,253,.20); }
}
#actWizardStart {
  animation: actWizardPulse 5s ease-in-out infinite;
}
#actWizardStart:hover,
#actWizardStart:focus-visible {
  animation-play-state: paused;
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  #actWizardStart { animation: none; }
}

/* незаполненные поля формы акта ОСР — розовая заливка */
.act-editor .act-field-empty-col{
  background: #ffe3ef !important;
  border-radius: .25rem;
}
.act-editor .act-field-empty-col .form-control,
.act-editor .act-field-empty-col .form-select{
  background-color: #fff0f6;
}
.act-editor .act-field-empty-col .form-control:focus,
.act-editor .act-field-empty-col .form-select:focus{
  background-color: #fff;
}

/* статусы подвкладок ИД (обязательность/заполненность) */
@keyframes st-red-blink {
  0%, 88%, 100% { filter: none; box-shadow: none; }
  92% { filter: brightness(1.35); box-shadow: 0 0 0 2px rgba(220,53,69,.45); }
  96% { filter: none; box-shadow: none; }
}
.sub-tab.st-red{
  background: #f8d7da !important;
  border-color: #dc3545 !important;
  color: #842029 !important;
  animation: st-red-blink 5s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .sub-tab.st-red { animation: none; }
  .docid-subrail-btn.st-red { animation: none; }
}
.sub-tab.st-red:hover{
  background: #f1b0b7 !important;
  color: #842029 !important;
}
.sub-tab.st-green{
  background: #d1e7dd !important;
  border-color: #198754 !important;
  color: #0f5132 !important;
}
.sub-tab.st-green:hover{
  background: #bcd9ce !important;
  color: #0f5132 !important;
}
.sub-tab.active.st-red,
.sub-tab.active.st-green{
  font-weight: 700;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15);
}
.docid-req-box{
  border: 1px solid #dee2e6;
  border-radius: .35rem;
  padding: .5rem .75rem;
  margin-bottom: .5rem;
  background: #f8f9fa;
}
.docid-req-box.state-missing, .docid-req-box.state-no_context, .docid-req-box.state-error{
  border-color: #dc3545;
  background: #fff5f5;
}
.docid-req-box.state-ok, .docid-req-box.state-not_required{
  border-color: #198754;
  background: #f3fbf6;
}

/* ==================================================================
   Внутренний чат
   ================================================================== */
.chat-launcher {
    position: fixed;
    right: 20px;
    bottom: 22px;
    z-index: 1040;
    width: 66px;
    height: 66px;
    padding: 0;
    border: 3px solid #fff;
    border-radius: 24px 24px 24px 8px;
    background: radial-gradient(circle at 32% 26%, #ffe680 0%, #ffbf35 42%, #ff9b0a 76%, #f57c00 100%);
    color: #fff;
    font-size: 30px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 0 #c25c00,
                0 10px 22px rgba(0, 0, 0, 0.32),
                inset 0 -6px 12px rgba(168, 62, 0, 0.25),
                inset 0 6px 10px rgba(255, 255, 255, 0.5);
    animation: chat-float 3.6s ease-in-out infinite;
    transition: filter 0.15s ease, box-shadow 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.chat-launcher:hover,
.chat-launcher:focus-visible {
    filter: brightness(1.06) saturate(1.05);
    box-shadow: 0 8px 0 #c25c00,
                0 14px 26px rgba(0, 0, 0, 0.36),
                inset 0 -6px 12px rgba(168, 62, 0, 0.25),
                inset 0 6px 10px rgba(255, 255, 255, 0.55);
    outline: none;
}
.chat-launcher:active {
    filter: brightness(0.96);
    box-shadow: 0 2px 0 #c25c00,
                0 4px 10px rgba(0, 0, 0, 0.3);
}
.chat-launcher-icon {
    pointer-events: none;
    display: block;
    transform-origin: 50% 60%;
    filter: drop-shadow(0 2px 1px rgba(120, 50, 0, 0.35));
}
.chat-unread {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border: 2px solid #fff;
    border-radius: 12px;
    background: linear-gradient(180deg, #ff6b6b 0%, #e02626 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    animation: chat-badge-pop 1.6s ease-in-out infinite;
}

/* мягкое «парение» кнопки */
@keyframes chat-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-6px) rotate(-2deg); }
}

/* мигание при непрочитанных сообщениях */
@keyframes chat-alert {
    0%, 100% {
        box-shadow: 0 6px 0 #c25c00,
                    0 10px 22px rgba(0, 0, 0, 0.32),
                    0 0 0 0 rgba(255, 70, 70, 0.65),
                    inset 0 -6px 12px rgba(168, 62, 0, 0.25),
                    inset 0 6px 10px rgba(255, 255, 255, 0.5);
        filter: brightness(1);
    }
    50% {
        box-shadow: 0 6px 0 #c25c00,
                    0 10px 26px rgba(0, 0, 0, 0.36),
                    0 0 0 16px rgba(255, 70, 70, 0),
                    inset 0 -6px 12px rgba(168, 62, 0, 0.25),
                    inset 0 6px 10px rgba(255, 255, 255, 0.5);
        filter: brightness(1.12) saturate(1.15);
    }
}
@keyframes chat-wiggle {
    0%, 100% { transform: rotate(0deg) scale(1); }
    20% { transform: rotate(-10deg) scale(1.08); }
    40% { transform: rotate(8deg) scale(1.04); }
    60% { transform: rotate(-6deg) scale(1.06); }
    80% { transform: rotate(4deg) scale(1.02); }
}
@keyframes chat-badge-pop {
    0%, 100% { transform: scale(1); }
    45% { transform: scale(1.18); }
}
@keyframes chat-pop {
    0% { transform: translateY(0) scale(1); }
    30% { transform: translateY(-12px) scale(1.14) rotate(-6deg); }
    55% { transform: translateY(2px) scale(0.95) rotate(3deg); }
    100% { transform: translateY(0) scale(1); }
}

/* пока есть непрочитанные — мигает и подпрыгивает */
.chat-launcher.chat-alert {
    animation: chat-float 3.6s ease-in-out infinite,
               chat-alert 1.1s ease-in-out infinite;
}
.chat-launcher.chat-alert .chat-launcher-icon {
    animation: chat-wiggle 1.3s ease-in-out infinite;
}

/* короткий подскок при каждом новом сообщении */
.chat-launcher.chat-pop {
    animation: chat-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- ярлык чата на первой рельсе (под мигающим «!» задач) ---------- */
/* когда панель свёрнута, плавающая кнопка не нужна — чат открывается из рельсы */
body.panel-collapsed .chat-launcher-floating,
body:has(.left-panel.is-collapsed) .chat-launcher-floating {
    display: none !important;
}

.panel-rail-chat {
    position: relative;
    right: auto; bottom: auto;
    width: 44px; height: 44px;
    padding: 0;
    border: 1px solid #ffd08a !important;
    border-radius: 13px;
    color: #fff !important;
    font-size: 1.2rem;
    background: linear-gradient(145deg, #ffc247 0%, #ff8a1f 48%, #ef5b0c 100%) !important;
    box-shadow: 0 4px 14px rgba(255, 122, 24, .45), inset 0 1px 0 rgba(255, 255, 255, .55);
    animation: none;
    transition: filter .15s ease, transform .15s ease, box-shadow .15s ease;
}
.panel-rail-chat i {
    font-size: 1.25rem;
    filter: drop-shadow(0 2px 2px rgba(120, 50, 0, .45));
}
.panel-rail-chat:hover,
.panel-rail-chat:focus-visible {
    background: linear-gradient(145deg, #ffd470 0%, #ff9b38 48%, #f56a17 100%) !important;
    border-color: #ffe3b3 !important;
    color: #fff !important;
    filter: brightness(1.06);
    transform: translateX(2px);
    box-shadow: 0 6px 18px rgba(255, 122, 24, .6), inset 0 1px 0 rgba(255, 255, 255, .6);
    outline: none;
}
.panel-rail-chat:active {
    transform: translateX(1px) scale(.96);
    box-shadow: 0 2px 8px rgba(255, 122, 24, .5);
}
.panel-rail-chat .chat-unread {
    top: -6px; right: -6px;
    min-width: 18px; height: 18px;
    padding: 0 3px;
    border: 2px solid #102a43;
    border-radius: 9px;
    background: linear-gradient(180deg, #ff6b6b 0%, #d81e1e 100%);
    font-size: 9px;
    font-weight: 800;
    line-height: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
    animation: chat-badge-pop 1.6s ease-in-out infinite;
}
@keyframes aidChatRailAlert {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 138, 31, .6), 0 4px 14px rgba(255, 122, 24, .45);
        filter: brightness(1);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(255, 138, 31, 0), 0 4px 20px rgba(255, 122, 24, .75);
        filter: brightness(1.16);
    }
}
.panel-rail-chat.chat-alert {
    animation: aidChatRailAlert 1.5s ease-in-out infinite;
}
.panel-rail-chat.chat-alert i {
    animation: chat-wiggle 1.5s ease-in-out infinite;
}
.panel-rail-chat.chat-pop {
    animation: chat-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- всплывающие карточки новых сообщений (правый нижний угол) ---- */
.chat-notify-stack {
    position: fixed;
    right: 20px;
    bottom: 100px;
    z-index: 2100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
    pointer-events: none;
}

.chat-notify {
    position: relative;
    pointer-events: auto;
    width: 330px;
    max-width: calc(100vw - 40px);
    padding: 10px 12px 13px;
    overflow: hidden;
    font-size: 9pt;
    color: #22303c;
    text-align: left;
    background: #fff;
    border: 1px solid #c3cfdb;
    border-left: 4px solid #f59e0b;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(15, 30, 45, 0.28), 0 2px 6px rgba(15, 30, 45, 0.12);
    cursor: pointer;
    animation: chat-notify-in 0.3s cubic-bezier(0.22, 0.9, 0.32, 1.15);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.chat-notify-group { border-left-color: #2f80ed; }

.chat-notify:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(15, 30, 45, 0.34); }
.chat-notify:focus-visible { outline: 2px solid #f59e0b; outline-offset: 2px; }
.chat-notify-out { animation: chat-notify-out 0.2s ease forwards; }

.chat-notify-head { display: flex; align-items: center; gap: 8px; }

.chat-notify-avatar {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10pt;
    font-weight: 700;
    color: #fff;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffc247, #f08a00);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.chat-notify-group .chat-notify-avatar {
    font-size: 11pt;
    background: linear-gradient(180deg, #68a9f5, #2f80ed);
}

.chat-notify-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-weight: 700;
}

.chat-notify-time { flex: 0 0 auto; font-size: 7.5pt; color: #8494a3; }

.chat-notify-close {
    flex: 0 0 auto;
    padding: 0 3px;
    font-size: 13pt;
    line-height: 1;
    color: #8494a3;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.75;
}

.chat-notify-close:hover { color: #22303c; opacity: 1; }

.chat-notify-body {
    margin-top: 6px;
    line-height: 1.35;
    color: #2f3d4a;
    word-break: break-word;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chat-notify-sub { margin-top: 3px; font-size: 7.5pt; color: #8494a3; }
.chat-notify-hint { margin-top: 6px; font-size: 7pt; color: #a0aab3; }
.chat-notify-warn { margin-top: 5px; font-size: 7pt; color: #a15c00; }

.chat-notify-setup { cursor: default; border-left-color: #e5484d; }
.chat-notify-setup .chat-notify-body { -webkit-line-clamp: 6; }

.chat-notify-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px;
}

.chat-notify-btn {
    display: inline-block;
    padding: 3px 10px;
    font-size: 8pt;
    text-decoration: none;
    color: #2563a8;
    background: #fff;
    border: 1px solid #b9c7d6;
    border-radius: 5px;
    cursor: pointer;
}

.chat-notify-btn:hover { background: #eef4fa; color: #1d4f87; text-decoration: none; }

.chat-notify-btn.chat-notify-btn-primary {
    color: #fff;
    background: #2563a8;
    border-color: #1e5b90;
}

.chat-notify-btn.chat-notify-btn-primary:hover { background: #1d4f87; color: #fff; }

.chat-notify-btn.chat-notify-btn-danger {
    color: #b02a37;
    background: #fff5f6;
    border-color: #f0b9be;
}
.chat-notify-btn.chat-notify-btn-danger:hover { background: #ffe6e9; color: #8a1c27; }

.chat-notify-bar {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #ffd166, #f59e0b);
    transform-origin: left center;
    animation: chat-notify-bar 12s linear forwards;
}

.chat-notify-group .chat-notify-bar { background: linear-gradient(90deg, #8ab9f7, #2f80ed); }

/* пока вкладка не на виду — карточка ждёт и полоска таймера замирает */
.chat-notify-hold .chat-notify-bar { animation-play-state: paused; }

@keyframes chat-notify-in {
    from { opacity: 0; transform: translateX(60px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes chat-notify-out {
    to { opacity: 0; transform: translateX(40px) scale(0.96); }
}

@keyframes chat-notify-bar {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

@media (max-width: 575px) {
    .chat-notify-stack {
        right: 10px;
        left: 10px;
        bottom: 96px;
        align-items: stretch;
    }
    .chat-notify { width: 100%; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    .chat-launcher,
    .chat-launcher.chat-alert,
    .chat-launcher.chat-pop,
    .chat-launcher.chat-alert .chat-launcher-icon,
    .chat-unread,
    .chat-notify,
    .chat-notify-bar {
        animation: none !important;
    }
}

.chat-panel {
    width: min(760px, 96vw) !important;
    border-left: 1px solid #c9d3df;
}
.chat-panel-head {
    background: #e9f0f8;
    border-bottom: 1px solid #c9d3df;
    padding: 10px 14px;
    min-height: 48px;
}
.chat-panel-title { font-weight: 600; color: #17324a; white-space: nowrap; }
.chat-online-pill {
    font-size: 8pt;
    color: #2e7d32;
    background: #e7f5e7;
    border: 1px solid #b7d9b7;
    border-radius: 10px;
    padding: 1px 7px;
    white-space: nowrap;
}
.chat-me {
    font-size: 8pt;
    color: #4a5a6a;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-body { padding: 0 !important; overflow: hidden; }

.chat-layout { display: flex; height: 100%; min-height: 0; }
.chat-sidebar {
    width: 260px;
    min-width: 220px;
    border-right: 1px solid #dde4ec;
    background: #f7f9fc;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.chat-search-wrap { padding: 8px; border-bottom: 1px solid #e3e9f0; }
.chat-list-scroll { flex: 1 1 auto; overflow-y: auto; padding: 4px 6px 14px; }
.chat-section { margin-top: 8px; }
.chat-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px;
    font-size: 8pt;
    font-weight: 700;
    color: #6b7c8f;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.chat-mini-btn {
    border: 1px solid #b9c7d6;
    background: #fff;
    color: #2563a8;
    border-radius: 4px;
    width: 20px;
    height: 20px;
    line-height: 1;
    font-weight: 700;
    padding: 0;
}
.chat-mini-btn:hover { background: #e9f0f8; }
.chat-mini-btn.chat-mini-btn-muted { color: #8a949e; border-color: #d6dde5; background: #fafbfc; }
.chat-mini-btn.chat-mini-btn-muted:hover { background: #eef2f6; }

.chat-list { display: flex; flex-direction: column; gap: 1px; }
.chat-item {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 6px 7px;
    border-radius: 5px;
    color: #24323f;
    font-size: 9pt;
    line-height: 1.25;
}
.chat-item:hover { background: #e9f0f8; }
.chat-item.active { background: #d7e6f6; }
.chat-item-name {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-item-icon { flex: 0 0 auto; opacity: 0.8; }
.chat-item-sub { flex: 0 0 auto; font-size: 8pt; color: #8a99a8; }
.chat-item-badge {
    flex: 0 0 auto;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: #d32f2f;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-item-join .chat-item-sub { color: #2563a8; font-weight: 600; }
.chat-dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #b9c4ce;
}
.chat-dot.online { background: #2e9e4f; box-shadow: 0 0 0 2px rgba(46, 158, 79, 0.18); }
.chat-dot.offline { background: #c4ccd4; }
.chat-empty-hint {
    padding: 8px 7px;
    color: #8a99a8;
    font-size: 8.5pt;
    line-height: 1.35;
}

.chat-main {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
}
.chat-placeholder {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #7b8b9c;
    text-align: center;
    padding: 20px;
}
.chat-placeholder-icon { font-size: 40px; opacity: 0.55; }
.chat-placeholder-text { font-size: 11pt; color: #4a5a6a; }
.chat-placeholder-hint { font-size: 8.5pt; max-width: 280px; }

.chat-conv { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.chat-conv-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #e3e9f0;
    background: #fbfcfe;
    min-height: 42px;
}
.chat-back-btn {
    display: none;
    border: 1px solid #c9d3df;
    background: #fff;
    border-radius: 4px;
    width: 26px;
    height: 26px;
    line-height: 1;
    color: #2563a8;
    padding: 0;
}
.chat-conv-title { min-width: 0; }
.chat-conv-title > div:first-child {
    font-weight: 600;
    color: #17324a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-conv-sub { font-size: 8pt; color: #8a99a8; }
.chat-conv-sub.online { color: #2e9e4f; }

.chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 14px 6px;
    background: #f4f7fb;
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-height: 0;
}
.chat-loading { color: #8a99a8; font-size: 8.5pt; padding: 6px; }
.chat-msg {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    column-gap: 6px;
    align-items: end;
    max-width: 100%;
}
.chat-msg.own { grid-template-columns: minmax(0, 1fr) 28px; }
.chat-msg > .chat-msg-avatar { grid-column: 1; grid-row: 1 / span 2; align-self: end; }
.chat-msg.own > .chat-msg-avatar { grid-column: 2; }
.chat-msg > .chat-sender, .chat-msg > .chat-bubble { grid-column: 2; }
.chat-msg.own > .chat-sender, .chat-msg.own > .chat-bubble { grid-column: 1; }
.chat-msg-avatar,
.chat-item-avatar,
.chat-member-avatar {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #b8c4d0;
    background: #e9eef3;
}
.chat-item-avatar, .chat-member-avatar { width: 22px; height: 22px; }
.chat-avatar-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 10pt;
    font-weight: 700;
    background: linear-gradient(180deg, #6fa8d6, #3f78ad);
    border-color: transparent;
}
img.chat-notify-avatar { object-fit: cover; }
.chat-sender { font-size: 8pt; color: #6b7c8f; margin: 0 4px 1px; }
.chat-bubble {
    max-width: 78%;
    padding: 7px 10px 5px;
    border-radius: 10px 10px 10px 3px;
    background: #fff;
    border: 1px solid #dde4ec;
    box-shadow: 0 1px 2px rgba(20, 40, 70, 0.06);
    overflow-wrap: anywhere;
}
.chat-msg.own .chat-bubble {
    background: #dcecff;
    border-color: #b9d4f2;
    border-radius: 10px 10px 3px 10px;
}
.chat-text { white-space: pre-wrap; line-height: 1.35; color: #1d2b3a; }
.chat-meta { margin-top: 3px; font-size: 7.5pt; color: #8a99a8; text-align: right; }
.chat-read { display: inline-block; margin-left: 5px; font-size: 9pt; font-weight: 600; color: #8a99a8; }
.chat-read.read { color: #1e9e50; font-weight: 700; letter-spacing: -1px; }
.chat-img-link { display: block; margin: 4px 0 2px; }
/* Карточка «Адрес сервера» в админке */
.server-address-card {
    border: 1px solid #c9d7e4; border-radius: 10px;
    background: #f2f6fa; padding: 10px 14px; margin: 10px 0 14px;
}
.server-address-title { font-weight: 600; color: #1d2b3a; margin-bottom: 6px; }
.server-address-row {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    padding: 3px 0;
}
.server-address-ip {
    font-family: ui-monospace, Consolas, monospace; font-weight: 600;
    font-size: 10.5pt; color: #14304a;
    background: #fff; border: 1px solid #c9d7e4; border-radius: 6px;
    padding: 2px 10px;
}
.server-address-links a { color: #0d5bb5; text-decoration: none; }
.server-address-links a:hover { text-decoration: underline; }
.server-address-links {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 9.5pt; color: #48617a;
}
.server-address-hint {
    margin-top: 6px; font-size: 8pt; color: #6b8095;
}
/* Просмотр изображений поверх чата */
.chat-lightbox {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(10, 18, 28, 0.88);
    display: flex; align-items: center; justify-content: center;
    cursor: zoom-in;
}
.chat-lightbox-img {
    position: absolute; left: 50%; top: 50%;
    max-width: none; max-height: none;
    transform: translate(-50%, -50%);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    cursor: grab;
}
.chat-lightbox-img:active { cursor: grabbing; }
.chat-lightbox-bar {
    position: absolute; top: 12px; right: 12px; left: 12px;
    display: flex; align-items: center; justify-content: flex-end; gap: 8px;
    z-index: 2001;
}
.chat-lightbox-name {
    color: #d7e3ef; font-size: 9pt; margin-right: auto;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    opacity: 0.85;
}
.chat-lightbox-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 8px;
    border: 1px solid rgba(215, 227, 239, 0.35);
    background: rgba(20, 32, 45, 0.75); color: #eaf2fa;
    font-size: 14pt; line-height: 1; text-decoration: none; cursor: pointer;
}
.chat-lightbox-btn:hover { background: rgba(45, 70, 100, 0.9); }
.chat-lightbox-btn[disabled] { opacity: 0.4; cursor: default; }
.chat-lightbox-hint {
    position: absolute; bottom: 12px; left: 0; right: 0;
    text-align: center; color: #9fb3c8; font-size: 8pt; opacity: 0.8;
    pointer-events: none;
}
.chat-img {
    max-width: 240px;
    max-height: 200px;
    border-radius: 6px;
    border: 1px solid #d3dce6;
    display: block;
}
.chat-file {
    display: inline-block;
    margin-top: 4px;
    font-size: 8.5pt;
    color: #1d5fa8;
    text-decoration: none;
    word-break: break-word;
}
.chat-file:hover { text-decoration: underline; }

.chat-composer {
    position: relative;
    flex: 0 0 auto;
    border-top: 1px solid #e3e9f0;
    padding: 7px 10px 8px;
    background: #fbfcfe;
}
.chat-attach-list { display: flex; flex-wrap: wrap; gap: 5px; }
.chat-attach-list:not(:empty) { margin-bottom: 6px; }
.chat-attach-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 2px 5px 2px 8px;
    border: 1px solid #c9d3df;
    border-radius: 10px;
    background: #eef3f9;
    font-size: 8pt;
    color: #33475b;
}
.chat-attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.chat-attach-remove {
    border: 0;
    background: transparent;
    color: #8a99a8;
    font-size: 13px;
    line-height: 1;
    padding: 0 2px;
}
.chat-attach-remove:hover { color: #c62828; }
.chat-compose-row { display: flex; align-items: flex-end; gap: 6px; }
.chat-icon-btn {
    flex: 0 0 auto;
    cursor: pointer;
    border: 1px solid #c9d3df;
    border-radius: 5px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    font-size: 14px;
    margin: 0;
}
.chat-icon-btn:hover { background: #eef3f9; }

/* --- смайлики --- */
.chat-emoji-btn { font-size: 16px; }
.chat-emoji-btn.active { background: #e3eefb; border-color: #7fa8d4; }

.chat-emoji-pop {
    position: absolute;
    left: 10px;
    bottom: calc(100% - 1px);
    z-index: 12;
    width: min(340px, calc(100% - 20px));
    display: flex;
    flex-direction: column;
    max-height: 280px;
    background: #fff;
    border: 1px solid #b9c7d6;
    border-radius: 9px;
    box-shadow: 0 14px 34px rgba(15, 30, 45, 0.3);
    overflow: hidden;
}
.chat-emoji-pop[hidden] { display: none; }

.chat-emoji-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px 5px 10px;
    font-size: 8.5pt;
    font-weight: 600;
    color: #17324a;
    background: #f2f6fb;
    border-bottom: 1px solid #e3e9f0;
}
.chat-emoji-close {
    border: 0;
    background: transparent;
    color: #8494a3;
    font-size: 15px;
    line-height: 1;
    padding: 0 3px;
    cursor: pointer;
}
.chat-emoji-close:hover { color: #17324a; }

.chat-emoji-tabs {
    display: flex;
    gap: 2px;
    padding: 5px 6px;
    background: #f7fafd;
    border-bottom: 1px solid #e3e9f0;
    overflow-x: auto;
}
.chat-emoji-tab {
    flex: 1 0 32px;
    padding: 4px 0;
    font-size: 15px;
    line-height: 1;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    opacity: 0.65;
}
.chat-emoji-tab:hover { background: #e4edf7; opacity: 1; }
.chat-emoji-tab.active {
    background: #d8e6f5;
    opacity: 1;
    box-shadow: inset 0 -2px 0 #2563a8;
}

.chat-emoji-scroll { overflow-y: auto; padding: 6px; }
.chat-emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    gap: 2px;
}
.chat-emoji-item {
    height: 30px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
    background: transparent;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease;
}
.chat-emoji-item:hover,
.chat-emoji-item:focus-visible {
    background: #eaf2fb;
    transform: scale(1.2);
    outline: none;
}
.chat-emoji-empty {
    grid-column: 1 / -1;
    padding: 8px 4px;
    font-size: 8.5pt;
    color: #8a99a8;
}
.chat-input {
    flex: 1 1 auto;
    resize: none;
    border: 1px solid #c9d3df;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 9pt;
    font-family: inherit;
    line-height: 1.35;
    max-height: 110px;
    min-height: 30px;
    outline: none;
}
.chat-input:focus { border-color: #7fa8d4; box-shadow: 0 0 0 2px rgba(37, 99, 168, 0.12); }
.chat-send-btn {
    flex: 0 0 auto;
    border: 0;
    border-radius: 6px;
    width: 32px;
    height: 30px;
    background: #2563a8;
    color: #fff;
    font-size: 14px;
    line-height: 1;
    padding: 0;
}
.chat-send-btn:hover { background: #1d4f87; }
.chat-send-btn:disabled { opacity: 0.6; }
.chat-hint { min-height: 0; font-size: 8pt; margin-top: 3px; }

.chat-member-list {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid #e3e9f0;
    border-radius: 5px;
    padding: 4px 6px;
}
.chat-member {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 3px 2px;
    margin: 0;
    font-size: 9pt;
    cursor: pointer;
}
.chat-member:hover { background: #f2f6fb; }
.chat-member-name.online { color: #1f7a3a; }

@media (max-width: 640px) {
    .chat-panel { width: 100vw !important; }
    .chat-sidebar { width: 100%; min-width: 0; }
    .chat-layout.chat-conv-open .chat-sidebar { display: none; }
    .chat-main { display: none; }
    .chat-layout.chat-conv-open .chat-main { display: flex; }
    .chat-back-btn { display: block; }
    .chat-me { display: none; }
    .chat-bubble { max-width: 88%; }
}

/* ====================== профиль, дашборд, темы ====================== */

.profile-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #b8c4d0;
    background: #e9eef3;
    flex: 0 0 auto;
}
.profile-avatar-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #607d9b;
    font-size: 14px;
}
.profile-avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 28px;
}

/* ----- дашборд ----- */
.dash-wrap {
    padding: 10px 12px 20px;
    overflow-y: auto;
    height: 100%;
}
.dash-toolbar {
    background: #fff;
    border: 1px solid #d5d5d5;
    border-radius: 4px;
    padding: 6px 8px;
    margin-bottom: 10px;
}
.dash-section-title {
    font-weight: 600;
    font-size: 13px;
    margin: 12px 0 6px;
    color: #33475b;
}
.dash-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.dash-tile {
    position: relative;
    border: 1px solid #c9d3de;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(16, 42, 67, .06);
    transition: border-color .12s, box-shadow .12s;
}
.dash-tile:hover { border-color: #6fa8d6; }
.dash-tile.active {
    border-color: #0078d4;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, .22);
}
.dash-tile-main {
    display: block;
    color: inherit;
    text-decoration: none;
}
.dash-tile-photo {
    height: 180px;
    background: linear-gradient(135deg, #dce7f2, #c5d6e6);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.dash-tile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.dash-tile-photo-empty {
    font-size: 54px;
    color: #6c8aa8;
}
.dash-tile-body {
    padding: 7px 9px 9px;
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 2px 5px;
}
.dash-tile-check { grid-row: 1 / 3; font-size: 17px; line-height: 1.2; color: #0078d4; }
.dash-tile-name { font-weight: 600; font-size: 13px; line-height: 1.25; }
.dash-tile-meta { font-size: 11px; color: #6b7c8d; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-tile-upload {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.7);
    background: rgba(16, 42, 67, .72);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}
.dash-tile-upload:hover { background: #0078d4; }

.dash-counts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}
.dash-count {
    --dash-accent: #0078d4;
    background: linear-gradient(180deg, #fff 0%, #f7fbff 100%);
    border: 1px solid #d5d5d5;
    border-left: 4px solid var(--dash-accent);
    border-radius: 5px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.dash-count-shifrs     { --dash-accent: #0078d4; }
.dash-count-registries { --dash-accent: #7b5cd6; }
.dash-count-acts       { --dash-accent: #2f9e6f; }
.dash-count-docitems   { --dash-accent: #e08a1e; }
.dash-count-materials  { --dash-accent: #0f9aa8; }
.dash-count-value { font-size: 21px; font-weight: 700; color: var(--dash-accent); line-height: 1.1; }
.dash-count > span:last-child { font-size: 11px; color: #6b7c8d; }

.dash-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 10px;
    align-items: start;
}
.dash-card {
    background: #fff;
    border: 1px solid #d5d5d5;
    border-radius: 5px;
    padding: 9px 11px;
    min-width: 0;
}
.dash-card-title {
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 8px;
    padding: 0 0 5px 7px;
    border-bottom: 1px solid #e6ebf0;
    border-left: 4px solid #0078d4;
    color: #102a43;
}
.dash-panels > .dash-card:nth-child(2) .dash-card-title { border-left-color: #0f9aa8; }
.dash-panels > .dash-card:nth-child(3) .dash-card-title { border-left-color: #e08a1e; }
.dash-panels > .dash-card:nth-child(4) .dash-card-title { border-left-color: #7b5cd6; }
.dash-muted { color: #7b8b9a; font-size: 12px; padding: 6px 0; }
.dash-bar-row {
    display: grid;
    grid-template-columns: 96px 1fr 30px;
    gap: 6px;
    align-items: center;
    margin-bottom: 5px;
    font-size: 11px;
}
.dash-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-bar-track { height: 8px; background: #e6ebf0; border-radius: 4px; overflow: hidden; }
.dash-bar-fill { display: block; height: 100%; background: #0078d4; border-radius: 4px; }
.dash-bar-fill-alt { background: #2f9e6f; }
.dash-bar-fill--signed   { background: #2f9e6f; }
.dash-bar-fill--unsigned { background: #d64545; }
.dash-bar-fill--progress { background: #0078d4; }
.dash-bar-fill--review   { background: #e08a1e; }
.dash-bar-fill--pause    { background: #8a99a8; }
.dash-bar-fill--other    { background: #7b5cd6; }
.dash-bar-fill.dyn-0 { background: #0f9aa8; }
.dash-bar-fill.dyn-1 { background: #4a90d9; }
.dash-bar-fill.dyn-2 { background: #7b5cd6; }
.dash-bar-value { text-align: right; font-weight: 600; }
.dash-bar-row--chart { grid-template-columns: 70px 1fr 104px; }
.dash-chart-hint { font-size: 11px; line-height: 1.3; padding: 0 0 7px; }
.dash-chart-summary {
    font-size: 11px;
    line-height: 1.3;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dotted #dfe6ec;
}
.dash-bar-value.dash-bar-fill--signed-value   { color: #2f9e6f; }
.dash-bar-value.dash-bar-fill--unsigned-value { color: #d64545; }
.dash-bar-value.dash-bar-fill--progress-value { color: #0078d4; }
.dash-bar-value.dash-bar-fill--review-value   { color: #e08a1e; }
.dash-bar-value.dash-bar-fill--pause-value    { color: #8a99a8; }
.dash-bar-value.dash-bar-fill--other-value    { color: #7b5cd6; }
.dash-events-wrap {
    max-height: 340px;
    overflow-y: auto;
    border: 1px solid #e6ebf0;
    border-radius: 4px;
    padding: 0 8px;
}
.dash-event {
    border-bottom: 1px dotted #dfe6ec;
    padding: 4px 0 6px;
    font-size: 11px;
}
.dash-event:last-child { border-bottom: 0; }
.dash-event-top { display: flex; justify-content: space-between; gap: 6px; font-weight: 600; }
.dash-event-top time { color: #7b8b9a; font-weight: 400; white-space: nowrap; }
.dash-event-detail { color: #42576b; margin-top: 2px; }
.dash-event-user { color: #8a99a8; font-size: 10px; }
.dash-members { font-size: 11px; }
.dash-members th { color: #5d6f80; font-weight: 600; }
.dash-members-wrap { max-height: 340px; overflow-y: auto; border: 1px solid #e6ebf0; border-radius: 4px; }
.dash-members thead th { position: sticky; top: 0; background: #f7f9fb; z-index: 1; }
.dash-user-photo-cell { width: 38px; text-align: center; }
.dash-user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #b8c4d0;
    background: #e9eef3;
    display: inline-block;
    vertical-align: middle;
}
.dash-user-avatar-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #607d9b;
    font-size: 13px;
}
.dash-badge-all { background: #e6f0fb; color: #0b5fa5; font-weight: 600; }

/* ----- тёмная тема ----- */
html[data-theme="dark"] body {
    background: #121820;
    color: #e4ebf2;
}
html[data-theme="dark"] .top-panel {
    background: linear-gradient(to bottom, #202b38, #18212c);
    border-bottom-color: #34445a;
    color: #e4ebf2;
}
html[data-theme="dark"] .left-panel,
html[data-theme="dark"] .right-panel,
html[data-theme="dark"] .tab-content-area,
html[data-theme="dark"] .modal-content {
    background: #1b2430;
    color: #e4ebf2;
    border-color: #34445a;
}
html[data-theme="dark"] .left-panel.is-collapsed,
html[data-theme="dark"] .left-panel.is-collapsed .panel-rail {
    background: #102a43;
}
html[data-theme="dark"] .panel-header {
    background: linear-gradient(to bottom, #263346, #202b3a);
    color: #e4ebf2;
    border-bottom-color: #34445a;
}
html[data-theme="dark"] .panel-section { border-bottom-color: #34445a; }
html[data-theme="dark"] .list-item { color: #cddae6; }
html[data-theme="dark"] .list-item:hover { background: #26374a; color: #fff; }
html[data-theme="dark"] .list-item.active { background: #0055cc; color: #fff; }
html[data-theme="dark"] .nav-tabs .nav-link { color: #a9bbcc; }
html[data-theme="dark"] .nav-tabs .nav-link.active {
    background: #1b2430;
    color: #fff;
    border-color: #34445a #34445a #1b2430;
}
html[data-theme="dark"] .sub-tab { color: #a9bbcc; }
html[data-theme="dark"] .sub-tab.active { color: #fff; }
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] textarea {
    background: #121b25;
    color: #e4ebf2;
    border-color: #3a4a5d;
}
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    background: #16212d;
    color: #fff;
    border-color: #4da3ff;
    box-shadow: 0 0 0 .2rem rgba(77, 163, 255, .18);
}
html[data-theme="dark"] .table,
html[data-theme="dark"] .table > :not(caption) > * > * {
    color: #d5e1ec;
    border-color: #34445a;
}
html[data-theme="dark"] .table-hover > tbody > tr:hover > * { background: #263449; }
html[data-theme="dark"] .dash-toolbar,
html[data-theme="dark"] .dash-count,
html[data-theme="dark"] .dash-card {
    background: #1b2430;
    border-color: #34445a;
}
html[data-theme="dark"] .dash-card-title,
html[data-theme="dark"] .dash-section-title { color: #7db8ee; }
html[data-theme="dark"] .dash-count-shifrs     { --dash-accent: #66b2ff; }
html[data-theme="dark"] .dash-count-registries { --dash-accent: #b39bff; }
html[data-theme="dark"] .dash-count-acts       { --dash-accent: #5fd3a0; }
html[data-theme="dark"] .dash-count-docitems   { --dash-accent: #ffb75e; }
html[data-theme="dark"] .dash-count-materials  { --dash-accent: #5fd0dc; }
html[data-theme="dark"] .dash-badge-all { background: #173a5e; color: #9ecbff; }
html[data-theme="dark"] .dash-members-wrap,
html[data-theme="dark"] .dash-events-wrap { border-color: #34445a; }
html[data-theme="dark"] .dash-members thead th { background: #202b3a; }
html[data-theme="dark"] .dash-user-avatar { border-color: #3c5066; background: #26374a; }
html[data-theme="dark"] .dash-user-avatar-empty { color: #9ecbff; }
html[data-theme="dark"] .dash-bar-fill--signed   { background: #48c78e; }
html[data-theme="dark"] .dash-bar-fill--unsigned { background: #f07171; }
html[data-theme="dark"] .dash-bar-fill--progress { background: #5aa9f5; }
html[data-theme="dark"] .dash-bar-fill--review   { background: #ffb75e; }
html[data-theme="dark"] .dash-bar-fill--other    { background: #b39bff; }
html[data-theme="dark"] .dash-tile {
    background: #1b2430;
    border-color: #34445a;
}
html[data-theme="dark"] .dash-tile.active { border-color: #4da3ff; box-shadow: 0 0 0 2px rgba(77,163,255,.25); }
html[data-theme="dark"] .dash-tile-main { color: #e4ebf2; }
html[data-theme="dark"] .dash-tile-meta,
html[data-theme="dark"] .dash-muted,
html[data-theme="dark"] .dash-event-top time { color: #92a5b8; }
html[data-theme="dark"] .dash-event-detail { color: #b7c7d6; }
html[data-theme="dark"] .dash-bar-track { background: #2c3a4a; }
html[data-theme="dark"] .dash-chart-summary { border-top-color: #34445a; }
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer { border-color: #34445a; }
html[data-theme="dark"] .mat-date-warn-row .mat-col-docdate { background: #4a3b16; }
html[data-theme="dark"] .mat-date-warn { color: #ffb75e; }
html[data-theme="dark"] .profile-avatar { border-color: #3c5066; background: #26374a; }

@media (max-width: 991.98px) {
    .dash-panels { grid-template-columns: 1fr; }
    .dash-tiles { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .dash-tile-photo { height: 140px; }
}
@media print {
    .dash-tile-upload, #dashThumbInput { display: none !important; }
}

/* ----- дашборд как встроенная страница в правой панели ----- */
.dashboard-page .dash-wrap {
    height: auto;
    min-height: 100%;
    overflow: visible;
}
.panel-rail-btn.is-active {
    background: #1b4f7a;
    border-color: #9ec5e8;
    color: #fff;
}


/* ===== ???????? ?????????: ?????? ? ???????? (????? ?????? 2.0) ===== */
.org-toolbar { margin-bottom: 12px; }
.org-card {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    background: var(--bs-body-bg, #fff); border: 1px solid var(--bs-border-color, #e2e8f0);
    border-radius: 13px; padding: 18px 20px;
}
.org-icon {
    width: 62px; height: 62px; border-radius: 12px; background: #eaf1ff; color: #2563eb;
    display: grid; place-items: center; font-size: 28px; flex: 0 0 auto;
}
.org-title { flex: 1; min-width: 210px; }
.org-title h1 { font-size: 21px; margin: 0 0 4px; }
.org-title .sub { color: #64748b; font-size: 13px; }
.org-actions { display: flex; gap: 8px; flex: 0 0 auto; flex-wrap: wrap; }
.login-help { border: 1px solid #bfdbfe; background: #eff6ff; border-radius: 10px; padding: 12px 14px; }
.login-help-title { font-weight: 650; margin-bottom: 6px; color: #1d4ed8; }
html[data-theme="dark"] .login-help { background: #1c2b3e; border-color: #34445a; color: #cddae6; }
html[data-theme="dark"] .login-help-title { color: #9ec5ff; }
.org-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.org-stats .stat {
    background: #f8faff; border: 1px solid #e7edf7; border-radius: 10px;
    padding: 9px 13px; min-width: 96px;
}
.org-stats .stat strong { display: block; font-size: 19px; }
.org-stats .stat span { font-size: 12px; color: #64748b; }
.org-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--bs-border-color, #e2e8f0);
            padding: 14px 10px 0; margin-top: 12px; overflow-x: auto; white-space: nowrap; }
.org-tabs a { padding-bottom: 10px; color: #475569; text-decoration: none; font-weight: 600; }
.org-tabs a.active { color: #164fc5; border-bottom: 3px solid #2563eb; }
.org-panel { background: var(--bs-body-bg, #fff); border: 1px solid var(--bs-border-color, #e2e8f0);
             border-radius: 12px; padding: 16px; margin-top: 14px; }
.org-panel .panel-head { display: flex; justify-content: space-between; align-items: center;
                         gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.org-panel .panel-head h2 { font-size: 17px; margin: 0; }
.access-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 14px; }
.access-table { min-width: 680px; }
.access-table .obj-cell { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.sideinfo .notice, .sideinfo .warning {
    border: 1px solid #bfdbfe; background: #eff6ff; border-radius: 10px;
    padding: 12px; margin-bottom: 12px; font-size: 13px;
}
.sideinfo .warning { border-color: #fecaca; background: #fff7f7; }
.sideinfo .notice strong, .sideinfo .warning strong { display: block; margin-bottom: 6px; }
.sideinfo .notice strong { color: #1d4ed8; }
.sideinfo .warning strong { color: #b91c1c; }
.sideinfo p { margin: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 20px;
        padding: 5px 11px; font-weight: 650; font-size: 12px; }
.pill.green { background: #dcfce7; color: #166534; }
.pill.red { background: #fee2e2; color: #991b1b; }
.bottomgrid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; margin-top: 16px; }
.bottomgrid .tablewrap { overflow-x: auto; }
html[data-theme="dark"] .org-stats .stat,
html[data-theme="dark"] .sideinfo .notice,
html[data-theme="dark"] .sideinfo .warning { background: #1c2b3e; border-color: #34445a; color: #cddae6; }
html[data-theme="dark"] .org-icon { background: #244264; color: #9ec5ff; }
@media (max-width: 1050px) {
    .access-layout { grid-template-columns: 1fr; }
    .sideinfo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
}
@media (max-width: 650px) {
    .org-card { padding: 14px; }
    .org-stats { width: 100%; }
    .org-stats .stat { flex: 1; }
    .bottomgrid { grid-template-columns: 1fr; }
}


/* ================================================================
   Вторая рельса и обзорное окно «Исполнительная документация»
   ================================================================ */
.docid-subrail {
    width: 58px;
    min-width: 58px;
    max-width: 58px;
    background: #0d2438;
    border-right: 1px solid #071827;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px 6px;
    overflow-y: auto;
    overflow-x: visible;
    flex-shrink: 0;
    z-index: 4;
}
.docid-subrail-divider {
    width: 28px;
    height: 1px;
    background: rgba(255,255,255,.18);
    margin: 2px 0 3px;
}
.docid-subrail-btn {
    position: relative;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cfe2f3;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 6px;
    font-size: 1.15rem;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
.docid-subrail-btn:hover,
.docid-subrail-btn:focus-visible,
.docid-subrail-btn.active {
    background: #1b587f;
    border-color: #7fc2ef;
    color: #fff;
    outline: none;
}
.docid-subrail-btn.active::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 2px;
    background: #7fc2ef;
}
/* Подсказки второй рельсы рисуются JS в body (.subrail-tip), чтобы их
   не обрезал скроллящийся контейнер .docid-subrail. */
/* Статус красит весь ярлык рельсы, как раньше у горизонтальных подвкладок:
   красный мигает раз в 5 с, зелёный — спокойный. */
.docid-subrail-btn.st-red {
    background: #f8cdd1 !important;
    border-color: #dc3545 !important;
    color: #000 !important;
    animation: st-red-blink 5s ease-in-out infinite;
}
.docid-subrail-btn.st-red:hover,
.docid-subrail-btn.st-red:focus-visible {
    background: #f1b0b7 !important;
    color: #000 !important;
}
.docid-subrail-btn.st-yellow {
    background: #ffe8a3 !important;
    border-color: #d39e00 !important;
    color: #000 !important;
}
.docid-subrail-btn.st-yellow:hover,
.docid-subrail-btn.st-yellow:focus-visible {
    background: #ffdf85 !important;
    color: #000 !important;
}
.docid-subrail-btn.st-green {
    background: #c8e6c9 !important;
    border-color: #198754 !important;
    color: #000 !important;
}
.docid-subrail-btn.st-green:hover,
.docid-subrail-btn.st-green:focus-visible {
    background: #b4dcb6 !important;
    color: #000 !important;
}
.docid-subrail-btn.active.st-red,
.docid-subrail-btn.active.st-yellow,
.docid-subrail-btn.active.st-green { font-weight: 700; }

/* обзорная страница */
.docid-overview { padding: 20px; }
.docid-overview-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.docid-overview-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.docid-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}
.docid-overview-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 112px;
    padding: 14px;
    background: #fff;
    border: 1px solid #d7dee6;
    border-left: 4px solid #9aa9b8;
    border-radius: 8px;
    color: #212529;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.docid-overview-card:hover,
.docid-overview-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(0,0,0,.12);
    border-color: #6fa8d6;
    text-decoration: none;
    color: inherit;
    outline: none;
}
.docid-overview-card.st-red { border-left-color: #dc3545; }
.docid-overview-card.st-green { border-left-color: #28a745; }
.docid-overview-icon {
    width: 38px; height: 38px;
    flex: 0 0 38px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    background: #eef4fa;
    color: #1b587f;
    font-size: 1.25rem;
}
.docid-overview-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.docid-overview-title { font-weight: 600; line-height: 1.25; }
.docid-overview-desc { font-size: 12px; color: #6c757d; line-height: 1.35; }
.docid-overview-status { font-size: 11px; color: #495057; display: flex; align-items: center; gap: 5px; }
.docid-status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.docid-status-dot.st-red { background: #dc3545; }
.docid-status-dot.st-green { background: #28a745; }
.docid-overview-arrow { color: #9aa9b8; align-self: center; }

html[data-theme="dark"] .docid-overview-card {
    background: #1b2735;
    border-color: #33465b;
    color: #e9eef4;
}
html[data-theme="dark"] .docid-overview-icon { background: #233b52; color: #9fd0f5; }
html[data-theme="dark"] .docid-overview-desc,
html[data-theme="dark"] .docid-overview-status { color: #aebdcc; }

/* info-строка «Шифр / Реестр / Акт» над содержимым ИД */
.aid-context-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 10px 14px;
    margin: 0 0 10px;
    background: #123c5e;
    border: 1px solid #2b5a80;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(18, 60, 94, .22);
    color: #fff;
    font-size: 14px;
    flex-shrink: 0;
}
.aid-context-item { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.aid-context-open {
    cursor: pointer;
    padding: 2px 6px;
    margin: -2px -6px;
    border-radius: 4px;
}
.aid-context-open:hover { background: rgba(255, 255, 255, .12); }
.aid-context-open:hover .aid-context-value { text-decoration: underline; }
.aid-context-open:focus-visible { outline: 2px solid #9ec5e8; outline-offset: 1px; }
.aid-context-icon { color: #9ec5e8; font-size: 16px; }
.aid-context-label {
    color: rgba(255, 255, 255, .72);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.aid-context-value { font-weight: 700; color: #fff; font-size: 15px; overflow-wrap: anywhere; }
.aid-context-value.is-empty { font-weight: 400; color: rgba(255, 255, 255, .65); }
.aid-context-divider { width: 1px; height: 18px; background: rgba(255, 255, 255, .35); }
.aid-context-subrail {
    padding: 3px 9px;
    border-radius: 12px;
    background: rgba(127, 194, 239, .18);
    border: 1px solid rgba(127, 194, 239, .45);
    white-space: nowrap;
}
.aid-context-subrail .aid-context-value { font-size: 14px; color: #d8efff; }

/* комментарии «не могу выполнить» в окнах задач */
.task-comment-toggle {
    border: 0;
    background: transparent;
    padding: 0 2px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}
.task-comment-row > td { background: #fffdf5; padding: 6px 10px !important; }
.task-comment-inner { font-size: 12px; }
.task-comment-saved {
    white-space: pre-wrap;
    overflow-wrap: break-word;
    color: #7a4a00;
}
.task-comment-saved:empty { display: none; }
.task-comment-input { font-size: 12px; resize: vertical; }

/* inline-статусы на карточках обзорного окна */
.docid-overview-card { flex-wrap: wrap; }
.docid-overview-link {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}
.docid-overview-link:hover,
.docid-overview-link:focus-visible { color: inherit; text-decoration: none; outline: none; }
.docid-overview-status-control {
    flex: 1 1 100%;
    padding-left: 50px;
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.docid-overview-status-select {
    font-size: 11px;
    padding: 2px 22px 2px 6px;
    height: auto;
    max-width: 260px;
}

/* «Пульт качества» справа от одностолбцовой формы акта ОСР */
.act-editor-layout { align-items: flex-start; }
.act-quality-pane { position: relative; }
.act-quality-sticky {
    position: sticky;
    top: 0;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    padding-right: 2px;
}
.act-quality-card {
    background: #f8fafc;
    border: 1px solid #d7dee6;
    border-radius: 8px;
    padding: 10px;
}
.act-quality-title { font-size: 13px; font-weight: 700; margin: 0 0 8px; }
.act-quality-progress { margin-bottom: 10px; }
.act-quality-progress-row { display: flex; justify-content: space-between; font-size: 11px; color: #6c757d; }
.act-quality-progress .progress { height: 6px; }
.act-quality-block { border-top: 1px solid #e1e7ee; padding-top: 8px; margin-top: 8px; }
.act-quality-block-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #6c757d;
    margin-bottom: 6px;
}
.act-quality-toc { display: flex; flex-direction: column; gap: 2px; }
.act-quality-toc-item {
    border: 0;
    background: transparent;
    text-align: left;
    padding: 3px 5px;
    border-radius: 4px;
    font-size: 11.5px;
    line-height: 1.25;
    color: #315b80;
    cursor: pointer;
}
.act-quality-toc-item:hover,
.act-quality-toc-item.active { background: #e4eef8; color: #12456e; }
.act-quality-toc-item.is-current { font-weight: 700; }
.act-quality-issues,
.act-quality-hints { display: flex; flex-direction: column; gap: 6px; }
.act-quality-empty { font-size: 11px; color: #9aa9b8; font-style: italic; }
.act-quality-issue,
.act-quality-hint {
    border: 1px solid #e3c7c7;
    border-left: 3px solid #dc3545;
    border-radius: 4px;
    background: #fffafa;
    padding: 5px 6px;
    font-size: 11px;
    line-height: 1.3;
}
.act-quality-issue-label { font-weight: 700; color: #842029; margin-bottom: 2px; }
.act-quality-issue-text { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 68px; overflow: auto; }
.act-quality-hint {
    border-color: #cfe0f2;
    border-left-color: #0d6efd;
    background: #f6faff;
}
.act-quality-hint button {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0;
    font-size: 11px;
    line-height: 1.3;
    color: #0b4f9c;
    cursor: pointer;
    overflow-wrap: anywhere;
}
.act-quality-issue-actions { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }

html[data-theme="dark"] .aid-context-bar {
    background: #123c5e;
    border-color: #2b5a80;
}
html[data-theme="dark"] .aid-context-value { color: #fff; }
html[data-theme="dark"] .aid-context-divider { background: rgba(255, 255, 255, .35); }
html[data-theme="dark"] .task-comment-row > td { background: #1c2b3e; }
html[data-theme="dark"] .task-comment-saved { color: #ffd28a; }
html[data-theme="dark"] .act-quality-card {
    background: #1b2735;
    border-color: #33465b;
}
html[data-theme="dark"] .act-quality-title,
html[data-theme="dark"] .act-quality-value { color: #e9eef4; }
html[data-theme="dark"] .act-quality-toc-item { color: #9ecbff; }
html[data-theme="dark"] .act-quality-toc-item:hover,
html[data-theme="dark"] .act-quality-toc-item.active { background: #233b52; color: #cfe6ff; }
html[data-theme="dark"] .act-quality-issue {
    background: #33232a;
    border-color: #6b3540;
    border-left-color: #dc3545;
    color: #f2d9dd;
}
html[data-theme="dark"] .act-quality-issue-label { color: #ffb3bd; }
html[data-theme="dark"] .act-quality-hint {
    background: #1c2c44;
    border-color: #34527a;
}
html[data-theme="dark"] .act-quality-hint button { color: #9ecbff; }

/* подсветка пункта чек-листа после перехода из уведомления */
@keyframes aidClHighlight {
    0%, 100% { background: transparent; }
    15%, 60% { background: #fff3cd; }
    35%, 80% { background: transparent; }
}
#checklistTable tbody tr.cl-highlight { animation: aidClHighlight 1s ease-in-out 4; }
#checklistTable tbody tr.cl-highlight td { border-color: #ffc107; }

/* вкладки внутри окон задач */
.task-modal-tabs .nav-link { padding: 5px 14px; font-size: 13px; }
.task-tab-counter {
    display: inline-block; margin-left: 5px; padding: 0 6px; min-width: 18px;
    border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 18px;
    text-align: center; color: #31506e; background: #e7eef6;
}
.task-tab-counter[hidden] { display: none; }
.task-tab-counter.is-hot { color: #5a3c00; background: #ffd54f; }
html[data-theme="dark"] .task-tab-counter { color: #cfe4f7; background: #2a4059; }
html[data-theme="dark"] .task-tab-counter.is-hot { color: #2a2000; background: #ffd54f; }

/* примечание и действия в строках окон задач */
.task-note-cell { min-width: 180px; }
.task-note-cell .task-note-input { font-size: 11px; height: 26px; padding: 2px 6px; }
.task-actions { text-align: center; white-space: nowrap; }
.task-actions .btn { padding: 0 5px; font-size: 11px; line-height: 1.4; }
.task-title-cell { vertical-align: middle; }

/* кнопка перехода в карточке уведомления чата */
.chat-notify-link {
    margin: 6px 0 0;
    padding: 3px 9px;
    font-size: 11px;
    line-height: 1.2;
    color: #0d6efd;
    background: transparent;
    border: 1px solid #0d6efd;
    border-radius: 4px;
    cursor: pointer;
}
.chat-notify-link:hover { background: #0d6efd; color: #fff; }

@media (max-width: 900px) {
    .docid-subrail { width: 48px; min-width: 48px; max-width: 48px; padding: 6px 3px; }
    .docid-subrail-btn { width: 38px; height: 38px; }
}

/* ================================================================
   Карточки со статусами: цвет только у карточки, текст везде чёрный
   ================================================================ */
.aid-card-gate-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 20px 12px;
    padding: 8px 12px;
    background: #ffe8a3;
    border: 1px solid #d39e00;
    border-radius: 6px;
    color: #000;
    font-size: 13px;
}
.aid-card-gate-bar span { color: #000; }
a.aid-card-gate-bar { text-decoration: none; cursor: pointer; }
a.aid-card-gate-bar:hover { background: #ffdf7e; border-color: #b8860b; }
#aidCardGateBar .aid-gate-arrow { margin-left: auto; }

/* Только текст плашки: крупный красный жирный. Остальной текст карточек остаётся чёрным. */
#aidCardGateBar [data-gate-text] {
    color: #c62828 !important;
    font-size: 18px;
    font-weight: 700;
}
#aidCardGateBar > i { color: #c62828 !important; }

.docid-overview-head h4,
.docid-overview-head .small { color: #000; }

.docid-overview-grid { position: relative; }
.docid-overview-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 118px;
    padding: 14px 34px;
    text-align: center;
    color: #000;
    cursor: pointer;
    overflow: visible;
}
.docid-overview-card.no-context { min-height: 92px; cursor: pointer; }
.docid-overview-card.no-status { min-height: 92px; text-decoration: none; }
.docid-overview-card .docid-overview-title {
    color: #000;
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.2;
}
.docid-overview-card.no-context .docid-overview-title { font-size: 1.35rem; font-weight: 800; }
.docid-overview-card .docid-overview-active {
    color: #000;
    font-size: .86rem;
    font-weight: 600;
    line-height: 1.25;
}
.docid-overview-card .docid-overview-active.is-prompt { font-weight: 800; }
.docid-overview-card .docid-overview-active.is-not-required { font-weight: 400; }
.docid-overview-card .docid-overview-next {
    color: #c62828 !important;
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.25;
}
.docid-overview-card .docid-overview-next[hidden] { display: none; }
.docid-overview-card .docid-overview-summary { color: #000; font-size: .76rem; }
.docid-overview-open {
    position: absolute;
    top: 6px;
    right: 8px;
    color: #000;
    text-decoration: none;
    font-size: .9rem;
    line-height: 1;
    background: transparent;
    border: 0;
    padding: 2px;
    cursor: pointer;
}
.docid-overview-open:hover { color: #000; }

.docid-overview-card.st-pink {
    background: #f8cdd1;
    border: 1px solid #dc3545;
    border-left: 4px solid #dc3545;
}
.docid-overview-card.st-yellow {
    background: #ffe8a3;
    border: 1px solid #d39e00;
    border-left: 4px solid #d39e00;
}
.docid-overview-card.st-green {
    background: #c8e6c9;
    border: 1px solid #198754;
    border-left: 4px solid #198754;
}
.docid-overview-card.no-status,
.docid-overview-card.no-context {
    background: #fff;
    border: 1px solid #d7dee6;
    border-left: 4px solid #9aa9b8;
}
.docid-overview-card.osr-card { text-decoration: none; }
.docid-gate-link { text-decoration: none; }
.docid-gate-link:hover { text-decoration: underline; }

/* Меню статусов живёт в body и позиционируется JS по viewport. */
.docid-card-menu {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000;
    width: 220px;
    max-height: min(70vh, 360px);
    overflow-y: auto;
    padding: 4px;
    background: #fff;
    border: 1px solid #9aa9b8;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,.22);
    text-align: left;
}
.docid-card-menu[hidden] { display: none; }
.docid-card-menu-group-title {
    padding: 4px 7px 2px;
    color: #6c757d;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.docid-card-menu-group-title[hidden],
.docid-card-menu-item[hidden] { display: none; }
.docid-card-menu-item {
    display: block;
    width: 100%;
    padding: 5px 7px;
    background: transparent;
    border: 0;
    border-radius: 4px;
    color: #000;
    font-size: 12px;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
}
.docid-card-menu-item:hover,
.docid-card-menu-item:focus-visible { background: #f1f3f5; color: #000; outline: none; }
.docid-card-menu-item.is-active { background: #ffe8a3; font-weight: 700; }

html[data-theme="dark"] .docid-overview-card.st-pink { background: #f8cdd1; border-color: #dc3545; }
html[data-theme="dark"] .docid-overview-card.st-yellow { background: #ffe8a3; border-color: #d39e00; }
html[data-theme="dark"] .docid-overview-card.st-green { background: #c8e6c9; border-color: #198754; }
html[data-theme="dark"] .docid-overview-card,
html[data-theme="dark"] .docid-overview-card .docid-overview-title,
html[data-theme="dark"] .docid-overview-card .docid-overview-active,
html[data-theme="dark"] .docid-overview-card .docid-overview-summary,
html[data-theme="dark"] .docid-card-menu-item,
html[data-theme="dark"] .aid-card-gate-bar,
html[data-theme="dark"] .aid-card-gate-bar span,
html[data-theme="dark"] .docid-overview-head h4,
html[data-theme="dark"] .docid-overview-head .small { color: #000; }

/* Кнопка частичного заполнения акта ОСР: оранжевая, текст белый. */
.btn-act-partial {
    background-color: #f59e0b;
    border-color: #d97706;
    color: #fff;
}
.btn-act-partial:hover,
.btn-act-partial:focus-visible,
.btn-act-partial:active {
    background-color: #e08e0b;
    border-color: #b45309;
    color: #fff;
}

/* ================================================================
   PREMIUM: окно карточек исполнительной документации
   ================================================================ */
.docid-overview {
    --ov-ink: #0b2239;
    --ov-muted: #637b91;
    --ov-line: rgba(120, 150, 178, .28);
    position: relative;
    padding: 14px;
    border-radius: 18px;
    background:
        radial-gradient(900px 240px at 8% -10%, rgba(46, 125, 190, .10), transparent 60%),
        linear-gradient(145deg, rgba(255, 255, 255, .97), rgba(238, 245, 251, .94));
    border: 1px solid rgba(120, 150, 178, .26);
    box-shadow: 0 12px 34px rgba(18, 60, 94, .08), inset 0 1px 0 rgba(255, 255, 255, .9);
}
.docid-overview-head { padding: 2px 4px 12px; }
.docid-overview-head h4 { font-size: 1.18rem; letter-spacing: -.015em; }
.docid-overview-head h4 i { color: #1b6ca8; }
.docid-overview-head .small { color: var(--ov-muted) !important; }

.docid-overview-grid {
    gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
}
@keyframes aidOvIn {
    from { opacity: 0; transform: translateY(9px) scale(.99); }
    to   { opacity: 1; transform: none; }
}
.docid-overview-grid > .docid-overview-card {
    isolation: isolate;
    overflow: hidden;
    min-height: 158px;
    padding: 16px 18px 15px;
    gap: 7px;
    border-radius: 14px !important;
    background: rgba(255, 255, 255, .86) !important;
    border: 1px solid var(--ov-line) !important;
    border-left: 4px solid var(--ov-accent, #6f8ba6) !important;
    box-shadow: 0 5px 16px rgba(16, 48, 76, .07), inset 0 1px 0 rgba(255, 255, 255, .85);
    color: var(--ov-ink) !important;
    animation: aidOvIn .3s cubic-bezier(.2, .7, .2, 1) both;
    transition: transform .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s ease, border-color .2s ease;
}
.docid-overview-grid > .docid-overview-card:nth-child(2n) { animation-delay: .03s; }
.docid-overview-grid > .docid-overview-card:nth-child(3n) { animation-delay: .06s; }
.docid-overview-grid > .docid-overview-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--ov-soft, rgba(226, 235, 243, .6)), rgba(255, 255, 255, 0) 62%);
    z-index: -2;
    pointer-events: none;
}
.docid-overview-grid > .docid-overview-card::after {
    content: "";
    position: absolute;
    width: 150px;
    height: 150px;
    right: -62px;
    top: -72px;
    background: radial-gradient(circle, var(--ov-glow, rgba(111, 139, 166, .18)), transparent 68%);
    z-index: -1;
    pointer-events: none;
    transition: transform .25s ease, opacity .25s ease;
}
.docid-overview-grid > .docid-overview-card:hover,
.docid-overview-grid > .docid-overview-card:focus-visible {
    transform: translateY(-4px);
    border-color: var(--ov-accent, #6f8ba6) !important;
    box-shadow: 0 16px 34px rgba(14, 45, 72, .16), 0 0 0 3px var(--ov-glow, rgba(111, 139, 166, .18));
    color: inherit !important;
    text-decoration: none;
    outline: none;
}
.docid-overview-grid > .docid-overview-card:hover::after { transform: translate(-8px, 8px) scale(1.14); }

.docid-overview-card.st-pink {
    --ov-accent: #dc3545;
    --ov-soft: rgba(248, 205, 209, .62);
    --ov-glow: rgba(220, 53, 69, .22);
}
.docid-overview-card.st-yellow {
    --ov-accent: #c98a00;
    --ov-soft: rgba(255, 232, 163, .65);
    --ov-glow: rgba(211, 158, 0, .24);
}
.docid-overview-card.st-green {
    --ov-accent: #1f9d55;
    --ov-soft: rgba(200, 230, 201, .65);
    --ov-glow: rgba(31, 157, 85, .22);
}
.docid-overview-card.no-status,
.docid-overview-card.no-context {
    --ov-accent: #6f8ba6;
    --ov-soft: rgba(226, 235, 243, .7);
    --ov-glow: rgba(111, 139, 166, .18);
}
.docid-overview-card.no-context { min-height: 108px; }
.docid-overview-card.is-locked { cursor: help; }

.docid-overview-card .docid-overview-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(255, 255, 255, .95), var(--ov-soft, rgba(226, 235, 243, .7)));
    color: var(--ov-accent, #6f8ba6);
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(16, 48, 76, .08), inset 0 0 0 1px rgba(255, 255, 255, .75);
}
.docid-overview-card .docid-overview-title {
    color: var(--ov-ink) !important;
    font-size: .98rem;
    font-weight: 750;
    letter-spacing: -.01em;
}
.docid-overview-card.no-context .docid-overview-title { font-size: 1.32rem; font-weight: 800; }
.docid-overview-card .docid-overview-desc {
    color: var(--ov-muted);
    font-size: .72rem;
    line-height: 1.35;
    max-width: 28ch;
}
.docid-overview-card .docid-overview-active {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .82);
    border: 1px solid rgba(120, 150, 178, .24);
    color: #35536d !important;
    font-size: .74rem;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(16, 48, 76, .06);
}
.docid-overview-card .docid-overview-active::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ov-accent, #6f8ba6);
    box-shadow: 0 0 0 3px var(--ov-glow, rgba(111, 139, 166, .18));
}
.docid-overview-card .docid-overview-active.is-prompt { font-weight: 800; }
.docid-overview-card .docid-overview-active.is-not-required { font-weight: 400; }
.docid-overview-card .docid-overview-next {
    display: inline-block;
    margin-top: 1px;
    padding: 4px 9px;
    border-radius: 8px;
    background: rgba(255, 245, 245, .9);
    border: 1px solid rgba(198, 40, 40, .22);
    color: #c62828 !important;
    font-size: .74rem;
    font-weight: 700;
}
.docid-overview-card .docid-overview-summary {
    color: #526b82 !important;
    font-size: .72rem;
}

.docid-overview-open {
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px !important;
    background: rgba(255, 255, 255, .92) !important;
    border: 1px solid rgba(120, 150, 178, .3) !important;
    color: #5a7186 !important;
    font-size: 1rem;
    box-shadow: 0 2px 7px rgba(16, 48, 76, .1);
    transition: background .16s ease, color .16s ease, transform .16s ease;
}
.docid-overview-open:hover {
    background: var(--ov-accent, #6f8ba6) !important;
    color: #fff !important;
    transform: translateX(2px);
}
.docid-overview-open:focus-visible { outline: 2px solid var(--ov-accent, #6f8ba6); outline-offset: 2px; }
.docid-overview-card > .docid-overview-arrow {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, .9);
    border: 1px solid rgba(120, 150, 178, .28);
    color: #5a7186 !important;
    align-self: auto;
}

/* Плашка требуемости — тот же премиальный язык, текст остаётся красным 18px. */
.aid-card-gate-bar {
    margin: 0 20px 14px;
    padding: 10px 14px;
    border-radius: 12px;
    background: linear-gradient(90deg, #fff2f2, #fff9f9) !important;
    border: 1px solid rgba(198, 40, 40, .32) !important;
    box-shadow: 0 6px 18px rgba(198, 40, 40, .08), inset 0 1px 0 #fff;
}
.aid-card-gate-bar > i:first-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
    color: #c62828 !important;
    box-shadow: 0 2px 6px rgba(198, 40, 40, .16);
}
.aid-card-gate-bar .aid-gate-arrow { color: #c62828; font-weight: 700; }
a.aid-card-gate-bar:hover {
    background: linear-gradient(90deg, #ffe6e6, #fff3f3) !important;
    transform: translateX(2px);
    box-shadow: 0 9px 22px rgba(198, 40, 40, .12);
}

/* Меню выбора требуемости в том же стиле. */
.docid-card-menu {
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(120, 150, 178, .35);
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 20px 48px rgba(12, 40, 66, .24);
}
.docid-card-menu-group-title { padding: 6px 9px 3px; color: #7b8fa4; letter-spacing: .05em; }
.docid-card-menu-item { padding: 7px 10px; border-radius: 8px; font-size: 12.5px; }
.docid-card-menu-item:hover,
.docid-card-menu-item:focus-visible { background: #edf5fb; }
.docid-card-menu-item.is-active {
    background: linear-gradient(90deg, #ffe8a3, #fff7e0);
    color: #6f4b00;
}

html[data-theme="dark"] .docid-overview {
    background:
        radial-gradient(900px 240px at 8% -10%, rgba(80, 150, 210, .10), transparent 60%),
        linear-gradient(145deg, #1a2e42, #132536);
    border-color: #2c455d;
    box-shadow: 0 14px 36px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .04);
}
html[data-theme="dark"] .docid-overview-head h4,
html[data-theme="dark"] .docid-overview-head .small { color: #dceaf6 !important; }
html[data-theme="dark"] .docid-overview-head h4 i { color: #8ec8f0; }
html[data-theme="dark"] .docid-overview-grid > .docid-overview-card {
    background: linear-gradient(145deg, #1d3348, #172a3c) !important;
    border-color: #34506a !important;
    color: #e8f2fb !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .05);
}
html[data-theme="dark"] .docid-overview-card .docid-overview-title,
html[data-theme="dark"] .docid-overview-card .docid-overview-summary { color: #e3eef8 !important; }
html[data-theme="dark"] .docid-overview-card .docid-overview-desc { color: #a9c0d4 !important; }
html[data-theme="dark"] .docid-overview-card .docid-overview-active {
    background: rgba(255, 255, 255, .06);
    border-color: rgba(160, 195, 225, .2);
    color: #cfe2f3 !important;
}
html[data-theme="dark"] .docid-overview-open,
html[data-theme="dark"] .docid-overview-card > .docid-overview-arrow {
    background: rgba(255, 255, 255, .08) !important;
    border-color: rgba(160, 195, 225, .25) !important;
    color: #cfe2f3 !important;
}
html[data-theme="dark"] .docid-overview-card .docid-overview-next { color: #ff8a8a !important; }
html[data-theme="dark"] .docid-card-menu { background: #1b2f43; border-color: #38546e; }
html[data-theme="dark"] .docid-card-menu-group-title { color: #9db4c8; }
html[data-theme="dark"] .docid-card-menu-item { color: #e8f1fa !important; }
html[data-theme="dark"] .docid-card-menu-item:hover,
html[data-theme="dark"] .docid-card-menu-item:focus-visible { background: #29445c; }

/* --- уведомление: карточка без выбранного реестра --- */
.docid-card-alert {
    position: fixed; inset: 0; z-index: 2100;
    display: flex; align-items: center; justify-content: center;
    padding: 18px; background: rgba(8, 24, 38, .5);
    backdrop-filter: blur(3px);
}
.docid-card-alert[hidden] { display: none; }
@keyframes docidAlertPop {
    from { opacity: 0; transform: translateY(10px) scale(.97); }
    to { opacity: 1; transform: none; }
}
.docid-card-alert-card {
    width: min(420px, 100%); padding: 24px 22px 20px;
    border-radius: 18px; text-align: center;
    background: #fff; border: 1px solid rgba(198, 40, 40, .24);
    box-shadow: 0 26px 64px rgba(8, 28, 46, .36);
    animation: docidAlertPop .2s cubic-bezier(.2, .7, .2, 1) both;
}
.docid-card-alert-mark {
    width: 58px; height: 58px; margin: 0 auto 12px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; font-size: 1.7rem;
    color: #c62828; background: #fdecec;
    box-shadow: inset 0 0 0 1px rgba(198, 40, 40, .16);
}
.docid-card-alert-card h3 { margin: 0 0 8px; font-size: 1.12rem; font-weight: 800; color: #8e1d1d; }
.docid-card-alert-card p { margin: 0 0 16px; font-size: .84rem; line-height: 1.5; color: #5b7288; }
.docid-card-alert-card .btn { min-width: 120px; }
html[data-theme="dark"] .docid-card-alert-card { background: #1b2f43; border-color: #5d3540; }
html[data-theme="dark"] .docid-card-alert-card h3 { color: #ff9c9c; }
html[data-theme="dark"] .docid-card-alert-card p { color: #a8c4dc; }
html[data-theme="dark"] .docid-card-alert-mark {
    color: #ff8a8a; background: #3a2029;
    box-shadow: inset 0 0 0 1px rgba(255, 138, 138, .24);
}

@media (prefers-reduced-motion: reduce) {
    .docid-overview-grid > .docid-overview-card { animation: none; }
    .docid-overview-grid > .docid-overview-card:hover { transform: none; }
    .docid-card-alert-card { animation: none; }
}

/* ================================================================
   PREMIUM: встроенный дашборд объектов
   ================================================================ */
.dashboard-page .dash-wrap {
    --db-ink: #0b2239;
    --db-muted: #637b91;
    --db-line: rgba(120, 150, 178, .28);
    padding: 14px;
    border-radius: 18px;
    background:
        radial-gradient(1000px 320px at 12% -12%, rgba(46, 125, 190, .12), transparent 62%),
        linear-gradient(145deg, rgba(255, 255, 255, .97), rgba(236, 244, 251, .94));
    border: 1px solid rgba(120, 150, 178, .26);
    box-shadow: 0 12px 34px rgba(18, 60, 94, .08), inset 0 1px 0 rgba(255, 255, 255, .9);
}
.dashboard-page .dash-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 14px;
    background: linear-gradient(105deg, #123c5e, #1b5b86);
    border: 1px solid rgba(255, 255, 255, .16);
    box-shadow: 0 8px 20px rgba(18, 60, 94, .18);
}
.dashboard-page .dash-toolbar .toolbar-hint {
    color: #fff;
    font-size: 1rem;
    letter-spacing: -.01em;
}
.dashboard-page .dash-toolbar .text-muted { color: rgba(255, 255, 255, .72) !important; }
.dashboard-page .dash-toolbar .btn { border-radius: 9px; font-weight: 600; box-shadow: 0 2px 8px rgba(0, 0, 0, .16); }

.dashboard-page .dash-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 18px 2px 10px;
    font-size: 1rem;
    font-weight: 750;
    letter-spacing: -.01em;
    color: var(--db-ink);
}
.dashboard-page .dash-section-title::before {
    content: "";
    width: 4px;
    height: 16px;
    border-radius: 3px;
    background: linear-gradient(#2e7dbe, #123c5e);
}

@keyframes aidDashIn {
    from { opacity: 0; transform: translateY(9px) scale(.99); }
    to   { opacity: 1; transform: none; }
}
.dashboard-page .dash-tiles {
    gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.dashboard-page .dash-tile {
    border-radius: 16px;
    border: 1px solid var(--db-line);
    background: #fff;
    box-shadow: 0 6px 18px rgba(16, 48, 76, .08);
    animation: aidDashIn .32s cubic-bezier(.2, .7, .2, 1) both;
    transition: transform .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s ease, border-color .2s ease;
}
.dashboard-page .dash-tile:nth-child(2n) { animation-delay: .04s; }
.dashboard-page .dash-tile:nth-child(3n) { animation-delay: .08s; }
.dashboard-page .dash-tile:hover {
    transform: translateY(-5px);
    border-color: #7db8ee;
    box-shadow: 0 18px 36px rgba(14, 45, 72, .16);
}
.dashboard-page .dash-tile.active {
    border-color: #1b6ca8;
    box-shadow: 0 12px 30px rgba(18, 108, 168, .2), 0 0 0 3px rgba(27, 108, 168, .16);
}
.dashboard-page .dash-tile.active::after {
    content: "✓ ВЫБРАН";
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(18, 60, 94, .9);
    color: #fff;
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .06em;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .18);
}
.dashboard-page .dash-tile-main { position: relative; display: block; }
.dashboard-page .dash-tile-photo {
    position: relative;
    height: 180px;
    background: linear-gradient(135deg, #dce7f2, #b9d0e4);
}
.dashboard-page .dash-tile-photo::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(9, 32, 52, .28), transparent 55%);
    pointer-events: none;
}
.dashboard-page .dash-tile-photo img { transition: transform .35s ease; }
.dashboard-page .dash-tile:hover .dash-tile-photo img { transform: scale(1.05); }
.dashboard-page .dash-tile-photo-empty { font-size: 64px; color: #7e9cb8; opacity: .9; }
.dashboard-page .dash-tile-body {
    padding: 12px 13px 14px;
    grid-template-columns: 20px 1fr;
    gap: 3px 7px;
}
.dashboard-page .dash-tile-check { font-size: 19px; color: #1b6ca8; }
.dashboard-page .dash-tile-name { font-size: .95rem; font-weight: 750; color: var(--db-ink); }
.dashboard-page .dash-tile-meta { font-size: .75rem; color: var(--db-muted); }
.dashboard-page .dash-tile-upload {
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(9, 32, 52, .72);
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
}
.dashboard-page .dash-tile-upload:hover { background: #1b6ca8; transform: scale(1.05); }

.dashboard-page .dash-counts { gap: 12px; }
.dashboard-page .dash-count {
    position: relative;
    overflow: hidden;
    border-radius: 13px;
    padding: 12px 14px;
    background: linear-gradient(145deg, rgba(255, 255, 255, .96), #f2f7fb);
    border: 1px solid var(--db-line);
    border-left: 4px solid var(--dash-accent);
    box-shadow: 0 5px 14px rgba(16, 48, 76, .07);
    transition: transform .18s ease, box-shadow .18s ease;
}
.dashboard-page .dash-count::after {
    content: "";
    position: absolute;
    width: 90px;
    height: 90px;
    right: -40px;
    top: -46px;
    border-radius: 50%;
    background: var(--dash-accent);
    opacity: .10;
}
.dashboard-page .dash-count:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(16, 48, 76, .12);
}
.dashboard-page .dash-count-value { font-size: 1.7rem; letter-spacing: -.03em; }
.dashboard-page .dash-count > span:last-child {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.dashboard-page .dash-panels { gap: 14px; }
.dashboard-page .dash-card {
    border-radius: 14px;
    padding: 14px 15px;
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--db-line);
    box-shadow: 0 6px 18px rgba(16, 48, 76, .07);
}
.dashboard-page .dash-card:nth-child(1) { --panel-accent: #1b6ca8; }
.dashboard-page .dash-card:nth-child(2) { --panel-accent: #0f9aa8; }
.dashboard-page .dash-card:nth-child(3) { --panel-accent: #e08a1e; }
.dashboard-page .dash-card:nth-child(4) { --panel-accent: #7b5cd6; }
.dashboard-page .dash-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .9rem;
    font-weight: 750;
    border: 0;
    border-bottom: 1px solid rgba(120, 150, 178, .2);
    padding: 0 0 9px;
    color: var(--db-ink);
}
.dashboard-page .dash-card-title::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 3px;
    background: var(--panel-accent, #1b6ca8);
    box-shadow: 0 0 0 4px rgba(27, 108, 168, .12);
}
.dashboard-page .dash-bar-row { grid-template-columns: 100px 1fr 34px; font-size: .75rem; }
.dashboard-page .dash-bar-row--chart { grid-template-columns: 76px 1fr 104px; }
.dashboard-page .dash-bar-track {
    height: 9px;
    background: #e9eff5;
    box-shadow: inset 0 1px 2px rgba(16, 48, 76, .08);
}
.dashboard-page .dash-bar-fill { border-radius: 999px; box-shadow: 0 1px 4px rgba(16, 48, 76, .18); }
.dashboard-page .dash-events-wrap,
.dashboard-page .dash-members-wrap { border-color: var(--db-line); border-radius: 10px; }
.dashboard-page .dash-event { padding: 7px 2px; }
.dashboard-page .dash-members thead th { background: #f3f7fb; }

html[data-theme="dark"] .dashboard-page .dash-wrap {
    background:
        radial-gradient(1000px 320px at 12% -12%, rgba(80, 150, 210, .10), transparent 62%),
        linear-gradient(145deg, #16283a, #112130);
    border-color: #2c455d;
    box-shadow: 0 14px 36px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .04);
}
html[data-theme="dark"] .dashboard-page .dash-toolbar {
    background: linear-gradient(105deg, #0f314c, #16436a);
    border-color: #2c5a80;
}
html[data-theme="dark"] .dashboard-page .dash-section-title,
html[data-theme="dark"] .dashboard-page .dash-card-title,
html[data-theme="dark"] .dashboard-page .dash-tile-name { color: #dceaf6 !important; }
html[data-theme="dark"] .dashboard-page .dash-tile,
html[data-theme="dark"] .dashboard-page .dash-count,
html[data-theme="dark"] .dashboard-page .dash-card {
    background: linear-gradient(145deg, #1d3348, #172a3c) !important;
    border-color: #34506a !important;
}
html[data-theme="dark"] .dashboard-page .dash-tile-photo { background: linear-gradient(135deg, #203b55, #162c40); }
html[data-theme="dark"] .dashboard-page .dash-count-value { color: var(--dash-accent) !important; }
html[data-theme="dark"] .dashboard-page .dash-card-title { border-bottom-color: #34506a; }
html[data-theme="dark"] .dashboard-page .dash-bar-track { background: #2c3a4a; }
html[data-theme="dark"] .dashboard-page .dash-members thead th { background: #202f41; }

@media (max-width: 991.98px) {
    .dashboard-page .dash-tiles { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
    .dashboard-page .dash-tile-photo { height: 180px; }
}
@media (prefers-reduced-motion: reduce) {
    .dashboard-page .dash-tile { animation: none; }
    .dashboard-page .dash-tile:hover,
    .dashboard-page .dash-count:hover { transform: none; }
}

/* ================================================================
   PREMIUM: сводные данные v2 — фильтры, KPI, таблица, пагинация
   ================================================================ */
.sum-page {
    --sum-ink: #0b2239;
    --sum-muted: #637b91;
    --sum-line: rgba(120, 150, 178, .28);
    --sum-blue: #123c5e;
    --sum-accent: #1b6ca8;
    --sum-soft: rgba(46, 125, 190, .1);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 13px;
    min-width: 0;
    padding: 14px;
    color: var(--sum-ink);
}
@keyframes sumIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}
.sum-page > * { animation: sumIn .3s cubic-bezier(.2, .7, .2, 1) both; }
.sum-page > *:nth-child(2) { animation-delay: .03s; }
.sum-page > *:nth-child(3) { animation-delay: .06s; }

/* --- hero --- */
.sum-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    padding: 15px 18px;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(115deg, #0f314c 0%, #123c5e 42%, #1b5b86 100%);
    border: 1px solid rgba(255, 255, 255, .16);
    box-shadow: 0 14px 32px rgba(18, 60, 94, .22), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.sum-hero-left { display: flex; align-items: center; gap: 13px; min-width: 0; }
.sum-hero-mark {
    width: 46px; height: 46px; flex: 0 0 46px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 13px; font-size: 1.45rem;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
}
.sum-hero-kicker { font-size: .66rem; letter-spacing: .14em; font-weight: 800; color: rgba(255, 255, 255, .66); }
.sum-hero-title { margin: 2px 0 1px; font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.12; }
.sum-hero-meta { font-size: .78rem; color: rgba(255, 255, 255, .8); display: flex; align-items: center; gap: 6px; }
.sum-hero-right { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.sum-seg {
    display: inline-flex; padding: 4px; gap: 3px;
    border-radius: 12px; background: rgba(8, 30, 48, .35);
    border: 1px solid rgba(255, 255, 255, .16);
}
.sum-seg-item {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 11px; border-radius: 9px;
    color: rgba(255, 255, 255, .78); font-size: .8rem; font-weight: 650;
    text-decoration: none; white-space: nowrap;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}
.sum-seg-item:hover { color: #fff; background: rgba(255, 255, 255, .1); text-decoration: none; }
.sum-seg-item.is-active {
    color: #123c5e; background: #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .2);
}
.sum-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    min-height: 35px; padding: 7px 12px; border-radius: 10px;
    border: 1px solid transparent; font-size: .8rem; font-weight: 700;
    cursor: pointer; white-space: nowrap;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.sum-btn:hover { transform: translateY(-2px); }
.sum-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.sum-btn:focus-visible { outline: 2px solid #8ec8f0; outline-offset: 2px; }
.sum-btn-ghost { color: #fff; background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .22); }
.sum-btn-ghost:hover { background: rgba(255, 255, 255, .2); }
.sum-btn-accent { color: #123c5e; background: linear-gradient(135deg, #fff, #dceefa); box-shadow: 0 4px 12px rgba(0, 0, 0, .18); }
.sum-btn-soft { color: var(--sum-accent); background: #eaf3fa; border-color: rgba(27, 108, 168, .25); }
.sum-btn-soft:hover { background: #d9ebf8; box-shadow: 0 5px 14px rgba(27, 108, 168, .16); }

/* --- KPI --- */
.sum-kpis {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}
.sum-kpi {
    --kpi-accent: #1b6ca8;
    position: relative; overflow: hidden;
    display: flex; align-items: center; gap: 10px;
    min-width: 0; padding: 11px 13px;
    border-radius: 14px; text-align: left; cursor: pointer;
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--sum-line);
    border-left: 4px solid var(--kpi-accent);
    box-shadow: 0 5px 16px rgba(16, 48, 76, .07);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.sum-kpi::after {
    content: ""; position: absolute; width: 86px; height: 86px; right: -38px; top: -42px;
    border-radius: 50%; background: var(--kpi-accent); opacity: .09;
}
.sum-kpi:hover { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(16, 48, 76, .13); }
.sum-kpi.is-active { border-color: var(--kpi-accent); box-shadow: 0 0 0 2px rgba(27, 108, 168, .15), 0 10px 22px rgba(16, 48, 76, .13); }
.sum-kpi:focus-visible { outline: 2px solid var(--kpi-accent); outline-offset: 2px; }
.sum-kpi-signed { --kpi-accent: #1f9d55; }
.sum-kpi-unsigned { --kpi-accent: #c62828; }
.sum-kpi-in_progress { --kpi-accent: #d39e00; }
.sum-kpi-on_review { --kpi-accent: #0f8ba8; }
.sum-kpi-paused { --kpi-accent: #7b5cd6; }
.sum-kpi-icon {
    width: 36px; height: 36px; flex: 0 0 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px; font-size: 1.05rem;
    color: var(--kpi-accent);
    background: linear-gradient(145deg, #fff, rgba(226, 235, 243, .8));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8), 0 3px 8px rgba(16, 48, 76, .08);
}
.sum-kpi-copy { display: flex; flex-direction: column; min-width: 0; }
.sum-kpi-label { font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--sum-muted); white-space: nowrap; }
.sum-kpi-value { font-size: 1.45rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; color: var(--sum-ink); }
.sum-kpi-arrow { margin-left: auto; align-self: flex-start; font-size: .7rem; color: var(--sum-muted); opacity: .65; }

/* --- main layout / left filters --- */
.sum-layout { display: flex; align-items: flex-start; gap: 13px; min-width: 0; }
.sum-filters {
    position: sticky; top: 0; align-self: flex-start;
    width: 272px; min-width: 240px; max-width: 330px;
    display: flex; flex-direction: column;
    border-radius: 16px; overflow: hidden;
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--sum-line);
    box-shadow: 0 8px 24px rgba(18, 60, 94, .09);
    backdrop-filter: blur(8px);
}
.sum-filters-head {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    padding: 11px 12px 9px;
    background: linear-gradient(120deg, #f4f9fd, #e9f2f9);
    border-bottom: 1px solid var(--sum-line);
}
.sum-filters-title { display: flex; align-items: center; gap: 7px; font-size: .88rem; font-weight: 800; }
.sum-filters-title i { color: var(--sum-accent); }
.sum-filters-badge {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 2px 7px; border-radius: 999px; min-width: 18px;
    font-size: .64rem; font-weight: 800; color: #fff; background: var(--sum-accent);
}
.sum-filters-badge:empty { display: none; }
.sum-filter-tools { display: flex; gap: 3px; }
.sum-filter-tools button {
    border: 0; background: rgba(255, 255, 255, .8); color: #4a6780;
    border-radius: 7px; padding: 3px 7px; font-size: .66rem; font-weight: 700; cursor: pointer;
    border: 1px solid rgba(120, 150, 178, .24);
}
.sum-filter-tools button:hover { background: #fff; color: var(--sum-accent); }
.sum-filter-search {
    display: flex; align-items: center; gap: 7px;
    margin: 9px 10px 4px; padding: 6px 9px;
    border-radius: 10px; background: #f5f9fc;
    border: 1px solid rgba(120, 150, 178, .3);
    color: var(--sum-muted);
}
.sum-filter-search:focus-within { border-color: var(--sum-accent); box-shadow: 0 0 0 3px rgba(27, 108, 168, .12); background: #fff; }
.sum-filter-search i { font-size: .8rem; }
.sum-filter-search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: .78rem; color: var(--sum-ink); }
.sum-filter-body { overflow: auto; max-height: min(56vh, 560px); padding: 4px 8px 8px; scrollbar-width: thin; }
.sum-filters-foot { padding: 8px 10px; border-top: 1px solid var(--sum-line); background: rgba(248, 251, 253, .9); }
.sum-filters-foot button {
    width: 100%; border: 1px dashed rgba(198, 40, 40, .35); color: #c62828;
    background: #fff7f7; border-radius: 9px; padding: 7px; font-size: .74rem; font-weight: 700; cursor: pointer;
}
.sum-filters-foot button:hover { background: #ffecec; }

.sum-sec { border-bottom: 1px solid rgba(120, 150, 178, .16); padding: 4px 0; }
.sum-sec:last-child { border-bottom: 0; }
.sum-sec-head {
    width: 100%; display: flex; align-items: center; gap: 7px;
    padding: 7px 6px; border: 0; background: transparent; cursor: pointer;
    border-radius: 8px; color: var(--sum-ink); font-size: .8rem; font-weight: 800; text-align: left;
}
.sum-sec-head:hover { background: #eef5fa; }
.sum-sec-head > i:first-child { color: var(--sum-accent); font-size: .88rem; }
.sum-sec-count {
    margin-left: auto; padding: 1px 7px; border-radius: 999px;
    background: #edf3f8; color: #5b7690; font-size: .64rem; font-weight: 800;
}
.sum-sec-caret { font-size: .7rem; color: #7b91a4; transition: transform .18s ease; }
.sum-sec.is-collapsed .sum-sec-caret { transform: rotate(-90deg); }
.sum-sec.is-collapsed .sum-sec-body { display: none; }
.sum-sec-body { padding: 2px 0 5px; }
.sum-hint { padding: 8px 12px; font-size: .72rem; color: var(--sum-muted); }

.sum-level { display: flex; gap: 4px; padding: 2px 5px 5px; }
.sum-level-btn {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    padding: 7px 6px; border-radius: 9px; cursor: pointer;
    border: 1px solid rgba(120, 150, 178, .3); background: #f7fafc;
    color: #5b7690; font-size: .72rem; font-weight: 700;
}
.sum-level-btn.is-active { background: #123c5e; color: #fff; border-color: #123c5e; box-shadow: 0 3px 9px rgba(18, 60, 94, .2); }

.sum-node {
    display: flex; align-items: center; gap: 5px;
    padding: 3px 4px 3px calc(4px + var(--d, 0) * 13px);
    border-radius: 7px; min-width: 0;
    transition: background .14s ease;
}
.sum-node:hover { background: #edf5fa; }
.sum-node.is-on .sum-node-label { font-weight: 700; color: #23425d; }
.sum-node.is-partial .sum-node-label { color: #8a6320; }
.sum-node-caret {
    width: 16px; height: 18px; flex: 0 0 16px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; background: transparent; color: #7b91a4; cursor: pointer; font-size: .64rem;
    transition: transform .16s ease;
}
.sum-node-caret.is-open { transform: rotate(90deg); }
.sum-node-caret.is-empty { visibility: hidden; }
.sum-check {
    width: 17px; height: 17px; flex: 0 0 17px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 5px; cursor: pointer; padding: 0;
    border: 1px solid #b6c7d6; background: #fff; color: #fff;
    font-size: .62rem; line-height: 1;
}
.sum-check.is-on { background: var(--sum-accent); border-color: var(--sum-accent); }
.sum-check.is-partial { background: #e8a900; border-color: #c98a00; }
.sum-node-label {
    min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: .73rem; color: #46617a;
}
.sum-node-count {
    flex: 0 0 auto; padding: 0 5px; border-radius: 999px;
    background: #eef3f7; color: #7890a5; font-size: .61rem; font-weight: 700;
}
.sum-col-row { display: flex; align-items: center; gap: 7px; padding: 3px 6px; border-radius: 7px; }
.sum-col-row:hover { background: #edf5fa; }
.sum-col-row span { font-size: .73rem; color: #46617a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- content / toolbar --- */
.sum-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.sum-toolbar {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    padding: 9px 11px; border-radius: 14px;
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--sum-line);
    box-shadow: 0 5px 16px rgba(16, 48, 76, .06);
}
.sum-search {
    display: flex; align-items: center; gap: 7px;
    min-width: 230px; flex: 0 1 320px; padding: 7px 10px;
    border-radius: 10px; background: #f5f9fc;
    border: 1px solid rgba(120, 150, 178, .3); color: var(--sum-muted);
}
.sum-search:focus-within { border-color: var(--sum-accent); box-shadow: 0 0 0 3px rgba(27, 108, 168, .12); background: #fff; }
.sum-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: .8rem; color: var(--sum-ink); }
.sum-search button { border: 0; background: transparent; color: var(--sum-muted); cursor: pointer; padding: 0 2px; }
.sum-chips { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; min-width: 0; }
.sum-chip {
    display: inline-flex; align-items: center; gap: 5px;
    max-width: 210px; padding: 4px 8px; border-radius: 999px;
    border: 1px solid rgba(27, 108, 168, .28); background: #eaf3fa;
    color: #245a83; font-size: .69rem; font-weight: 700; cursor: pointer;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sum-chip:hover { background: #d8ebf8; }
.sum-chip i:last-child { font-size: .68rem; opacity: .7; }
.sum-toolbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.sum-count {
    padding: 5px 10px; border-radius: 999px; font-size: .72rem; font-weight: 800;
    color: #245a83; background: #eaf3fa; white-space: nowrap;
}

/* --- table --- */
.sum-table-wrap {
    position: relative; overflow: auto; max-height: min(62vh, 720px);
    border-radius: 14px; background: #fff;
    border: 1px solid var(--sum-line);
    box-shadow: 0 8px 24px rgba(16, 48, 76, .08);
    scrollbar-width: thin;
}
.sum-table-wrap.is-loading .sum-table { opacity: .35; }
.sum-table {
    width: 100%; min-width: max-content; border-collapse: separate; border-spacing: 0;
    font-size: .76rem;
}
.sum-table thead th {
    position: sticky; top: 0; z-index: 3;
    padding: 0; background: linear-gradient(180deg, #123c5e, #1b527a);
    color: #fff; border-bottom: 1px solid rgba(255, 255, 255, .16);
    white-space: nowrap; text-align: left;
}
.sum-table thead th.sum-col-num { left: 0; z-index: 5; }
.sum-th {
    width: 100%; display: flex; align-items: center; gap: 5px;
    padding: 9px 11px; border: 0; background: transparent; color: inherit;
    font-size: .72rem; font-weight: 750; cursor: pointer; white-space: nowrap;
}
.sum-th:hover { background: rgba(255, 255, 255, .12); }
.sum-th.is-sorted { background: rgba(255, 255, 255, .16); }
.sum-th i { font-size: .7rem; opacity: .7; }
.sum-th-empty { padding: 10px 12px; }
.sum-table tbody td {
    padding: 7px 11px; border-bottom: 1px solid rgba(120, 150, 178, .16);
    color: #2b4359; white-space: nowrap; vertical-align: middle;
    background: #fff;
}
.sum-table tbody tr:nth-child(even) td { background: #f7fafc; }
.sum-table tbody tr:hover td { background: #eaf4fb; }
.sum-table tbody td.sum-cell-num {
    position: sticky; left: 0; z-index: 2;
    font-weight: 800; color: #245a83; background: #f2f7fb;
    text-align: right; min-width: 42px;
}
.sum-table tbody tr:nth-child(even) td.sum-cell-num { background: #eaf1f7; }
.sum-table tbody tr:hover td.sum-cell-num { background: #dcecf7; }
.sum-cell-trunc { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.sum-cell-status { text-align: center; }
.sum-pill {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 3px 9px; border-radius: 999px;
    font-size: .67rem; font-weight: 800; letter-spacing: .01em;
    border: 1px solid transparent; white-space: nowrap;
}
.sum-pill.ok { background: #dcf5e4; color: #146c43; border-color: #a8e0be; }
.sum-pill.bad { background: #ffe3e5; color: #a31621; border-color: #f5b9be; }
.sum-pill.review { background: #dff1fa; color: #0b6285; border-color: #b3dcf0; }
.sum-pill.work { background: #fff1cf; color: #8a5a00; border-color: #f3d68f; }
.sum-pill.pause { background: #ede7fb; color: #5b3a9e; border-color: #d3c4f2; }
.sum-pill.muted { background: #edf2f6; color: #5b7288; border-color: #d3dfe9; }
.sum-loading-cell { padding: 24px !important; text-align: center; color: var(--sum-muted); }

/* --- skeleton / empty --- */
.sum-skeleton { position: absolute; inset: 0; background: #fff; padding: 14px; z-index: 6; }
.sum-skeleton > div {
    height: 22px; margin-bottom: 9px; border-radius: 7px;
    background: linear-gradient(90deg, #eef3f7 25%, #f8fbfd 37%, #eef3f7 63%);
    background-size: 400% 100%; animation: sumShimmer 1.3s linear infinite;
}
.sum-skeleton > div:nth-child(2n) { width: 82%; }
.sum-skeleton > div:nth-child(3n) { width: 64%; }
@keyframes sumShimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.sum-empty {
    position: absolute; inset: 0; z-index: 7;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; padding: 20px; text-align: center; background: rgba(255, 255, 255, .96);
}
.sum-empty[hidden] { display: none; }
.sum-empty > i { font-size: 2.4rem; color: #9ab6cd; }
.sum-empty h3 { margin: 0; font-size: 1rem; font-weight: 800; color: var(--sum-ink); }
.sum-empty p { margin: 0 0 6px; font-size: .78rem; color: var(--sum-muted); }

/* --- pager --- */
.sum-pager {
    display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
    padding: 9px 12px; border-radius: 13px;
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--sum-line);
    box-shadow: 0 5px 14px rgba(16, 48, 76, .06);
}
.sum-page-size { display: flex; align-items: center; gap: 7px; font-size: .73rem; font-weight: 700; color: var(--sum-muted); }
.sum-page-size select {
    border-radius: 8px; border: 1px solid rgba(120, 150, 178, .4);
    padding: 4px 7px; background: #fff; color: var(--sum-ink); font-size: .74rem; font-weight: 700;
}
.sum-page-info { font-size: .73rem; font-weight: 700; color: #46617a; }
.sum-page-btns { display: flex; align-items: center; gap: 3px; margin-left: auto; flex-wrap: wrap; }
.sum-pg {
    min-width: 29px; height: 29px; padding: 0 6px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; border: 1px solid rgba(120, 150, 178, .3);
    background: #fff; color: #4c6880; font-size: .73rem; font-weight: 750; cursor: pointer;
}
.sum-pg:hover:not(:disabled) { background: #eaf3fa; border-color: var(--sum-accent); }
.sum-pg.is-active { background: #123c5e; border-color: #123c5e; color: #fff; }
.sum-pg:disabled { opacity: .4; cursor: not-allowed; }
.sum-pg-dots { padding: 0 2px; color: #90a3b4; }

/* --- column popover --- */
.sum-popover {
    position: fixed; z-index: 2000; width: 272px; max-height: 420px; overflow: auto;
    padding: 7px; border-radius: 13px;
    background: #fff; border: 1px solid rgba(120, 150, 178, .4);
    box-shadow: 0 20px 48px rgba(12, 40, 66, .26);
}
.sum-popover[hidden] { display: none; }
.sum-pop-head { padding: 5px 7px 7px; font-size: .71rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--sum-muted); }
.sum-pop-row {
    display: flex; align-items: center; gap: 8px; padding: 6px 7px;
    border-radius: 8px; font-size: .76rem; color: #34516b; cursor: pointer;
}
.sum-pop-row:hover { background: #edf5fa; }
.sum-pop-row input { accent-color: #1b6ca8; width: 15px; height: 15px; }
.sum-pop-foot { border-top: 1px solid rgba(120, 150, 178, .2); margin-top: 5px; padding: 6px 5px 2px; }
.sum-pop-foot button { border: 0; background: transparent; color: var(--sum-accent); font-size: .73rem; font-weight: 800; cursor: pointer; }
.sum-pop-empty { padding: 14px; font-size: .76rem; color: var(--sum-muted); }

/* --- редактирование реестра в сводных данных --- */
.sum-col-edit, .sum-cell-edit { width: 42px; min-width: 42px; text-align: center; }
.sum-col-edit { color: rgba(255, 255, 255, .82); font-size: .72rem; }
.sum-row-edit {
    width: 27px; height: 27px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; border: 1px solid rgba(27, 108, 168, .32);
    background: #eaf3fa; color: #1b6ca8; cursor: pointer; font-size: .76rem;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}
.sum-row-edit:hover { background: #1b6ca8; color: #fff; transform: translateY(-1px); }
.sum-row-edit:focus-visible { outline: 2px solid #8ec8f0; outline-offset: 2px; }
.sum-row-edit-empty { color: #b5c5d2; }
.sum-cell-editable { position: relative; cursor: pointer; }
.sum-cell-editable:hover { box-shadow: inset 0 0 0 1px rgba(27, 108, 168, .38); }
.sum-cell-pencil { margin-left: 7px; font-size: .68rem; color: #1b6ca8; opacity: .5; }
.sum-cell-editable:hover .sum-cell-pencil { opacity: 1; }
.sum-cell-empty { color: #9ab0c3; font-style: italic; }

.sum-editor {
    position: fixed; inset: 0; z-index: 2100;
    display: flex; align-items: center; justify-content: center;
    padding: 18px; background: rgba(8, 24, 38, .48);
    backdrop-filter: blur(3px);
}
.sum-editor[hidden] { display: none; }
@keyframes sumEditorIn {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: none; }
}
.sum-editor-card {
    width: min(520px, 100%); max-height: calc(100vh - 36px); overflow: auto;
    border-radius: 18px; background: #fff; border: 1px solid rgba(120, 150, 178, .4);
    box-shadow: 0 28px 70px rgba(6, 24, 40, .42);
    animation: sumEditorIn .2s cubic-bezier(.2, .7, .2, 1) both;
}
.sum-editor-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 16px 18px; color: #fff;
    background: linear-gradient(115deg, #0f314c, #1b5b86);
    border-bottom: 1px solid rgba(255, 255, 255, .16);
}
.sum-editor-kicker { font-size: .62rem; letter-spacing: .14em; font-weight: 800; color: rgba(255, 255, 255, .66); }
.sum-editor-head h2 { margin: 2px 0 3px; font-size: 1.08rem; font-weight: 800; line-height: 1.2; }
.sum-editor-sub { font-size: .76rem; color: rgba(255, 255, 255, .8); }
.sum-editor-close {
    width: 30px; height: 30px; flex: 0 0 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px; border: 1px solid rgba(255, 255, 255, .22);
    background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer;
}
.sum-editor-close:hover { background: rgba(255, 255, 255, .2); }
.sum-editor-body { display: grid; gap: 13px; padding: 17px 18px; }
.sum-editor-field { display: grid; gap: 6px; }
.sum-editor-field > span { font-size: .74rem; font-weight: 800; color: #33526c; }
.sum-editor-select, .sum-editor textarea {
    width: 100%; border-radius: 11px; border: 1px solid rgba(120, 150, 178, .45);
    background: #fff; color: #203c54; padding: 9px 11px;
    font: inherit; font-size: .82rem; outline: none;
    transition: border-color .16s ease, box-shadow .16s ease;
}
.sum-editor textarea { resize: vertical; min-height: 104px; line-height: 1.45; }
.sum-editor-select:focus, .sum-editor textarea:focus {
    border-color: #1b6ca8; box-shadow: 0 0 0 3px rgba(27, 108, 168, .16);
}
.sum-editor-hint {
    display: flex; align-items: flex-start; gap: 7px;
    padding: 9px 11px; border-radius: 10px;
    background: #eef6fb; color: #41647e; font-size: .72rem; line-height: 1.4;
}
.sum-editor-foot {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 12px 18px 15px; border-top: 1px solid rgba(120, 150, 178, .18);
}

/* --- dark theme --- */
html[data-theme="dark"] .sum-hero { background: linear-gradient(115deg, #0c2438, #123c5e); border-color: #2c5a80; }
html[data-theme="dark"] .sum-kpi,
html[data-theme="dark"] .sum-filters,
html[data-theme="dark"] .sum-toolbar,
html[data-theme="dark"] .sum-pager,
html[data-theme="dark"] .sum-table-wrap,
html[data-theme="dark"] .sum-empty { background: linear-gradient(145deg, #1d3348, #172a3c) !important; border-color: #34506a; }
html[data-theme="dark"] .sum-page { color: #e6f1fa; }
html[data-theme="dark"] .sum-kpi-value,
html[data-theme="dark"] .sum-sec-head,
html[data-theme="dark"] .sum-node-label.is-on,
html[data-theme="dark"] .sum-page-info,
html[data-theme="dark"] .sum-count { color: #e3eef8 !important; }
html[data-theme="dark"] .sum-kpi-label,
html[data-theme="dark"] .sum-kpi-icon { color: #a8c4dc; }
html[data-theme="dark"] .sum-kpi-icon { background: rgba(255, 255, 255, .06); }
html[data-theme="dark"] .sum-filters-head { background: #20384e; }
html[data-theme="dark"] .sum-filter-search,
html[data-theme="dark"] .sum-search { background: #1a2e42; }
html[data-theme="dark"] .sum-filter-search input,
html[data-theme="dark"] .sum-search input { color: #e3eef8; }
html[data-theme="dark"] .sum-filter-tools button,
html[data-theme="dark"] .sum-level-btn,
html[data-theme="dark"] .sum-node:hover,
html[data-theme="dark"] .sum-col-row:hover,
html[data-theme="dark"] .sum-chip,
html[data-theme="dark"] .sum-pg { background: #243c53; color: #cfe2f3; }
html[data-theme="dark"] .sum-chip { border-color: #3c6284; }
html[data-theme="dark"] .sum-level-btn.is-active,
html[data-theme="dark"] .sum-pg.is-active { background: #2e7dbe; border-color: #2e7dbe; color: #fff; }
html[data-theme="dark"] .sum-sec-count,
html[data-theme="dark"] .sum-node-count { background: #274058; color: #a8c4dc; }
html[data-theme="dark"] .sum-check { background: #16283a; border-color: #5b7893; }
html[data-theme="dark"] .sum-check.is-on { background: #4a9ad4; border-color: #4a9ad4; }
html[data-theme="dark"] .sum-table tbody td { background: #1d3348; color: #dceaf6; border-bottom-color: #34506a; }
html[data-theme="dark"] .sum-table tbody tr:nth-child(even) td { background: #1a2f43; }
html[data-theme="dark"] .sum-table tbody tr:hover td { background: #24435d; }
html[data-theme="dark"] .sum-table tbody td.sum-cell-num { background: #213b52; color: #9fd0f2; }
html[data-theme="dark"] .sum-skeleton { background: #1d3348; }
html[data-theme="dark"] .sum-skeleton > div { background: linear-gradient(90deg, #294159 25%, #33516b 37%, #294159 63%); background-size: 400% 100%; }
html[data-theme="dark"] .sum-popover { background: #1b2f43; border-color: #38546e; }
html[data-theme="dark"] .sum-pop-row { color: #e3eef8; }
html[data-theme="dark"] .sum-pop-row:hover { background: #29445c; }
html[data-theme="dark"] .sum-filters-foot button { background: #2a1f29; border-color: #7b3b45; color: #ff9c9c; }
html[data-theme="dark"] .sum-btn-soft { background: #243c53; color: #9fd0f2; }
html[data-theme="dark"] .sum-cell-editable:hover { box-shadow: inset 0 0 0 1px rgba(143, 200, 242, .45); }
html[data-theme="dark"] .sum-cell-pencil { color: #9fd0f2; }
html[data-theme="dark"] .sum-row-edit { background: #243c53; color: #9fd0f2; border-color: #4a7192; }
html[data-theme="dark"] .sum-row-edit:hover { background: #2e7dbe; color: #fff; }
html[data-theme="dark"] .sum-editor-card { background: #1b2f43; border-color: #38546e; }
html[data-theme="dark"] .sum-editor-field > span { color: #cfe2f3; }
html[data-theme="dark"] .sum-editor-select,
html[data-theme="dark"] .sum-editor textarea { background: #16283a; color: #e3eef8; border-color: #4b6a85; }
html[data-theme="dark"] .sum-editor-hint { background: #20384e; color: #a8c4dc; }
html[data-theme="dark"] .sum-editor-foot { border-top-color: #34506a; }

@media (max-width: 1279.98px) {
    .sum-filters { width: 240px; min-width: 220px; }
    .sum-kpis { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
}
@media (max-width: 991.98px) {
    .sum-layout { flex-direction: column; }
    .sum-filters { position: static; width: 100%; max-width: none; }
    .sum-filter-body { max-height: 280px; }
    .sum-hero-right { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .sum-page > *, .sum-kpi:hover, .sum-btn:hover { animation: none; transform: none; }
    .sum-editor-card { animation: none; }
    .sum-skeleton > div { animation: none; }
}

/* ================================================================
   PREMIUM: материалы v2 — визуальный язык «Сводных данных» без изменений DOM/JS
   ================================================================ */
.mat-page {
    --mat-ink: #0b2239;
    --mat-muted: #637b91;
    --mat-line: rgba(120, 150, 178, .28);
    --mat-blue: #123c5e;
    --mat-accent: #1b6ca8;
    --mat-soft: rgba(46, 125, 190, .1);
    position: relative;
    display: flex; flex-direction: column; gap: 10px;
    min-width: 0; padding: 10px 12px 12px;
    color: var(--mat-ink);
}
@keyframes matIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}
.mat-page > * { animation: matIn .3s cubic-bezier(.2, .7, .2, 1) both; }
.mat-page > *:nth-child(2) { animation-delay: .03s; }

.mat-hero {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: nowrap; gap: 12px; min-height: 54px; padding: 7px 12px;
    border-radius: 14px; color: #fff;
    background: linear-gradient(115deg, #0f314c 0%, #123c5e 42%, #1b5b86 100%);
    border: 1px solid rgba(255, 255, 255, .16);
    box-shadow: 0 10px 24px rgba(18, 60, 94, .2), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.mat-hero-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 0 auto; }
.mat-hero-mark {
    width: 36px; height: 36px; flex: 0 0 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px; font-size: 1.15rem;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
}
.mat-hero-copy { min-width: 0; }
.mat-hero-line { display: flex; align-items: baseline; gap: 8px; }
.mat-hero-kicker { font-size: .58rem; letter-spacing: .12em; font-weight: 800; color: rgba(255, 255, 255, .6); white-space: nowrap; }
.mat-hero-title { margin: 0; font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; white-space: nowrap; }
.mat-hero-meta {
    display: flex; align-items: center; flex-wrap: nowrap; gap: 5px;
    max-width: 320px; font-size: .68rem; color: rgba(255, 255, 255, .78);
}
.mat-hero-meta > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mat-hero-dot { width: 4px; height: 4px; flex: 0 0 4px; border-radius: 50%; background: rgba(255, 255, 255, .55); }
.mat-hero-right {
    display: flex; align-items: center; gap: 7px;
    min-width: 0; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none;
}
.mat-hero-right::-webkit-scrollbar { display: none; }
.mat-mini-stats { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.mat-mini-stat {
    --mat-stat: #8ec8f0;
    display: inline-flex; align-items: center; gap: 5px;
    height: 34px; padding: 4px 9px; border-radius: 10px;
    background: rgba(8, 30, 48, .3); border: 1px solid rgba(255, 255, 255, .18);
    white-space: nowrap;
}
.mat-mini-stat i { font-size: .8rem; color: var(--mat-stat); }
.mat-mini-stat b { font-size: .88rem; font-weight: 800; color: #fff; }
.mat-mini-stat small { font-size: .6rem; font-weight: 700; color: rgba(255, 255, 255, .68); text-transform: uppercase; }
.mat-mini-stat.st-all { --mat-stat: #8ec8f0; }
.mat-mini-stat.st-linked { --mat-stat: #5fd4e8; }
.mat-mini-stat.st-deficit { --mat-stat: #ff9c9c; }
.mat-mini-stat.st-nocons { --mat-stat: #8de0ad; }
.mat-mini-stat.st-cons { --mat-stat: #ffd77a; }
.mat-mini-stat.st-docs { --mat-stat: #c6b0ff; }
.mat-context-chip {
    display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
    max-width: 220px; min-height: 34px; padding: 5px 10px;
    border-radius: 10px; font-size: .7rem; font-weight: 700;
    color: #fff; background: rgba(8, 30, 48, .35);
    border: 1px solid rgba(255, 255, 255, .2);
}
.mat-context-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mat-context-chip.is-act { background: rgba(255, 255, 255, .92); color: #123c5e; border-color: rgba(255, 255, 255, .7); }

.mat-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.mat-page .mat-toolbar.tab-toolbar {
    display: flex; align-items: center; flex-wrap: nowrap; gap: 8px;
    min-height: 50px; padding: 7px 10px; border-radius: 13px;
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--mat-line);
    box-shadow: 0 5px 16px rgba(16, 48, 76, .06);
    overflow-x: auto; scrollbar-width: thin;
}
.mat-page .mat-toolbar.tab-toolbar::-webkit-scrollbar { height: 6px; }
.mat-page .mat-toolbar.tab-toolbar > .btn,
.mat-page .mat-toolbar.tab-toolbar > a.btn { flex: 0 0 auto; white-space: nowrap; }
.mat-page .mat-toolbar .btn {
    min-height: 32px; border-radius: 9px;
    font-size: .76rem; font-weight: 700; white-space: nowrap;
    box-shadow: 0 2px 7px rgba(16, 48, 76, .08);
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.mat-page .mat-toolbar .btn:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(16, 48, 76, .14); }
.mat-page .mat-toolbar .btn-success { background: linear-gradient(135deg, #28a745, #218838); border-color: #1e7e34; color: #fff; }
.mat-page .mat-toolbar .btn-warning { background: linear-gradient(135deg, #f0ad4e, #e6951c); border-color: #d39e00; color: #fff; }
.mat-page .mat-toolbar .btn-info { background: linear-gradient(135deg, #37a9c4, #1788a4); border-color: #147d96; color: #fff; }
.mat-page .mat-toolbar .btn-secondary { background: linear-gradient(135deg, #f4f8fb, #e5edf4); border-color: rgba(120, 150, 178, .38); color: #3c5c76; }
.mat-page .mat-toolbar .btn-outline-secondary,
.mat-page .mat-toolbar .btn-outline-primary { background: #fff; color: #275d87; border-color: rgba(27, 108, 168, .35); }
.mat-page .mat-toolbar .btn-outline-secondary:hover,
.mat-page .mat-toolbar .btn-outline-primary:hover { background: #eaf3fa; }
.mat-page .mat-toolbar .btn-teal { background: linear-gradient(135deg, #0f8ba8, #0c6f88); border-color: #0b6177; color: #fff; }
.mat-page .mat-toolbar .mat-link-btn,
.mat-page .mat-toolbar .mat-add-toggle,
.mat-page .mat-toolbar #matSaveBtnLeft,
.mat-page .mat-toolbar #matColsBtn { min-width: 36px; padding-left: 8px; padding-right: 8px; }
.mat-search {
    display: flex; align-items: center; gap: 7px;
    min-width: 230px; flex: 0 1 300px; padding: 4px 9px;
    border-radius: 10px; background: #f5f9fc;
    border: 1px solid rgba(120, 150, 178, .3); color: var(--mat-muted);
}
.mat-search:focus-within { border-color: var(--mat-accent); box-shadow: 0 0 0 3px rgba(27, 108, 168, .12); background: #fff; }
.mat-search .form-control {
    width: 100%; min-width: 0; max-width: none;
    height: auto; padding: 0; border: 0; border-radius: 0;
    background: transparent; box-shadow: none; font-size: .8rem; color: var(--mat-ink);
}
.mat-count, .mat-act-chip {
    display: inline-flex; align-items: center; min-height: 29px;
    padding: 5px 10px; border-radius: 999px;
    font-size: .72rem; font-weight: 800; white-space: nowrap;
    border: 1px solid transparent;
}
.mat-count { color: #245a83; background: #eaf3fa; border-color: rgba(27, 108, 168, .18); }
.mat-act-chip { color: #146c43; background: #e7f6ee; border-color: #a8e0be; }

.mat-page #matColsPanel.mat-cols-panel {
    display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
    padding: 10px 12px; margin: 0; font-size: .76rem;
    border-radius: 13px; background: rgba(255, 255, 255, .97);
    border: 1px solid var(--mat-line);
    box-shadow: 0 8px 22px rgba(16, 48, 76, .1);
}
.mat-page #matColsPanel .mat-cols-label { display: inline-flex; align-items: center; gap: 6px; color: #245a83; }
.mat-page #matColsPanel .mat-cols-item { color: #3c5c76; }
.mat-page #matColsPanel .mat-cols-close { border-radius: 8px; }

.mat-page .table-responsive.grid-scroll {
    max-height: min(62vh, 720px);
    border-radius: 14px; background: #fff;
    border: 1px solid var(--mat-line);
    box-shadow: 0 8px 24px rgba(16, 48, 76, .08);
    scrollbar-width: thin;
}
.mat-page #materialsTable {
    margin-bottom: 0; border-collapse: separate; border-spacing: 0;
    font-size: .76rem;
}
.mat-page #materialsTable > :not(caption) > * > * { border-color: rgba(120, 150, 178, .22); }
.mat-page #materialsTable thead th {
    position: sticky; top: 0; z-index: 3;
    padding: 9px 9px;
    background: linear-gradient(180deg, #123c5e, #1b527a);
    color: #fff; border-bottom: 1px solid rgba(255, 255, 255, .16);
    font-size: .72rem; font-weight: 750; text-align: left; white-space: nowrap;
}
.mat-page #materialsTable thead th:first-child { border-top-left-radius: 14px; }
.mat-page #materialsTable thead th:last-child { border-top-right-radius: 14px; }
.mat-page #materialsTable tbody td {
    padding: 7px 9px; color: #2b4359;
    white-space: nowrap; vertical-align: middle; background: #fff;
}
.mat-page #materialsTable tbody tr:nth-child(even) td { background: #f7fafc; }
.mat-page #materialsTable tbody tr:hover td { background: #eaf4fb; }
.mat-page #materialsTable tbody tr.mat-date-warn-row td.mat-col-docdate { background: #fff3cd; }
.mat-page #materialsTable .btn-xs { border-radius: 7px; padding: 2px 6px; font-size: .68rem; }
.mat-page #materialsTable mark.mat-hit {
    background: #cfe4ff; color: #0b3d66;
    border-radius: 3px; padding: 0 1px;
    box-shadow: 0 0 0 1px rgba(27, 108, 168, .18);
}
html[data-theme="dark"] .mat-page #materialsTable mark.mat-hit { background: #2b6ca8; color: #fff; }

/* --- узкий экран: все столбцы по ширине окна, перенос текста, авто-высота строк --- */
.mat-page.is-narrow { gap: 8px; padding: 8px 10px 10px; }
.mat-page.is-narrow .mat-hero { flex-wrap: nowrap; gap: 8px; }
.mat-page.is-narrow .mat-hero-right { overflow: hidden; }
.mat-page.is-narrow .mat-mini-stat.st-nocons,
.mat-page.is-narrow .mat-mini-stat.st-cons,
.mat-page.is-narrow .mat-mini-stat.st-docs { display: none; }
.mat-page.is-narrow .mat-context-chip { max-width: 150px; }
.mat-page.is-narrow .mat-toolbar.tab-toolbar { overflow-x: hidden; }
.mat-page.is-narrow .mat-more-btn { flex: 0 0 auto; }
.mat-page.is-narrow .mat-search { flex: 1 1 120px; min-width: 100px; }
.mat-page.is-narrow .mat-act-chip { display: none !important; }
.mat-page .table-responsive.grid-scroll { overflow-x: hidden; }
.mat-more-btn.is-active { background: #123c5e !important; color: #fff !important; border-color: #123c5e !important; }
.mat-more-menu {
    position: fixed; z-index: 2000; min-width: 168px;
    display: flex; flex-direction: column; gap: 4px;
    padding: 8px; border-radius: 12px;
    max-height: calc(100vh - 16px); overflow-y: auto;
    background: #fff; border: 1px solid rgba(120, 150, 178, .4);
    box-shadow: 0 16px 40px rgba(12, 42, 68, .28);
}
.mat-more-menu .btn { width: 100%; text-align: left; white-space: nowrap; font-size: .76rem; }
html[data-theme="dark"] .mat-more-menu { background: #1d3348; border-color: #34506a; }
html[data-theme="dark"] .mat-more-menu .btn-outline-secondary,
html[data-theme="dark"] .mat-more-menu .btn-outline-primary { background: #1b2f43; color: #9fd0f2; border-color: #4a7192; }

/* --- таблица всегда по ширине контента: перенос текста, авто-высота строк, без горизонтального скролла --- */
.mat-page #materialsTable {
    table-layout: fixed; width: 100%; font-size: .7rem;
}
.mat-page #materialsTable thead th,
.mat-page #materialsTable tbody td {
    padding: 4px 3px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: top;
    line-height: 1.18;
}
.mat-page #materialsTable th.mat-col-sel,
.mat-page #materialsTable td.mat-col-sel { width: 3.3% !important; min-width: 22px !important; }
.mat-page #materialsTable th.mat-col-qty,
.mat-page #materialsTable td.mat-col-qty { width: 5.4% !important; }
.mat-page #materialsTable th.mat-col-num,
.mat-page #materialsTable td.mat-col-num { width: 4.1% !important; }
.mat-page #materialsTable th.mat-col-unit,
.mat-page #materialsTable td.mat-col-unit { width: 4.4% !important; }
.mat-page #materialsTable th.mat-col-passport,
.mat-page #materialsTable td.mat-col-passport { width: 5.7% !important; }
.mat-page #materialsTable th.mat-col-consumption,
.mat-page #materialsTable td.mat-col-consumption { width: 5.7% !important; }
.mat-page #materialsTable th.mat-col-balance,
.mat-page #materialsTable td.mat-col-balance { width: 5.7% !important; }
.mat-page #materialsTable th.mat-col-price,
.mat-page #materialsTable td.mat-col-price { width: 4.6% !important; }
.mat-page #materialsTable th.mat-col-sheets,
.mat-page #materialsTable td.mat-col-sheets { width: 4.1% !important; }
.mat-page #materialsTable th.mat-col-actions,
.mat-page #materialsTable td.mat-col-actions { width: 6% !important; min-width: 44px !important; }
.mat-page #materialsTable td.mat-col-actions form.d-inline { display: inline-block !important; margin: 0; }
.mat-page #materialsTable td.mat-col-actions .btn-xs { padding: 1px 3px !important; font-size: .62rem !important; }
.mat-page #materialsTable th.mat-col-docdate,
.mat-page #materialsTable td.mat-col-docdate { width: 6.1% !important; }
.mat-page #materialsTable th.mat-col-docnum,
.mat-page #materialsTable td.mat-col-docnum { width: 6.1% !important; }
.mat-page #materialsTable th.mat-col-category,
.mat-page #materialsTable td.mat-col-category { width: 5.7% !important; }
.mat-page #materialsTable th.mat-col-name,
.mat-page #materialsTable td.mat-col-name { width: 11.9% !important; }
.mat-page #materialsTable th.mat-col-doc,
.mat-page #materialsTable td.mat-col-doc { width: 6.3% !important; }
.mat-page #materialsTable th.mat-col-org,
.mat-page #materialsTable td.mat-col-org { width: 6.3% !important; }
.mat-page #materialsTable th.mat-col-notes,
.mat-page #materialsTable td.mat-col-notes { width: 4.3% !important; }
.mat-page #materialsTable th.mat-col-smeta,
.mat-page #materialsTable td.mat-col-smeta { width: 4.3% !important; }

/* --- dark theme --- */
html[data-theme="dark"] .mat-page { color: #e6f1fa; }
html[data-theme="dark"] .mat-hero { background: linear-gradient(115deg, #0c2438, #123c5e); border-color: #2c5a80; }
html[data-theme="dark"] .mat-page .mat-toolbar.tab-toolbar,
html[data-theme="dark"] .mat-page #matColsPanel.mat-cols-panel,
html[data-theme="dark"] .mat-page .table-responsive.grid-scroll {
    background: linear-gradient(145deg, #1d3348, #172a3c) !important; border-color: #34506a;
}
html[data-theme="dark"] .mat-page #matColsPanel .mat-cols-item { color: #e3eef8 !important; }
html[data-theme="dark"] .mat-hero-meta { color: #a8c4dc; }
html[data-theme="dark"] .mat-mini-stat { background: rgba(6, 18, 30, .45); border-color: #3c6284; }
html[data-theme="dark"] .mat-search { background: #1a2e42; border-color: #34506a; }
html[data-theme="dark"] .mat-search input { color: #e3eef8; }
html[data-theme="dark"] .mat-count,
html[data-theme="dark"] .mat-act-chip { background: #243c53; color: #cfe2f3; border-color: #3c6284; }
html[data-theme="dark"] .mat-page .mat-toolbar .btn-secondary { background: #243c53; color: #cfe2f3; border-color: #3c6284; }
html[data-theme="dark"] .mat-page .mat-toolbar .btn-outline-secondary,
html[data-theme="dark"] .mat-page .mat-toolbar .btn-outline-primary { background: #1b2f43; color: #9fd0f2; border-color: #4a7192; }
html[data-theme="dark"] .mat-page #materialsTable thead th { background: linear-gradient(180deg, #173b57, #1b527a); }
html[data-theme="dark"] .mat-page #materialsTable tbody td { background: #1d3348; color: #dceaf6; border-bottom-color: #34506a; }
html[data-theme="dark"] .mat-page #materialsTable tbody tr:nth-child(even) td { background: #1a2f43; }
html[data-theme="dark"] .mat-page #materialsTable tbody tr:hover td { background: #24435d; }
html[data-theme="dark"] .mat-page #materialsTable tbody tr.mat-date-warn-row td.mat-col-docdate { background: #4a3b16; }

@media (max-width: 1279.98px) {
    .mat-hero-kicker { display: none; }
    .mat-hero-meta { max-width: 240px; }
}
@media (max-width: 991.98px) {
    .mat-hero { gap: 8px; padding: 7px 10px; }
    .mat-hero-meta { max-width: 180px; }
}
@media (max-width: 575.98px) {
    .mat-page { padding: 8px; }
    .mat-hero-title { font-size: .98rem; }
    .mat-hero-meta { display: none; }
    .mat-context-chip { max-width: 160px; }
    .mat-search { width: 220px; flex: 0 0 220px; }
}
@media (prefers-reduced-motion: reduce) {
    .mat-page > *, .mat-page .mat-toolbar .btn:hover { animation: none; transform: none; }
}

@media print {
    .mat-page { padding: 0; }
    .mat-page .mat-hero,
    .mat-page #matColsPanel { display: none !important; }
    .mat-page .table-responsive.grid-scroll {
        max-height: none; overflow: visible !important;
        border: 0; border-radius: 0; box-shadow: none;
    }
    .mat-page #materialsTable { border-collapse: collapse; }
    .mat-page #materialsTable thead th {
        position: static; background: #fff !important; color: #000 !important; border-color: #999;
    }
    .mat-page #materialsTable tbody td { background: #fff; color: #000; border-color: #999; }
    .mat-page #materialsTable { table-layout: auto; width: 100%; font-size: .76rem; }
    .mat-page #materialsTable th[class*="mat-col-"],
    .mat-page #materialsTable td[class*="mat-col-"] { width: auto !important; min-width: 0 !important; }
    .mat-page #materialsTable thead th,
    .mat-page #materialsTable tbody td {
        padding: 7px 9px; white-space: nowrap; overflow: visible;
        overflow-wrap: normal; word-break: normal; vertical-align: middle;
    }
    .mat-more-btn, .mat-more-menu { display: none !important; }
    .mat-page #materialsTable mark.mat-hit { background: transparent; color: inherit; box-shadow: none; }
}

/* ================================================================
   PREMIUM SHELL v2 — единый визуальный язык для всех вкладок
   ================================================================ */
:root {
    --p-ink: #0b2239;
    --p-muted: #647d94;
    --p-line: rgba(120, 150, 178, .28);
    --p-blue: #1b6ca8;
    --p-blue-2: #2e8fd0;
    --p-surface: rgba(255, 255, 255, .92);
    --p-surface-2: rgba(238, 245, 251, .86);
    --p-glow: rgba(46, 143, 208, .16);
    --p-shadow: 0 10px 28px rgba(18, 60, 94, .08);
}
html[data-theme="dark"] {
    --p-ink: #e7eff7;
    --p-muted: #9fb3c6;
    --p-line: rgba(130, 160, 190, .22);
    --p-blue: #5aa9f5;
    --p-blue-2: #7fc2ff;
    --p-surface: rgba(27, 42, 60, .94);
    --p-surface-2: rgba(22, 35, 50, .9);
    --p-glow: rgba(90, 169, 245, .2);
    --p-shadow: 0 12px 30px rgba(0, 0, 0, .28);
}

/* --- верхняя панель --- */
.top-panel {
    height: 48px;
    padding: 0 16px;
    color: #eaf3fb;
    background: linear-gradient(105deg, #0a2136 0%, #123c5e 50%, #0f3453 100%);
    border-bottom: 1px solid rgba(255, 255, 255, .14);
    box-shadow: 0 5px 20px rgba(6, 26, 44, .28), inset 0 1px 0 rgba(255, 255, 255, .12);
    position: relative;
    z-index: 20;
}
.top-panel::after {
    content: "";
    position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
    background: linear-gradient(90deg, #2e8fd0, rgba(46, 143, 208, 0) 60%, #7fd2ff);
    opacity: .85;
    pointer-events: none;
}
.top-panel h5 {
    font-size: 1.04rem;
    font-weight: 750;
    letter-spacing: .01em;
    display: inline-flex;
    align-items: center;
    gap: 9px;
}
.aid-brand-mark {
    font-size: 1.25rem;
    color: #7fd2ff;
    filter: drop-shadow(0 0 8px rgba(127, 210, 255, .5));
}
.top-panel .text-muted { color: rgba(234, 243, 251, .75) !important; }
.top-panel .badge { font-weight: 650; letter-spacing: .02em; }
.top-panel .badge.text-bg-light {
    background: rgba(255, 255, 255, .16) !important;
    color: #f0f7fd !important;
    border: 1px solid rgba(255, 255, 255, .26) !important;
}
.top-panel .badge.text-bg-dark {
    background: rgba(3, 18, 32, .4) !important;
    color: #d6ecff !important;
    border: 1px solid rgba(140, 200, 240, .36) !important;
}
.top-panel .badge.text-bg-info {
    background: rgba(86, 190, 224, .2) !important;
    color: #c8efff !important;
    border: 1px solid rgba(134, 211, 235, .42) !important;
}
.top-panel .btn {
    border-radius: 9px;
    font-weight: 600;
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}
.top-panel .btn:hover { transform: translateY(-1px); }
.top-panel .btn-outline-secondary,
.top-panel .btn-outline-primary {
    color: #dcecfa;
    border-color: rgba(180, 214, 240, .46);
    background: rgba(255, 255, 255, .06);
}
.top-panel .btn-outline-secondary:hover,
.top-panel .btn-outline-primary:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, .72);
    background: rgba(255, 255, 255, .16);
}
.top-panel .btn-outline-warning {
    color: #ffdf9f;
    border-color: rgba(255, 206, 116, .5);
    background: rgba(255, 193, 7, .1);
}
.top-panel .btn-outline-warning:hover { color: #fff; background: rgba(255, 193, 7, .24); }
.top-panel .btn-link { color: #cfe6fa; }
.top-panel .profile-avatar {
    border-color: rgba(255, 255, 255, .4);
    box-shadow: 0 3px 10px rgba(0, 0, 0, .28);
}

/* --- основные вкладки --- */
.main-tabs {
    gap: 4px;
    padding: 6px 8px 0;
    margin: 0 0 10px;
    background: linear-gradient(145deg, var(--p-surface), var(--p-surface-2));
    border: 1px solid var(--p-line);
    border-radius: 14px;
    box-shadow: var(--p-shadow), inset 0 1px 0 rgba(255, 255, 255, .8);
}
.main-tabs .nav-item { display: flex; }
.main-tabs .nav-item .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 0 !important;
    border-radius: 10px !important;
    padding: 8px 14px;
    margin-bottom: 6px;
    font-weight: 650;
    font-size: 12.5px;
    color: var(--p-muted) !important;
    background: transparent;
    transition: background .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.main-tabs .nav-item .nav-link i { font-size: 15px; opacity: .78; }
.main-tabs .nav-item .nav-link:hover {
    background: var(--p-glow);
    color: var(--p-blue) !important;
    transform: translateY(-1px);
}
.main-tabs .nav-item .nav-link.active {
    background: linear-gradient(135deg, #1b6ca8, #2e8fd0) !important;
    color: #fff !important;
    box-shadow: 0 6px 16px rgba(27, 108, 168, .28), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.main-tabs .nav-item .nav-link.active i { opacity: 1; }
html[data-theme="dark"] .main-tabs .nav-item .nav-link.active {
    background: linear-gradient(135deg, #2b7fc4, #4aa3e8) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .18);
}

/* --- подвкладки --- */
.sub-tabs {
    gap: 5px;
    padding: 6px 8px 0;
    margin: 0 0 10px;
    background: linear-gradient(145deg, var(--p-surface), var(--p-surface-2));
    border: 1px solid var(--p-line);
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(18, 60, 94, .05);
}
.sub-tab {
    border: 1px solid transparent !important;
    border-radius: 9px !important;
    padding: 6px 12px;
    margin-bottom: 6px;
    top: 0 !important;
    background: transparent;
    color: var(--p-muted) !important;
    font-weight: 600;
    transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}
.sub-tab:hover {
    background: var(--p-glow);
    color: var(--p-blue) !important;
    transform: translateY(-1px);
}
.sub-tab.active {
    background: linear-gradient(135deg, rgba(27, 108, 168, .12), rgba(46, 143, 208, .2)) !important;
    color: var(--p-blue) !important;
    border-color: rgba(27, 108, 168, .28) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6);
}
html[data-theme="dark"] .sub-tab.active {
    background: linear-gradient(135deg, rgba(90, 169, 245, .16), rgba(90, 169, 245, .26)) !important;
    color: #9ecbff !important;
    border-color: rgba(90, 169, 245, .36) !important;
}

/* --- заголовок раздела (для вкладок без собственного hero) --- */
.aid-page-ribbon {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    padding: 10px 14px;
    margin: 0 0 10px;
    border-radius: 14px;
    border: 1px solid var(--p-line);
    background:
        radial-gradient(520px 120px at 6% -40%, var(--p-glow), transparent 70%),
        linear-gradient(145deg, var(--p-surface), var(--p-surface-2));
    box-shadow: var(--p-shadow), inset 0 1px 0 rgba(255, 255, 255, .7);
    overflow: hidden;
    flex-shrink: 0;
    animation: aidRibbonIn .28s ease both;
}
@keyframes aidRibbonIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: none; }
}
.aid-page-ribbon-icon {
    width: 38px; height: 38px;
    flex: 0 0 38px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 11px;
    background: linear-gradient(145deg, rgba(255, 255, 255, .95), var(--p-surface-2));
    color: var(--p-blue);
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(18, 60, 94, .1), inset 0 0 0 1px rgba(255, 255, 255, .7);
}
.aid-page-ribbon-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.aid-page-ribbon-title {
    font-size: 1.02rem; font-weight: 750; color: var(--p-ink); letter-spacing: -.01em;
}
.aid-page-ribbon-sub { font-size: .76rem; color: var(--p-muted); }
.aid-page-ribbon-accent {
    position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: linear-gradient(180deg, var(--p-blue-2), var(--p-blue));
}
html[data-theme="dark"] .aid-page-ribbon-icon {
    background: linear-gradient(145deg, #263b52, #1e2f42);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .3), inset 0 0 0 1px rgba(255, 255, 255, .08);
}

/* --- левая панель --- */
.left-panel:not(.is-collapsed) {
    background: linear-gradient(180deg, #f7fbff, #eef4fa);
    border-right-color: var(--p-line);
}
.panel-header {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .09em;
    font-weight: 800;
    color: var(--p-blue);
    background: linear-gradient(90deg, var(--p-glow), transparent);
}
.list-item {
    border-radius: 9px;
    margin: 2px 6px;
    padding: 6px 10px;
    border: 1px solid transparent;
    transition: background .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.list-item:hover { background: var(--p-glow); transform: translateX(2px); }
.list-item.active {
    background: linear-gradient(135deg, #1b6ca8, #2e8fd0) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(27, 108, 168, .26);
    border-color: rgba(255, 255, 255, .2);
}
.panel-rail-btn {
    border-radius: 13px;
    transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.panel-rail-btn:hover { background: rgba(255, 255, 255, .14); transform: translateX(2px); }
.panel-rail-btn.is-active,
.panel-rail-btn.active {
    background: linear-gradient(135deg, #2e8fd0, #1b6ca8);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .2);
}
html[data-theme="dark"] .left-panel:not(.is-collapsed) {
    background: linear-gradient(180deg, #1b2a3c, #162333);
    border-right-color: #34445a;
}
html[data-theme="dark"] .panel-header {
    color: #7db8ee;
    background: linear-gradient(90deg, rgba(90, 169, 245, .14), transparent);
}

/* --- панель действий и таблицы (все вкладки, кроме матрицы материалов) --- */
.tab-toolbar:not(.mat-toolbar) {
    padding: 9px 11px;
    margin: 0 0 10px;
    border: 1px solid var(--p-line);
    border-radius: 12px;
    background: linear-gradient(145deg, var(--p-surface), var(--p-surface-2));
    box-shadow: 0 4px 14px rgba(18, 60, 94, .05), inset 0 1px 0 rgba(255, 255, 255, .75);
}
.tab-toolbar:not(.mat-toolbar) .btn { border-radius: 8px; font-weight: 600; }
.tab-content-area > .table-responsive:not(.grid-scroll) {
    border: 1px solid var(--p-line);
    border-radius: 12px;
    background: var(--p-surface);
    box-shadow: 0 6px 20px rgba(18, 60, 94, .06);
    overflow: auto;
}
.tab-content-area > .table-responsive:not(.grid-scroll) > .table { margin: 0; background: transparent; }
.tab-content-area > .table-responsive:not(.grid-scroll) > .table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(180deg, #f4f9fe, #e8f1f8);
    color: #123c5e;
    font-weight: 750;
    font-size: 11px;
    letter-spacing: .02em;
    text-transform: uppercase;
    border-bottom: 2px solid rgba(27, 108, 168, .22);
    white-space: nowrap;
}
.tab-content-area > .table-responsive:not(.grid-scroll) > .table tbody tr { transition: background .15s ease; }
.tab-content-area > .table-responsive:not(.grid-scroll) > .table tbody tr:hover > * {
    background: rgba(46, 143, 208, .09);
}
html[data-theme="dark"] .tab-content-area > .table-responsive:not(.grid-scroll) > .table thead th {
    background: linear-gradient(180deg, #22344a, #1b2a3c);
    color: #cfe4f7;
    border-bottom-color: rgba(120, 170, 220, .3);
}
html[data-theme="dark"] .tab-content-area > .table-responsive:not(.grid-scroll) > .table tbody tr:hover > * {
    background: rgba(90, 169, 245, .12);
}

/* --- блоки исполнительной документации --- */
.review-docs-box {
    padding: 12px;
    margin-top: 14px;
    border: 1px solid var(--p-line);
    border-radius: 14px;
    background: linear-gradient(145deg, var(--p-surface), var(--p-surface-2));
    box-shadow: 0 6px 18px rgba(18, 60, 94, .06);
}
.grid-sections {
    padding: 10px 12px;
    margin-bottom: 10px;
    border: 1px solid var(--p-line);
    border-radius: 12px;
    background: linear-gradient(145deg, var(--p-surface), var(--p-surface-2));
}
#osrGrid {
    border: 1px solid var(--p-line);
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(18, 60, 94, .06);
    overflow: hidden;
}

/* --- данные объекта --- */
.objdata-groups {
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--p-line);
    border-radius: 14px;
    background: linear-gradient(145deg, var(--p-surface), var(--p-surface-2));
    box-shadow: 0 6px 18px rgba(18, 60, 94, .06);
}
.objdata-group {
    gap: 4px;
    padding: 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .55);
    border: 1px solid rgba(120, 150, 178, .16);
}
.objdata-group-label {
    padding: 2px 8px 5px;
    color: var(--p-blue);
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.objdata-tab {
    border-radius: 8px;
    border-color: rgba(120, 150, 178, .28);
    background: linear-gradient(145deg, rgba(255, 255, 255, .95), var(--p-surface-2));
    font-weight: 600;
    transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.objdata-tab:hover { transform: translateY(-1px); box-shadow: 0 5px 12px rgba(18, 60, 94, .1); }
.objdata-tab.active {
    background: linear-gradient(135deg, #1b6ca8, #2e8fd0) !important;
    border-color: rgba(255, 255, 255, .22) !important;
    box-shadow: 0 5px 14px rgba(27, 108, 168, .26);
    color: #fff !important;
}
html[data-theme="dark"] .objdata-group { background: rgba(255, 255, 255, .03); border-color: rgba(130, 160, 190, .16); }

/* --- пустое состояние --- */
.empty-state {
    border: 1px solid var(--p-line);
    border-radius: 14px;
    background:
        radial-gradient(400px 120px at 50% -30%, var(--p-glow), transparent 70%),
        linear-gradient(145deg, var(--p-surface), var(--p-surface-2));
    box-shadow: var(--p-shadow);
}
.empty-state-title { color: var(--p-ink); font-weight: 750; }

/* --- адаптив и доступность --- */
@media (max-width: 575.98px) {
    .main-tabs .nav-item .nav-link { padding: 6px 8px; font-size: 12px; }
    .sub-tab { padding: 5px 8px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .main-tabs .nav-item .nav-link,
    .sub-tab,
    .list-item,
    .panel-rail-btn,
    .objdata-tab,
    .aid-page-ribbon,
    .tab-toolbar:not(.mat-toolbar) .btn {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}
@media print {
    .aid-page-ribbon { display: none !important; }
    .top-panel::after { display: none !important; }
    .tab-content-area > .table-responsive:not(.grid-scroll) {
        border: 0; box-shadow: none; background: #fff; overflow: visible;
    }
    .tab-content-area > .table-responsive:not(.grid-scroll) > .table thead th {
        position: static; background: #fff !important; color: #000 !important;
        border-bottom: 1px solid #999;
    }
}

/* ================================================================
   PREMIUM MENU — «Данные объекта»
   ================================================================ */
.od-menu {
    position: relative;
    margin: 0 0 12px;
    padding: 12px;
    border: 1px solid var(--p-line);
    border-radius: 16px;
    background:
        radial-gradient(700px 180px at 4% -30%, var(--p-glow), transparent 68%),
        linear-gradient(145deg, var(--p-surface), var(--p-surface-2));
    box-shadow: var(--p-shadow), inset 0 1px 0 rgba(255, 255, 255, .8);
}
.od-menu-head {
    display: flex;
    align-items: center;
    gap: 11px;
    flex-wrap: wrap;
    padding: 2px 2px 12px;
}
.od-menu-head-icon {
    width: 36px; height: 36px;
    flex: 0 0 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 11px;
    background: linear-gradient(135deg, #1b6ca8, #2e8fd0);
    color: #fff;
    font-size: 1.15rem;
    box-shadow: 0 5px 14px rgba(27, 108, 168, .3), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.od-menu-head-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; margin-right: auto; }
.od-menu-head-title { font-weight: 750; font-size: .95rem; color: var(--p-ink); }
.od-menu-head-sub { font-size: .74rem; color: var(--p-muted); }
.od-menu-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 190px;
    flex: 0 1 260px;
    padding: 5px 9px;
    border-radius: 10px;
    border: 1px solid var(--p-line);
    background: rgba(255, 255, 255, .78);
    box-shadow: inset 0 1px 2px rgba(18, 60, 94, .05);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.od-menu-search > i { color: var(--p-muted); font-size: .9rem; }
.od-menu-search input {
    border: 0; outline: 0; background: transparent;
    min-width: 0; flex: 1 1 auto;
    font-size: .82rem; color: var(--p-ink);
}
.od-menu-search input::placeholder { color: var(--p-muted); opacity: .8; }
.od-menu-search:focus-within {
    border-color: var(--p-blue);
    box-shadow: 0 0 0 3px var(--p-glow);
}
.od-search-clear {
    border: 0; background: transparent; color: var(--p-muted);
    padding: 0 2px; cursor: pointer;
}
.od-search-clear:hover { color: var(--p-blue); }
.od-search-clear[hidden] { display: none; }

.od-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 9px;
    align-items: start;
}
.od-menu-group {
    position: relative;
    border-radius: 12px;
    border: 1px solid var(--p-line);
    background: rgba(255, 255, 255, .62);
    box-shadow: 0 3px 12px rgba(18, 60, 94, .05);
    overflow: hidden;
    animation: odGroupIn .3s ease both;
}
.od-menu-group:nth-child(2n) { animation-delay: .03s; }
.od-menu-group:nth-child(3n) { animation-delay: .06s; }
@keyframes odGroupIn {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: none; }
}
.od-menu-group::before {
    content: "";
    position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: linear-gradient(180deg, var(--od-accent), transparent 85%);
    z-index: 1;
    pointer-events: none;
}
.od-group-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.od-group-head::before {
    content: "";
    position: absolute; inset: 0;
    background: var(--od-accent);
    opacity: .08;
    pointer-events: none;
}
.od-group-icon {
    position: relative;
    width: 24px; height: 24px;
    flex: 0 0 24px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    background: var(--od-accent);
    color: #fff;
    font-size: .8rem;
    box-shadow: 0 3px 8px rgba(18, 60, 94, .18);
}
.od-group-title {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 750;
    font-size: .82rem;
    color: var(--p-ink);
    overflow-wrap: anywhere;
}
.od-group-count {
    position: relative;
    flex: 0 0 auto;
    min-width: 19px;
    padding: 1px 5px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .8);
    color: var(--od-accent);
    font-size: .7rem;
    font-weight: 800;
    text-align: center;
}
.od-group-chevron {
    position: relative;
    font-size: .72rem;
    color: var(--p-muted);
    transition: transform .2s ease;
}
.od-menu-group.is-collapsed .od-group-body { display: none; }
.od-menu-group.is-collapsed .od-group-chevron { transform: rotate(-90deg); }
.od-menu-group.is-searching .od-group-chevron { opacity: .4; }
.od-group-body { display: flex; flex-direction: column; gap: 3px; padding: 0 7px 8px; }
.od-menu-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border-radius: 9px;
    color: var(--p-ink);
    text-decoration: none;
    font-size: .8rem;
    font-weight: 550;
    transition: background .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.od-item-icon {
    width: 18px; flex: 0 0 18px;
    text-align: center;
    font-size: .9rem;
    color: var(--od-accent);
    opacity: .88;
}
.od-item-label { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.od-item-arrow {
    font-size: .7rem;
    color: var(--p-muted);
    opacity: 0;
    transform: translateX(-3px);
    transition: opacity .18s ease, transform .18s ease, color .18s ease;
}
.od-menu-item:hover {
    background: rgba(255, 255, 255, .92);
    transform: translateX(2px);
    box-shadow: 0 3px 10px rgba(18, 60, 94, .08);
}
.od-menu-item:hover .od-item-arrow { opacity: 1; transform: none; color: var(--od-accent); }
.od-menu-item.active {
    background: linear-gradient(135deg, var(--od-accent), var(--p-blue));
    color: #fff;
    box-shadow: 0 5px 14px rgba(18, 60, 94, .2), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.od-menu-item.active .od-item-icon,
.od-menu-item.active .od-item-arrow { color: #fff; opacity: 1; }
.od-menu-item.is-hit:not(.active) { background: rgba(46, 143, 208, .12); }
.od-menu-item mark.od-hit {
    background: #cfe4ff;
    color: #0b3d66;
    border-radius: 3px;
    padding: 0 1px;
    box-shadow: 0 0 0 1px rgba(27, 108, 168, .18);
}
.od-menu-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 22px;
    color: var(--p-muted);
    font-size: .85rem;
}
.od-menu-empty[hidden] { display: none; }
.od-menu-empty i { font-size: 1.6rem; color: var(--p-blue); }

html[data-theme="dark"] .od-menu-group {
    background: rgba(255, 255, 255, .03);
    border-color: rgba(130, 160, 190, .18);
}
html[data-theme="dark"] .od-group-head::before { opacity: .16; }
html[data-theme="dark"] .od-group-count { background: rgba(10, 20, 32, .5); }
html[data-theme="dark"] .od-menu-search { background: rgba(10, 20, 32, .5); }
html[data-theme="dark"] .od-menu-item:hover { background: rgba(90, 169, 245, .12); }
html[data-theme="dark"] .od-menu-item mark.od-hit { background: #2b6ca8; color: #fff; }

@media (max-width: 767.98px) {
    .od-menu-search { flex: 1 1 100%; }
    .od-menu-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
    .od-menu-group, .od-menu-item, .od-group-chevron, .od-menu-search { animation: none !important; transition: none !important; transform: none !important; }
}
@media print {
    .od-menu { display: none !important; }
}

/* ================================================================
   PREMIUM DASHBOARD v3 — hero, поиск, быстрые действия, донат, таймлайн
   ================================================================ */
.dashboard-page .dash-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    min-height: 126px;
    padding: 18px 22px;
    margin-bottom: 12px;
    border-radius: 18px;
    overflow: hidden;
    color: #eaf4fc;
    background:
        radial-gradient(600px 220px at 88% -30%, rgba(90, 169, 245, .35), transparent 70%),
        linear-gradient(115deg, #0a2136 0%, #123c5e 52%, #15527e 100%);
    border: 1px solid rgba(255, 255, 255, .14);
    box-shadow: 0 14px 34px rgba(9, 32, 52, .22), inset 0 1px 0 rgba(255, 255, 255, .14);
    animation: aidHeroIn .35s ease both;
}
@keyframes aidHeroIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
}
.dash-hero-orb { position: absolute; border-radius: 50%; pointer-events: none; }
.dash-hero-orb-a {
    width: 240px; height: 240px; right: -60px; top: -130px;
    background: radial-gradient(circle, rgba(127, 210, 255, .28), transparent 68%);
}
.dash-hero-orb-b {
    width: 180px; height: 180px; right: 130px; bottom: -130px;
    background: radial-gradient(circle, rgba(90, 169, 245, .2), transparent 68%);
}
.dash-hero-main, .dash-hero-side { position: relative; z-index: 1; }
.dash-hero-eyebrow {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 999px;
    font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
    color: #bfe4ff; background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .18);
}
.dash-hero-title {
    margin: 8px 0 3px; font-size: 1.55rem; font-weight: 800;
    letter-spacing: -.025em; line-height: 1.15; color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, .2);
}
.dash-hero-sub {
    margin: 0; font-size: .8rem; color: rgba(234, 244, 252, .78);
    max-width: 640px; overflow-wrap: anywhere;
}
.dash-hero-side { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; margin-left: auto; }
.dash-hero-clock { font-size: .78rem; font-weight: 700; color: #dcefff; white-space: nowrap; }
.dash-hero-count {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 12px; border-radius: 999px;
    font-size: .74rem; font-weight: 700; color: #fff;
    background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2);
}
.dashboard-page .dash-toolbar { position: relative; z-index: 2; }

.dashboard-page .dash-section-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
}
.dashboard-page .dash-section-head .dash-section-title { margin: 16px 2px 8px; }
.dashboard-page .dash-section-tag {
    display: inline-flex; align-items: center; gap: 6px;
    margin: 16px 2px 8px; padding: 4px 10px; border-radius: 999px;
    font-size: .68rem; font-weight: 700; color: var(--db-muted);
    background: rgba(255, 255, 255, .7); border: 1px solid var(--db-line);
}
.dashboard-page .dash-search {
    position: relative; display: flex; align-items: center; gap: 7px;
    min-width: 200px; flex: 0 1 260px;
    padding: 6px 10px; margin: 12px 2px 8px;
    border-radius: 11px; border: 1px solid var(--db-line);
    background: rgba(255, 255, 255, .82);
    box-shadow: inset 0 1px 2px rgba(18, 60, 94, .05);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.dashboard-page .dash-search > i { color: var(--db-muted); font-size: .9rem; }
.dashboard-page .dash-search input {
    flex: 1 1 auto; min-width: 0; border: 0; outline: 0;
    background: transparent; font-size: .8rem; color: var(--db-ink);
}
.dashboard-page .dash-search input::placeholder { color: var(--db-muted); }
.dashboard-page .dash-search:focus-within {
    border-color: #1b6ca8; box-shadow: 0 0 0 3px rgba(27, 108, 168, .16);
}
.dashboard-page .dash-search-clear {
    border: 0; background: transparent; color: var(--db-muted); cursor: pointer; padding: 0 2px;
}
.dashboard-page .dash-search-clear:hover { color: #1b6ca8; }
.dashboard-page .dash-search-clear[hidden] { display: none; }
.dash-search-empty {
    display: flex; align-items: center; gap: 8px;
    padding: 18px; margin: 8px 2px; border-radius: 12px;
    color: var(--db-muted); font-size: .82rem;
    background: rgba(255, 255, 255, .6); border: 1px dashed var(--db-line);
}
.dash-search-empty[hidden] { display: none; }
.dash-search-empty i { font-size: 1.1rem; color: #1b6ca8; }
.dashboard-page mark.dash-hit {
    background: #cfe4ff; color: #0b3d66; border-radius: 3px; padding: 0 1px;
    box-shadow: 0 0 0 1px rgba(27, 108, 168, .18);
}

.dashboard-page .dash-quick {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px; margin: 0 2px 14px;
}
.dash-quick-btn {
    --qa-accent: #1b6ca8;
    position: relative; display: flex; align-items: center; gap: 10px;
    padding: 11px 12px; border-radius: 13px;
    text-decoration: none; color: var(--db-ink);
    font-size: .8rem; font-weight: 700;
    background: linear-gradient(145deg, rgba(255, 255, 255, .96), rgba(238, 245, 251, .9));
    border: 1px solid var(--db-line); border-left: 3px solid var(--qa-accent);
    box-shadow: 0 5px 14px rgba(16, 48, 76, .06);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.dash-quick-id { --qa-accent: #1b6ca8; }
.dash-quick-mat { --qa-accent: #0f9aa8; }
.dash-quick-obj { --qa-accent: #7b5cd6; }
.dash-quick-sum { --qa-accent: #e08a1e; }
.dash-quick-icon {
    width: 30px; height: 30px; flex: 0 0 30px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 9px; color: var(--qa-accent);
    background: rgba(255, 255, 255, .85); box-shadow: inset 0 0 0 1px var(--db-line);
}
.dash-quick-arrow {
    margin-left: auto; color: var(--db-muted); opacity: .5;
    transition: transform .18s ease, opacity .18s ease;
}
.dash-quick-btn:hover {
    transform: translateY(-3px); box-shadow: 0 12px 24px rgba(16, 48, 76, .12);
    border-color: var(--qa-accent); text-decoration: none; color: inherit;
}
.dash-quick-btn:hover .dash-quick-arrow { opacity: 1; transform: translate(2px, -2px); }

.dashboard-page .dash-count-icon {
    position: absolute; right: 12px; top: 11px; z-index: 2;
    width: 28px; height: 28px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem; color: var(--dash-accent);
    background: rgba(255, 255, 255, .82);
    box-shadow: inset 0 0 0 1px var(--db-line), 0 3px 8px rgba(16, 48, 76, .08);
}
.dashboard-page .dash-count::after { top: auto; bottom: -48px; right: -34px; }

.dash-donut-block {
    display: flex; align-items: center; gap: 14px;
    padding: 4px 0 12px; margin-bottom: 10px;
    border-bottom: 1px solid rgba(120, 150, 178, .18);
}
.dash-donut {
    position: relative; width: 92px; height: 92px; flex: 0 0 92px;
    border-radius: 50%; background: #e9eff5;
    box-shadow: 0 4px 12px rgba(16, 48, 76, .12), inset 0 0 0 1px rgba(255, 255, 255, .5);
}
.dash-donut-hole {
    position: absolute; inset: 13px; border-radius: 50%; background: #fff;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    box-shadow: inset 0 1px 4px rgba(16, 48, 76, .12);
}
.dash-donut-hole strong { font-size: 1.05rem; font-weight: 800; line-height: 1; color: var(--db-ink); }
.dash-donut-hole span { font-size: .6rem; color: var(--db-muted); margin-top: 2px; }
.dash-donut-note { display: flex; align-items: center; gap: 8px; font-size: .72rem; line-height: 1.35; color: var(--db-muted); }
.dash-donut-note i { font-size: 1.15rem; color: var(--panel-accent, #1b6ca8); }

.dashboard-page .dash-events-wrap { padding: 4px 4px 4px 0; }
.dashboard-page .dash-event {
    position: relative; padding: 8px 6px 8px 26px;
    border-bottom: 1px solid rgba(120, 150, 178, .14);
}
.dashboard-page .dash-event:last-child { border-bottom: 0; }
.dashboard-page .dash-event::before {
    content: ""; position: absolute; left: 6px; top: 15px;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--panel-accent, #e08a1e);
    box-shadow: 0 0 0 4px rgba(224, 138, 30, .14);
}
.dashboard-page .dash-event::after {
    content: ""; position: absolute; left: 10px; top: 26px; bottom: -6px; width: 2px;
    background: linear-gradient(rgba(120, 150, 178, .3), transparent);
}
.dashboard-page .dash-event:last-child::after { display: none; }
.dashboard-page .dash-event-detail { font-size: .72rem; }
.dashboard-page .dash-event-user { font-weight: 600; color: var(--db-muted); }

.dash-member-stack { display: flex; align-items: center; padding: 2px 0 10px; }
.dash-member-avatar, .dash-member-more {
    width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin-right: -7px; border: 2px solid #fff; object-fit: cover;
    font-size: .7rem; font-weight: 800; color: #1b6ca8; background: #e8f1fa;
    box-shadow: 0 2px 7px rgba(16, 48, 76, .12);
}
.dash-member-avatar-empty { background: linear-gradient(135deg, #dcebf8, #c5dcef); }
.dash-member-more { background: #123c5e; color: #fff; z-index: 1; }

html[data-theme="dark"] .dashboard-page .dash-hero {
    background:
        radial-gradient(600px 220px at 88% -30%, rgba(90, 169, 245, .24), transparent 70%),
        linear-gradient(115deg, #081a2b, #102c44 55%, #153e60);
    border-color: #2c5a80;
}
html[data-theme="dark"] .dashboard-page .dash-search { background: rgba(10, 20, 32, .5); }
html[data-theme="dark"] .dashboard-page .dash-search input { color: #e4ebf2; }
html[data-theme="dark"] .dash-quick-btn { background: linear-gradient(145deg, #1d3348, #172a3c); border-color: #34506a; color: #dceaf6; }
html[data-theme="dark"] .dash-quick-icon { background: #203a52; box-shadow: inset 0 0 0 1px #34506a; }
html[data-theme="dark"] .dash-donut-hole { background: #1d3348; }
html[data-theme="dark"] .dash-donut.is-empty { background: #2c3a4a; }
html[data-theme="dark"] .dash-search-empty { background: rgba(255, 255, 255, .03); }
html[data-theme="dark"] .dashboard-page mark.dash-hit { background: #2b6ca8; color: #fff; }
html[data-theme="dark"] .dash-member-avatar { border-color: #1d3348; }

@media (max-width: 767.98px) {
    .dashboard-page .dash-hero { padding: 14px; min-height: auto; }
    .dashboard-page .dash-hero-title { font-size: 1.2rem; }
    .dashboard-page .dash-hero-side { align-items: flex-start; margin-left: 0; }
    .dashboard-page .dash-search { flex: 1 1 100%; margin: 8px 0; }
    .dashboard-page .dash-quick { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
    .dashboard-page .dash-hero { animation: none; }
    .dashboard-page .dash-quick-btn,
    .dashboard-page .dash-quick-arrow { transition: none; transform: none; }
}
@media print {
    .dashboard-page .dash-hero {
        background: #fff !important; color: #000 !important;
        border: 1px solid #999; box-shadow: none;
    }
    .dash-hero-title, .dash-hero-sub, .dash-hero-clock, .dash-hero-count { color: #000 !important; }
    .dash-quick, .dash-search, .dash-search-empty, .dash-hero-orb { display: none !important; }
    .dash-donut { box-shadow: none; }
}

/* ---------- узнаваемые строки таблиц исполнительной документации ---------- */
.aid-rows-table {
    --aid-line: #cfdae6;
    border-color: var(--aid-line) !important;
    border-radius: 8px;
    font-size: 12px;
    box-shadow: 0 1px 2px rgba(16, 42, 67, .06), 0 6px 18px rgba(16, 42, 67, .05);
}
.aid-rows-table > :not(caption) > * > * { border-color: var(--aid-line) !important; }
.aid-rows-table thead th {
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, #f6f9fc 0%, #e8f0f8 100%) !important;
    color: #24415e;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .1px;
    border-bottom: 2px solid #b6cade !important;
    text-shadow: 0 1px 0 #fff;
}
.aid-rows-table tbody tr { background: #f6f9fe; height: 50px; transition: background-color .12s ease; }
.aid-rows-table tbody tr:nth-of-type(odd) > td { background: #eaf2fb; }
.aid-rows-table tbody tr:nth-of-type(even) > td { background: #f6f9fe; }

/* выгруженные строки — заметным зелёным по всей длине */
.aid-rows-table tbody tr.is-exported > td,
.aid-rows-table tbody tr.fr-checked > td {
    background: linear-gradient(90deg, #e0f3e6 0%, #f0faf3 100%) !important;
}
.aid-rows-table tbody tr.is-exported > td:first-child,
.aid-rows-table tbody tr.fr-checked > td:first-child {
    box-shadow: inset 4px 0 0 #2e9e5b;
}

/* выбранная строка — насыщенный синий, перекрывает зелёный */
.aid-rows-table tbody tr.row-selected > td,
.aid-rows-table tbody tr.table-active > td {
    background: linear-gradient(90deg, #bcd8ff 0%, #dfedff 100%) !important;
    box-shadow: inset 4px 0 0 #1565c0;
}
.aid-rows-table tbody tr.row-selected.is-exported > td:first-child,
.aid-rows-table tbody tr.row-selected.fr-checked > td:first-child {
    box-shadow: inset 4px 0 0 #1565c0;
}
.aid-rows-table tbody td:has(.aid-export-check:checked) { background: #dff2e5 !important; }
/* строка с включённой галочкой выгрузки красится так же, как в актах:
   зелёный фон по всей длине + зелёная полоска слева */
.aid-rows-table tbody tr:not(.row-selected):not(.table-active):has(.aid-export-check:checked) > td {
    background: linear-gradient(90deg, #e0f3e6 0%, #f0faf3 100%) !important;
}
.aid-rows-table tbody tr:not(.row-selected):not(.table-active):has(.aid-export-check:checked) > td:first-child {
    box-shadow: inset 4px 0 0 #2e9e5b;
}

/* акты и приложения: узкое наименование переносится, а не растягивает колонку */
.aid-acts-table tbody td:nth-child(2),
.aid-appendices-table tbody td:nth-child(3) {
    max-width: 150px;
    overflow-wrap: anywhere;
}

/* наведение всегда заметно, в том числе на выгруженной строке */
.aid-rows-table.table-hover > tbody > tr:hover > td,
.aid-rows-table.table-hover > tbody > tr:hover > th {
    background: #d3e6fc !important;
    color: #10385f;
}
.aid-rows-table.table-hover > tbody > tr:hover > td:first-child {
    box-shadow: inset 4px 0 0 #2f80d1;
}
.aid-rows-table.table-hover > tbody > tr.row-selected:hover > td,
.aid-rows-table.table-hover > tbody > tr.table-active:hover > td {
    background: linear-gradient(90deg, #a9caff 0%, #cfe2ff 100%) !important;
    box-shadow: inset 4px 0 0 #0d5bb0;
}
.aid-rows-table tbody tr.fr-kit-head > td {
    background: linear-gradient(90deg, #cfe0f5 0%, #e4effa 100%) !important;
    color: #24415e;
    font-weight: 700;
    border-top: 1px solid #a9c2dc !important;
}
.aid-rows-table tbody tr.fr-kit-head.table-active > td {
    background: #c5dcff !important;
    box-shadow: inset 4px 0 0 #1565c0;
}
.aid-rows-table tbody tr.fr-skip > td,
.aid-rows-table.table-hover > tbody > tr.fr-skip:hover > td {
    background: #f1f3f5 !important;
    color: #9aa5b1 !important;
    text-decoration: line-through;
}
.aid-rows-table tbody tr.fr-skip > td:first-child,
.aid-rows-table tbody tr.fr-skip > td:nth-child(2),
.aid-rows-table tbody tr.fr-skip > td:nth-child(3) { text-decoration: none; }
.aid-rows-table tbody tr.fr-skip.fr-checked > td { background: #f1f3f5 !important; }

/* Пустые таблицы тоже должны выглядеть как живая строка, а не как белый фон */
.aid-rows-table tbody tr.aid-empty-row > td,
.aid-rows-table.table-hover > tbody > tr.aid-empty-row:hover > td {
    background: repeating-linear-gradient(135deg, #fbfdff 0, #fbfdff 12px, #f5f9fe 12px, #f5f9fe 24px) !important;
    border: 1px dashed #b6cade !important;
    padding: 18px 12px !important;
    text-align: center;
    box-shadow: none !important;
}
.aid-empty-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: #5b7189;
}
.aid-empty-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: linear-gradient(145deg, #eaf3ff 0%, #dbeaff 100%);
    border: 1px solid #c4dcf5;
    color: #2f6fb0;
    font-size: 1.25rem;
    box-shadow: 0 2px 6px rgba(31, 87, 145, .1);
}
.aid-empty-title { font-size: 12.5px; font-weight: 700; color: #2a4b6b; }
.aid-empty-hint { font-size: 11px; color: #8093a6; }

/* Тёмная тема */
html[data-theme="dark"] .aid-rows-table {
    --aid-line: #2e4056;
    box-shadow: none;
    color: #d6e2ee;
}
html[data-theme="dark"] .aid-rows-table thead th {
    background: linear-gradient(180deg, #1e2f42 0%, #172536 100%) !important;
    color: #bed4e8;
    border-bottom-color: #36506a !important;
    text-shadow: none;
}
html[data-theme="dark"] .aid-rows-table tbody tr { background: #162639; }
html[data-theme="dark"] .aid-rows-table tbody tr:nth-of-type(odd) > td { background: #1b2e43 !important; }
html[data-theme="dark"] .aid-rows-table tbody tr:nth-of-type(even) > td { background: #162639 !important; }
html[data-theme="dark"] .aid-rows-table tbody tr.is-exported > td,
html[data-theme="dark"] .aid-rows-table tbody tr.fr-checked > td,
html[data-theme="dark"] .aid-rows-table tbody tr:not(.row-selected):not(.table-active):has(.aid-export-check:checked) > td {
    background: linear-gradient(90deg, #1d4436 0%, #18382e 100%) !important;
}
html[data-theme="dark"] .aid-rows-table tbody tr.row-selected > td,
html[data-theme="dark"] .aid-rows-table tbody tr.table-active > td {
    background: linear-gradient(90deg, #1f4c78 0%, #1b3b5b 100%) !important;
    box-shadow: inset 4px 0 0 #4da3ff;
}
html[data-theme="dark"] .aid-rows-table.table-hover > tbody > tr:hover > td,
html[data-theme="dark"] .aid-rows-table.table-hover > tbody > tr:hover > th {
    background: #244461 !important;
    color: #eaf3ff;
}
html[data-theme="dark"] .aid-rows-table.table-hover > tbody > tr.row-selected:hover > td,
html[data-theme="dark"] .aid-rows-table.table-hover > tbody > tr.table-active:hover > td {
    background: linear-gradient(90deg, #275780 0%, #204766 100%) !important;
    box-shadow: inset 4px 0 0 #6dbbff;
}
html[data-theme="dark"] .aid-rows-table tbody tr.fr-kit-head > td {
    background: linear-gradient(90deg, #213d58 0%, #1b3249 100%) !important;
    color: #bed4e8;
}
html[data-theme="dark"] .aid-rows-table tbody tr.fr-kit-head.table-active > td {
    background: #1f4c78 !important;
    box-shadow: inset 4px 0 0 #4da3ff;
}
html[data-theme="dark"] .aid-rows-table tbody tr.fr-skip > td,
html[data-theme="dark"] .aid-rows-table.table-hover > tbody > tr.fr-skip:hover > td {
    background: #202a36 !important;
    color: #7d8b9b !important;
}
html[data-theme="dark"] .aid-rows-table tbody tr.aid-empty-row > td,
html[data-theme="dark"] .aid-rows-table.table-hover > tbody > tr.aid-empty-row:hover > td {
    background: repeating-linear-gradient(135deg, #152335 0, #152335 12px, #192a3e 12px, #192a3e 24px) !important;
    border-color: #36506a !important;
}
html[data-theme="dark"] .aid-empty-icon {
    background: linear-gradient(145deg, #203a55 0%, #1a3047 100%);
    border-color: #3b5d7d;
    color: #8fc4f3;
}
html[data-theme="dark"] .aid-empty-title { color: #cfe2f3; }
html[data-theme="dark"] .aid-empty-hint { color: #8ba0b5; }

/* ---------- «крутые» подсказки второй рельсы ---------- */
.subrail-tip {
    position: fixed;
    z-index: 1080;
    max-width: 260px;
    min-width: 180px;
    padding: 10px 12px;
    border-radius: 10px;
    background: linear-gradient(145deg, #17324c 0%, #0b1d2f 100%);
    border: 1px solid #3f6d95;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .12);
    color: #e8f3ff;
    font-size: 12px;
    line-height: 1.35;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-6px);
    transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
    pointer-events: none;
}
.subrail-tip.show { opacity: 1; visibility: visible; transform: translateX(0); }
.subrail-tip::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    width: 10px;
    height: 10px;
    transform: translateY(-50%) rotate(45deg);
    background: #10273d;
    border-left: 1px solid #3f6d95;
    border-bottom: 1px solid #3f6d95;
}
.subrail-tip.tip-left::before {
    left: auto;
    right: -6px;
    border-left: 0;
    border-bottom: 0;
    border-right: 1px solid #3f6d95;
    border-top: 1px solid #3f6d95;
}
.subrail-tip-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    letter-spacing: .1px;
}
.subrail-tip-head strong { font-weight: 700; }
.subrail-tip-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #8fa9c2;
    box-shadow: 0 0 0 3px rgba(143, 169, 194, .18);
}
.subrail-tip-dot.tip-red { background: #ff6b74; box-shadow: 0 0 0 3px rgba(255, 107, 116, .2); }
.subrail-tip-dot.tip-amber { background: #ffc857; box-shadow: 0 0 0 3px rgba(255, 200, 87, .2); }
.subrail-tip-dot.tip-green { background: #5bd18a; box-shadow: 0 0 0 3px rgba(91, 209, 138, .2); }
.subrail-tip-desc { margin-top: 6px; color: #a9c2d8; font-size: 11.5px; }
.subrail-tip-status {
    display: inline-flex;
    margin-top: 8px;
    padding: 3px 8px;
    border-radius: 20px;
    background: rgba(143, 169, 194, .16);
    border: 1px solid rgba(143, 169, 194, .3);
    color: #cfe0ef;
    font-size: 10.5px;
    font-weight: 700;
}
.subrail-tip-status.tip-red { background: rgba(255, 107, 116, .16); border-color: rgba(255, 107, 116, .4); color: #ffc3c7; }
.subrail-tip-status.tip-amber { background: rgba(255, 200, 87, .14); border-color: rgba(255, 200, 87, .38); color: #ffe0a3; }
.subrail-tip-status.tip-green { background: rgba(91, 209, 138, .15); border-color: rgba(91, 209, 138, .4); color: #b6f0cd; }
