
        header {
            height: 72px;
            background: rgba(255,255,255,0.96);
            backdrop-filter: blur(10px);
            border-bottom: 1px solid var(--color-border);
            color: var(--color-text);
            padding: 0 28px;
            display: flex; align-items: center; justify-content: space-between;
            position: sticky; top: 0; z-index: 20;
            box-shadow: 0 2px 8px rgba(15,23,42,0.06);
        }
        header h1 { font-size: 20px; font-weight: 700; letter-spacing: 0.3px; color: var(--color-text); }
        header > div:first-child span { font-size: 13px; color: var(--color-text-secondary); margin-top: 2px; display: block; }
        .header-notifications { position: relative; }
        .notif-btn {
            width: auto;
            height: auto;
            padding: 0;
            border: none;
            border-radius: 0;
            background: transparent;
            color: var(--color-nav-bg);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            box-shadow: none;
            transition: transform 0.15s ease, opacity 0.15s ease;
        }
        /* Header-кнопка «Мои заметки» — рядом с уведомлениями */
        .notes-header-btn {
            position: relative;
            width: 32px; height: 32px;
            border: none;
            background: transparent;
            color: var(--color-nav-bg);
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 8px;
            transition: background 0.15s, transform 0.15s;
        }
        .notes-header-btn:hover {
            background: var(--color-bg-subtle);
            transform: translateY(-1px);
        }
        .notes-header-btn svg { display: block; }
        .notes-header-badge {
            position: absolute;
            top: -2px; right: -4px;
            min-width: 16px; height: 16px;
            padding: 0 4px;
            border-radius: 999px;
            background: var(--color-primary);
            color: #fff;
            font-size: 10px;
            font-weight: 700;
            display: inline-flex;
            align-items: center; justify-content: center;
            line-height: 1;
        }
        .notif-btn:hover,
        .notif-btn.open {
            transform: translateY(-1px);
            opacity: 0.9;
        }
        .notif-btn-icon {
            font-size: 19px;
            line-height: 1;
        }
        .notif-btn-icon-img {
            width: 31px;
            height: 31px;
            display: block;
            object-fit: contain;
        }
        .notif-badge {
            position: absolute;
            top: -5px;
            right: -8px;
            min-width: 18px;
            padding: 1px 5px;
            border-radius: 999px;
            background: var(--color-danger);
            color: var(--color-surface);
            font-size: 10px;
            font-weight: 700;
            text-align: center;
            box-shadow: 0 2px 6px rgba(229,57,53,0.35);
        }
        .notif-panel {
            position: absolute;
            top: 54px;
            right: 0;
            width: 380px;
            max-height: 520px;
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: 18px;
            box-shadow: 0 18px 40px rgba(15,23,42,0.16);
            overflow: hidden;
            display: none;
            flex-direction: column;
        }
        .notif-panel.open { display: flex; }
        .notif-panel-head {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 12px;
            padding: 16px 18px 14px;
            border-bottom: 1px solid #eef2f7;
            background: linear-gradient(180deg, #fbfcff 0%, var(--color-bg-tint) 100%);
        }
        .notif-panel-title {
            font-size: 15px;
            font-weight: 700;
            color: var(--color-text);
        }
        .notif-panel-subtitle {
            margin-top: 2px;
            font-size: 12px;
            color: var(--color-text-secondary);
        }
        .notif-panel-read-btn {
            border: 1px solid #dbe2ea;
            background: var(--color-surface);
            color: #334155;
            border-radius: 999px;
            padding: 7px 11px;
            font-size: 11px;
            font-weight: 600;
            cursor: pointer;
            white-space: nowrap;
        }
        .notif-panel-read-btn:hover {
            background: var(--color-bg-tint);
            border-color: #cbd5e1;
        }
        .notif-list {
            display: flex;
            flex-direction: column;
            overflow-y: auto;
            max-height: 450px;
            background: var(--color-surface);
        }
        .notif-empty {
            padding: 28px 20px;
            color: var(--color-gray-400);
            font-size: 13px;
            text-align: center;
        }
        .notif-item {
            padding: 16px 18px;
            border-bottom: 1px solid var(--color-bg-subtle);
            background: var(--color-surface);
        }
        .notif-item.unread {
            background: #f8fbff;
        }
        .notif-item:last-child {
            border-bottom: none;
        }
        .notif-item.is-clickable { cursor: pointer; transition: background 0.15s; }
        .notif-item.is-clickable:hover { background: var(--color-primary-25); }
        .notif-item.is-clickable.unread:hover { background: #e8f1fc; }
        .notif-item-head {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 12px;
        }
        .notif-item-title {
            font-size: 14px;
            font-weight: 700;
            color: var(--color-text);
        }
        .notif-item-time {
            flex-shrink: 0;
            font-size: 11px;
            color: #94a3b8;
            padding-top: 2px;
        }
        .notif-item-text {
            margin-top: 7px;
            font-size: 13px;
            line-height: 1.45;
            color: #475569;
            white-space: pre-line;
        }
        .notif-item-meta {
            margin-top: 10px;
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }
        .notif-chip {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            border-radius: 999px;
            padding: 4px 9px;
            font-size: 11px;
            font-weight: 600;
            background: #eef2ff;
            color: #3949ab;
        }
        .notif-chip.is-muted {
            background: var(--color-bg-subtle);
            color: #64748b;
        }
        .notif-chip.is-success {
            background: var(--color-success-50);
            color: var(--color-success);
        }
        .notif-chip.is-danger {
            background: #fdecec;
            color: var(--color-danger-text);
        }
        .notif-actions {
            display: flex;
            gap: 10px;
            margin-top: 12px;
        }
        .notif-action-btn {
            border: none;
            border-radius: 10px;
            padding: 9px 12px;
            font-size: 12px;
            font-weight: 700;
            cursor: pointer;
            transition: opacity 0.15s ease, transform 0.15s ease;
            /* iOS: без этого тап иногда перехватывается как зум/скролл и
               onclick не срабатывает. manipulation отключает 300ms-delay
               и жесты зума для элемента, оставляя только pan. */
            touch-action: manipulation;
            -webkit-tap-highlight-color: rgba(21, 101, 192, 0.2);
            user-select: none;
        }
        .notif-action-btn:active { transform: translateY(1px); }
        .notif-action-btn:hover {
            opacity: 0.92;
            transform: translateY(-1px);
        }
        .notif-action-btn.accept {
            background: #1f7a4d;
            color: var(--color-surface);
        }
        .notif-action-btn.decline {
            background: #fff1f2;
            color: var(--color-danger-text);
            border: 1px solid #fecdd3;
        }
        .notif-action-btn:disabled {
            opacity: 0.6;
            cursor: default;
            transform: none;
        }

        .toolbar {
            background: white; padding: 14px 30px;
            display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
            border-bottom: 1px solid #e0e0e0; box-shadow: 0 2px 8px rgba(0,0,0,0.06);
        }
        .toolbar button {
            padding: 7px 16px; border: none; border-radius: 6px; cursor: pointer;
            font-size: 13px; font-weight: 500; transition: all 0.2s;
        }
        .btn-expand { background: #e8f4fd; color: var(--color-primary); }
        .btn-collapse { background: #fce4ec; color: var(--color-danger-text); }
        .btn-expand:hover { background: var(--color-primary); color: white; }
        .btn-collapse:hover { background: var(--color-danger-text); color: white; }

        /* PLAN SELECTOR */
        .plan-selector-wrap {
            display: none; align-items: center; gap: 8px;
            background: transparent; border-radius: 8px;
            padding: 0;
        }
        .plan-selector-wrap label { font-size: 12px; color: var(--color-text-secondary); white-space: nowrap; }
        .plan-select {
            background: var(--color-gray-100); color: var(--color-text-strong); border: 1px solid var(--color-border-strong);
            border-radius: 6px; padding: 5px 10px; font-size: 13px; font-weight: 500;
            cursor: pointer; outline: none; max-width: 200px;
        }
        .plan-select option { background: white; color: var(--color-text); }
        .btn-plan-create {
            background: var(--color-gray-100); color: var(--color-text-strong); border: 1px solid var(--color-border-strong);
            border-radius: 6px; padding: 5px 10px; font-size: 13px; cursor: pointer;
            font-weight: 600; transition: all 0.2s;
        }
        .btn-plan-create:hover { background: var(--color-border); }
        .btn-plan-delete {
            background: #fce4ec; color: var(--color-danger-text); border: 1px solid #f48fb1;
            border-radius: 6px; padding: 5px 8px; font-size: 13px; cursor: pointer; transition: all 0.2s;
        }
        .btn-plan-delete:hover { background: var(--color-danger-text); color: white; }
        .btn-add-phase {
            background: var(--color-primary); color: white; border: none; border-radius: 6px;
            padding: 7px 14px; font-size: 13px; font-weight: 500; cursor: pointer;
            transition: all 0.2s; box-shadow: none;
        }
        .btn-add-phase:hover { background: var(--color-primary-hover); box-shadow: 0 1px 3px rgba(21, 101, 192, 0.20); }
        .btn-inline-add {
            background: none; border: 1px dashed rgba(255,255,255,0.4); color: rgba(255,255,255,0.7);
            border-radius: 4px; padding: 2px 8px; font-size: 11px; cursor: pointer;
            margin-left: 10px; transition: all 0.2s;
        }
        .btn-inline-add:hover { border-color: white; color: white; background: rgba(255,255,255,0.15); }
        .btn-inline-add-step {
            background: none; border: 1px dashed #aaa; color: #888;
            border-radius: 4px; padding: 2px 8px; font-size: 11px; cursor: pointer;
            margin-left: 10px; transition: all 0.2s;
        }
        .btn-inline-add-step:hover { border-color: var(--color-primary); color: var(--color-primary); }
        .btn-del-phase, .btn-del-step {
            background: none; border: none; color: rgba(255,100,100,0.6); cursor: pointer;
            font-size: 14px; padding: 0 4px; margin-left: 6px; transition: color 0.2s;
        }
        .btn-del-phase:hover { color: #ff5252; }
        .btn-del-step { color: #ccc; }
        .btn-del-step:hover { color: #f44336; }

        .filter-group { display: flex; gap: 8px; align-items: center; margin-left: auto; }
        .filter-group label { font-size: 13px; color: #666; }
        select {
            padding: 6px 12px; border: 1px solid #ddd; border-radius: 6px;
            font-size: 13px; background: white; cursor: pointer;
            outline: none; color: #333;
        }
        select:focus { border-color: var(--color-primary); }

        .stats-bar {
            background: white; padding: 12px 30px;
            display: flex; gap: 20px; flex-wrap: wrap;
            border-bottom: 2px solid #e0e0e0;
        }
        .stat-item {
            display: flex; align-items: center; gap: 8px;
            font-size: 13px; color: #555;
        }
        .stat-dot {
            width: 10px; height: 10px; border-radius: 50%;
        }

        .tabs {
            display: flex; background: white;
            border-bottom: 2px solid #e0e0e0; padding: 0 30px;
        }
        .tab {
            padding: 12px 20px; cursor: pointer; font-size: 14px; font-weight: 500;
            border-bottom: 3px solid transparent; color: #666; transition: all 0.2s;
            margin-bottom: -2px;
        }
        .tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
        .tab:hover:not(.active) { color: var(--color-primary); background: #f5f8ff; }

        .tab-content { display: none; padding: 20px 30px; }
        .tab-content.active { display: block; }

        #tab-mindmap.tab-content { padding: 0; overflow: hidden; }
        #tab-mindmap .schema-v2-wrap { padding: 10px 16px; gap: 8px; height: calc(100vh - 70px); box-sizing: border-box; }
        #tab-mindmap .schema-v2-frame-wrap { flex: 1; min-height: 0; }
        #mindmapContainer { width: 100%; height: 100%; }

        /* PLAN TABLE */
        /* Скругление было 10px и в сочетании с overflow-x: auto «срезало»
           уголки цветной шапки фазы. Делаем без скругления — шапка видна
           целиком от края до края. Тень оставляем для отделения от фона. */
        .plan-table-wrap { border-radius: 0; box-shadow: 0 2px 12px rgba(0,0,0,0.08); overflow-x: auto; -webkit-overflow-scrolling: touch; }
        @media (min-width: 769px) {
            /* min-width включаем только на десктопе и планшете в table-mode.
               На ≤768px таблица рендерится как карточки (display: block) и
               жёсткий 820px ломает вёрстку. */
            .plan-table { min-width: 820px; }
        }
        .plan-table { width: 100%; border-collapse: collapse; background: white; }
        .plan-table th {
            background: var(--color-nav-bg); color: white; padding: 12px 14px;
            text-align: left; font-size: 12px; font-weight: 600;
            letter-spacing: 0.5px; text-transform: uppercase;
            position: sticky; top: 0; z-index: 10;
        }
        .plan-table td { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; font-size: 13px; vertical-align: middle; }

        /* PHASE ROW */
        .phase-row td {
            background: linear-gradient(90deg, var(--color-nav-bg), #16213e);
            color: white; font-weight: 700; font-size: 14px;
            cursor: pointer; user-select: none;
            padding: 13px 14px;
        }
        .phase-row td:first-child { border-radius: 4px 0 0 4px; }
        .phase-row:hover td { filter: brightness(1.2); }

        /* STEP ROW — светло-серый, 2px stripe фазы слева на первой ячейке */
        .step-row td {
            background: var(--color-primary-10);
            font-weight: 600; font-size: 13px;
            cursor: pointer; color: var(--color-nav-bg);
            padding: 10px 14px;
        }
        .step-row td:first-child {
            padding-left: 28px;
            box-shadow: inset 2px 0 0 var(--phase-color, transparent);
        }
        .step-row:hover td { background: #eef2ff; }

        /* TASK ROW — белый, тонкая 3px полоса слева в цвет фазы (DNA v2) */
        .task-row td { background: white; }
        .task-row td:first-child {
            padding-left: 50px;
            box-shadow: inset 3px 0 0 var(--phase-color, transparent);
        }
        .task-row:hover td { background: #fafbff; }
        .task-row.hidden { display: none; }
        .step-row.hidden { display: none; }

        .toggle-icon { margin-right: 8px; transition: transform 0.2s; display: inline-flex; align-items: center; }
        .toggle-icon svg { display: block; }
        .collapsed .toggle-icon { transform: rotate(-90deg); }
        .plan-drag-handle { display: inline-flex; align-items: center; vertical-align: middle; margin-right: 6px; color: rgba(255,255,255,0.7); }
        .plan-drag-handle svg { display: block; }
        .step-row .plan-drag-handle, .task-row .plan-drag-handle { color: var(--color-text-muted); }
        .btn-inline-add svg, .btn-inline-add-step svg, .btn-del-phase svg, .btn-del-step svg {
            display: inline-block; vertical-align: -2px;
        }

        /* STATUS BADGE */
        .status-badge {
            display: inline-block; padding: 3px 10px; border-radius: 20px;
            font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px;
            white-space: nowrap;
        }
        .status-todo { background: #f5f5f5; color: #757575; border: 1px solid #e0e0e0; }
        .status-progress { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
        .status-done { background: var(--color-success-50); color: var(--color-success); border: 1px solid #a5d6a7; }
        .status-blocked { background: #fce4ec; color: var(--color-danger-text); border: 1px solid #f48fb1; }

        /* Status select в строке задачи (Linear-стиль): без рамки,
           прозрачный фон, цветной текст по data-status строки. На hover —
           лёгкая подсветка, чтобы пользователь видел, что элемент кликабельный. */
        .task-row td:nth-child(5) { white-space: nowrap; }
        .task-row td:nth-child(5) select {
            border: 1px solid transparent !important;
            background: transparent !important;
            font-weight: 500;
            padding: 3px 22px 3px 8px !important;
            cursor: pointer;
            transition: background 0.15s, border-color 0.15s;
        }
        .task-row td:nth-child(5) select:hover {
            background: var(--color-bg-subtle) !important;
            border-color: var(--color-border) !important;
        }
        .task-row td:nth-child(5) select:focus {
            outline: none;
            border-color: var(--color-primary) !important;
            box-shadow: 0 0 0 2px var(--color-primary-25);
        }
        /* Цветовая семантика по data-status строки */
        .task-row[data-status="todo"]     td:nth-child(5) select { color: #6B7280; }
        .task-row[data-status="progress"] td:nth-child(5) select { color: #1565C0; }
        .task-row[data-status="done"]     td:nth-child(5) select { color: #15803D; }
        .task-row[data-status="blocked"]  td:nth-child(5) select { color: #B91C1C; }

        /* DATE SHIFT SUBROW */
        /* Risk flag — значок открытого риска прямо в названии задачи. Связь
           реестра рисков с роадмапом: при наличии рисков (status ∉ {Закрыт,
           Принят}) у задачи появляется треугольник со счётчиком. Цвет
           определяется максимальным приоритетом рисков задачи. */
        .task-name-cell .task-name-text { vertical-align: middle; }
        .task-risk-flag {
            display: inline-flex; align-items: center; gap: 3px;
            margin-left: 8px;
            padding: 2px 5px;
            border-radius: 6px;
            background: var(--color-warning-50);
            border: 1px solid #fde68a;
            color: #92400E;
            font-size: 11px;
            font-weight: 600;
            cursor: pointer;
            vertical-align: middle;
            line-height: 1;
            transition: background 0.15s, border-color 0.15s, transform 0.15s;
        }
        .task-risk-flag svg { display: block; }
        .task-risk-flag:hover { transform: scale(1.06); }
        .task-risk-flag-cnt { font-size: 10px; line-height: 1; }
        .task-risk-flag.risk-prio-critical {
            background: var(--color-danger-50);
            border-color: #fecaca;
            color: var(--color-danger-700);
        }
        .task-risk-flag.risk-prio-high {
            background: #fff7ed;
            border-color: #fdba74;
            color: #9A3412;
        }
        .task-risk-flag.risk-prio-low {
            background: var(--color-bg-subtle);
            border-color: var(--color-border);
            color: var(--color-text-secondary);
        }

        /* Колонка «Сроки» — два date-инпута в одной ячейке через диапазон.
           Контент центрируется по горизонтали, чтобы попадать под заголовок
           «Сроки» в шапке таблицы. */
        .task-dates-cell { white-space: nowrap; text-align: center; }
        .task-dates-wrap {
            display: inline-flex; align-items: center; gap: 4px;
            justify-content: center;
        }
        .task-date-input {
            border: 1px solid #ddd; border-radius: 4px;
            padding: 3px 5px; font-size: 12px;
            width: 92px; min-width: 0;
            font-family: inherit;
        }
        .task-date-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-primary-25); }
        .task-dates-sep {
            color: var(--color-text-muted);
            font-size: 11px;
        }
        /* Заголовок «Сроки» (3-я колонка) — выравниваем по центру так же,
           как контент. Остальные заголовки оставляем по левому краю. */
        .plan-table th:nth-child(3) { text-align: center; }
        /* Date-shift chip — маленькая иконка рядом с date input. Появляется
           только если у задачи был перенос. */
        .task-shift-slot { display: inline-flex; align-items: center; }
        .task-shift-chip {
            display: inline-flex; align-items: center; justify-content: center;
            width: 22px; height: 22px;
            border-radius: 50%;
            background: var(--color-bg-subtle);
            border: 1px solid var(--color-border);
            color: var(--color-text-secondary);
            cursor: pointer;
            padding: 0;
            transition: background 0.15s, border-color 0.15s, transform 0.15s, color 0.15s;
        }
        .task-shift-chip svg { display: block; }
        .task-shift-chip:hover { background: var(--color-warning-50); border-color: #fde68a; color: #92400e; transform: scale(1.08); }
        .task-shift-chip.has-reason {
            background: var(--color-warning-50);
            border-color: #fde68a;
            color: #92400e;
        }
        .shift-pop-icon { display: inline-flex; align-items: center; color: #92400e; }

        /* Popover с причиной последнего переноса */
        .shift-popover {
            position: absolute;
            width: 320px;
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: 10px;
            box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
            padding: 12px 14px;
            z-index: 200;
            font-size: 13px;
        }
        .shift-pop-head {
            display: flex; align-items: center; gap: 8px;
            margin-bottom: 8px;
            padding-bottom: 8px;
            border-bottom: 1px solid var(--color-border);
        }
        .shift-pop-icon { font-size: 14px; }
        .shift-pop-dates { font-weight: 600; color: #92400e; }
        .shift-pop-ts { color: var(--color-text-muted); font-size: 11px; margin-left: auto; }
        .shift-pop-label {
            display: block;
            font-size: 11px; font-weight: 500;
            color: var(--color-text-secondary);
            margin-bottom: 4px;
            text-transform: uppercase; letter-spacing: 0.4px;
        }
        .shift-pop-reason {
            width: 100%;
            border: 1px solid var(--color-border);
            border-radius: 6px;
            padding: 6px 8px;
            font-size: 13px;
            font-family: inherit;
            resize: vertical;
            min-height: 60px;
            background: var(--color-surface);
            color: var(--color-text);
        }
        .shift-pop-reason:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 2px var(--color-primary-25); }
        .shift-pop-foot {
            display: flex; align-items: center; justify-content: space-between;
            margin-top: 8px;
            font-size: 12px;
        }
        .shift-pop-history {
            background: none; border: none; padding: 0;
            color: var(--color-primary); cursor: pointer;
            font-size: 12px; font-weight: 500;
        }
        .shift-pop-history:hover { text-decoration: underline; }
        .shift-pop-status { color: var(--color-text-secondary); font-size: 11px; }

        /* Drawer со всей историей переносов */
        .shift-drawer {
            position: fixed;
            top: 0; right: 0; bottom: 0;
            width: 440px;
            max-width: 100vw;
            background: var(--color-surface);
            border-left: 1px solid var(--color-border-strong);
            box-shadow: -12px 0 32px rgba(15, 23, 42, 0.10);
            z-index: 250;
            display: flex; flex-direction: column;
            transform: translateX(100%);
            transition: transform 220ms cubic-bezier(0.2, 0, 0, 1);
        }
        .shift-drawer.is-open { transform: translateX(0); }
        .shift-drawer-head {
            display: flex; align-items: center; justify-content: space-between;
            padding: 14px 18px;
            border-bottom: 1px solid var(--color-border);
        }
        .shift-drawer-head h3 {
            font-size: 16px; font-weight: 600;
            color: var(--color-text);
            margin: 0;
        }
        .shift-drawer-close {
            background: none; border: none;
            font-size: 18px; cursor: pointer;
            color: var(--color-text-secondary);
            width: 28px; height: 28px;
            border-radius: 6px;
        }
        .shift-drawer-close:hover { background: var(--color-bg-subtle); color: var(--color-text); }
        .shift-drawer-sub {
            padding: 8px 18px 12px;
            color: var(--color-text-secondary);
            font-size: 13px;
            border-bottom: 1px solid var(--color-border);
        }
        .shift-drawer-list {
            flex: 1;
            overflow-y: auto;
            padding: 14px 18px;
            display: flex; flex-direction: column; gap: 14px;
        }
        .shift-drawer-empty {
            text-align: center;
            color: var(--color-text-muted);
            padding: 32px 0;
            font-size: 13px;
        }
        .shift-item {
            background: var(--color-bg-faint);
            border: 1px solid var(--color-border);
            border-radius: 8px;
            padding: 10px 12px;
        }
        .shift-item-top {
            display: flex; align-items: center; gap: 10px;
            margin-bottom: 4px;
        }
        .shift-item-field {
            font-size: 11px; font-weight: 500;
            color: var(--color-text-secondary);
            text-transform: uppercase; letter-spacing: 0.4px;
        }
        .shift-item-dates {
            font-weight: 600;
            color: #92400e;
            background: var(--color-warning-50);
            padding: 2px 8px;
            border-radius: 999px;
            font-size: 12px;
            border: 1px solid #fde68a;
        }
        .shift-item-meta {
            display: flex; align-items: center; gap: 8px;
            font-size: 12px;
            color: var(--color-text-muted);
            margin-bottom: 6px;
        }
        .shift-item-fio { font-weight: 500; color: var(--color-text-secondary); }
        .shift-item-ts { color: var(--color-text-muted); }
        .shift-item-reason {
            font-size: 13px;
            color: var(--color-text);
            line-height: 1.5;
        }
        .shift-item-reason.is-empty {
            color: var(--color-text-muted);
            font-style: italic;
        }

        /* URGENCY */
        .urgency-select {
            border: 1px solid #ddd; border-radius: 4px;
            padding: 3px 6px; font-size: 12px; font-weight: 500;
            cursor: pointer;
        }
        .urgency-select.urgency-normal   { background: #f9fafb; color: #4b5563; border-color: #e5e7eb; }
        .urgency-select.urgency-urgent   { background: #fef3c7; color: #92400e; border-color: #fde68a; }
        .urgency-select.urgency-critical { background: #fee2e2; color: #991b1b; border-color: #fecaca; font-weight: 700; }

        /* PROGRESS BAR */
        .progress-wrap { display: flex; align-items: center; gap: 8px; min-width: 120px; }
        .progress-bar { flex: 1; height: 6px; background: #e0e0e0; border-radius: 3px; overflow: hidden; }
        .progress-fill { height: 100%; border-radius: 3px; transition: width 0.4s; }
        .progress-label { font-size: 11px; color: #666; min-width: 28px; }

        /* PHASE / STEP — визуальный ритм без давления:
           — phase-row: плотная цветная шапка (цвет фазы, не градиент)
             с белым текстом — как заголовок секции
           — step-row: светло-серая подшапка с тонкой цветной полосой слева
           — task-row: белые, с 3px полосой слева в цвет фазы */
        /* Phase header в стиле Linear/Notion: спокойный серый фон,
           цветной круглый маркер слева от названия + 3px stripe в цвет фазы.
           Контрастно к строкам задач, читабельно, не «кричит». */
        .phase-row td {
            background: var(--color-bg-subtle);
            color: var(--color-text);
            font-weight: 600;
            padding: 10px 14px 10px 12px;
            border: none;
            box-shadow: inset 3px 0 0 var(--phase-color, #94A3B8);
        }
        .phase-row td .toggle-icon,
        .phase-row td .plan-drag-handle { color: var(--color-text-secondary); }
        .phase-row strong {
            color: var(--color-text);
            font-weight: 700;
            letter-spacing: 0.1px;
        }
        .phase-row strong::before {
            content: '';
            display: inline-block;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--phase-color, #94A3B8);
            margin-right: 8px;
            vertical-align: 1px;
        }
        .phase-row .phase-progress {
            float: right;
            font-size: 12px;
            color: var(--color-text-secondary);
            font-weight: 500;
        }
        .phase-row .btn-inline-add,
        .phase-row .btn-del-phase {
            background: white;
            color: var(--color-text-strong);
            border: 1px solid var(--color-border);
        }
        .phase-row .btn-inline-add:hover {
            background: var(--color-primary-25);
            border-color: var(--color-primary-50);
            color: var(--color-primary);
        }
        .phase-row .btn-del-phase:hover {
            background: var(--color-danger-25);
            border-color: var(--color-danger-50);
            color: var(--color-danger);
        }
        .step-row td {
            background: var(--color-bg-faint);
        }

        /* Критичные задачи — спокойная подсветка строки и красное жирное
           название задачи. Никаких плашек-text перед именем, чтобы они
           не реfлоу-или строку при появлении (это вызывало «прыжки»
           ширин колонок и моргание чипа переноса). */
        .task-row[data-urgency="critical"] td { background: #FEF2F2; }
        .task-row[data-urgency="critical"] .task-name-cell {
            color: #991B1B;
            font-weight: 600;
        }

        /* CHECKBOX — плавно растёт от 13px (360px экран) до 20px (1200px+) */
        input[type=checkbox] {
            width: clamp(13px, 1vw + 9px, 20px);
            height: clamp(13px, 1vw + 9px, 20px);
            cursor: pointer;
            accent-color: var(--color-primary);
        }

        /* FILES TAB */
        .files-table { width: 100%; border-collapse: collapse; background: white; border: 1px solid var(--color-border-strong); border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06); }
        .files-table th { background: var(--color-nav-bg); color: white; padding: 11px 14px; text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; }
        .files-table td { padding: 9px 14px; border-bottom: 1px solid #f0f0f0; font-size: 13px; vertical-align: middle; }
        .files-table tr:hover td { background: var(--color-primary-10); }
        .files-empty { text-align: center; padding: 40px; color: #aaa; font-size: 14px; }
        .file-download-link { color: var(--color-primary); text-decoration: none; font-weight: 500; }
        .file-download-link:hover { text-decoration: underline; }
        .btn-delete-file {
            padding: 3px 10px; border: 1px solid #e0e0e0; border-radius: 5px;
            background: white; color: #aaa; font-size: 12px; cursor: pointer; transition: all 0.2s;
        }
        .btn-delete-file:hover { border-color: var(--color-danger); color: var(--color-danger); background: #fff5f5; }
        .file-size { color: #aaa; font-size: 12px; }

        /* ATTACH FILE BUTTON in task row — SVG-иконка скрепка */
        .btn-attach {
            width: 22px; height: 22px; border: none; border-radius: 5px;
            background: transparent; color: var(--color-text-secondary); cursor: pointer;
            transition: all 0.15s; flex-shrink: 0; padding: 0; line-height: 1;
            display: inline-flex; align-items: center; justify-content: center;
            opacity: 0.6;
        }
        .btn-attach svg, .btn-comment svg, .kb-card-action svg, .kb-card-menu svg { display: block; }
        .btn-comment {
            display: inline-flex; align-items: center; gap: 3px;
        }
        .btn-attach:hover { opacity: 1; background: var(--color-gray-100); }
        .btn-attach.has-files { opacity: 1; }
        .btn-attach-ico {
            width: 17px;
            height: 17px;
            display: block;
            opacity: 0.7;
            transition: opacity 0.18s;
        }
        .btn-attach:hover .btn-attach-ico,
        .btn-attach.has-files .btn-attach-ico { opacity: 1; }
        .btn-attach-count {
            font-size: 11px;
            font-weight: 600;
            line-height: 1;
        }

        /* FILES MODAL */
        .files-modal-list { max-height: 220px; overflow-y: auto; margin: 12px 0; border: 1px solid #eee; border-radius: 8px; }
        .files-modal-item {
            display: flex; align-items: center; gap: 10px; padding: 9px 12px;
            border-bottom: 1px solid #f5f5f5; font-size: 13px;
        }
        .files-modal-item:last-child { border-bottom: none; }
        .files-modal-item .fname { flex: 1; color: var(--color-primary); text-decoration: none; }
        .files-modal-item .fname:hover { text-decoration: underline; }
        .files-modal-item .fmeta { font-size: 11px; color: #aaa; white-space: nowrap; }
        .files-modal-empty { padding: 20px; text-align: center; color: #bbb; font-size: 13px; }
        .upload-area {
            border: 2px dashed #ddd; border-radius: 8px; padding: 16px;
            text-align: center; cursor: pointer; transition: all 0.2s; margin-top: 12px;
            color: #999; font-size: 13px;
        }
        .upload-area:hover, .upload-area.drag-over { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-20); }
        .upload-progress { display: none; margin-top: 8px; font-size: 13px; color: var(--color-primary); }

        /* HISTORY TABLE */
        .history-table { width: 100%; border-collapse: collapse; background: white; border: 1px solid var(--color-border-strong); border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06); }
        .history-table th { background: var(--color-nav-bg); color: white; padding: 11px 14px; text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; }
        .history-table td { padding: 9px 14px; border-bottom: 1px solid #f0f0f0; font-size: 13px; vertical-align: middle; }
        .history-table tr:hover td { background: var(--color-primary-10); }
        .history-empty { text-align: center; padding: 40px; color: #aaa; font-size: 14px; }
        .history-action-add { color: var(--color-success); font-weight: 600; }
        .history-action-delete { color: var(--color-danger-text); font-weight: 600; }
        .history-action-update { color: var(--color-primary); font-weight: 600; }
        /* SCHEMA TAB V2 */
        .schema-v2-wrap { padding: 20px 28px 28px; display: flex; flex-direction: column; gap: 16px; }
        .schema-v2-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 10px;
        }
        .schema-v2-toolbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
        .schema-v2-btn-save {
            display: inline-flex; align-items: center; gap: 6px;
            background: var(--color-primary); color: white;
            border: none; border-radius: 10px;
            padding: 9px 18px; font-size: 13px; font-weight: 600;
            cursor: pointer; transition: background 0.15s;
        }
        .schema-v2-btn-save:hover { background: var(--color-primary-hover); }
        .schema-v2-btn-convert {
            display: inline-flex; align-items: center; gap: 6px;
            background: #f3e8ff; color: #6b21a8;
            border: none; border-radius: 10px;
            padding: 9px 18px; font-size: 13px; font-weight: 600;
            cursor: pointer; transition: background 0.15s, color 0.15s;
        }
        .schema-v2-btn-convert:hover { background: #6b21a8; color: white; }
        .schema-v2-zoom-wrap {
            display: flex; align-items: center; gap: 6px;
            background: var(--color-gray-100); border: 1px solid var(--color-border);
            border-radius: 10px; padding: 0 12px; height: 38px;
        }
        .schema-v2-zoom-label { font-size: 12px; color: var(--color-gray-400); white-space: nowrap; }
        .schema-v2-zoom-sel {
            border: none; background: transparent;
            font-size: 13px; font-weight: 500; color: var(--color-text-strong);
            cursor: pointer; outline: none;
        }
        .schema-v2-status { font-size: 12px; color: var(--color-gray-400); }
        .schema-v2-frame-wrap {
            border-radius: 16px;
            overflow: hidden;
            border: 1px solid var(--color-border);
            box-shadow: 0 2px 12px rgba(0,0,0,0.07);
        }
        .schema-v2-frame { width: 100%; height: 72vh; border: none; display: block; }
        /* Convert modal */
        .task-convert-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; margin: 12px 0; padding: 10px; background: var(--color-primary-10); border-radius: 8px; border: 1px solid #e8eaf6; }
        .task-convert-item { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 4px 2px; }
        .task-convert-item input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }
        .task-convert-empty { text-align: center; color: #aaa; padding: 20px; font-size: 13px; }
        .convert-select-all { font-size: 12px; color: var(--color-primary); cursor: pointer; text-decoration: underline; margin-left: auto; }

        .btn-restore { padding: 5px 14px; border: none; border-radius: 6px; background: var(--color-success-50); color: var(--color-success); font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; margin-right: 6px; }
        .btn-restore:hover { background: var(--color-success); color: white; }
        .btn-archive-del { padding: 5px 10px; border: none; border-radius: 6px; background: #fce4ec; color: var(--color-danger-text); font-size: 12px; cursor: pointer; transition: all 0.2s; }
        .btn-archive-del:hover { background: var(--color-danger-text); color: white; }
        .archive-ttl { font-size: 11px; color: #f57c00; }
        .history-refresh-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
        .history-refresh-bar button { padding: 6px 16px; border: none; border-radius: 6px; background: #e8f4fd; color: var(--color-primary); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
        .history-refresh-bar button:hover { background: var(--color-primary); color: white; }
        .history-refresh-bar span { font-size: 12px; color: #999; }

        /* TASK NAME CELL */
        .task-name-cell { cursor: default; }
        .task-name-cell:hover { background: #f0f7ff; }

        /* DELETE BUTTON */
        .btn-delete-task {
            width: 22px; height: 22px; border-radius: 5px; border: none;
            background: transparent; color: var(--color-gray-400); font-size: 16px; line-height: 1;
            cursor: pointer; display: flex; align-items: center; justify-content: center;
            padding: 0; transition: all 0.15s; flex-shrink: 0; opacity: 0.6;
        }
        .btn-delete-task:hover {
            opacity: 1; color: var(--color-danger); background: var(--color-danger-25);
        }

        /* Bulk-выделение задач (Cmd/Ctrl + клик по строке). */
        .task-row.is-selected td {
            background: var(--color-primary-25) !important;
            box-shadow: inset 3px 0 0 var(--color-primary);
        }
        .bulk-toolbar {
            position: fixed;
            bottom: 24px;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            align-items: center;
            gap: 12px;
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: 12px;
            padding: 10px 16px;
            box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
            z-index: 250;
            font-size: 13px;
        }
        .bulk-toolbar-count { color: var(--color-text); }
        .bulk-toolbar-count strong { color: var(--color-primary); font-weight: 700; }
        .bulk-toolbar-divider {
            width: 1px; height: 18px; background: var(--color-border);
        }
        .bulk-toolbar-btn {
            background: var(--color-primary);
            color: #fff;
            border: none;
            border-radius: 8px;
            padding: 6px 12px;
            font-size: 12px;
            font-weight: 600;
            font-family: inherit;
            cursor: pointer;
            transition: background 0.15s;
        }
        .bulk-toolbar-btn:hover { background: var(--color-primary-dark); }
        .bulk-toolbar-btn-danger {
            background: var(--color-danger);
        }
        .bulk-toolbar-btn-danger:hover { background: var(--color-danger-700); }
        .bulk-toolbar-btn-ghost {
            background: transparent;
            color: var(--color-text-secondary);
            border: 1px solid var(--color-border);
        }
        .bulk-toolbar-btn-ghost:hover {
            background: var(--color-bg-subtle);
            color: var(--color-text);
        }

        /* Inline-создание задачи в этапе. Появляется на месте,
           без модалки; Enter сохраняет и сразу открывает следующий ввод. */
        .inline-add-row td.inline-add-cell {
            background: var(--color-primary-10);
            padding: 6px 14px 6px 50px;
            border-bottom: 1px solid var(--color-primary-50);
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .inline-add-input {
            flex: 1;
            padding: 6px 10px;
            font-size: 13px;
            font-family: inherit;
            border: 1.5px solid var(--color-primary);
            border-radius: 6px;
            outline: none;
            background: white;
            color: var(--color-text);
            box-shadow: 0 0 0 3px var(--color-primary-25);
        }
        .inline-add-input:disabled {
            background: var(--color-bg-subtle);
            color: var(--color-text-muted);
        }
        .inline-add-hint {
            font-size: 11px;
            color: var(--color-text-secondary);
            white-space: nowrap;
        }

        /* Drag-хэндлы ⠿ — спрятаны по умолчанию, появляются на hover
           строки фазы/этапа. Уменьшает визуальный шум на ~30 значков
           на средний план. Drag по-прежнему работает: маркер виден когда
           нужен, drag-логика на самой строке. */
        .phase-row .plan-drag-handle,
        .step-row .plan-drag-handle {
            opacity: 0;
            transition: opacity 0.15s ease;
        }
        .phase-row:hover .plan-drag-handle { opacity: 0.85; }
        .step-row:hover .plan-drag-handle  { opacity: 0.7; }
        @media (hover: none) {
            .phase-row .plan-drag-handle,
            .step-row .plan-drag-handle { opacity: 0.5; }
        }

        /* ───── Hover-actions в строке задачи ─────
           Иконки 📎 файлы / 💬 комментарии / заметка / удалить — спрятаны
           по умолчанию, показываются только при наведении на строку. Это
           убирает «шум» из таблицы (на 100 задачах × 4 иконки = 400 элементов
           меньше). Иконки с активным состоянием (has-files / has-comments)
           показываются всегда — чтобы было видно «у этой задачи есть файл».
           Touch-устройства всё показывают (нет hover) — фоллбек ниже. */
        .task-row .btn-attach,
        .task-row .btn-comment,
        .task-row .note-btn,
        .task-row .btn-delete-task {
            opacity: 0;
            transition: opacity 0.15s ease, color 0.15s, background 0.15s;
        }
        .task-row:hover .btn-attach,
        .task-row:hover .btn-comment,
        .task-row:hover .note-btn,
        .task-row:hover .btn-delete-task,
        .task-row:focus-within .btn-attach,
        .task-row:focus-within .btn-comment,
        .task-row:focus-within .note-btn,
        .task-row:focus-within .btn-delete-task {
            opacity: 0.7;
        }
        /* Иконки с активным состоянием — всегда видны (показывают, что
           у задачи есть файлы / комментарии / заметка) */
        .task-row .btn-attach.has-files,
        .task-row .btn-comment.has-comments,
        .task-row .note-btn.has-note {
            opacity: 0.85;
        }
        /* На выполненных задачах файлик показываем всегда, чтобы было сразу
           видно, к какой работе прикреплены результаты. */
        .task-row[data-status="done"] .btn-attach {
            opacity: 0.85;
        }
        /* Hover на саму иконку — полная яркость */
        .task-row .btn-attach:hover,
        .task-row .btn-comment:hover,
        .task-row .note-btn:hover,
        .task-row .btn-delete-task:hover {
            opacity: 1 !important;
        }
        /* На touch-устройствах нет hover — показываем иконки как раньше */
        @media (hover: none) {
            .task-row .btn-attach,
            .task-row .btn-comment,
            .task-row .note-btn,
            .task-row .btn-delete-task {
                opacity: 0.6;
            }
        }

        /* RISKS TABLE */
        .risks-table-wrap { border-radius: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
        .risks-table { width: 100%; border-collapse: collapse; background: white; }
        .risks-table th { background: var(--color-nav-bg); color: white; padding: 12px 14px; text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; position: sticky; top: 0; z-index: 10; }
        .risks-table td { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; font-size: 13px; vertical-align: middle; }
        .risks-table tr:hover td { background: rgba(21,101,192,0.04); }
        .risks-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
        .btn-add-risk {
            background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
            color: white; padding: 9px 16px; border: none; border-radius: 8px;
            font-size: 13px; font-weight: 500; cursor: pointer;
            display: inline-flex; align-items: center; gap: 6px;
            box-shadow: 0 2px 8px rgba(21,101,192,0.35); transition: all 0.2s;
        }
        .btn-add-risk:hover { background: linear-gradient(135deg, var(--color-primary-500) 0%, var(--color-primary) 100%); box-shadow: 0 2px 8px rgba(21,101,192,0.35); }
        .btn-add-risk-icon { font-size: 14px; line-height: 1; }
        .btn-sort-risks { background: #e8f4fd; color: var(--color-primary); padding: 9px 16px; border: none; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
        .btn-sort-risks:hover { background: var(--color-primary); color: white; }
        .risks-table tr.dragging { opacity: 0.35; }
        .risks-table tr.drag-over-top td { border-top: 2px solid var(--color-primary); }
        .risk-select { border: 1px solid #ddd; border-radius: 4px; padding: 4px 8px; font-size: 12px; background: white; cursor: pointer; font-family: inherit; }
        .risk-select:focus { border-color: var(--color-primary); outline: none; }
        /* Priority select styled as badge */
        .priority-select { border: none; border-radius: 20px; padding: 3px 12px; font-size: 11px; font-weight: 700; cursor: pointer; font-family: inherit; appearance: none; -webkit-appearance: none; text-align: center; }
        .priority-select.p-critical { background: #b71c1c; color: white; }
        .priority-select.p-high { background: #e65100; color: white; }
        .priority-select.p-med { background: #f9a825; color: white; }
        .priority-select.p-low { background: #558b2f; color: white; }
        /* Editable text cells */
        .editable-cell { cursor: text; }
        .editable-cell:hover { background: rgba(21,101,192,0.05) !important; }
        .editable-cell input { width: 100%; border: 1px solid var(--color-primary); border-radius: 4px; padding: 4px 6px; font-size: inherit; font-family: inherit; outline: none; box-shadow: 0 0 0 2px rgba(21,101,192,0.12); background: white; }
        .btn-del-risk { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #e0e0e0; background: white; color: #bbb; font-size: 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; transition: all 0.2s; }
        .btn-del-risk:hover { border-color: var(--color-danger); color: var(--color-danger); background: #fff5f5; }
        .modal-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

        .risk-high { background: #fce4ec !important; }
        .risk-med { background: #fff8e1 !important; }
        .risk-low { background: #f1f8e9 !important; }
        /* Priority-based row backgrounds */
        .risk-p-critical { background: #f48fb1 !important; }
        .risk-p-high { background: #fce4ec !important; }
        .risk-p-med { background: #fff8e1 !important; }
        .risk-p-low { background: #f1f8e9 !important; }
        .risk-p-move { transition: background 0.4s; outline: 2px solid var(--color-primary); outline-offset: -2px; }

        .priority-badge {
            display: inline-block; padding: 3px 10px; border-radius: 20px;
            font-size: 11px; font-weight: 700;
        }
        .p-critical { background: #b71c1c; color: white; }
        .p-high { background: #e65100; color: white; }
        .p-med { background: #f9a825; color: white; }
        .p-low { background: #558b2f; color: white; }

        /* GANTT */
        .gantt-wrap { overflow-x: auto; }
        .gantt-table { width: 100%; border-collapse: collapse; background: white; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.08); min-width: 900px; }
        .gantt-table th { background: var(--color-nav-bg); color: white; padding: 10px 12px; font-size: 12px; text-align: center; }
        .gantt-table th.task-col { text-align: left; min-width: 380px; width: 380px; }
        .gantt-table td { padding: 9px 12px; border-bottom: 1px solid #f0f0f0; font-size: 12px; }
        .gantt-table td.task-name { font-weight: 500; min-width: 380px; width: 380px; }
        .gantt-cell { width: 55px; text-align: center; }
        .gantt-bar { height: 18px; border-radius: 4px; margin: auto; }

        .gantt-phase-row td { background: var(--color-bg-chip); font-weight: 700; padding: 8px 12px; }

        .gantt-range-cell {
    position: relative;
    height: 34px;
    padding: 0;
}

.gantt-range-track {
    position: relative;
    height: 34px;
}

.gantt-range-bar {
    position: absolute;
    top: 8px;
    height: 18px;
    border-radius: 999px;
    min-width: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.gantt-range-bar.nodate {
    border: 2px dashed rgba(0,0,0,.18);
    opacity: .75;
}

.gantt-week-head {
    min-width: 78px;
    text-align: center;
    background: var(--color-nav-bg);
    color: #c5cae9;
    font-size: 11px;
    font-weight: 500;
}
.gantt-block-cell {
    width: 78px;
    min-width: 78px;
    text-align: center;
    padding: 6px 4px;
    border-left: 1px solid #eef1f5;
}
.gantt-block {
    display: inline-block;
    width: 48px;
    height: 28px;
    border-radius: 6px;
    opacity: 0.85;
    cursor: default;
}

.gantt-table {
    table-layout: fixed;
    width: 100%;
}

.gantt-table td,
.gantt-table th {
    box-sizing: border-box;
}

        /* Gantt source toggle */
        .gantt-source-toggle {
            display: flex; gap: 0; margin-bottom: 16px; background: #e8eaf6; border-radius: 8px; overflow: hidden; width: fit-content;
        }
        .gantt-source-btn {
            padding: 8px 20px; border: none; cursor: pointer; font-size: 13px; font-weight: 500;
            background: transparent; color: #555; transition: all 0.2s;
        }
        .gantt-source-btn.active { background: var(--color-primary); color: white; }
        .gantt-source-btn:hover:not(.active) { background: #c5cae9; }



        /* Задачи без дат — полосатый бар */
        .gantt-bar-nodate {
            height: 18px; border-radius: 4px; margin: auto; width: 80%;
            background: repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(255,255,255,0.3) 3px, rgba(255,255,255,0.3) 6px);
            opacity: 0.5;
        }

        /* SUMMARY CARDS */
        .summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
        .summary-card {
            background: white; border-radius: 10px; padding: 18px 20px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.07); border-left: 4px solid;
            display: flex; flex-direction: column; gap: 6px;
        }
        .summary-card .num { font-size: 28px; font-weight: 700; }
        .summary-card .lbl { font-size: 12px; color: #777; text-transform: uppercase; letter-spacing: 0.5px; }

        .scrollable { max-height: calc(100vh - 280px); overflow-y: auto; }

        /* Модальное окно */
        .modal-overlay {
            display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.4); z-index: 1000;
            align-items: center; justify-content: center;
        }
        .modal-overlay.active { display: flex; }
        .modal {
            background: white; border-radius: 12px; padding: 24px 28px;
            box-shadow: 0 8px 30px rgba(0,0,0,0.2); min-width: 400px; max-width: 500px;
        }
        .modal-convert { min-width: 500px; max-width: 640px; }
        .modal-wide { min-width: 460px; max-width: 580px; }
        .modal h3 { margin-bottom: 16px; color: var(--color-nav-bg); }
        .modal label { display: block; font-size: 13px; color: #555; margin-bottom: 4px; margin-top: 12px; }
        .modal select, .modal input[type=text] {
            width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px;
            font-size: 14px; outline: none;
        }
        .modal select:focus, .modal input[type=text]:focus { border-color: var(--color-primary); }
        .modal-buttons { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }
        .modal-buttons button {
            padding: 8px 20px; border: none; border-radius: 6px; font-size: 14px;
            font-weight: 500; cursor: pointer;
        }
        /* Primary CTA — главное действие. Один цвет на весь интерфейс,
           чистый primary без декоративных эффектов (минималистичный
           вариант, как у Linear / Notion). */
        .btn-toolbar-add {
            background: var(--color-primary);
            color: #fff;
            box-shadow: none;
        }
        .btn-toolbar-add:hover {
            background: var(--color-primary-hover);
            box-shadow: 0 1px 3px rgba(21, 101, 192, 0.20);
        }
        .btn-add-task { background: var(--color-primary); color: white; }
        .btn-add-task:hover { background: var(--color-primary-dark); }
        .btn-cancel { background: #f5f5f5; color: #333; }
        .btn-cancel:hover { background: #e0e0e0; }

        .gantt-legend {
            display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; font-size: 11px;
        }
        .gantt-legend-item {
            display: flex; align-items: center; gap: 4px; padding: 3px 8px;
            background: #f5f5f5; border-radius: 4px;
        }
        .gantt-legend-dot { width: 10px; height: 10px; border-radius: 3px; }

        /* LOGIN SCREEN */
        .login-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: linear-gradient(135deg, var(--color-nav-bg) 0%, #16213e 50%, #0f3460 100%);
            z-index: 2000; display: flex; align-items: center; justify-content: center;
        }
        .login-overlay.hidden { display: none; }
        .login-box {
            background: white; border-radius: 16px; padding: 40px 36px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.3); min-width: 380px; max-width: 440px;
            text-align: center;
        }
        .login-box h2 {
            color: var(--color-nav-bg); margin-bottom: 6px; font-size: 22px;
        }
        .login-box .subtitle {
            color: #888; font-size: 13px; margin-bottom: 28px;
        }
        .login-box .field { text-align: left; margin-bottom: 16px; }
        .login-box .login-hint {
            font-size: 11px;
            color: var(--color-text-secondary);
            margin-top: 6px;
            line-height: 1.4;
        }
        .login-box .field label {
            display: block; font-size: 13px; color: #555; margin-bottom: 5px; font-weight: 500;
        }
        .login-box .field input, .login-box .field select {
            width: 100%; padding: 10px 14px; border: 2px solid #e0e0e0; border-radius: 8px;
            font-size: 15px; outline: none; transition: border-color 0.2s;
        }
        .login-box .field input:focus, .login-box .field select:focus {
            border-color: var(--color-primary);
        }
        .login-box .error-msg {
            color: var(--color-danger-text); font-size: 13px; margin-bottom: 12px; min-height: 20px;
        }
        .login-box .btn-login {
            width: 100%; padding: 12px; border: none; border-radius: 8px;
            background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark)); color: white;
            font-size: 15px; font-weight: 600; cursor: pointer; transition: opacity 0.2s;
        }
        .login-box .btn-login:hover { opacity: 0.9; }
        .login-box .btn-login:disabled { opacity: 0.5; cursor: not-allowed; }

        /* USER INFO в хедере */
        .user-info {
            display: flex; align-items: center; gap: 12px;
        }
        .user-info .user-name {
            font-size: 14px; font-weight: 500; color: var(--color-text-strong);
        }
        .user-info .user-avatar {
            width: 36px; height: 36px; border-radius: 50%;
            background: linear-gradient(135deg,var(--color-primary),var(--color-primary-500)); display: flex;
            align-items: center; justify-content: center;
            font-size: 13px; font-weight: 700; color: white; cursor: pointer;
            flex-shrink: 0;
        }
        .btn-logout {
            padding: 5px 14px; border: 1px solid var(--color-border-strong);
            border-radius: 6px; background: var(--color-gray-100); color: var(--color-text-strong);
            font-size: 12px; cursor: pointer; transition: all 0.2s;
        }
        .btn-logout:hover { background: var(--color-border); color: var(--color-text); }

        /* ADD RISK MODAL */


        /* ===== SIDEBAR NAV ===== */
        .app-shell { min-height: 100vh; }

        .sidebar-nav {
            width: 72px;
            background: var(--color-text);
            color: var(--color-surface);
            position: fixed;
            left: 0; top: 0; bottom: 0;
            display: flex;
            flex-direction: column;
            transition: width 0.25s ease;
            overflow: hidden;
            z-index: 50;
        }
        .sidebar-nav:hover { width: 246px; }

        .sidebar-brand {
            min-height: 72px;
            display: flex;
            align-items: center;
            padding: 0 20px;
            border-bottom: 1px solid rgba(255,255,255,0.08);
            font-size: 16px;
            font-weight: 700;
            white-space: nowrap;
            gap: 12px;
        }
        .sidebar-brand-icon {
            width: 36px;
            height: 36px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }
        .sidebar-brand-icon-img {
            width: 30px;
            height: 30px;
            display: block;
            object-fit: contain;
        }
        .sidebar-brand-label {
            opacity: 0; transition: opacity 0.15s ease; white-space: nowrap;
        }
        .sidebar-nav:hover .sidebar-brand-label { opacity: 1; }

        .sidebar-menu {
            flex: 1;
            padding: 12px 8px;
            display: flex;
            flex-direction: column;
            gap: 4px;
            overflow-y: auto;
            scrollbar-width: none;
        }
        .sidebar-menu::-webkit-scrollbar { display: none; }

        .side-link {
            width: 100%;
            border: none;
            background: transparent;
            color: rgba(255,255,255,0.75);
            display: flex;
            align-items: center;
            gap: 12px;
            border-radius: 12px;
            padding: 10px 12px;
            cursor: pointer;
            text-align: left;
            transition: background 0.2s ease, color 0.2s ease;
            font-size: 14px;
            font-family: inherit;
        }
        .side-link:hover { background: rgba(255,255,255,0.1); color: var(--color-surface); }
        .side-link.active {
            background: rgba(255,255,255,0.15); color: var(--color-surface);
            position: relative;
        }
        .side-link.active::before {
            content: '';
            position: absolute;
            left: 0; top: 6px; bottom: 6px;
            width: 3px;
            background: var(--color-primary-400);
            border-radius: 0 3px 3px 0;
        }

        .side-ico {
            min-width: 36px;
            width: 36px;
            height: 36px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }
        .side-ico-img {
            width: 30px;
            height: 30px;
            display: block;
            object-fit: contain;
        }
        #pageHeaderIcon {
            width: 36px;
            height: 36px;
            transition: transform 0.25s ease;
        }
        .page-header-icon-img {
            width: 36px;
            height: 36px;
            display: block;
            object-fit: contain;
        }
        .side-label {
            opacity: 0; white-space: nowrap;
            transition: opacity 0.15s ease;
        }
        .sidebar-nav:hover .side-label { opacity: 1; }

        .sidebar-profile {
            padding: 12px 8px 14px;
            border-top: 1px solid rgba(255,255,255,0.08);
        }
        .sidebar-profile-box {
            display: flex; align-items: center; gap: 10px;
            background: rgba(255,255,255,0.08);
            border-radius: 12px; padding: 10px;
        }
        .sidebar-avatar {
            width: 36px; height: 36px; border-radius: 50%;
            background: #2563eb; color: var(--color-surface);
            display: flex; align-items: center; justify-content: center;
            font-weight: 700; font-size: 13px; flex-shrink: 0;
        }
        .sidebar-profile-meta { opacity: 0; transition: opacity 0.15s ease; white-space: nowrap; }
        .sidebar-nav:hover .sidebar-profile-meta { opacity: 1; }
        .sidebar-profile-name { font-weight: 700; font-size: 13px; }
        .sidebar-profile-role { font-size: 11px; color: #94a3b8; margin-top: 2px; }

        .main-area {
            padding-left: 80px;
            min-height: 100vh;
        }

        /* ===== TABS now hidden - replaced by sidebar ===== */
        .tabs { display: none; }

        /* ===== Tab content padding ===== */
        .tab-content { padding: 20px 28px; }
        .tab-content.active { display: block; }

        /* ===== Toolbar restyle ===== */
        .toolbar {
            background: rgba(255,255,255,0.96);
            backdrop-filter: blur(8px);
            padding: 10px 28px;
            display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
            border-bottom: 1px solid var(--color-border);
            box-shadow: none;
        }

        /* ===== Summary + phase progress restyle ===== */
        .summary-card {
            border-radius: 16px;
            box-shadow: 0 4px 16px rgba(15,23,42,0.07);
        }

        /* ===== Table containers restyle ===== */
        .plan-table-wrap, .risks-table-wrap, .files-table, .history-table {
            border-radius: 16px;
        }


        /* ===== HOME / ANNOUNCEMENTS BOARD ===== */
        .home-layout {
            max-width: 860px;
            margin: 0 auto;
            padding: 28px 24px;
            display: flex;
            flex-direction: column;
            gap: 18px;
        }

        /* ===== FAVORITE PROJECT CARDS ===== */
        .fav-cards-section { display: flex; flex-direction: column; gap: 12px; }
        .fav-cards-header {
            display: flex; align-items: baseline; justify-content: space-between;
            gap: 12px; flex-wrap: wrap;
        }
        .fav-cards-title {
            margin: 0; font-size: 15px; font-weight: 700; color: var(--color-text);
            letter-spacing: 0.2px;
        }
        .fav-cards-hint { font-size: 12px; color: var(--color-text-secondary); }
        .fav-cards-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
            gap: 12px;
        }
        .fav-card {
            background: var(--color-surface);
            border: 1px solid var(--color-border-strong);
            border-radius: 10px;
            padding: 14px 16px;
            cursor: pointer;
            transition: border-color 0.15s, background 0.15s;
            display: flex; flex-direction: column; gap: 10px;
            min-height: 140px;
            box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
        }
        .fav-card:hover {
            border-color: var(--color-primary);
            background: var(--color-bg-tint);
        }
        .fav-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
        .fav-card-title {
            font-size: 14px; font-weight: 700; color: var(--color-text);
            line-height: 1.3; overflow: hidden; text-overflow: ellipsis;
            display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
        }
        .fav-card-unstar {
            border: none; background: transparent; color: #f5b301;
            font-size: 16px; line-height: 1; cursor: pointer; padding: 2px 4px;
            border-radius: 5px; transition: background 0.15s;
        }
        .fav-card-unstar:hover { background: #fffaeb; }
        .fav-card-progress { display: flex; align-items: center; gap: 8px; }
        .fav-card-progress-bar {
            flex: 1; height: 6px; background: var(--color-gray-100); border-radius: 999px; overflow: hidden;
        }
        .fav-card-progress-fill {
            height: 100%; background: linear-gradient(90deg, var(--color-primary), #42a5f5);
            border-radius: 999px; transition: width 0.3s;
        }
        .fav-card-progress-label {
            font-size: 12px; font-weight: 700; color: var(--color-primary); min-width: 34px; text-align: right;
        }
        .fav-card-stats { display: flex; flex-wrap: wrap; gap: 6px; }
        .fav-card-stat {
            font-size: 11px; color: var(--color-text-secondary); background: var(--color-gray-100);
            padding: 2px 8px; border-radius: 999px;
        }
        .fav-card-stat--done { background: var(--color-success-50); color: var(--color-success); }
        .fav-card-stat--overdue { background: #fdecea; color: var(--color-danger-text); font-weight: 600; }
        .fav-card-foot {
            display: flex; flex-direction: column; gap: 3px;
            font-size: 11px; color: var(--color-text-secondary); margin-top: auto;
        }
        .fav-card-deadline--empty { color: var(--color-gray-400); font-style: italic; }
        @media (max-width: 640px) {
            .fav-cards-grid { grid-template-columns: 1fr; }
        }

        /* ===== HOME v2 (variant C) — widened layout, 2-col grid =====
           Применяется только когда .home-layout имеет модификатор --hc.
           Существующие классы (.announce-*, .plan-chat-*, .fav-*) не ломаются —
           добавлены только оверрайды внутри .home-layout--hc. */
        .home-layout.home-layout--hc {
            max-width: 1280px;
            margin: 0 auto;
            padding: 22px 24px;
            gap: 16px;
        }

        /* Greeting */
        .hc-greet {
            display: flex; justify-content: space-between; align-items: center;
            gap: 14px; flex-wrap: wrap;
        }
        .hc-greet-title {
            font-size: 22px; font-weight: 700; color: var(--color-text);
            letter-spacing: -0.2px; margin-bottom: 2px;
        }
        .hc-greet-sub { font-size: 13px; color: var(--color-text-secondary); }
        .hc-greet-sub b { color: var(--color-primary); font-weight: 600; }
        .hc-greet-sub .hc-danger { color: var(--color-danger); font-weight: 600; }

        /* Favorites — horizontal strip override */
        .fav-cards-section--strip {
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-2xl);
            padding: 10px 12px;
        }
        .fav-cards-section--strip .fav-cards-header {
            margin-bottom: 8px; padding: 0 4px;
        }
        .fav-cards-section--strip .fav-cards-title {
            font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px;
        }
        .fav-cards-grid--strip {
            display: flex !important; grid-template-columns: none !important;
            overflow-x: auto; gap: 10px; padding: 2px 4px 4px;
            scrollbar-width: thin;
        }
        .fav-cards-grid--strip::-webkit-scrollbar { height: 6px; }
        .fav-cards-grid--strip::-webkit-scrollbar-track { background: transparent; }
        .fav-cards-grid--strip::-webkit-scrollbar-thumb {
            background: var(--color-gray-200); border-radius: 3px;
        }
        .fav-cards-grid--strip .fav-card {
            flex: 0 0 220px; min-height: 0; padding: 10px 12px; border-radius: var(--radius-lg);
            background: var(--color-bg-faint); gap: 6px;
        }
        .fav-cards-grid--strip .fav-card-head .fav-card-title { font-size: 12.5px; }
        .fav-cards-grid--strip .fav-card-stats { gap: 4px; }
        .fav-cards-grid--strip .fav-card-stat { font-size: 10px; padding: 1px 6px; }
        .fav-cards-grid--strip .fav-card-foot { display: none; }

        /* KPI row */
        .hc-kpi-row {
            display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
        }
        .hc-kpi-tile {
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-2xl);
            padding: 14px 18px; cursor: pointer; position: relative; overflow: hidden;
            display: flex; flex-direction: column; gap: 2px;
            transition: var(--transition-fast);
        }
        .hc-kpi-tile:hover { border-color: var(--color-primary); box-shadow: var(--shadow-sm); }
        .hc-kpi-tile::before {
            content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
            background: var(--hc-kpi, var(--color-primary));
        }
        .hc-kpi-tile[data-kind="today"]   { --hc-kpi: var(--color-primary); }
        .hc-kpi-tile[data-kind="overdue"] { --hc-kpi: var(--color-danger); }
        .hc-kpi-tile[data-kind="week"]    { --hc-kpi: var(--color-warning); }
        .hc-kpi-tile[data-kind="mention"] { --hc-kpi: #8B5CF6; }
        .hc-kpi-label { font-size: 11px; color: var(--color-text-secondary); font-weight: 500; }
        .hc-kpi-value {
            font-size: 24px; font-weight: 700; color: var(--hc-kpi, var(--color-text));
            line-height: 1.1;
        }
        .hc-kpi-sub { font-size: 10.5px; color: var(--color-text-muted); }

        /* Main grid */
        .hc-main-grid {
            display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: flex-start;
        }
        .hc-col { display: flex; flex-direction: column; gap: 14px; }

        /* Card */
        .hc-card {
            background: var(--color-surface);
            border: 1px solid var(--color-border-strong);
            border-radius: 10px;
            padding: 16px 18px;
            box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
            transition: border-color 0.15s, background 0.15s;
        }
        .hc-card:hover {
            border-color: var(--color-border-strong);
            background: var(--color-bg-tint);
        }
        .hc-composer-card { padding: 12px 14px; }
        /* Нейтрализуем вложенный .announce-composer — он рисуется внутри hc-card */
        .hc-composer-card > .announce-composer {
            background: transparent;
            border: none;
            border-radius: 0;
            padding: 0;
            box-shadow: none;
        }
        .hc-card-head {
            display: flex; justify-content: space-between; align-items: center;
            margin-bottom: 12px; gap: 10px;
        }
        .hc-card-title {
            font-size: 14px; font-weight: 700; color: var(--color-text);
            display: flex; align-items: center; gap: 8px;
            min-width: 0; flex: 1 1 auto;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .hc-card-more { flex-shrink: 0; }
        .hc-card-icon {
            width: 24px; height: 24px; border-radius: var(--radius-sm);
            display: inline-flex; align-items: center; justify-content: center;
            font-size: 14px;
        }
        .hc-card-icon.blue   { background: var(--color-primary-50); color: var(--color-primary); }
        .hc-card-icon.red    { background: var(--color-danger-50); color: var(--color-danger-text); }
        .hc-card-icon.amber  { background: var(--color-warning-50); color: #92400E; }
        .hc-card-icon.green  { background: var(--color-success-50); color: var(--color-success); }
        .hc-card-icon.purple { background: #F3F0FF; color: #6D28D9; }
        .hc-card-icon.gray   { background: var(--color-gray-100); color: var(--color-gray-700); }
        .hc-card-more {
            font-size: 11px; color: var(--color-primary); font-weight: 600;
            cursor: pointer; background: transparent; border: none; padding: 4px 6px;
            border-radius: var(--radius-sm);
        }
        .hc-card-more:hover { background: var(--color-primary-10); }
        .hc-card-hint { font-size: 10.5px; color: var(--color-text-secondary); }
        .hc-count-pill {
            font-size: 11px; color: var(--color-text-secondary);
            background: var(--color-gray-100); padding: 2px 8px;
            border-radius: var(--radius-pill); font-weight: 600;
        }

        /* Tabs (Мой день) */
        .hc-tabs {
            display: flex; gap: 4px;
            border-bottom: 1px solid var(--color-border);
            margin: -4px 0 10px; overflow-x: auto;
        }
        .hc-tab {
            font-size: 12px; color: var(--color-text-secondary);
            padding: 8px 10px; cursor: pointer; border: none; background: transparent;
            border-bottom: 2px solid transparent; font-weight: 500; white-space: nowrap;
            transition: var(--transition-fast);
        }
        .hc-tab.active {
            color: var(--color-primary); border-bottom-color: var(--color-primary);
            font-weight: 600;
        }
        .hc-tab-count {
            display: inline-block; font-size: 10px; padding: 1px 6px;
            background: var(--color-gray-100); color: var(--color-text-secondary);
            border-radius: var(--radius-pill); margin-left: 4px; font-weight: 700;
        }
        .hc-tab.active .hc-tab-count {
            background: var(--color-primary-50); color: var(--color-primary);
        }
        .hc-tab--danger .hc-tab-count { background: var(--color-danger-50); color: var(--color-danger-text); }

        /* Task list */
        .hc-task-list { display: flex; flex-direction: column; gap: 6px; }
        .hc-task-item {
            display: flex; align-items: center; gap: 10px;
            padding: 10px 12px; border-radius: var(--radius-md);
            border: 1px solid var(--color-border); background: var(--color-bg-faint);
            cursor: pointer; transition: var(--transition-fast);
        }
        .hc-task-item:hover { border-color: var(--color-primary); background: var(--color-primary-10); }
        .hc-task-item.is-overdue { border-color: var(--color-danger-50); background: var(--color-danger-25); }
        .hc-task-check {
            width: 16px; height: 16px; border: 2px solid var(--color-border-strong);
            border-radius: var(--radius-xs); flex-shrink: 0; position: relative;
        }
        .hc-task-item.is-overdue .hc-task-check { border-color: var(--color-danger); }
        .hc-task-check.is-done {
            background: var(--color-success); border-color: var(--color-success);
        }
        .hc-task-check.is-done::after {
            content: "✓"; position: absolute; color: #fff; font-size: 11px; font-weight: 700;
            left: 1px; top: -3px;
        }
        .hc-task-body { flex: 1; min-width: 0; }
        .hc-task-name {
            font-size: 13px; color: var(--color-text); font-weight: 500;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        }
        .hc-task-check.is-done + .hc-task-body .hc-task-name {
            text-decoration: line-through; color: var(--color-text-muted);
        }
        .hc-task-meta {
            font-size: 11px; color: var(--color-text-secondary);
            display: flex; gap: 6px; margin-top: 2px; align-items: center;
        }
        .hc-plan-dot { display: inline-flex; align-items: center; gap: 4px; }
        .hc-plan-dot::before {
            content: ""; width: 6px; height: 6px; border-radius: 50%;
            background: var(--dot, var(--color-primary));
        }
        .hc-task-chip {
            font-size: 10px; font-weight: 600; padding: 2px 7px;
            border-radius: var(--radius-pill); flex-shrink: 0;
        }
        .hc-task-chip--today    { background: var(--color-warning-50); color: #92400E; }
        .hc-task-chip--overdue  { background: var(--color-danger-50); color: var(--color-danger-text); }
        .hc-task-chip--progress { background: var(--color-primary-50); color: var(--color-primary); }
        .hc-task-chip--done     { background: var(--color-success-50); color: var(--color-success); }

        /* Deadlines list */
        .hc-dl-list { display: flex; flex-direction: column; gap: 8px; }
        .hc-dl-item {
            display: flex; gap: 12px; padding: 8px 10px;
            border-left: 3px solid var(--dl, var(--color-primary));
            background: var(--color-bg-faint); border-radius: var(--radius-sm);
            cursor: pointer; transition: var(--transition-fast);
        }
        .hc-dl-item:hover { background: var(--color-primary-10); }
        .hc-dl-date {
            font-size: 10px; text-transform: uppercase; color: var(--color-text-secondary);
            font-weight: 700; min-width: 52px; line-height: 1.2;
        }
        .hc-dl-body { flex: 1; min-width: 0; }
        .hc-dl-title { font-size: 12.5px; color: var(--color-text); font-weight: 500; }
        .hc-dl-meta { font-size: 10.5px; color: var(--color-text-muted); margin-top: 2px; }

        /* Mentions */
        .hc-mention-list { display: flex; flex-direction: column; gap: 4px; }
        .hc-mention-item {
            display: flex; gap: 10px; padding: 9px 8px;
            border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition-fast);
        }
        .hc-mention-item:hover { background: var(--color-gray-50); }
        .hc-mention-item.is-unread { background: var(--color-primary-10); }
        .hc-mention-avatar {
            width: 30px; height: 30px; border-radius: 50%;
            background: var(--color-primary); color: #fff;
            display: flex; align-items: center; justify-content: center;
            font-size: 11px; font-weight: 700; flex-shrink: 0;
        }
        .hc-mention-body { flex: 1; min-width: 0; }
        .hc-mention-line {
            font-size: 12px; color: var(--color-text); line-height: 1.4;
            overflow: hidden; display: -webkit-box;
            -webkit-line-clamp: 2; -webkit-box-orient: vertical;
        }
        .hc-mention-line b { font-weight: 600; }
        .hc-mention-line .hc-tag { color: var(--color-primary); font-weight: 600; }
        .hc-mention-time { font-size: 10px; color: var(--color-text-muted); margin-top: 2px; }
        .hc-mention-dot {
            width: 6px; height: 6px; background: var(--color-primary); border-radius: 50%;
            flex-shrink: 0; align-self: center;
        }

        /* Empty state */
        .hc-empty-state {
            text-align: center; padding: 24px 10px;
            color: var(--color-text-muted); font-size: 12px;
            display: flex; flex-direction: column; align-items: center; gap: 6px;
        }
        .hc-empty-icon { font-size: 28px; }

        /* Feed compact (3 items) */
        .announce-feed--compact { gap: 8px !important; }
        .announce-feed--compact > .announce-card { padding: 10px 12px; }
        .announce-feed--compact > .announce-card:nth-child(n+4) { display: none; }

        /* ===== SAFETY NET против horizontal overflow =====
           Grid/flex children имеют min-width: auto по умолчанию и могут
           выпирать за родителя из-за длинного контента. Явно выставляем 0. */
        .home-layout.home-layout--hc {
            width: 100%;
            box-sizing: border-box;
            overflow-x: hidden;
        }
        .hc-main-grid { width: 100%; min-width: 0; }
        .hc-col { min-width: 0; width: 100%; }
        .hc-card {
            min-width: 0;
            max-width: 100%;
            box-sizing: border-box;
            overflow: hidden;
        }
        .hc-kpi-tile { min-width: 0; max-width: 100%; box-sizing: border-box; }
        .hc-tabs { max-width: 100%; margin-left: 0; margin-right: 0; }
        .fav-cards-section.fav-cards-section--strip {
            box-sizing: border-box;
            max-width: 100%;
            overflow: hidden;
        }

        /* ===== RESPONSIVE (C-layout) ===== */

        /* Tablet: колонки в стек */
        @media (max-width: 1024px) {
            .hc-main-grid { grid-template-columns: 1fr; }
            .home-layout.home-layout--hc { max-width: 860px; }
        }

        /* Tablet narrow / large phone */
        @media (max-width: 720px) {
            .home-layout.home-layout--hc {
                padding: 14px 12px 24px;
                gap: 12px;
            }
            .hc-greet-title { font-size: 18px; letter-spacing: -0.1px; }
            .hc-greet-sub { font-size: 12.5px; line-height: 1.4; }

            /* KPI: 4 → 2x2 сетка, тайлы поменьше */
            .hc-kpi-row { grid-template-columns: 1fr 1fr; gap: 8px; }
            .hc-kpi-tile { padding: 10px 12px; }
            .hc-kpi-label { font-size: 10.5px; }
            .hc-kpi-value { font-size: 20px; }
            .hc-kpi-sub { font-size: 10px; }

            /* Favorites: уже strip — просто ужимаем карточки */
            .fav-cards-section--strip { padding: 8px 10px; }
            .fav-cards-grid--strip .fav-card { flex: 0 0 180px; padding: 9px 11px; gap: 5px; }
            .fav-cards-grid--strip .fav-card-head .fav-card-title { font-size: 12px; }
            .fav-cards-grid--strip .fav-card-stat { font-size: 9.5px; padding: 1px 5px; }

            /* Cards — тоньше рамки по бокам */
            .hc-card { padding: 12px 14px; border-radius: var(--radius-xl); }
            .hc-composer-card { padding: 10px 12px; }
            .hc-card-head { margin-bottom: 10px; }
            .hc-card-title { font-size: 13px; }
            .hc-count-pill { font-size: 10px; padding: 1px 6px; }
            .hc-card-more { font-size: 11px; padding: 6px 4px; }

            /* Columns stack with smaller gap */
            .hc-col { gap: 10px; }

            /* My Day tabs — tap targets крупнее, скроллабельно */
            .hc-tabs {
                margin: -2px 0 8px;
                padding: 0;
                max-width: 100%;
                -webkit-overflow-scrolling: touch;
            }
            .hc-tab {
                padding: 10px 12px;
                font-size: 12px;
                min-height: 40px;
            }
            .hc-tab-count { font-size: 9.5px; padding: 1px 5px; }

            /* Task item — крупнее tap target, читаемые meta */
            .hc-task-item { padding: 11px 10px; gap: 9px; }
            .hc-task-check { width: 18px; height: 18px; }
            .hc-task-name { font-size: 13px; }
            .hc-task-meta {
                font-size: 10.5px; flex-wrap: wrap; gap: 4px;
            }
            .hc-task-chip { font-size: 9.5px; padding: 2px 6px; }

            /* Deadlines — компактнее */
            .hc-dl-item { padding: 8px 9px; gap: 10px; }
            .hc-dl-date { min-width: 42px; font-size: 9.5px; }
            .hc-dl-title { font-size: 12px; }
            .hc-dl-meta { font-size: 10px; }

            /* Mentions */
            .hc-mention-item { padding: 10px 8px; gap: 8px; }
            .hc-mention-avatar { width: 28px; height: 28px; font-size: 10px; }
            .hc-mention-line { font-size: 11.5px; line-height: 1.35; }
            .hc-mention-time { font-size: 9.5px; }

            /* Composer — в две строки (top + chips), chips равномерно */
            .announce-composer { flex-direction: column; align-items: stretch; gap: 8px; padding: 4px; }
            .announce-composer-top { display: flex; gap: 10px; align-items: center; }
            .announce-composer-top .announce-input-fake { flex: 1; }
            .announce-chips { display: flex; gap: 6px; flex-wrap: wrap; }
            .announce-chip { flex: 1; min-width: 0; font-size: 11px; padding: 7px 8px; justify-content: center; }

            /* Feed — компактные карточки */
            .announce-feed--compact .announce-card,
            .announce-feed .announce-card { padding: 10px 12px; }

            /* Plan chat — sidebar в одной колонке */
            .plan-chat-block { padding: 12px 14px; }
            .plan-chat-body { grid-template-columns: 1fr; gap: 10px; }
            .pc-sidebar { max-height: 260px; }
            .pc-pane { min-height: 300px; }
        }

        /* Phone */
        @media (max-width: 480px) {
            .home-layout.home-layout--hc { padding: 12px 10px 24px; gap: 10px; }
            .hc-greet-title { font-size: 17px; }

            /* KPI — тайлы ещё ниже */
            .hc-kpi-row { gap: 6px; }
            .hc-kpi-tile { padding: 9px 11px; }
            .hc-kpi-value { font-size: 19px; }

            /* Favorites strip — карточки 160px */
            .fav-cards-grid--strip .fav-card { flex: 0 0 160px; min-height: 0; }

            /* Cards тоньше */
            .hc-card { padding: 11px 12px; }

            /* Greeting может переноситься */
            .hc-greet { flex-direction: column; align-items: stretch; gap: 4px; }

            /* Меньше My Day задач видно разом — ок, скроллится */
            .hc-task-name { white-space: normal; line-height: 1.3; }

            /* Композер — chips 3 в ряд */
            .announce-chip { font-size: 10.5px; padding: 6px 4px; }
        }

        /* Very small phone (<360px) */
        @media (max-width: 360px) {
            .hc-kpi-row { grid-template-columns: 1fr 1fr; }
            .hc-kpi-value { font-size: 17px; }
            .hc-kpi-label { font-size: 10px; }
            .hc-tab { padding: 8px 8px; font-size: 11.5px; }
            .hc-task-name { font-size: 12.5px; }
            .fav-cards-grid--strip .fav-card { flex: 0 0 150px; }
        }

        /* ===== PAGE HELP ICON (?) В ШАПКЕ + TOOLTIP =====
           Справа от #pageHeaderTitle. Data-help подгружается на каждое
           переключение вкладки из tabTitles[name].help. Сам tooltip рендерится
           JS-ом на уровне body (position:fixed) — чтобы не обрезался
           родителями с overflow. */
        .page-help {
            width: 26px;
            height: 26px;
            min-width: 26px;
            border-radius: 50%;
            background: var(--color-primary-10);
            color: var(--color-primary);
            border: 1.5px solid var(--color-primary-50);
            display: inline-grid;
            place-items: center;
            font-size: 16px;
            font-weight: 700;
            line-height: 1;
            text-align: center;
            cursor: help;
            flex-shrink: 0;
            user-select: none;
            font-family: var(--font-sans);
            transition: background 0.15s, color 0.15s, transform 0.15s, border-color 0.15s;
            /* Лёгкий сдвиг вниз через асимметричный padding — компенсация
               верхнего bearing глифа "?" (визуально кажется приподнятым). */
            padding: 5px 0 0 0;
            box-sizing: border-box;
            vertical-align: middle;
        }
        /* Inline SVG в HTML внутри .page-help — flex-родитель центрирует
           SVG идеально, без зависимости от font metrics. Цвет иконки
           берётся из currentColor (color родителя). */
        .page-help svg { display: block; }
        .page-help:hover,
        .page-help:focus-visible {
            background: var(--color-primary);
            color: #fff;
            border-color: var(--color-primary);
            outline: none;
            transform: scale(1.1);
            box-shadow: 0 2px 8px rgba(21, 101, 192, 0.35);
        }

        /* Floating tooltip — рендерится JS-ом (используется и для .page-help, и для legacy .side-help) */
        .side-tooltip {
            position: fixed;
            background: var(--color-nav-bg);
            color: rgba(255, 255, 255, 0.95);
            padding: 10px 14px;
            border-radius: var(--radius-lg);
            max-width: 320px;
            font-size: 12.5px;
            font-weight: 400;
            line-height: 1.45;
            box-shadow: var(--shadow-xl);
            z-index: 9999;
            pointer-events: none;
            opacity: 0;
            transform: translateY(-4px);
            transition: opacity 0.12s ease, transform 0.12s ease;
        }
        .side-tooltip.visible {
            opacity: 1;
            transform: translateY(0);
        }
        /* Стрелка — сверху по центру, направлена вверх (tooltip под иконкой "?") */
        .side-tooltip::before {
            content: '';
            position: absolute;
            top: -5px;
            left: var(--arrow-left, 14px);
            width: 10px;
            height: 10px;
            background: var(--color-nav-bg);
            transform: rotate(45deg);
            border-radius: 2px;
        }
        /* Если tooltip не поместился снизу — JS ставит data-placement="top", стрелка снизу */
        .side-tooltip[data-placement="top"]::before {
            top: auto;
            bottom: -5px;
        }

        /* Mobile: при открытом drawer-сайдбаре tooltip справа тоже работает */
        @media (max-width: 768px) {
            .side-tooltip { max-width: 240px; font-size: 12px; padding: 9px 12px; }
        }

        /* ===== TAB VISIBILITY SETTINGS ===== */
        .side-link--user-hidden,
        .mobile-chip--user-hidden { display: none !important; }

        .side-link-settings {
            opacity: 0.75;
            font-size: 12px;
        }
        .side-link-settings:hover { opacity: 1; }

        .tabs-settings-modal {
            max-width: 440px;
            padding: 22px 24px;
        }
        .tabs-settings-title {
            font-size: 18px; font-weight: 700; color: var(--color-text);
            margin-bottom: 4px;
        }
        .tabs-settings-hint {
            font-size: 12px; color: var(--color-text-secondary);
            margin-bottom: 16px; line-height: 1.4;
        }
        .tabs-settings-list {
            display: flex; flex-direction: column; gap: 4px;
            max-height: 420px; overflow-y: auto;
            margin-bottom: 16px;
            padding: 4px;
            background: var(--color-bg-faint); border-radius: var(--radius-lg);
        }
        .tabs-settings-row {
            display: flex; align-items: center; gap: 10px;
            padding: 9px 12px; border-radius: var(--radius-md);
            cursor: pointer; transition: background var(--transition-fast);
        }
        .tabs-settings-row:hover { background: var(--color-primary-10); }
        .tabs-settings-row.is-locked {
            cursor: default; opacity: 0.7;
        }
        .tabs-settings-row.is-locked:hover { background: transparent; }
        .tabs-settings-row input[type="checkbox"] {
            width: 16px; height: 16px; cursor: pointer; accent-color: var(--color-primary);
        }
        .tabs-settings-row.is-locked input { cursor: not-allowed; }
        .tabs-settings-label {
            flex: 1; font-size: 13px; color: var(--color-text); font-weight: 500;
        }
        .tabs-settings-lock {
            font-size: 10px; color: var(--color-text-muted);
            padding: 2px 7px; background: var(--color-gray-100);
            border-radius: var(--radius-pill); font-weight: 600;
            text-transform: uppercase; letter-spacing: 0.3px;
        }
        .tabs-settings-footer {
            display: flex; justify-content: space-between; align-items: center;
            gap: 10px; flex-wrap: wrap;
        }
        .tabs-settings-actions { display: flex; gap: 8px; }

        /* ===== KANBAN WIZARD ===== */
        .kb-wizard .kb-stepper {
            display: flex; align-items: center; gap: 6px;
            margin: 4px 0 16px;
        }
        .kb-step-dot {
            display: flex; align-items: center; gap: 8px;
            color: var(--color-gray-400); font-size: 12px; flex-shrink: 0;
        }
        .kb-step-dot span {
            display: flex; align-items: center; justify-content: center;
            width: 24px; height: 24px; border-radius: 50%;
            background: var(--color-gray-100); color: var(--color-gray-400); font-weight: 700; font-size: 12px;
            border: 1.5px solid var(--color-border);
        }
        .kb-step-dot label { font-weight: 500; cursor: default; }
        .kb-step-dot.is-active span { background: var(--color-primary); color: var(--color-surface); border-color: var(--color-primary); }
        .kb-step-dot.is-active label { color: var(--color-primary); font-weight: 600; }
        .kb-step-dot.is-done span {
            background: var(--color-success-50); color: var(--color-success); border-color: #c8e6c9;
        }
        .kb-step-line {
            flex: 1; height: 2px; background: var(--color-border); border-radius: 999px;
        }
        .kb-step-pane { display: block; }
        .kb-step-hint {
            font-size: 11px; color: var(--color-text-secondary); margin-top: 4px;
        }
        .kb-roadmap-toggle {
            display: flex; align-items: center; gap: 8px;
            padding: 10px 12px; margin-top: 6px;
            background: var(--color-bg-tint); border: 1px solid var(--color-border); border-radius: 8px;
            font-size: 13px; color: var(--color-text-strong); cursor: pointer;
        }
        .kb-roadmap-toggle input { margin: 0; cursor: pointer; }
        .kb-wizard-nav { display: flex; gap: 8px; justify-content: flex-end; }

        /* ===== KANBAN LINKED ROADMAP CHIP ===== */
        .kb-card-linked {
            display: inline-flex; align-items: center; gap: 5px;
            margin: 6px 0 0; padding: 4px 9px;
            background: #ecfdf5; color: #047857;
            border: 1px solid #a7f3d0; border-radius: 999px;
            font-size: 11px; font-weight: 600;
            cursor: pointer; transition: background 0.15s, border-color 0.15s;
            max-width: 100%;
        }
        .kb-card-linked:hover { background: #d1fae5; border-color: #6ee7b7; }
        .kb-card-linked-ico { font-size: 12px; line-height: 1; }
        .kb-card-linked-text {
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
            max-width: 180px;
        }

        /* ===== KANBAN DUE DATE CHIP ===== */
        .kb-card-due {
            display: inline-flex; align-items: center; gap: 5px;
            margin: 6px 0 0; padding: 3px 9px;
            background: #eff6ff; color: #1e40af;
            border: 1px solid #bfdbfe; border-radius: 999px;
            font-size: 11px; font-weight: 600;
        }
        .kb-card-due.is-soon    { background: #fef3c7; color: #92400e; border-color: #fde68a; }
        .kb-card-due.is-overdue { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
        .kb-card-due-ico { width: 13px; height: 13px; flex-shrink: 0; }

        /* Подсветка строки задачи в дорожной карте при переходе из канбана */
        @keyframes kbLinkedFlash {
            0%   { background: var(--color-warning-50); }
            60%  { background: #fef9c3; }
            100% { background: transparent; }
        }
        tr.kb-linked-flash > td { animation: kbLinkedFlash 2.2s ease-out; }

        /* ===== PLAN CHAT ON HOME ===== */
        .plan-chat-block {
            background: var(--color-surface);
            border: 1px solid var(--color-border-strong);
            border-radius: 10px;
            padding: 16px 18px;
            display: flex;
            flex-direction: column;
            gap: 12px;
            min-height: 460px;
            box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
        }
        .plan-chat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
        .plan-chat-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--color-text); }
        .plan-chat-hint { font-size: 12px; color: var(--color-text-secondary); }
        .plan-chat-body {
            display: grid;
            grid-template-columns: 240px 1fr;
            gap: 14px;
            min-height: 400px;
        }
        .pc-sidebar {
            display: flex; flex-direction: column; gap: 8px;
            background: var(--color-gray-50);
            border: 1px solid var(--color-bg-subtle);
            border-radius: 12px;
            padding: 10px;
            min-height: 0;
        }
        .pc-search-wrap { display: flex; }
        .pc-search {
            width: 100%;
            border: 1px solid var(--color-border);
            border-radius: 8px;
            padding: 7px 10px;
            font-size: 12px;
            background: var(--color-surface);
            outline: none;
        }
        .pc-search:focus { border-color: var(--color-primary); }
        .pc-rooms-list { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 4px; max-height: 420px; }
        .pc-rooms-empty { font-size: 12px; color: var(--color-gray-400); padding: 8px; text-align: center; }
        .pc-room {
            display: flex; flex-direction: column; gap: 2px;
            padding: 8px 10px;
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.12s;
            position: relative;
        }
        .pc-room:hover { background: var(--color-primary-25); }
        .pc-room.is-active { background: var(--color-primary-50); }
        .pc-room-top { display: flex; align-items: center; gap: 6px; }
        .pc-room-star { font-size: 11px; color: #f5b301; }
        .pc-room-name {
            font-size: 12px; font-weight: 600; color: var(--color-text);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
            flex: 1;
        }
        .pc-room-unread {
            background: var(--color-primary); color: var(--color-surface); font-size: 10px; font-weight: 700;
            border-radius: 999px; padding: 1px 6px; min-width: 18px; text-align: center;
        }
        .pc-room-last {
            font-size: 11px; color: var(--color-text-secondary);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .pc-room-meta { font-size: 10px; color: var(--color-gray-400); }

        .pc-pane {
            display: flex; flex-direction: column;
            background: var(--color-bg-faint);
            border: 1px solid var(--color-bg-subtle);
            border-radius: 12px;
            min-height: 400px;
            position: relative;
        }
        .pc-pane-head {
            padding: 10px 14px;
            border-bottom: 1px solid var(--color-bg-subtle);
            background: var(--color-surface);
            border-radius: 12px 12px 0 0;
        }
        .pc-pane-title { font-size: 13px; font-weight: 700; color: var(--color-text); }
        .pc-pane-sub  { font-size: 11px; color: var(--color-text-secondary); margin-top: 2px; }
        .pc-messages {
            flex: 1; overflow-y: auto; padding: 12px 14px;
            display: flex; flex-direction: column; gap: 10px;
            max-height: 360px;
        }
        .pc-msg {
            display: flex; gap: 8px; align-items: flex-start;
        }
        .pc-msg.is-own { flex-direction: row-reverse; }
        .pc-msg-avatar {
            width: 28px; height: 28px; border-radius: 50%;
            background: #e0e7ff; color: #3949ab;
            display: flex; align-items: center; justify-content: center;
            font-size: 11px; font-weight: 700; flex-shrink: 0;
        }
        .pc-msg-bubble {
            background: var(--color-surface); border: 1px solid var(--color-border);
            border-radius: 12px;
            padding: 7px 11px;
            max-width: 70%;
            font-size: 12px; color: var(--color-text);
            position: relative;
        }
        .pc-msg.is-own .pc-msg-bubble { background: var(--color-primary-50); border-color: #bfdbfe; }
        .pc-msg-author { font-size: 10px; font-weight: 700; color: var(--color-text-secondary); margin-bottom: 2px; }
        .pc-msg.is-own .pc-msg-author { text-align: right; color: #1e40af; }
        .pc-msg-text { white-space: pre-wrap; word-break: break-word; }
        .pc-msg-time { font-size: 9px; color: var(--color-gray-400); margin-top: 3px; text-align: right; }
        .pc-msg-mention { background: var(--color-warning-50); color: #92400e; padding: 0 3px; border-radius: 3px; font-weight: 600; }
        .pc-msg-file {
            display: inline-flex; align-items: center; gap: 6px;
            margin-top: 4px; padding: 5px 9px;
            background: var(--color-gray-100); border-radius: 8px;
            text-decoration: none; color: var(--color-primary); font-size: 11px;
        }
        .pc-msg-file img { max-width: 200px; max-height: 200px; border-radius: 6px; display: block; }
        .pc-msg-reactions {
            display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px;
        }
        .pc-msg-reaction {
            display: inline-flex; align-items: center; gap: 3px;
            background: var(--color-surface); border: 1px solid var(--color-border);
            border-radius: 999px; padding: 1px 7px;
            font-size: 11px; cursor: pointer;
            transition: background 0.12s;
        }
        .pc-msg-reaction:hover { background: var(--color-gray-100); }
        .pc-msg-reaction.is-mine { background: var(--color-primary-25); border-color: #bfdbfe; color: #1e40af; }
        .pc-msg-react-btn {
            opacity: 0; transition: opacity 0.12s;
            background: var(--color-surface); border: 1px solid var(--color-border);
            border-radius: 999px; padding: 1px 7px;
            font-size: 11px; cursor: pointer;
            margin-top: 4px;
        }
        .pc-msg:hover .pc-msg-react-btn { opacity: 0.8; }
        .pc-msg-react-btn:hover { opacity: 1 !important; background: var(--color-gray-100); }

        .pc-input-row {
            position: relative;
            display: flex; gap: 6px; align-items: flex-end;
            padding: 10px 14px;
            border-top: 1px solid var(--color-bg-subtle);
            background: var(--color-surface);
            border-radius: 0 0 12px 12px;
        }
        .pc-attach-btn, .pc-emoji-btn, .pc-send-btn {
            border: none; background: transparent;
            cursor: pointer; font-size: 16px;
            width: 32px; height: 32px;
            display: flex; align-items: center; justify-content: center;
            border-radius: 6px; transition: background 0.12s;
            flex-shrink: 0;
        }
        .pc-attach-btn:hover, .pc-emoji-btn:hover { background: var(--color-gray-100); }
        .pc-send-btn { color: var(--color-primary); font-size: 18px; }
        .pc-send-btn:hover { background: var(--color-primary-25); }
        .pc-input {
            flex: 1; resize: none; border: 1px solid var(--color-border);
            border-radius: 8px; padding: 7px 10px;
            font-size: 12px; font-family: inherit;
            max-height: 100px; line-height: 1.4;
            outline: none;
        }
        .pc-input:focus { border-color: var(--color-primary); }

        .pc-mention-popup, .pc-emoji-popup {
            position: absolute;
            bottom: 100%; left: 50px;
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: 10px;
            box-shadow: 0 8px 24px rgba(0,0,0,0.12);
            padding: 6px;
            z-index: 100;
            max-height: 200px; overflow-y: auto;
        }
        .pc-mention-popup { min-width: 180px; }
        .pc-mention-item {
            padding: 6px 10px;
            font-size: 12px; cursor: pointer;
            border-radius: 6px;
        }
        .pc-mention-item:hover, .pc-mention-item.is-active { background: var(--color-primary-25); }
        .pc-emoji-popup {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 2px;
        }
        .pc-emoji-popup span {
            cursor: pointer;
            font-size: 18px;
            width: 32px; height: 32px;
            display: flex; align-items: center; justify-content: center;
            border-radius: 6px;
        }
        .pc-emoji-popup span:hover { background: var(--color-gray-100); }

        @media (max-width: 768px) {
            .plan-chat-body { grid-template-columns: 1fr; }
            .pc-sidebar { max-height: 200px; }
            .pc-pane { min-height: 300px; }
        }

        /* ===== TOAST NOTIFICATIONS ===== */
        .toast-container {
            position: fixed;
            right: 20px;
            bottom: 20px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            z-index: 10000;
            pointer-events: none;
            max-width: calc(100vw - 40px);
        }
        .toast {
            pointer-events: auto;
            display: flex;
            align-items: flex-start;
            gap: 10px;
            min-width: 260px;
            max-width: 420px;
            padding: 12px 14px 12px 12px;
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-left: 4px solid var(--color-text-secondary);
            border-radius: 10px;
            box-shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
            font-size: 13px;
            color: var(--color-text);
            opacity: 0;
            transform: translateX(30px);
            transition: opacity 0.22s ease, transform 0.22s ease;
        }
        .toast--visible {
            opacity: 1;
            transform: translateX(0);
        }
        .toast--leaving {
            opacity: 0;
            transform: translateX(30px);
        }
        .toast-ico {
            flex-shrink: 0;
            width: 22px;
            height: 22px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 13px;
            font-weight: 700;
            color: var(--color-surface);
            background: var(--color-text-secondary);
            margin-top: 1px;
        }
        .toast-msg {
            flex: 1;
            line-height: 1.4;
            word-break: break-word;
        }
        .toast-close {
            flex-shrink: 0;
            background: transparent;
            border: none;
            color: var(--color-gray-400);
            font-size: 18px;
            line-height: 1;
            cursor: pointer;
            padding: 0 2px;
            border-radius: 4px;
            transition: color 0.12s, background 0.12s;
        }
        .toast-close:hover { color: var(--color-text-strong); background: var(--color-gray-100); }

        .toast--success { border-left-color: var(--color-success-500); }
        .toast--success .toast-ico { background: var(--color-success-500); }

        .toast--error { border-left-color: var(--color-danger-500); }
        .toast--error .toast-ico { background: var(--color-danger-500); }

        .toast--warning { border-left-color: var(--color-warning); }
        .toast--warning .toast-ico { background: var(--color-warning); }

        .toast--info { border-left-color: var(--color-primary-400); }
        .toast--info .toast-ico { background: var(--color-primary-400); }

        @media (max-width: 480px) {
            .toast-container {
                right: 10px;
                left: 10px;
                bottom: 10px;
            }
            .toast { min-width: 0; max-width: 100%; }
        }

        .announce-composer {
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: 20px;
            padding: 20px;
            box-shadow: 0 4px 18px rgba(15,23,42,0.06);
        }
        .announce-composer-top {
            display: flex;
            align-items: center;
            gap: 14px;
        }
        .announce-avatar {
            width: 44px; height: 44px; border-radius: 50%;
            background: linear-gradient(135deg, var(--color-primary), var(--color-primary-500));
            color: var(--color-surface); display: flex; align-items: center;
            justify-content: center; font-weight: 700;
            font-size: 15px; flex-shrink: 0;
        }
        .announce-input-fake {
            flex: 1;
            background: var(--color-gray-100);
            border: none;
            border-radius: 999px;
            padding: 13px 20px;
            font-size: 14px;
            cursor: pointer;
            color: var(--color-text-secondary);
            text-align: left;
            transition: background 0.2s;
        }
        .announce-input-fake:hover { background: #e9ecef; }
        .announce-chips {
            display: flex; gap: 10px; flex-wrap: wrap;
            margin-top: 14px; padding-top: 14px;
            border-top: 1px solid var(--color-bg-subtle);
        }
        .announce-chip {
            background: var(--color-bg-tint); border: 1px solid var(--color-border);
            border-radius: 999px; padding: 8px 16px;
            font-size: 13px; color: #4b5563; cursor: pointer;
            transition: all 0.18s; font-family: inherit;
        }
        .announce-chip:hover { background: #e8f4fd; border-color: var(--color-primary); color: var(--color-primary); }

        .announce-feed { display: flex; flex-direction: column; gap: 16px; }

        .announce-card {
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: 20px;
            padding: 20px;
            box-shadow: 0 4px 18px rgba(15,23,42,0.05);
            transition: box-shadow 0.2s;
        }
        .announce-card:hover { box-shadow: 0 6px 24px rgba(15,23,42,0.1); }

        .announce-card-head {
            display: flex; align-items: center;
            justify-content: space-between; margin-bottom: 14px;
        }
        .announce-card-author {
            display: flex; align-items: center; gap: 12px;
        }
        .announce-card-name { font-weight: 700; font-size: 14px; color: var(--color-text); }
        .announce-card-time { font-size: 12px; color: var(--color-gray-400); margin-top: 2px; }

        .announce-type-badge {
            display: inline-flex; align-items: center; gap: 5px;
            padding: 4px 12px; border-radius: 999px;
            font-size: 11px; font-weight: 700;
            text-transform: uppercase; letter-spacing: 0.4px;
        }
        .type-news     { background: var(--color-primary-50); color: var(--color-primary-strong); }
        .type-alert    { background: var(--color-danger-50); color: var(--color-danger-700); }
        .type-reminder { background: var(--color-warning-50); color: #b45309; }

        .announce-card-title {
            font-weight: 700; font-size: 16px;
            color: var(--color-text); margin-bottom: 8px;
        }
        .announce-card-text {
            font-size: 14px; line-height: 1.65;
            color: var(--color-text-strong); white-space: pre-wrap;
        }
        .announce-card-footer {
            display: flex; align-items: center;
            justify-content: space-between;
            margin-top: 14px; padding-top: 12px;
            border-top: 1px solid var(--color-bg-subtle);
        }
        .announce-card-plan {
            font-size: 12px; color: var(--color-gray-400);
        }
        .announce-card-del {
            border: none; background: none; color: var(--color-border-strong);
            font-size: 18px; cursor: pointer; padding: 0 4px;
            transition: color 0.2s; line-height: 1;
        }
        .announce-card-del:hover { color: var(--color-danger); }

        .announce-empty {
            text-align: center; padding: 56px 24px;
            color: var(--color-gray-400); font-size: 15px;
            border: 2px dashed var(--color-border);
            border-radius: 20px; background: var(--color-surface);
        }
        .announce-empty span { font-size: 40px; display: block; margin-bottom: 12px; }

        /* ===== ANNOUNCE MODAL ===== */
        .announce-modal-wrap {
            display: none; position: fixed;
            inset: 0; background: rgba(15,23,42,0.45);
            z-index: 1000; align-items: center; justify-content: center;
            padding: 20px;
        }
        .announce-modal-wrap.active { display: flex; }
        .announce-modal {
            width: 100%; max-width: 560px;
            background: var(--color-surface); border-radius: 20px;
            padding: 28px; box-shadow: 0 20px 60px rgba(15,23,42,0.2);
        }
        .announce-modal h3 { font-size: 20px; margin-bottom: 18px; color: var(--color-text); }
        .announce-modal label {
            display: block; font-size: 13px; font-weight: 600;
            color: var(--color-text-strong); margin: 14px 0 6px;
        }
        .announce-modal input,
        .announce-modal textarea,
        .announce-modal select {
            width: 100%; border: 1px solid var(--color-border-strong);
            border-radius: 10px; padding: 11px 14px;
            font: inherit; font-size: 14px; outline: none;
            transition: border-color 0.2s;
        }
        .announce-modal input:focus,
        .announce-modal textarea:focus,
        .announce-modal select:focus { border-color: var(--color-primary); }
        .announce-modal textarea { min-height: 140px; resize: vertical; }
        .announce-modal-actions {
            display: flex; justify-content: flex-end;
            gap: 10px; margin-top: 20px;
        }
        .ann-btn-cancel {
            border: none; padding: 11px 18px; border-radius: 10px;
            background: var(--color-gray-100); color: var(--color-text-strong); font-size: 14px;
            font-weight: 600; cursor: pointer;
        }
        .ann-btn-submit {
            border: none; padding: 11px 22px; border-radius: 10px;
            background: var(--color-primary); color: var(--color-surface); font-size: 14px;
            font-weight: 600; cursor: pointer;
        }
        .ann-btn-submit:hover { background: var(--color-primary-dark); }

        /* type selector chips inside modal */
        .type-chips { display: flex; gap: 8px; flex-wrap: wrap; }
        .type-chip {
            border: 2px solid var(--color-border); border-radius: 999px;
            padding: 7px 16px; font-size: 13px; font-weight: 600;
            cursor: pointer; transition: all 0.18s; background: var(--color-surface);
            font-family: inherit;
        }
        .type-chip.selected-news     { background: var(--color-primary-50); border-color: var(--color-primary-strong); color: var(--color-primary-strong); }
        .type-chip.selected-alert    { background: var(--color-danger-50); border-color: var(--color-danger-700); color: var(--color-danger-700); }
        .type-chip.selected-reminder { background: var(--color-warning-50); border-color: #b45309; color: #b45309; }

        /* Header icon transition */
        header:hover #pageHeaderIcon {
            transform: scale(1.04);
        }

        /* ===== Мобильная навигация (вариант A+C): hamburger + chip bar ===== */
        /* Скрыто по умолчанию — показывается только на мобильных */
        .mobile-hamburger {
            display: none;
            width: 32px;
            height: 32px;
            align-items: center;
            justify-content: center;
            background: transparent;
            border: none;
            font-size: 20px;
            line-height: 1;
            color: var(--color-text-strong);
            cursor: pointer;
            border-radius: 8px;
            padding: 0;
            flex-shrink: 0;
            font-family: inherit;
        }
        .mobile-hamburger:active { background: var(--color-border); }

        .mobile-chip-bar {
            display: none;
            gap: 4px;
            padding: 6px calc(10px + env(safe-area-inset-right, 0px)) 6px calc(10px + env(safe-area-inset-left, 0px));
            overflow-x: auto;
            background: var(--color-surface);
            border-bottom: 1px solid #f0f0f0;
            flex-shrink: 0;
            scrollbar-width: none;
            -webkit-overflow-scrolling: touch;
        }
        .mobile-chip-bar::-webkit-scrollbar { display: none; }
        .mobile-chip {
            flex-shrink: 0;
            padding: 5px 11px;
            border-radius: 999px;
            background: var(--color-gray-100);
            font-size: 11px;
            color: var(--color-text-secondary);
            font-weight: 600;
            white-space: nowrap;
            cursor: pointer;
            border: none;
            font-family: inherit;
            transition: background 0.15s, color 0.15s;
        }
        .mobile-chip:active { background: var(--color-border); }
        .mobile-chip.active {
            background: var(--color-primary);
            color: var(--color-surface);
        }

        .mobile-nav-backdrop { display: none; }
        .sidebar-logout-wrap { display: none; }

        /* ===== АДАПТИВНОСТЬ ДЛЯ МОБИЛЬНЫХ ===== */
        @media (max-width: 768px) {

            /* ── Header: компактный, 52px ── */
            header {
                height: 52px;
                padding: 0 calc(12px + env(safe-area-inset-right, 0px)) 0 calc(12px + env(safe-area-inset-left, 0px));
                gap: 6px;
                overflow: visible;
                width: 100%;
                /* 100vw на iOS Safari включает safe-area → шапка выходит
                   за видимую область, видится «сдвиг вправо» в Simulator.
                   В Chrome Responsive mode этого не происходит. Используем 100%. */
                max-width: 100%;
                box-shadow: 0 1px 4px rgba(15,23,42,0.06);
            }
            header > div:first-child {
                gap: 8px !important;
                min-width: 0;
                flex: 1;
            }
            header > div:last-child {
                flex-shrink: 0;
                gap: 10px !important;
            }
            /* Иконка страницы — скрыта, навигация через чипы */
            #pageHeaderIcon { display: none !important; }
            header h1 {
                font-size: 16px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
            /* Подзаголовок */
            #pageHeaderSubtitle { display: none !important; }
            #progressWrap { display: none; }
            #mobilePlanSelectorWrap { display: flex; }
            /* User info */
            .user-info .user-name { display: none; }
            .user-info { gap: 6px; flex-shrink: 0; }
            .user-info .btn-logout { display: none; }
            #userLevelBadge { display: none !important; }
            .user-info .user-avatar {
                width: 30px;
                height: 30px;
                font-size: 11px;
            }
            /* Notifications bell */
            .notif-btn {
                width: 30px;
                height: 30px;
            }
            .notif-btn-icon-img {
                width: 20px;
                height: 20px;
            }

            /* ── Toolbar ── */
            .toolbar {
                padding: 8px 12px;
                gap: 6px;
                flex-wrap: wrap;
                border-bottom: 1px solid #f0f0f0;
                box-shadow: none;
            }
            .toolbar button {
                padding: 7px 10px;
                font-size: 11px;
                border-radius: 8px;
            }
            .toolbar .btn-toolbar-add {
                width: 100%;
                order: -1;
                padding: 10px;
                font-size: 13px;
                font-weight: 600;
                border-radius: 10px;
                background: linear-gradient(135deg, var(--color-success), #43a047);
                color: var(--color-surface);
                box-shadow: 0 2px 6px rgba(46,125,50,0.2);
            }
            .toolbar .btn-add-phase {
                width: 100%;
                order: -1;
                padding: 9px;
                border-radius: 10px;
                font-size: 12px;
            }
            .toolbar .btn-expand,
            .toolbar .btn-collapse {
                flex: 1;
                text-align: center;
                padding: 7px 4px;
                font-size: 11px;
            }
            .filter-group {
                margin-left: 0;
                width: 100%;
                gap: 4px;
                order: 10;
            }
            .filter-group label { font-size: 11px; }
            .filter-group select {
                font-size: 12px;
                padding: 7px 8px;
                flex: 1;
                border-radius: 8px;
            }

            /* Stats bar */
            .stats-bar { padding: 8px 14px; gap: 10px; }
            .stat-item { font-size: 12px; }

            /* Tabs */
            .tabs {
                padding: 0 4px;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
                flex-wrap: nowrap;
                scrollbar-width: none;
            }
            .tabs::-webkit-scrollbar { display: none; }
            .tab { padding: 10px 12px; font-size: 12px; white-space: nowrap; }

            /* Tab content */
            .tab-content { padding: 8px 6px; }

            /* Sidebar: drawer on mobile (вариант A+C) */
            .sidebar-nav {
                position: fixed;
                width: 280px;
                max-width: 85%;
                height: 100%;
                top: 0;
                bottom: 0;
                left: 0;
                flex-direction: column;
                overflow-y: auto;
                overflow-x: hidden;
                transform: translateX(-100%);
                transition: transform 0.25s ease;
                z-index: 200;
            }
            .sidebar-nav.open { transform: translateX(0); }
            .sidebar-nav:hover { width: 280px; }
            .sidebar-brand { display: flex; }
            .sidebar-profile { display: block; }
            .sidebar-brand-label,
            .side-label,
            .sidebar-profile-meta { opacity: 1; }
            .sidebar-menu {
                flex-direction: column;
                align-items: stretch;
                padding: 12px 8px;
                width: 100%;
                overflow-y: auto;
                overflow-x: hidden;
            }
            .side-link {
                justify-content: flex-start;
                min-width: 0;
                padding: 10px 12px;
            }
            .side-label { display: inline; }
            .main-area {
                padding-left: 0;
                padding-bottom: 0;
            }

            /* Mobile hamburger / chip bar / backdrop */
            .mobile-hamburger { display: inline-flex; }
            .mobile-chip-bar { display: flex; }
            .mobile-nav-backdrop {
                display: block;
                position: fixed;
                inset: 0;
                background: rgba(0,0,0,0.4);
                z-index: 190;
                opacity: 0;
                pointer-events: none;
                transition: opacity 0.25s ease;
            }
            .mobile-nav-backdrop.open {
                opacity: 1;
                pointer-events: auto;
            }

            /* Logout в сайдбаре на мобильных */
            .sidebar-logout-wrap {
                display: block;
                margin-top: auto;
                padding: 8px 0;
                border-top: 1px solid rgba(255,255,255,0.08);
            }
            .sidebar-logout-btn {
                color: rgba(255,255,255,0.6) !important;
            }
            .sidebar-logout-btn:hover {
                color: var(--color-danger-500) !important;
                background: rgba(239,68,68,0.1) !important;
            }

            /* ===== ПЛАН: карточки на мобильных (вариант A+C) ===== */
            .plan-table-wrap {
                overflow-x: visible;
                border-radius: 0;
                background: none;
                box-shadow: none;
            }
            .plan-table {
                white-space: normal;
                background: transparent;
            }
            .plan-table thead { display: none; }
            .plan-table,
            .plan-table tbody { display: block; width: 100%; }

            /* — Фаза — */
            .phase-row { display: block; margin: 10px 0 4px; }
            .phase-row td {
                display: block;
                border-radius: 8px;
                padding: 9px 12px !important;
                font-size: 12px;
            }
            .phase-row .plan-drag-handle { display: none; }
            .phase-progress { font-size: 11px; }

            /* — Этап — */
            .step-row { display: block; margin: 4px 0 3px; }
            .step-row td { display: none; }
            .step-row td[colspan] {
                display: block;
                padding: 7px 10px !important;
                background: #f0f2ff;
                border-radius: 6px;
                font-size: 12px;
            }
            .step-row .plan-drag-handle { display: none; }

            /* — Задача (карточка) — */
            .task-row {
                display: block;
                position: relative;
                background: var(--color-surface);
                border: 1px solid #eff0f3;
                border-radius: 10px;
                padding: 10px 12px;
                margin-bottom: 6px;
                box-shadow: 0 1px 3px rgba(0,0,0,0.03);
            }
            .task-row td {
                display: block;
                padding: 0 !important;
                border-bottom: none !important;
                background: transparent !important;
                width: 100%;
            }

            /* Checkbox — верхний правый угол */
            .task-row td:nth-child(1) {
                position: absolute;
                top: 10px;
                right: 30px;
                width: auto;
                padding-left: 0 !important;
            }

            /* Название задачи */
            .task-row td:nth-child(2) {
                font-weight: 600;
                font-size: 13px;
                color: var(--color-text);
                line-height: 1.35;
                padding-right: 56px !important;
                padding-bottom: 6px !important;
                min-width: 0;
                max-width: none;
                box-shadow: none;
            }

            /* Мета-строка: даты + ответственный */
            .task-row td:nth-child(3),
            .task-row td:nth-child(4),
            .task-row td:nth-child(5) {
                display: inline-block;
                width: auto;
                padding-right: 3px !important;
                padding-bottom: 3px !important;
            }
            .task-row td:nth-child(3) input,
            .task-row td:nth-child(4) input {
                width: 115px !important;
                font-size: 11px !important;
                padding: 5px 7px !important;
                border-radius: 6px !important;
                background: #f7f8fa;
                border-color: #e8e8eb !important;
            }
            .task-row td:nth-child(5) input {
                width: 120px !important;
                font-size: 11px !important;
                padding: 5px 7px !important;
                border-radius: 6px !important;
                background: #f7f8fa;
                border-color: #e8e8eb !important;
            }

            /* Статус */
            .task-row td:nth-child(6) {
                padding-top: 4px !important;
                padding-bottom: 4px !important;
            }
            .task-row td:nth-child(6) select {
                width: 100%;
                padding: 6px 8px !important;
                font-size: 12px !important;
                border-radius: 8px !important;
                background: #f7f8fa;
                border-color: #e8e8eb !important;
            }

            /* Прогресс — скрыт */
            .task-row td:nth-child(7) { display: none; }

            /* Примечание + кнопки */
            .task-row td:nth-child(8) {
                padding-top: 5px !important;
                border-top: 1px solid #f5f5f7 !important;
                margin-top: 3px;
            }
            .task-row td:nth-child(8) input {
                width: 100% !important;
                font-size: 11px !important;
                padding: 5px 8px !important;
                border-radius: 6px !important;
                background: #f7f8fa;
                border-color: #e8e8eb !important;
                margin-bottom: 4px;
            }
            .task-row td:nth-child(8) > div {
                flex-wrap: wrap;
                gap: 4px !important;
            }
            .btn-attach, .btn-comment {
                width: 28px !important;
                height: 28px !important;
                font-size: 14px !important;
            }

            /* Кнопка удаления — верхний правый угол */
            .task-row td:nth-child(9) {
                position: absolute;
                top: 8px;
                right: 6px;
                width: auto;
                text-align: center;
            }
            .btn-delete-task {
                width: 22px;
                height: 22px;
                font-size: 14px;
                padding: 0;
                line-height: 1;
            }

            /* Убрать sticky / drag на мобильных */
            .plan-drag-handle { display: none; }

            /* Risks таблица */
            .risks-table-wrap {
                touch-action: pan-x pan-y;
            }
            .risks-table {
                display: block;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
                white-space: nowrap;
            }
            .risks-table td, .risks-table th { padding: 8px 10px; font-size: 12px; }

            /* Sticky: колонка "Риск" */
            .risks-table th:nth-child(1),
            .risks-table td:nth-child(1) {
                position: sticky;
                left: 0;
                z-index: 3;
                background: var(--color-nav-bg);
                min-width: 48px;
                max-width: 60px;
            }
            .risks-table tbody td:nth-child(1) {
                background: white;
                box-shadow: 3px 0 6px -2px rgba(0,0,0,0.12);
            }
            .risks-table th:nth-child(2),
            .risks-table td:nth-child(2) {
                position: sticky;
                left: 60px;
                z-index: 3;
                min-width: 140px;
                max-width: 180px;
                white-space: normal;
                word-break: break-word;
                box-shadow: 3px 0 6px -2px rgba(0,0,0,0.12);
            }
            .risks-table th:nth-child(2) { background: var(--color-nav-bg); }
            .risks-table tbody td:nth-child(2) { background: white; }

            /* Progress wrap */
            .progress-wrap { min-width: 70px; }

            /* Summary cards */
            .summary-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
            .summary-card { padding: 12px 14px; }
            .summary-card .num { font-size: 22px; }

            /* Scrollable height */
            .scrollable {
                max-height: none;
                overflow-x: visible;
                overflow-y: visible;
            }

            /* Файлы: sticky колонка "Файл" */
            .files-table { white-space: nowrap; }
            .files-table th:nth-child(1),
            .files-table td:nth-child(1) {
                position: sticky; left: 0; z-index: 3;
                min-width: 130px; max-width: 180px;
                white-space: normal; word-break: break-word;
                box-shadow: 3px 0 6px -2px rgba(0,0,0,0.12);
            }
            .files-table th:nth-child(1) { background: var(--color-nav-bg); }
            .files-table td:nth-child(1) { background: white; }

            /* История: sticky колонка "Задача" (6-я) */
            .history-table { white-space: nowrap; }
            .history-table th:nth-child(1),
            .history-table td:nth-child(1) {
                position: sticky; left: 0; z-index: 3;
                min-width: 100px;
                box-shadow: 3px 0 6px -2px rgba(0,0,0,0.12);
            }
            .history-table th:nth-child(1) { background: var(--color-nav-bg); }
            .history-table td:nth-child(1) { background: white; }

            /* Архив: sticky колонка "Задача" */
            #archiveTable { white-space: nowrap; }
            #archiveTable th:nth-child(5),
            #archiveTable td:nth-child(5) {
                position: sticky; left: 0; z-index: 3;
                min-width: 140px; max-width: 180px;
                white-space: normal; word-break: break-word;
                box-shadow: 3px 0 6px -2px rgba(0,0,0,0.12);
            }
            #archiveTable th:nth-child(5) { background: var(--color-nav-bg); }
            #archiveTable td:nth-child(5) { background: white; }

            /* Modal — выезжает снизу */
            .modal-overlay { padding: 0; align-items: flex-end; }
            .modal {
                min-width: unset;
                width: 100%;
                max-width: 100%;
                border-radius: 20px 20px 0 0;
                padding: 20px 18px 36px;
                max-height: 85vh;
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
            }
            /* 2-колоночная сетка → 1 колонка на мобильном */
            .modal-2col { grid-template-columns: 1fr; gap: 0; }
            /* Список задач из схемы — ограничиваем высоту */
            .task-convert-list { max-height: 35vh; }
            /* Кнопки модалки — на всю ширину */
            .modal-buttons { flex-direction: column; gap: 8px; }
            .modal-buttons button { width: 100%; }

            /* Login box */
            .login-box {
                min-width: unset;
                width: calc(100% - 32px);
                max-width: 400px;
                padding: 28px 22px;
            }


            /* Gantt */
            .gantt-source-toggle { width: 100%; }
            .gantt-source-btn { flex: 1; text-align: center; }

            /* Files modal */
            .files-modal-list { max-height: 180px; }
        }

        @media (max-width: 480px) {
            header h1 { font-size: 14px; }
            .summary-grid { grid-template-columns: 1fr 1fr; }
            .status-badge { padding: 2px 6px; font-size: 9px; }
            .toolbar .btn-toolbar-add { padding: 8px; font-size: 12px; }
            .toolbar button { font-size: 10px; padding: 5px 6px; }
            .mobile-chip { padding: 4px 9px; font-size: 10px; }
        }

        @media (max-width: 360px) {
            .task-row td:nth-child(2) { font-size: 12px; }
            .task-row td:nth-child(3) input,
            .task-row td:nth-child(4) input { width: 100px !important; }
            .task-row td:nth-child(5) input { width: 100px !important; }
        }
        /* ── ЧATY ─────────────────────────────────── */
        .chat-btn {
            position: fixed; bottom: 28px; right: 28px; z-index: 1000;
            width: 52px; height: 52px; border-radius: 50%;
            background: var(--color-nav-bg); color: white; border: none;
            font-size: 22px; cursor: pointer;
            box-shadow: 0 4px 16px rgba(0,0,0,0.28);
            display: flex; align-items: center; justify-content: center;
            transition: background 0.2s, transform 0.15s;
        }
        .chat-btn:hover { background: #283593; transform: scale(1.07); }
        .chat-badge {
            position: absolute; top: 4px; right: 4px;
            background: var(--color-danger); color: white; font-size: 10px;
            font-weight: 700; border-radius: 10px; padding: 1px 5px;
            min-width: 16px; text-align: center; display: none;
        }
        .chat-panel {
            position: fixed; bottom: 90px; right: 28px; z-index: 999;
            width: 340px; max-height: 480px;
            background: white; border-radius: 14px;
            box-shadow: 0 8px 32px rgba(0,0,0,0.22);
            display: none; flex-direction: column; overflow: hidden;
        }
        .chat-panel.open { display: flex; }
        .chat-header {
            background: var(--color-nav-bg); color: white;
            padding: 13px 16px; font-weight: 600; font-size: 14px;
            display: flex; align-items: center; justify-content: space-between;
        }
        .chat-header span { opacity: 0.7; font-size: 11px; font-weight: 400; }
        .chat-close { background: none; border: none; color: white; font-size: 18px; cursor: pointer; opacity: 0.7; }
        .chat-close:hover { opacity: 1; }
        .chat-messages {
            flex: 1; overflow-y: auto; padding: 12px;
            display: flex; flex-direction: column; gap: 8px;
            background: #f5f6fa;
        }
        .chat-msg { max-width: 75%; display: flex; flex-direction: column; gap: 1px; }
        .chat-msg.mine { align-self: flex-end; align-items: flex-end; }
        .chat-msg.theirs { align-self: flex-start; align-items: flex-start; }
        .chat-msg-name { font-size: 11px; font-weight: 600; color: var(--color-primary); padding-left: 4px; margin-bottom: 2px; }
        .chat-msg-bubble { padding: 8px 12px; border-radius: 16px; font-size: 14px; line-height: 1.45; word-break: break-word; }
        .chat-msg-bubble.img-only { padding: 3px; background: transparent !important; box-shadow: none !important; }
        .chat-msg.mine .chat-msg-bubble { background: var(--color-nav-bg); color: white; border-bottom-right-radius: 4px; }
        .chat-msg.theirs .chat-msg-bubble { background: white; color: var(--color-nav-bg); border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
        .chat-msg-time { font-size: 10px; color: #aaa; padding: 0 4px; }
        .chat-date-sep { align-self: center; font-size: 11px; color: #888; background: rgba(0,0,0,0.07); border-radius: 10px; padding: 3px 12px; margin: 4px 0; }
        .chat-img-thumb { max-width: 260px; max-height: 280px; border-radius: 13px; display: block; cursor: pointer; object-fit: cover; }
        .chat-msg.mine .chat-img-thumb { border-bottom-right-radius: 3px; }
        .chat-msg.theirs .chat-img-thumb { border-bottom-left-radius: 3px; }
        .chat-img-caption { font-size: 13px; padding: 5px 4px 2px; }
        .chat-file-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; text-decoration: none; color: inherit; min-width: 200px; max-width: 280px; }
        .chat-file-card:hover { opacity: 0.85; }
        .chat-file-icon { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
        .chat-msg.theirs .chat-file-icon { background: #e8f0fe; }
        .chat-file-info { flex: 1; min-width: 0; }
        .chat-file-fname { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
        .chat-file-fsize { font-size: 11px; opacity: 0.65; margin-top: 2px; }
        .chat-scroll-down { position: absolute; bottom: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; background: white; border: none; box-shadow: 0 2px 8px rgba(0,0,0,0.2); cursor: pointer; font-size: 18px; display: none; align-items: center; justify-content: center; z-index: 5; }
        .chat-scroll-down.show { display: flex; }
        .chat-attach-preview { display: none; flex-direction: column; background: #f0f4ff; border-top: 1px solid #d6e0ff; }
        .chat-attach-preview.show { display: flex; }
        .chat-attach-list { display: flex; gap: 10px; padding: 10px 16px 6px; overflow-x: auto; flex-wrap: wrap; }
        .chat-attach-item { display: flex; flex-direction: column; align-items: center; gap: 3px; position: relative; flex-shrink: 0; }
        .chat-attach-item-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; display: block; }
        .chat-attach-item-icon { width: 64px; height: 64px; border-radius: 8px; background: #e8f0fe; display: flex; align-items: center; justify-content: center; font-size: 26px; }
        .chat-attach-item-name { font-size: 10px; color: #555; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .chat-attach-item-remove { position: absolute; top: -5px; right: -5px; width: 18px; height: 18px; border-radius: 50%; background: var(--color-danger); color: white; border: none; cursor: pointer; font-size: 10px; display: flex; align-items: center; justify-content: center; line-height: 1; }
        .chat-attach-options { padding: 2px 16px 8px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: #555; }
        .messenger-input-wrap { flex-shrink: 0; border-top: 1px solid #eee; background: white; }
        .messenger-input-row { padding: 10px 16px; display: flex; gap: 10px; align-items: center; }
        .messenger-input-row input { flex: 1; border: 1px solid var(--color-border); border-radius: 8px; padding: 10px 14px; font-size: 14px; outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
        .messenger-input-row input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-25); }
        .chat-input-row {
            display: flex; gap: 8px; padding: 10px;
            border-top: 1px solid #eee; background: white;
        }
        .chat-input-row input {
            flex: 1; border: 1px solid #ddd; border-radius: 20px;
            padding: 8px 14px; font-size: 13px; outline: none;
        }
        .chat-input-row input:focus { border-color: var(--color-nav-bg); }
        .chat-send-btn {
            width: 36px; height: 36px; border-radius: 50%;
            background: var(--color-nav-bg); color: white; border: none;
            font-size: 16px; cursor: pointer; display: flex;
            align-items: center; justify-content: center; flex-shrink: 0;
        }
        .chat-send-btn:hover { background: #283593; }
        @media (max-width: 600px) {
            .chat-panel { width: calc(100vw - 32px); right: 16px; }
            .chat-btn { bottom: 16px; right: 16px; }
        }
        @media (max-width: 640px) {
            .notif-panel {
                position: fixed;
                top: 84px;
                right: 12px;
                left: 12px;
                width: auto;
                max-height: calc(100vh - 110px);
            }
            .notif-panel-head {
                flex-direction: column;
                align-items: stretch;
            }
            .notif-actions {
                flex-direction: column;
            }
        }
        /* ── МЕССЕНДЖЕР ─────────────────────────────── */
        .messenger { display: flex; height: calc(100vh - 220px); min-height: 420px; background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
        .messenger-sidebar { width: 280px; flex-shrink: 0; border-right: 1px solid #eee; display: flex; flex-direction: column; }
        .messenger-toolbar { padding: 10px 12px; border-bottom: 1px solid #eee; display: flex; gap: 8px; }
        .messenger-toolbar button { flex: 1; padding: 8px 6px; border: 1px solid #ddd; border-radius: 8px; background: white; font-size: 12px; cursor: pointer; transition: all 0.2s; font-weight: 500; }
        .messenger-toolbar button:hover { background: var(--color-nav-bg); color: white; border-color: var(--color-nav-bg); }
        .messenger-rooms { flex: 1; overflow-y: auto; }
        .messenger-room-item { padding: 12px 14px; cursor: pointer; border-bottom: 1px solid #f5f5f5; display: flex; align-items: center; gap: 10px; transition: background 0.15s; }
        .messenger-room-item:hover { background: var(--color-primary-10); }
        .messenger-room-item.active { background: var(--color-primary-20); }
        .messenger-room-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--color-nav-bg); color: white; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
        .messenger-room-info { flex: 1; min-width: 0; }
        .messenger-room-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .messenger-room-preview { font-size: 12px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
        .messenger-room-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
        .messenger-room-time { font-size: 10px; color: #bbb; }
        .messenger-room-badge { background: var(--color-danger); color: white; border-radius: 10px; padding: 2px 6px; font-size: 10px; font-weight: 700; }
        .messenger-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
        .messenger-placeholder { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #bbb; font-size: 15px; gap: 8px; }
        .messenger-conv-header { padding: 13px 18px; border-bottom: 1px solid #eee; display: flex; align-items: center; gap: 12px; background: white; flex-shrink: 0; }
        .messenger-conv-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--color-nav-bg); color: white; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
        .messenger-conv-name { font-weight: 600; font-size: 15px; }
        .messenger-conv-subtitle { font-size: 11px; color: #888; margin-top: 1px; }
        .messenger-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: #f5f6fa; }
        .messenger-send-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--color-primary); color: white; border: none; font-size: 16px; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
        .messenger-send-btn:hover { background: var(--color-primary-hover); }
        .messenger-attach-btn { width: 42px; height: 42px; border-radius: 50%; background: var(--color-bg-chip); color: #555; border: none; font-size: 17px; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
        .messenger-attach-btn:hover { background: #dde3f0; }
        @media (max-width: 600px) {
            .messenger { flex-direction: column; height: auto; min-height: unset; }
            .messenger-sidebar { width: 100%; max-height: 220px; border-right: none; border-bottom: 1px solid #eee; }
            .messenger-main { min-height: 350px; }
        }
        /* ── ПЕЧАТЬ ──────────────────────────────────────── */
        @media print {
            body { background: white !important; }
            header, .toolbar, .tabs, .chat-btn, .login-overlay,
            .modal-overlay, #tab-gantt, #tab-risks, #tab-history,
            #tab-archive, #tab-files, #tab-chat,
            .btn-add-task-row, .btn-attach, .btn-delete,
            [class*="btn-"], th:last-child, td:last-child { display: none !important; }
            #tab-plan { display: block !important; padding: 0 !important; }
            #print-header { display: block !important; }
            .scrollable { overflow: visible !important; max-height: none !important; }
            .plan-table-wrap { box-shadow: none !important; border-radius: 0 !important; }
            .plan-table { width: 100%; font-size: 11px; border-collapse: collapse; }
            .plan-table th, .plan-table td { border: 1px solid #ccc !important; padding: 5px 8px !important; }
            .plan-table th { background: var(--color-nav-bg) !important; color: white !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
            .phase-row td { background: #e8eaf0 !important; font-weight: bold; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
            .step-row td { background: #f5f5f5 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
            .task-row { display: table-row !important; }
            .status-badge { border: 1px solid #999 !important; background: transparent !important; color: #333 !important; font-size: 10px; }
            .progress-bar-wrap, .progress-bar { display: none !important; }
            * { box-shadow: none !important; }
        }
        #print-header { display: none; padding: 0 0 12px; }
        #print-header h2 { font-size: 16px; margin: 0 0 2px; }
        #print-header p  { font-size: 11px; color: #666; margin: 0; }

        /* ===== DEPT / PROJECT SELECTOR ===== */
        .plan-context-bar {
            background: var(--color-surface);
            border-bottom: 1px solid var(--color-border);
            padding: 10px 28px;
            display: flex;
            align-items: center;
            gap: 20px;
            flex-wrap: wrap;
        }
        .dept-selector-label {
            font-size: 12px;
            font-weight: 600;
            color: var(--color-text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.4px;
            white-space: nowrap;
        }
        .dept-chips {
            display: flex;
            gap: 6px;
            flex-wrap: wrap;
        }
        .dept-chip {
            padding: 5px 14px;
            border: 1.5px solid var(--color-border-strong);
            border-radius: 999px;
            background: white;
            color: var(--color-text-strong);
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.18s;
            font-family: inherit;
            line-height: 1.4;
        }
        .dept-chip:hover {
            border-color: var(--color-primary);
            color: var(--color-primary);
            background: var(--color-primary-20);
        }
        .dept-chip.active {
            background: var(--color-primary);
            color: var(--color-surface);
            border-color: var(--color-primary);
            box-shadow: 0 2px 8px rgba(21,101,192,0.25);
        }
        .dept-chip.active-personal {
            background: #7c3aed;
            border-color: #7c3aed;
            color: var(--color-surface);
            box-shadow: 0 2px 8px rgba(124,58,237,0.25);
        }
        .plan-context-divider {
            width: 1px;
            height: 24px;
            background: var(--color-border);
            flex-shrink: 0;
        }
        .project-selector-wrap {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .project-selector-wrap label {
            font-size: 12px;
            font-weight: 600;
            color: var(--color-text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.4px;
            white-space: nowrap;
        }
        .plan-inline-selector {
            display: flex;
            align-items: center;
            gap: 6px;
            margin-left: auto;
        }
        .plan-inline-btn {
            width: 28px; height: 28px;
            border-radius: 6px;
            border: none;
            background: transparent;
            color: var(--color-text-secondary);
            font-size: 13px;
            cursor: pointer;
            display: flex; align-items: center; justify-content: center;
            transition: all 0.15s;
            flex-shrink: 0;
            padding: 0;
            line-height: 1;
            opacity: 0.65;
        }
        .plan-inline-btn:hover { opacity: 1; background: var(--color-gray-100); }
        .plan-inline-btn--danger:hover { background: var(--color-danger-25); }
        .plan-inline-btn--fav.is-active { opacity: 1; color: #f5b301; }
        .plan-inline-btn--fav.is-active:hover { background: #fffaeb; }
        .plan-inline-btn-ico {
            width: 22px;
            height: 22px;
            display: block;
            opacity: 0.78;
            transition: opacity 0.18s;
        }
        .plan-inline-btn:hover .plan-inline-btn-ico { opacity: 1; }
        .messenger-attach-ico {
            width: 22px;
            height: 22px;
            display: block;
            opacity: 0.78;
            transition: opacity 0.18s;
        }
        .messenger-attach-btn:hover .messenger-attach-ico { opacity: 1; }
        .project-select-styled {
            background: var(--color-gray-100);
            color: var(--color-text-strong);
            border: 1.5px solid var(--color-border-strong);
            border-radius: 8px;
            padding: 6px 32px 6px 12px;
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            outline: none;
            appearance: none;
            -webkit-appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 10px center;
            transition: border-color 0.2s;
            min-width: 180px;
        }
        .project-select-styled:focus { border-color: var(--color-primary); }
        .project-select-styled:hover { border-color: var(--color-gray-400); }

        /* Селектор отдела в plan-context-bar */
        .dept-select-styled {
            background: var(--color-gray-100);
            color: var(--color-text-strong);
            border: 1.5px solid var(--color-border-strong);
            border-radius: 8px;
            padding: 7px 34px 7px 14px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            outline: none;
            appearance: none;
            -webkit-appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 10px center;
            transition: border-color 0.15s, box-shadow 0.15s;
            min-width: 260px;
            max-width: 360px;
        }
        .dept-select-styled:focus {
            border-color: var(--color-primary);
            box-shadow: 0 0 0 3px rgba(21,101,192,0.12);
        }
        .dept-select-styled:hover { border-color: var(--color-gray-400); }
        .dept-select-styled optgroup {
            font-weight: 700;
            color: var(--color-nav-bg);
            background: var(--color-gray-50);
        }
        .dept-select-styled option {
            font-weight: 500;
            padding: 4px 8px;
        }
        @media (max-width: 768px) {
            .plan-context-bar {
                padding: 6px 10px;
                gap: 5px;
                flex-direction: column;
                align-items: stretch;
            }
            .plan-context-divider { display: none; }
            .dept-selector-label { font-size: 10px; }
            .dept-chip { padding: 4px 9px; font-size: 11px; }
            .project-selector-wrap { margin-left: 0; width: 100%; }
            .project-select-styled { min-width: unset; flex: 1; font-size: 12px; padding: 6px 8px; }
            .plan-inline-selector {
                margin-left: 0;
                width: 100%;
                flex-wrap: wrap;
                gap: 4px;
            }
            .plan-inline-selector select {
                flex: 1;
                min-width: 0 !important;
                font-size: 12px;
                padding: 6px 8px;
            }
            .plan-inline-btn {
                width: 26px;
                height: 26px;
                font-size: 12px;
            }
            .dept-select-styled { width: 100%; font-size: 12px; padding: 6px 8px; }
        }

        /* ===== GANTT V2 ===== */
        .gantt-v2-source-bar {
            padding: 14px 28px 0;
            display: flex;
            align-items: center;
        }
        .gantt-v2-toggle {
            display: flex;
            background: var(--color-bg-subtle);
            border: 1px solid var(--color-border);
            border-radius: 8px;
            overflow: hidden;
            padding: 2px;
            gap: 2px;
        }
        .gantt-v2-toggle-btn {
            padding: 6px 16px;
            border: none;
            cursor: pointer;
            font-size: 13px;
            font-weight: 500;
            background: transparent;
            color: var(--color-text-secondary);
            transition: background 0.15s, color 0.15s;
            font-family: inherit;
            border-radius: 6px;
        }
        .gantt-v2-toggle-btn.active { background: white; color: var(--color-text); box-shadow: 0 1px 2px rgba(15,23,42,0.06); }
        .gantt-v2-toggle-btn:hover:not(.active) { background: white; color: var(--color-text); }

        .gantt-v2-wrap {
            padding: 16px 28px 28px;
            overflow-x: auto;
        }
        .gantt-v2-card {
            background: white;
            border: 1px solid var(--color-border-strong);
            border-radius: 10px;
            box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
            overflow: hidden;
            min-width: 700px;
        }

        /* Header */
        .gantt-v2-header {
            display: flex;
            border-bottom: 1px solid var(--color-bg-chip);
            position: sticky;
            top: 0;
            background: white;
            z-index: 5;
        }
        .gantt-v2-name-head {
            width: 240px;
            flex-shrink: 0;
            padding: 18px 20px;
            font-size: 13px;
            color: var(--color-gray-400);
            font-weight: 500;
            border-right: 1px solid var(--color-bg-chip);
        }
        .gantt-v2-months-head {
            flex: 1;
            display: flex;
            position: relative;
        }
        .gantt-v2-month-cell {
            text-align: center;
            padding: 18px 0;
            font-size: 14px;
            font-weight: 700;
            color: var(--color-text);
            border-right: 1px solid var(--color-bg-chip);
            position: relative;
        }
        .gantt-v2-month-cell:last-child { border-right: none; }

        /* Today dot in header */
        .gantt-v2-today-head-dot {
            position: absolute;
            bottom: -7px;
            width: 14px;
            height: 14px;
            background: var(--color-text);
            border-radius: 50%;
            transform: translateX(-50%);
            z-index: 6;
        }

        /* Rows */
        .gantt-v2-rows {
            position: relative;
        }
        .gantt-v2-row {
            display: flex;
            align-items: center;
            border-bottom: 1px solid #f5f7fa;
            min-height: 72px;
        }
        .gantt-v2-row:last-child { border-bottom: none; }
        .gantt-v2-row:hover { background: #fafbff; }
        .gantt-v2-task-name {
            width: 240px;
            flex-shrink: 0;
            display: flex;
            align-items: flex-start;
            gap: 12px;
            padding: 12px 16px;
            font-size: 14px;
            font-weight: 600;
            color: var(--color-text);
            border-right: 1px solid var(--color-bg-chip);
            min-height: 72px;
        }
        .gantt-v2-phase-stripe {
            width: 4px;
            min-height: 36px;
            border-radius: 2px;
            flex-shrink: 0;
            align-self: center;
        }
        .gantt-v2-task-label {
            flex: 1;
            white-space: normal;
            word-break: break-word;
            line-height: 1.4;
        }
        .gantt-v2-timeline {
            flex: 1;
            position: relative;
            height: 72px;
            overflow: visible;
        }

        /* Month grid lines in timeline */
        .gantt-v2-grid-line {
            position: absolute;
            top: 0; bottom: 0;
            width: 1px;
            background: var(--color-bg-chip);
            pointer-events: none;
        }

        /* Bar */
        .gantt-v2-bar {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            height: 40px;
            border-radius: 999px;
            display: flex;
            align-items: center;
            padding: 3px 3px 3px 3px;
            min-width: 44px;
            transition: opacity 0.2s;
            cursor: default;
        }
        .gantt-v2-bar:hover { opacity: 0.85; }
        .gantt-v2-avatar {
            width: 34px;
            height: 34px;
            border-radius: 50%;
            background: rgba(255,255,255,0.75);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 11px;
            font-weight: 700;
            color: #333;
            flex-shrink: 0;
            border: 2px solid rgba(255,255,255,0.9);
        }

        /* Today vertical line in each row */
        .gantt-v2-today-line {
            position: absolute;
            top: 0; bottom: 0;
            width: 2px;
            background: var(--color-text);
            pointer-events: none;
            z-index: 4;
        }

        /* Empty state */
        .gantt-v2-empty {
            padding: 60px 40px;
            text-align: center;
            color: var(--color-gray-400);
            font-size: 15px;
            line-height: 1.7;
        }
        .gantt-v2-empty-icon { display: block; margin: 0 auto 12px; width: 36px; height: 36px; }

        @media (max-width: 768px) {
            .gantt-v2-wrap { padding: 12px; }
            .gantt-v2-name-head,
            .gantt-v2-task-name { width: 140px; font-size: 12px; }
        }

/* ===== RISKS V2 ===== */
.risks-v2-wrap {
    padding: 20px 28px 28px;
}
.risks-v2-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}
.risks-v2-plan-filter { gap: 10px; }
.risks-v2-plan-filter-label {
    font-size: 13px; font-weight: 500;
    color: var(--color-text-secondary);
    white-space: nowrap;
}
/* .risks-v2-plan-select: алиас, унифицирован через .system-select из tokens.css */
.risk-v2-task-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-primary);
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--color-primary-25);
    border: 1px solid var(--color-primary-50);
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s;
}
.risk-v2-task-link:hover { background: var(--color-primary-50); }
.risks-v2-btn-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    font-family: inherit;
    box-shadow: none;
}
.risks-v2-btn-add:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 2px 6px rgba(21, 101, 192, 0.22);
}
.risks-v2-btn-sort {
    background: white;
    color: var(--color-text-strong);
    border: 1.5px solid var(--color-border);
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.risks-v2-btn-sort:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-20);
}
.risks-v2-status {
    font-size: 12px;
    color: var(--color-gray-400);
    font-weight: 500;
}
.risks-v2-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(15,23,42,0.08);
    overflow: hidden;
}
.risks-v2-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.risks-v2-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}
.risks-v2-table thead th {
    background: #f8f9fa;
    color: var(--color-text-secondary);
    padding: 12px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}
.risks-v2-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-gray-100);
    font-size: 13px;
    vertical-align: middle;
    color: var(--color-text);
}
.risks-v2-table tbody tr:last-child td {
    border-bottom: none;
}
.risks-v2-table tbody tr:hover td {
    background: #fafbff;
}
/* Левый цветной бордер вместо окрашенной строки */
.risks-v2-table tbody tr td:first-child {
    padding-left: 10px;
}
.risk-v2-p-critical td:first-child { box-shadow: inset 4px 0 0 var(--color-danger-600); }
.risk-v2-p-high     td:first-child { box-shadow: inset 4px 0 0 var(--color-warning); }
.risk-v2-p-med      td:first-child { box-shadow: inset 4px 0 0 var(--color-primary-400); }
.risk-v2-p-low      td:first-child { box-shadow: inset 4px 0 0 var(--color-success-500); }

/* Drag */
.risks-v2-table tbody tr.dragging { opacity: 0.3; }
.risks-v2-table tbody tr.drag-over-top td { border-top: 2px solid var(--color-primary); }

/* Priority badge select */
.risk-v2-priority-sel {
    border: none;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    text-align: center;
    outline: none;
}
.risk-v2-priority-sel.p-critical { background: var(--color-danger-50); color: var(--color-danger-600); }
.risk-v2-priority-sel.p-high     { background: var(--color-warning-50); color: #d97706; }
.risk-v2-priority-sel.p-med      { background: var(--color-primary-50); color: var(--color-primary-strong); }
.risk-v2-priority-sel.p-low      { background: #d1fae5; color: #059669; }

/* Status badge */
.risk-v2-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.risk-v2-status-active    { background: var(--color-danger-50); color: var(--color-danger-600); }
.risk-v2-status-monitor   { background: var(--color-warning-50); color: #d97706; }
.risk-v2-status-accepted  { background: var(--color-primary-50); color: var(--color-primary-strong); }
.risk-v2-status-closed    { background: #f0fdf4; color: #16a34a; }

/* Status select */
.risk-v2-status-sel {
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    background: white;
    cursor: pointer;
    font-family: inherit;
    color: var(--color-text-strong);
    outline: none;
}
.risk-v2-status-sel:focus { border-color: var(--color-primary); }

/* Phase tag */
.risk-v2-phase-tag {
    background: var(--color-primary-25);
    color: var(--color-primary-strong);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* Prob / impact */
.risk-v2-prob-sel {
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    padding: 3px 6px;
    font-size: 12px;
    background: white;
    cursor: pointer;
    font-family: inherit;
    color: var(--color-text-strong);
    outline: none;
}
.risk-v2-prob-sel:focus { border-color: var(--color-primary); }

/* Editable cells */
.risk-v2-editable { cursor: text; }
.risk-v2-editable:hover td { background: var(--color-primary-20) !important; }
.risk-v2-editable-cell { cursor: text; }
.risk-v2-editable-cell:hover { background: var(--color-primary-20) !important; }
.risk-v2-editable-cell input {
    width: 100%;
    border: 1.5px solid var(--color-primary);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    box-shadow: 0 0 0 3px rgba(21,101,192,0.12);
    background: white;
}

/* Delete btn */
.risk-v2-del-btn {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 1.5px solid var(--color-border);
    background: white;
    color: var(--color-gray-400);
    font-size: 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.18s;
    line-height: 1;
}
.risk-v2-del-btn:hover {
    border-color: var(--color-danger-600);
    color: var(--color-danger-600);
    background: #fff5f5;
}

/* ID cell */
.risk-v2-id {
    font-size: 11px;
    color: var(--color-gray-400);
    font-weight: 600;
    font-family: monospace;
}

@media (max-width: 768px) {
    .risks-v2-wrap { padding: 12px; }
    .risks-v2-table thead th,
    .risks-v2-table tbody td { padding: 9px 10px; font-size: 12px; }
}

/* ===== SUMMARY V2 ===== */
/* ============================================================
   SUMMARY — minimalist Linear/Notion-style.
   Белые карточки, тонкие рамки, без translateY-hover,
   без пульсаций, без градиентов. Цвет — только в иконках.
   ============================================================ */
.sumv2-wrap {
    padding: 16px 20px 24px;
}
.sumv2-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 10px;
    flex-wrap: wrap;
}
.sumv2-plan-filter { display: flex; align-items: center; gap: 8px; }
.sumv2-plan-filter-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-secondary);
    white-space: nowrap;
}
/* Алиас: единый системный select из tokens.css (.system-select) */
.sumv2-plan-select { /* стили унаследованы через class="sumv2-plan-select system-select" */ }

.sumv2-export-btn {
    /* Используется class="sumv2-export-btn btn btn-secondary" в HTML — здесь
       только скрипты-специфичные правила (если нужны) */
}
.sumv2-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
}
.sumv2-col-left, .sumv2-col-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Стат-карточки — flat-стиль: белый фон, тонкая рамка, без hover-translate */
.sumv2-stats-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
/* KPI — DNA из preview-bpm-v2: 3px цветная полоса слева через ::before,
   цифра окрашена в currentColor (тон полосы), hover лёгкий translateY.
   Это «лицо системы» — должно ощущаться живо и заметно. */
.sumv2-stat-card {
    background: white !important;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 16px 16px 14px 22px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.sumv2-stat-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: currentColor;
    border-radius: 0 999px 999px 0;
}
.sumv2-stat-card:hover {
    border-color: var(--color-border-strong);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}
@media (prefers-reduced-motion: reduce) {
    .sumv2-stat-card:hover { transform: none; }
}
.sumv2-stat-card--alert {
    border-color: var(--color-danger-50);
}
.sumv2-stat-icon {
    width: 28px; height: 28px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    position: absolute;
    top: 12px; right: 12px;
    /* Иконка наследует тон карточки, но фон делаем slightly лайтнее */
    opacity: 0.92;
}
.sumv2-stat-icon svg { width: 16px; height: 16px; }
.sumv2-stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.sumv2-stat-num {
    font-size: 28px;
    font-weight: 700;
    /* currentColor → цифра окрашена в цвет полосы (по data-tint),
       это ключевая визуальная связка из v2-дизайна. */
    color: currentColor;
    line-height: 1.1;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
}
.sumv2-stat-sub {
    font-size: 11px;
    color: var(--color-text-secondary);
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

/* Карточки — единый стиль с остальной системой (border-radius 10, тонкая рамка) */
.sumv2-card {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.sumv2-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.sumv2-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: 0;
}
.sumv2-card-badge {
    background: var(--color-bg-subtle);
    color: var(--color-text);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--color-border);
    font-variant-numeric: tabular-nums;
}

/* Прогресс фаз — flat, без translateY */
.sumv2-phase-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.12s ease;
}
.sumv2-phase-row:last-child { margin-bottom: 0; }
.sumv2-phase-row:hover {
    background: var(--color-bg-subtle);
}
.sumv2-phase-name {
    width: 110px;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sumv2-phase-bar-track {
    flex: 1;
    height: 6px;
    background: var(--color-bg-subtle);
    border-radius: 999px;
    overflow: hidden;
}
.sumv2-phase-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}
.sumv2-phase-pct {
    width: 36px;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    text-align: right;
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
}

/* Плитки фаз — flat, белые, цветной dot вместо насыщенного фона */
.sumv2-phases-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.sumv2-phase-tile {
    background: white !important;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    transition: border-color 0.12s, background 0.12s;
}
.sumv2-phase-tile::before {
    content: '';
    position: absolute;
    left: 0; top: 8px; bottom: 8px;
    width: 3px;
    border-radius: 0 2px 2px 0;
    background: var(--phase-tile-dot, var(--color-text-secondary));
}
.sumv2-phase-tile:hover {
    border-color: var(--color-border-strong);
    background: var(--color-bg-subtle);
}
.sumv2-phase-tile-icon {
    width: 26px; height: 26px;
    border-radius: 6px;
    background: var(--color-bg-subtle);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.sumv2-phase-tile-info { min-width: 0; flex: 1; }
.sumv2-phase-tile-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sumv2-phase-tile-count {
    font-size: 11px;
    color: var(--color-text-secondary);
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

/* SVG-чарты */
.sumv2-chart-wrap {
    width: 100%;
    overflow: hidden;
}
.sumv2-chart-wrap svg { display: block; width: 100%; }

/* Подзаголовок карточки (справа в head) */
.sumv2-card-sub {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
}
.sumv2-card--danger {
    /* Тонкий красный border вместо широкой полосы — спокойнее */
    border-color: var(--color-danger-50);
}
.sumv2-empty {
    text-align: center;
    padding: 18px 10px;
    color: var(--color-text-muted);
    font-size: 12px;
}

/* Списки (дедлайны, просрочки) — flat, без translateX */
.sumv2-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sumv2-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    transition: background 0.12s;
    border-left: 2px solid transparent;
}
.sumv2-list-item:hover {
    background: var(--color-bg-subtle);
}
.sumv2-list-item--warn {
    border-left-color: var(--color-warning, #f59e0b);
    padding-left: 8px;
}
.sumv2-list-item--warn:hover { background: var(--color-bg-subtle); }
.sumv2-list-item--danger {
    border-left-color: var(--color-danger);
    padding-left: 8px;
}
.sumv2-list-item--danger:hover { background: var(--color-bg-subtle); }
.sumv2-list-main {
    min-width: 0;
    flex: 1;
}
.sumv2-list-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sumv2-list-meta {
    font-size: 10px;
    color: var(--color-text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sumv2-list-right {
    flex-shrink: 0;
    text-align: right;
}
.sumv2-list-date {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}
.sumv2-list-days {
    font-size: 10px;
    color: var(--color-text-muted);
    margin-top: 1px;
    font-variant-numeric: tabular-nums;
}
.sumv2-list-days--danger {
    color: var(--color-danger);
    font-weight: 600;
}

/* Донат статусов — минималистично */
.sumv2-donut-wrap {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.sumv2-donut-svg-wrap {
    position: relative;
    width: 160px;
    height: 160px;
    flex-shrink: 0;
}
.sumv2-donut-center {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}
.sumv2-donut-center-num {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.sumv2-donut-center-lbl {
    font-size: 10px;
    color: var(--color-text-secondary);
    margin-top: 4px;
    text-transform: none;
    letter-spacing: 0;
}
.sumv2-donut-legend {
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sumv2-donut-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}
.sumv2-donut-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sumv2-donut-label {
    flex: 1;
    color: var(--color-text);
    font-weight: 500;
}
.sumv2-donut-val {
    font-weight: 600;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
}
.sumv2-donut-pct {
    font-weight: 500;
    color: var(--color-text-muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

/* Загрузка по исполнителям */
.sumv2-workload {
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.sumv2-workload-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sumv2-workload-name {
    width: 140px;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sumv2-workload-bar-track {
    flex: 1;
    height: 8px;
    background: var(--color-bg-chip);
    border-radius: 999px;
    overflow: hidden;
}
.sumv2-workload-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary-400), #6366f1);
    border-radius: 999px;
    transition: width 0.6s ease;
}
.sumv2-workload-nums {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 74px;
    justify-content: flex-end;
}
.sumv2-workload-open { color: var(--color-primary-strong); }
.sumv2-workload-divider { color: #cbd5e1; font-weight: 400; }
.sumv2-workload-total { color: var(--color-gray-400); }
.sumv2-workload-overdue {
    background: var(--color-danger-25);
    color: var(--color-danger-700);
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    margin-left: 4px;
}

/* Адаптив */
@media (max-width: 1200px) {
    .sumv2-stats-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
    .sumv2-layout { grid-template-columns: 1fr; }
    .sumv2-stats-row { grid-template-columns: repeat(3, 1fr); }
    .sumv2-donut-wrap { justify-content: center; }
    .sumv2-workload-name { width: 100px; }
}
@media (max-width: 600px) {
    .sumv2-wrap { padding: 12px; }
    .sumv2-stats-row { grid-template-columns: repeat(2, 1fr); }
    .sumv2-phases-grid { grid-template-columns: 1fr 1fr; }
    .sumv2-phase-name { width: 80px; }
    .sumv2-donut-svg-wrap { width: 150px; height: 150px; }
}

/* ===== KANBAN ===== */
.kb-wrap {
    padding: 20px 28px 32px;
    min-height: 100%;
}
.kb-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.kb-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    margin-right: 10px;
}
.kb-subtitle { font-size: 12px; color: var(--color-gray-400); }
.kb-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.kb-add-btn:hover { background: var(--color-primary-hover); }

/* Board */
.kb-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    align-items: start;
}

/* Column */
.kb-col {
    background: var(--color-gray-100);
    border-radius: 16px;
    padding: 14px 12px;
    min-height: 200px;
    transition: background 0.15s;
}
.kb-col.drag-over { background: var(--color-primary-20); }
.kb-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 2px;
}
.kb-col-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.kb-col-count {
    background: var(--color-border);
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
}

/* Cards */
.kb-cards { display: flex; flex-direction: column; gap: 10px; }

.kb-card {
    background: var(--color-surface);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    cursor: grab;
    border: 1px solid var(--color-border);
    transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s, opacity 0.15s;
    user-select: none;
    position: relative;
    overflow: hidden;
}
.kb-card:hover { box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08); border-color: var(--color-border-strong); }
.kb-card.dragging { opacity: 0.55; cursor: grabbing; border-color: var(--color-primary); transform: rotate(1.5deg); }
.kb-card.drag-target { border-color: var(--color-primary); background: var(--color-primary-25); }
/* Цветная полоса метки сверху карточки — единственный «цвет» в карточке.
   4px высотой, во всю ширину, никак не пересекается с текстом. */
.kb-card-stripe {
    position: absolute; top: 0; left: 0; right: 0;
    height: 4px;
    border-top-left-radius: 8px; border-top-right-radius: 8px;
}
.kb-card-stripe + .kb-card-top { margin-top: 4px; }

.kb-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.kb-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.4;
    flex: 1;
}
.kb-card-menu {
    background: none;
    border: none;
    color: var(--color-gray-400);
    font-size: 18px;
    cursor: pointer;
    padding: 0 2px;
    border-radius: 4px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}
.kb-card-menu:hover { color: var(--color-text-strong); }

.kb-card-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
    border: 1px solid transparent;
    background: var(--color-bg-subtle);
    color: var(--color-text-strong);
}
.kb-card-tag--plan { background: var(--color-primary-25); color: var(--color-primary-strong); border-color: var(--color-primary-50); }

/* Priority */
.kb-priority {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: 10px;
}
.kb-priority-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.kb-priority-dot.high   { background: var(--color-danger-500); }
.kb-priority-dot.medium { background: var(--color-warning); }
.kb-priority-dot.low    { background: #22c55e; }

.kb-card-desc {
    font-size: 12px;
    color: var(--color-gray-400);
    margin-bottom: 10px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Footer */
.kb-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}
.kb-avatars {
    display: flex;
    align-items: center;
}
.kb-avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 2px solid var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: white;
    margin-left: -6px;
    flex-shrink: 0;
}
.kb-avatars .kb-avatar:first-child { margin-left: 0; }

.kb-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.kb-card-action {
    background: none;
    border: none;
    color: var(--color-border-strong);
    font-size: 14px;
    cursor: pointer;
    padding: 3px;
    border-radius: 5px;
    transition: color 0.15s;
    line-height: 1;
}
.kb-card-action:hover { color: var(--color-text-secondary); }

/* Add task button in column */
.kb-col-add {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin-top: 10px;
    padding: 8px 4px;
    background: none;
    border: none;
    color: var(--color-gray-400);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
    text-align: left;
}
.kb-col-add:hover { background: rgba(0,0,0,0.05); color: var(--color-text-strong); }

/* Drop placeholder */
.kb-drop-placeholder {
    height: 70px;
    border: 2px dashed var(--color-primary);
    border-radius: 10px;
    background: var(--color-primary-25);
    opacity: 0.6;
}

@media (max-width: 1100px) { .kb-board { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 640px)  { .kb-board { grid-template-columns: 1fr; } .kb-wrap { padding: 12px; } }

/* ===== ARCHIVE V2 ===== */
.arch-wrap {
    padding: 20px 28px 32px;
}
.arch-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.arch-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    margin-right: 10px;
}
.arch-subtitle {
    font-size: 12px;
    color: var(--color-gray-400);
}
.arch-updated {
    font-size: 12px;
    color: var(--color-gray-400);
}
.arch-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-gray-100);
    color: var(--color-text-strong);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
.arch-refresh-btn:hover { background: var(--color-border); }

/* Empty state */
.arch-empty {
    text-align: center;
    padding: 60px 40px;
    color: var(--color-gray-400);
}
.arch-empty-icon {
    font-size: 44px;
    display: block;
    margin-bottom: 14px;
}
.arch-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
}
.arch-empty-sub {
    font-size: 13px;
    color: var(--color-gray-400);
}

/* Archive item cards */
.arch-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.arch-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 10px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color 0.15s, background 0.15s;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.arch-card:hover { border-color: var(--color-primary); background: var(--color-bg-tint); }

/* Left color accent bar by type */
.arch-card-accent {
    width: 4px;
    min-height: 48px;
    border-radius: 4px;
    flex-shrink: 0;
    align-self: stretch;
}
.arch-card-accent--phase { background: var(--color-primary); }
.arch-card-accent--step  { background: var(--color-success); }
.arch-card-accent--task  { background: var(--color-warning); }

/* Type badge */
.arch-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.arch-badge--phase { background: var(--color-primary-50); color: var(--color-primary); }
.arch-badge--step  { background: #dcfce7; color: #166534; }
.arch-badge--task  { background: var(--color-warning-50); color: #92400e; }

/* Main info area */
.arch-card-body {
    flex: 1;
    min-width: 0;
}
.arch-card-breadcrumb {
    font-size: 12px;
    color: var(--color-gray-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}
.arch-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.arch-card-meta {
    font-size: 12px;
    color: var(--color-gray-400);
    margin-top: 4px;
}

/* Expiry warning */
.arch-ttl {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}
.arch-ttl--ok      { background: var(--color-gray-100); color: var(--color-text-secondary); }
.arch-ttl--warning { background: var(--color-warning-50); color: #92400e; }
.arch-ttl--danger  { background: var(--color-danger-50); color: #991b1b; }

/* Action buttons */
.arch-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.arch-btn-restore {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 7px 13px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.arch-btn-restore:hover { background: var(--color-primary-hover); }
.arch-btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-gray-400);
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.arch-btn-delete:hover { background: var(--color-danger-50); color: var(--color-danger-600); border-color: #fca5a5; }

@media (max-width: 640px) {
    .arch-wrap { padding: 12px; }
    .arch-card { flex-wrap: wrap; }
    .arch-card-actions { width: 100%; justify-content: flex-end; }
}

/* ===== COMMENTS PANEL (Word-style) ===== */
.comments-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.15);
    z-index: 1100;
}
.comments-overlay.open { display: block; }

.comments-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 440px;
    max-width: 100vw;
    background: var(--color-surface);
    border-left: 1px solid var(--color-border-strong);
    box-shadow: -12px 0 32px rgba(15, 23, 42, 0.10);
    z-index: 1101;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 220ms cubic-bezier(0.2, 0, 0, 1);
}
.comments-panel.open { transform: translateX(0); }

.comments-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    gap: 12px;
}
.comments-panel-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 3px;
}
.comments-panel-task {
    font-size: 12px;
    color: var(--color-text-secondary);
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.comments-panel-close {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--color-gray-400);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.comments-panel-close:hover { background: var(--color-gray-100); color: var(--color-text-strong); }

/* Comment list */
.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}
.comments-loading {
    text-align: center;
    padding: 40px;
    color: var(--color-gray-400);
    font-size: 13px;
}
.comments-empty {
    text-align: center;
    padding: 50px 20px;
    color: var(--color-gray-400);
    font-size: 13px;
}
.comments-empty-icon { display: block; margin: 0 auto 10px; width: 32px; height: 32px; }

/* Individual comment */
.comment-item {
    padding: 10px 18px;
    border-bottom: 1px solid var(--color-gray-50);
    transition: background 0.1s;
}
.comment-item:hover { background: var(--color-bg-faint); }
.comment-item:last-child { border-bottom: none; }

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.comment-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.comment-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    flex: 1;
}
.comment-time {
    font-size: 11px;
    color: var(--color-gray-400);
    white-space: nowrap;
}
.comment-del {
    background: none;
    border: none;
    color: var(--color-border-strong);
    font-size: 13px;
    cursor: pointer;
    padding: 0 2px;
    border-radius: 4px;
    transition: color 0.15s;
    line-height: 1;
}
.comment-del:hover { color: var(--color-danger-500); }
.comment-text {
    font-size: 13px;
    color: var(--color-text-strong);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    padding-left: 38px;
}

/* Input area */
.comments-input-wrap {
    border-top: 1px solid var(--color-border);
    padding: 12px 16px 16px;
    flex-shrink: 0;
    background: var(--color-bg-faint);
}
.comments-input-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.comments-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    font-size: 12px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}
.comments-input {
    flex: 1;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.15s;
    background: var(--color-surface);
    color: var(--color-text);
    line-height: 1.5;
}
.comments-input:focus { border-color: var(--color-primary); }
.comments-input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding-left: 42px;
}
.comments-hint { font-size: 11px; color: var(--color-gray-400); }
.comments-send-btn {
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.comments-send-btn:hover { background: var(--color-primary-hover); }

/* Comment button on task row */
.btn-comment {
    width: 22px;
    height: 22px;
    background: transparent;
    border: none;
    border-radius: 5px;
    padding: 0;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-secondary);
    opacity: 0.6;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex-shrink: 0;
}
.btn-comment:hover { opacity: 1; background: var(--color-gray-100); }
.btn-comment.has-comments { opacity: 1; }
.btn-comment-count {
    font-weight: 700;
    font-size: 11px;
}

@media (max-width: 768px) {
    .comments-overlay.open {
        background: rgba(0,0,0,0.3);
    }
    .comments-panel {
        width: 100%;
        left: 0;
        right: 0;
        border-left: none;
        border-radius: 0;
    }
    /* ── Заголовок ── */
    .comments-panel-header {
        padding: 48px 20px 14px 20px;
        position: sticky;
        top: 0;
        background: var(--color-surface);
        z-index: 2;
        text-align: center;
        border-bottom: 1px solid #f0f0f0;
    }
    .comments-panel-header > div {
        text-align: center;
    }
    .comments-panel-title {
        font-size: 17px;
        text-align: center;
    }
    .comments-panel-task {
        max-width: none;
        white-space: normal;
        line-height: 1.4;
        text-align: center;
        font-size: 13px;
        color: var(--color-gray-400);
        margin-top: 2px;
    }
    .comments-panel-close {
        position: absolute;
        top: 48px;
        right: 16px;
        width: 32px;
        height: 32px;
        font-size: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--color-gray-100);
        border-radius: 50%;
    }
    /* ── Пустое состояние ── */
    .comments-empty {
        text-align: center;
        padding: 60px 24px;
    }
    /* ── Список комментариев ── */
    .comment-item {
        padding: 12px 20px;
    }
    .comment-avatar { width: 32px; height: 32px; font-size: 11px; }
    .comment-text {
        font-size: 13px;
        padding-left: 42px;
    }
    /* ── Ввод ── */
    .comments-input-wrap {
        padding: 10px 16px 28px 16px;
        border-top: 1px solid #f0f0f0;
    }
    .comments-input-row {
        gap: 8px;
    }
    .comments-avatar { width: 32px; height: 32px; font-size: 11px; }
    .comments-input {
        font-size: 14px;
        padding: 10px 12px;
        min-height: 42px;
        border-radius: 12px;
    }
    .comments-hint { display: none; }
    .comments-send-btn {
        padding: 9px 18px;
        font-size: 13px;
        border-radius: 10px;
    }
    .comments-input-footer {
        padding-left: 0;
        justify-content: flex-end;
        margin-top: 6px;
    }
}

/* ===== HISTORY V2 ===== */
.hist-v2-wrap {
    padding: 20px 28px 32px;
}
.hist-v2-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.hist-v2-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    margin-right: 10px;
}
.hist-v2-subtitle {
    font-size: 12px;
    color: var(--color-gray-400);
}
.hist-v2-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-gray-100);
    color: var(--color-text-strong);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
.hist-v2-refresh-btn:hover { background: var(--color-border); }

/* Empty state */
.hist-v2-empty {
    text-align: center;
    padding: 60px 40px;
}
.hist-v2-empty-icon {
    font-size: 44px;
    display: block;
    margin-bottom: 14px;
}
.hist-v2-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
}
.hist-v2-empty-sub {
    font-size: 13px;
    color: var(--color-gray-400);
}

/* Timeline feed */
.hist-v2-feed {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Date group header */
.hist-v2-date-group {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-gray-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px 0 8px;
}
.hist-v2-date-group:first-child { padding-top: 0; }

/* Individual entry row */
.hist-v2-entry {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-gray-100);
}
.hist-v2-entry:last-child { border-bottom: none; }

/* Action dot */
.hist-v2-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
}
.hist-v2-dot--add      { background: var(--color-success-50); }
.hist-v2-dot--delete   { background: var(--color-danger-50); }
.hist-v2-dot--update   { background: var(--color-primary-50); }
.hist-v2-dot--file_add { background: #F3F0FF; }
.hist-v2-dot--file_delete { background: var(--color-danger-50); }
.hist-v2-dot--other    { background: var(--color-gray-100); }
.hist-v2-dot--date_shift { background: var(--color-warning-50); }

/* Entry body */
.hist-v2-body { flex: 1; min-width: 0; }

.hist-v2-row-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 3px;
}
.hist-v2-user {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}
.hist-v2-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
}
.hist-v2-badge--add      { background: #dcfce7; color: #166534; }
.hist-v2-badge--delete   { background: var(--color-danger-50); color: #991b1b; }
.hist-v2-badge--update   { background: var(--color-primary-50); color: #1e40af; }
.hist-v2-badge--file_add { background: #f3e8ff; color: #6b21a8; }
.hist-v2-badge--file_delete { background: var(--color-danger-50); color: #991b1b; }
.hist-v2-badge--other    { background: var(--color-gray-100); color: var(--color-text-secondary); }
.hist-v2-badge--date_shift { background: #fef3c7; color: #92400e; }

.hist-v2-time {
    font-size: 11px;
    color: var(--color-gray-400);
    margin-left: auto;
    white-space: nowrap;
}

.hist-v2-breadcrumb {
    font-size: 12px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hist-v2-breadcrumb strong {
    color: var(--color-text-strong);
    font-weight: 600;
}
.hist-v2-change {
    font-size: 12px;
    color: var(--color-gray-400);
    margin-top: 2px;
}
.hist-v2-change span {
    color: var(--color-text-strong);
    font-weight: 500;
}
.hist-v2-change .hist-v2-old {
    color: var(--color-gray-400);
    text-decoration: line-through;
    font-weight: 500;
}
.hist-v2-change .hist-v2-new {
    color: #b45309;
    font-weight: 600;
}

@media (max-width: 640px) {
    .hist-v2-wrap { padding: 12px; }
    .hist-v2-time { margin-left: 0; }
}

/* ===== FILES V2 ===== */
.files-v2-wrap {
    padding: 20px 28px 32px;
}
.files-v2-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.files-v2-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    margin-right: 10px;
}
.files-v2-subtitle {
    font-size: 12px;
    color: var(--color-gray-400);
}
.files-v2-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-gray-100);
    color: var(--color-text-strong);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
.files-v2-refresh-btn:hover { background: var(--color-border); }

/* Empty state */
.files-v2-empty {
    text-align: center;
    padding: 60px 40px;
    color: var(--color-gray-400);
}
.files-v2-empty-icon {
    font-size: 44px;
    display: block;
    margin-bottom: 14px;
}
.files-v2-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
}
.files-v2-empty-sub {
    font-size: 13px;
    color: var(--color-gray-400);
}

/* Grid of file cards */
.files-v2-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.files-v2-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow 0.15s;
}
.files-v2-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }

.files-v2-card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.files-v2-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.files-v2-icon--pdf  { background: var(--color-danger-50); }
.files-v2-icon--img  { background: var(--color-primary-50); }
.files-v2-icon--doc  { background: var(--color-primary-50); }
.files-v2-icon--xls  { background: var(--color-success-50); }
.files-v2-icon--zip  { background: var(--color-warning-50); }
.files-v2-icon--other{ background: var(--color-gray-100); }

.files-v2-info { flex: 1; min-width: 0; }
.files-v2-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    word-break: break-word;
    line-height: 1.4;
    margin-bottom: 3px;
}
.files-v2-name a {
    color: inherit;
    text-decoration: none;
}
.files-v2-name a:hover { color: var(--color-primary); text-decoration: underline; }
.files-v2-size {
    font-size: 11px;
    color: var(--color-gray-400);
}

.files-v2-breadcrumb {
    font-size: 12px;
    color: var(--color-text-secondary);
    background: var(--color-gray-50);
    border-radius: 6px;
    padding: 6px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.files-v2-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.files-v2-date {
    font-size: 11px;
    color: var(--color-gray-400);
}
.files-v2-btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-gray-400);
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.files-v2-btn-delete:hover { background: var(--color-danger-50); color: var(--color-danger-600); border-color: #fca5a5; }

@media (max-width: 640px) {
    .files-v2-wrap { padding: 12px; }
    .files-v2-grid { grid-template-columns: 1fr; }
}

/* ===== CALENDAR ===== */
.cal-wrap {
    padding: 20px 28px 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.cal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.cal-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cal-nav-btn {
    width: 34px; height: 34px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text-strong);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.cal-nav-btn:hover { background: var(--color-gray-100); }
.cal-today-btn {
    padding: 7px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text-strong);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
.cal-today-btn:hover { background: var(--color-gray-100); }
.cal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    margin-left: 4px;
}
.cal-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.cal-add-btn:hover { background: var(--color-primary-hover); }
.cal-view-toggle {
    display: flex;
    background: var(--color-gray-100);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}
.cal-view-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.cal-view-btn.active {
    background: var(--color-surface);
    color: var(--color-text);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.cal-body {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    overflow: hidden;
}

/* ---- Month view ---- */
.cal-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}
.cal-month-head {
    text-align: center;
    padding: 10px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-gray-400);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--color-gray-100);
    background: var(--color-bg-faint);
}
.cal-month-head.weekend { color: var(--color-text-secondary); font-weight: 700; }
.cal-month-cell {
    min-height: 110px;
    padding: 6px;
    border-right: 1px solid var(--color-gray-100);
    border-bottom: 1px solid var(--color-gray-100);
    vertical-align: top;
    position: relative;
    cursor: default;
}
.cal-month-cell:nth-child(7n) { border-right: none; }
.cal-month-cell.other-month { background: var(--color-bg-faint); }
.cal-month-cell.today { background: var(--color-primary-25); }
.cal-day-num {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-strong);
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    margin-bottom: 4px;
}
.cal-month-cell.today .cal-day-num {
    background: var(--color-primary);
    color: var(--color-surface);
}
.cal-month-cell.other-month .cal-day-num { color: var(--color-border-strong); }
.cal-month-cell.weekend-cell { background: #fdfcfc; }
.cal-event-pill {
    display: block;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 5px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
    opacity: 0.9;
}
.cal-event-more {
    font-size: 11px;
    color: var(--color-text-secondary);
    padding: 1px 4px;
}

/* ---- Week view ---- */
.cal-week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}
.cal-week-head {
    padding: 12px 8px 10px;
    text-align: center;
    border-right: 1px solid var(--color-gray-100);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-faint);
}
.cal-week-head:last-child { border-right: none; }
.cal-week-head.today-col .cal-week-dayname { color: var(--color-primary); }
.cal-week-head.today-col .cal-week-daynum {
    background: var(--color-primary);
    color: var(--color-surface);
}
.cal-week-dayname {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-gray-400);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.cal-week-daynum {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    margin: 0 auto;
}
.cal-week-col {
    border-right: 1px solid var(--color-gray-100);
    padding: 8px 6px;
    min-height: 300px;
    vertical-align: top;
}
.cal-week-col:last-child { border-right: none; }
.cal-week-col.today-col { background: var(--color-primary-25); }
.cal-week-event {
    display: block;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 8px;
    border-radius: 8px;
    margin-bottom: 5px;
    line-height: 1.4;
    cursor: default;
    opacity: 0.9;
}
.cal-week-event-phase {
    font-size: 10px;
    opacity: 0.75;
    margin-top: 2px;
}

/* ---- Day view ---- */
.cal-day-view {
    padding: 20px 24px;
    min-height: 300px;
}
.cal-day-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-gray-400);
    font-size: 14px;
}
.cal-day-event {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(0,0,0,0.06);
}
.cal-day-event-bar {
    width: 4px;
    border-radius: 4px;
    align-self: stretch;
    min-height: 36px;
    flex-shrink: 0;
}
.cal-day-event-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 3px;
}
.cal-day-event-meta {
    font-size: 12px;
    color: var(--color-gray-400);
}

/* Calendar event delete button */
.cal-event-del {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: rgba(0,0,0,0.15);
    border: none;
    color: inherit;
    font-size: 10px;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
    margin-left: 4px;
    vertical-align: middle;
    transition: background 0.15s;
}
.cal-event-del:hover { background: rgba(0,0,0,0.35); }

/* Calendar event modal */
.cal-modal-field {
    margin-bottom: 14px;
}
.cal-modal-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.cal-modal-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    font-size: 14px;
    color: var(--color-text);
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
}
.cal-modal-input:focus { border-color: var(--color-primary); }
.cal-user-picker {
    max-height: 168px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 8px;
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cal-user-picker-empty {
    color: var(--color-gray-400);
    font-size: 13px;
    padding: 8px;
}
.cal-user-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.cal-user-option:hover {
    background: var(--color-bg-tint);
}
.cal-user-option input[type=checkbox] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: var(--color-primary);
    cursor: pointer;
}
.cal-user-option.is-self {
    background: var(--color-primary-25);
}
.cal-user-option.is-self input[type=checkbox] {
    cursor: not-allowed;
}
.cal-user-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cal-user-option-name {
    font-size: 14px;
    color: var(--color-text);
}
.cal-user-option-note {
    font-size: 12px;
    color: var(--color-text-secondary);
}

/* Color picker */
.cal-color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.cal-color-swatch {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
    box-sizing: border-box;
}
.cal-color-swatch:hover { transform: scale(1.15); }
.cal-color-swatch.selected { border-color: var(--color-text); transform: scale(1.1); }

/* Announce checkbox row */
.cal-modal-announce-row {
    background: #f0f7ff;
    border: 1px solid var(--color-primary-50);
    border-radius: 10px;
    padding: 12px 14px;
    margin-top: 4px;
}
.cal-modal-check-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.cal-modal-check-wrap input[type=checkbox] {
    width: 16px; height: 16px;
    cursor: pointer;
    accent-color: var(--color-primary);
}
.cal-modal-check-label {
    font-size: 13px;
    font-weight: 500;
    color: #1e40af;
}

.cal-view-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}
.cal-view-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
    box-shadow: 0 0 0 4px rgba(148,163,184,0.12);
}
.cal-view-date {
    font-size: 14px;
    color: #4b5563;
}
.cal-view-time {
    font-size: 13px;
    color: var(--color-text-secondary);
}
.cal-view-section {
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-gray-50);
}
.cal-view-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}
.cal-view-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
    white-space: pre-wrap;
}
.cal-view-members {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.cal-view-member {
    padding: 7px 10px;
    border-radius: 999px;
    background: var(--color-primary-25);
    color: var(--color-primary-strong);
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.cal-view-member.is-pending {
    background: #fff7e6;
    color: #b26a00;
}
.cal-view-member.is-declined {
    background: #fdecec;
    color: var(--color-danger-text);
}
.cal-view-member-status {
    font-size: 11px;
    font-weight: 700;
    opacity: 0.8;
}
.cal-view-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}
.cal-view-meta-card {
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-surface);
}
.cal-view-meta-value {
    font-size: 14px;
    color: var(--color-text);
    line-height: 1.45;
}
.cal-view-delete-btn {
    background: var(--color-danger-50);
    color: var(--color-danger-700);
}
.cal-view-delete-btn:hover {
    background: #fecaca;
}
.cal-event-time {
    flex-shrink: 0;
    margin-right: 6px;
    font-weight: 700;
    opacity: 0.9;
}
.cal-event-pill-clickable,
.cal-week-event-clickable,
.cal-day-event-clickable {
    cursor: pointer;
}

/* Custom events marker (dot) in month cell */
.cal-custom-dot {
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    margin-right: 3px;
    vertical-align: middle;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .cal-wrap { padding: 12px; }
    .cal-week-daynum { font-size: 15px; width: 28px; height: 28px; }
    .cal-month-cell { min-height: 70px; }
}

/* ── Drag & Drop для плана (фазы / этапы / задачи) ─────── */
.plan-drag-handle {
    display: inline-block;
    cursor: grab;
    color: #ccc;
    font-size: 13px;
    margin-right: 5px;
    user-select: none;
    vertical-align: middle;
    transition: color 0.15s;
}
.plan-drag-handle:hover { color: #888; }
.plan-drag-handle:active { cursor: grabbing; }

/* Задачи: иконка появляется при наведении на строку */
#planBody tr.task-row .task-name-cell { position: relative; }
#planBody tr.task-row:hover .task-name-cell::before {
    content: '⠿';
    position: absolute;
    left: -14px;
    top: 50%;
    transform: translateY(-50%);
    color: #bbb;
    font-size: 13px;
    cursor: grab;
}

#planBody tr.plan-dragging { opacity: 0.35; }
#planBody tr.plan-drag-over td { border-top: 2px solid var(--color-primary); }

/* ── Конструктор полей (Этап 2) ── */
#fieldsAdminModal .field-def-row:last-child { border-bottom: none; }
#fieldsAdminModal .field-def-row:hover { background: var(--color-bg-tint); }
#fieldsAdminModal .plan-inline-btn { font-size: 14px; padding: 4px 8px; }
#fieldEditor input[type="text"],
#fieldEditor select,
#fieldEditor textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
    margin-top: 4px;
    margin-bottom: 10px;
    font-family: inherit;
}
#fieldEditor textarea { resize: vertical; }
#fieldEditor label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-strong);
    display: block;
    margin-top: 6px;
}
#fieldEditor input[disabled] { background: var(--color-gray-100); color: var(--color-text-secondary); cursor: not-allowed; }
#fieldEditor select[disabled] { background: var(--color-gray-100); color: var(--color-text-secondary); cursor: not-allowed; }

/* ── Force Change Password Modal (первый вход) ── */
.fcp-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(26,26,46,0.92) 0%, rgba(15,52,96,0.92) 100%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fcpFadeIn 0.25s ease-out;
}
.fcp-overlay.active { display: flex; }

@keyframes fcpFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes fcpSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fcp-card {
    background: var(--color-surface);
    border-radius: 18px;
    padding: 36px 36px 30px;
    box-shadow: 0 24px 70px rgba(0,0,0,0.35);
    width: 100%;
    max-width: 440px;
    animation: fcpSlideUp 0.3s ease-out;
    box-sizing: border-box;
}

.fcp-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-surface);
    margin: 0 auto 18px;
    box-shadow: 0 8px 20px rgba(21,101,192,0.35);
}

.fcp-title {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 700;
    color: var(--color-nav-bg);
    text-align: center;
}

.fcp-subtitle {
    margin: 0 0 24px;
    font-size: 13px;
    color: var(--color-text-secondary);
    text-align: center;
    line-height: 1.5;
}

.fcp-field {
    margin-bottom: 16px;
}

.fcp-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-strong);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.fcp-input-wrap {
    position: relative;
}

.fcp-input-wrap input {
    width: 100%;
    padding: 12px 44px 12px 14px;
    border: 2px solid var(--color-border);
    border-radius: 10px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}
/* Email-инпут — без правого паддинга под «глаз» (его тут нет) */
.fcp-input-wrap input[type=email] {
    padding-right: 14px;
}

.fcp-input-wrap input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(21,101,192,0.12);
}

.fcp-eye {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.55;
    transition: opacity 0.15s;
}
.fcp-eye:hover { opacity: 1; }

.fcp-hint {
    font-size: 11px;
    color: var(--color-text-secondary);
    margin-top: 6px;
    line-height: 1.4;
}
.fcp-requirements {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.fcp-requirements li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--color-gray-400);
    transition: color 0.2s;
}
.fcp-requirements li .fcp-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--color-border-strong);
    flex-shrink: 0;
    transition: all 0.2s;
    position: relative;
}
.fcp-requirements li.ok {
    color: #059669;
}
.fcp-requirements li.ok .fcp-dot {
    background: var(--color-success-500);
    border-color: var(--color-success-500);
}
.fcp-requirements li.ok .fcp-dot::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.fcp-match-hint {
    font-size: 12px;
    margin-top: 6px;
    min-height: 16px;
    transition: color 0.15s;
}
.fcp-match-hint.ok    { color: #059669; }
.fcp-match-hint.nomatch { color: var(--color-danger-600); }

.fcp-error {
    color: var(--color-danger-600);
    font-size: 13px;
    min-height: 18px;
    margin: 4px 0 10px;
    text-align: center;
}

.fcp-submit {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: var(--color-surface);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    box-shadow: 0 6px 16px rgba(21,101,192,0.25);
}
.fcp-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(21,101,192,0.35);
}
.fcp-submit:active:not(:disabled) { transform: translateY(0); }
.fcp-submit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.fcp-skip {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    border: none;
    background: none;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}
.fcp-skip:hover {
    background: var(--color-gray-100);
    color: var(--color-nav-bg);
}

@media (max-width: 480px) {
    .fcp-card { padding: 28px 22px 24px; border-radius: 14px; }
    .fcp-title { font-size: 19px; }
}

/* ── Упоминания в комментариях ── */
.comment-mention {
    background: var(--color-primary-50);
    color: var(--color-primary-strong);
    padding: 1px 6px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}
.comment-mention--me {
    background: var(--color-warning-50);
    color: #b45309;
}

/* Popup автокомплита @упоминаний */
.mention-popup {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 44px;
    right: 12px;
    max-height: 260px;
    overflow-y: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(15,23,42,0.15);
    z-index: 1500;
    padding: 4px;
}
.mention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 7px;
    transition: background 0.1s;
}
.mention-item:hover,
.mention-item--active {
    background: var(--color-primary-25);
}
.mention-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    color: var(--color-surface);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mention-name {
    font-size: 13px;
    color: var(--color-text);
    font-weight: 500;
}

/* Кликабельность task-name-cell — открывает Task Drawer */
.task-name-cell { cursor: pointer; transition: color 0.15s; }
.task-name-cell:hover .task-name-text { color: var(--color-primary); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--color-primary-50); }

/* ====================================================================
   TASK DRAWER — боковая панель редактирования задачи (480px справа).
   Linear/Trello/Tracker-стиль. Открывается по клику на задачу.
   ==================================================================== */
.task-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    visibility: hidden;
    z-index: 240;
    transition: opacity 200ms ease-out, visibility 0s linear 200ms;
}
.task-drawer-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity 200ms ease-out;
}

.task-drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 440px;
    max-width: 100vw;
    background: var(--color-surface);
    border-left: 1px solid var(--color-border-strong);
    box-shadow: -12px 0 32px rgba(15, 23, 42, 0.10);
    z-index: 250;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 220ms cubic-bezier(0.2, 0, 0, 1);
    visibility: hidden;
}
.task-drawer.is-open {
    transform: translateX(0);
    visibility: visible;
}
.task-drawer.is-closing {
    transition: transform 180ms cubic-bezier(0.4, 0, 1, 1);
}

/* Header */
.task-drawer-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    gap: 12px;
}
.task-drawer-breadcrumb {
    font-size: 12px;
    color: var(--color-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.task-drawer-breadcrumb strong {
    color: var(--color-text);
    font-weight: 600;
}
.task-drawer-close {
    background: transparent;
    border: none;
    width: 30px; height: 30px;
    border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.task-drawer-close:hover { background: var(--color-bg-subtle); color: var(--color-text); }
.task-drawer-close:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Body — scrollable */
.task-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Status + urgency + saved indicator (sticky-ish first row) */
.task-drawer-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.task-drawer-status,
.task-drawer-urgency {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    background: white;
    cursor: pointer;
    font-family: inherit;
}
.task-drawer-status[value="todo"],
.task-drawer-status option[value="todo"] { color: #4B5563; }
.task-drawer-saved {
    margin-left: auto;
    font-size: 11px;
    color: var(--color-success);
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.2s;
}
.task-drawer-saved.is-visible { opacity: 1; }
.task-drawer-saved.is-error { color: var(--color-danger); }

/* Title — inline-editable, large */
.task-drawer-title {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: 8px 10px;
    margin: 0 -10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.3;
    border-radius: 6px;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s;
}
.task-drawer-title:hover { background: var(--color-bg-subtle); }
.task-drawer-title:focus {
    outline: none;
    border-color: var(--color-primary);
    background: white;
    box-shadow: 0 0 0 3px var(--color-primary-25);
}

/* Meta grid */
.task-drawer-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
}
.task-drawer-meta > .task-drawer-field:first-child { grid-column: 1 / -1; }

.task-drawer-field { display: flex; flex-direction: column; gap: 4px; }
.task-drawer-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.task-drawer-input,
.task-drawer-textarea {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    background: white;
    color: var(--color-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.task-drawer-input:focus,
.task-drawer-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-25);
}
.task-drawer-input.is-saving,
.task-drawer-textarea.is-saving {
    background: var(--color-bg-subtle);
    color: var(--color-text-muted);
}
.task-drawer-input.is-error,
.task-drawer-textarea.is-error {
    border-color: var(--color-danger);
    box-shadow: 0 0 0 3px var(--color-danger-25);
}
.task-drawer-textarea { resize: vertical; min-height: 70px; }

/* Sections */
.task-drawer-section {
    border-top: 1px solid var(--color-border);
    padding-top: 14px;
}
.task-drawer-section-head {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 10px;
}
.task-drawer-section-count {
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-strong);
    text-transform: none;
    letter-spacing: 0;
}

/* Timeline-стиль: вертикальная линия слева + точка для каждой записи.
   Linear/Notion Activity-pattern. Без рамки на каждой записи — линия
   связывает события визуально. */
.task-drawer-shifts {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    padding: 4px 0 4px 18px;
}
.task-drawer-shifts::before {
    content: '';
    position: absolute;
    left: 5px; top: 8px; bottom: 8px;
    width: 1px;
    background: var(--color-border-strong);
}
.task-drawer-shifts:empty::before { display: none; }
.task-drawer-shift-item {
    position: relative;
    background: transparent;
    border: none;
    padding: 0;
    font-size: 12px;
}
.task-drawer-shift-item::before {
    content: '';
    position: absolute;
    left: -17px; top: 5px;
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--color-warning, #f59e0b);
    border: 2px solid white;
    box-shadow: 0 0 0 1px var(--color-border-strong);
}
.task-drawer-shift-item.is-empty {
    color: var(--color-text-muted);
    font-style: italic;
    padding-left: 0;
}
.task-drawer-shift-item.is-empty::before { display: none; }
.task-drawer-shift-dates {
    color: #92400e; font-weight: 600;
    background: var(--color-warning-50);
    padding: 1px 7px; border-radius: 999px;
    border: 1px solid #fde68a;
}
.task-drawer-shift-meta {
    display: flex; gap: 8px; align-items: center;
    color: var(--color-text-muted); font-size: 11px;
    margin-top: 4px;
}
.task-drawer-shift-reason { margin-top: 4px; color: var(--color-text); }
.task-drawer-shift-reason.is-empty { color: var(--color-text-muted); font-style: italic; }

.task-drawer-links { display: flex; gap: 8px; flex-wrap: wrap; }
.task-drawer-linkbtn {
    display: inline-flex; align-items: center; gap: 6px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-strong);
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.task-drawer-linkbtn:hover:not(:disabled) {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-20);
}
.task-drawer-linkbtn:disabled { opacity: 0.5; cursor: not-allowed; }
.task-drawer-linkbtn-count {
    background: var(--color-primary-25);
    color: var(--color-primary);
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px; text-align: center;
}
.task-drawer-linkbtn-count:empty { display: none; }

/* Footer */
.task-drawer-foot {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 18px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-faint);
    flex-shrink: 0;
}
/* Деструктивная кнопка в drawer — НЕ конкурирует с primary CTA.
   Без рамки и фона, по умолчанию. На hover — лёгкая красная плашка.
   Правило `destructive-emphasis` из §8: визуально отделена от primary. */
.task-drawer-delete {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}
.task-drawer-delete:hover {
    background: var(--color-danger-50);
    color: var(--color-danger);
}
.task-drawer-delete:focus-visible {
    outline: 2px solid var(--color-danger);
    outline-offset: 2px;
}
.task-drawer-hint {
    font-size: 11px;
    color: var(--color-text-muted);
}

/* Body lock when drawer open */
body.task-drawer-open { overflow: hidden; }

@media (max-width: 640px) {
    .task-drawer { width: 100vw; }
    .task-drawer-meta { grid-template-columns: 1fr; }
}

/* ===== АДМИНИСТРИРОВАНИЕ ===== */
.admin-wrap {
    max-width: 1100px;
    padding: 24px 28px 32px;
}
.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--color-border);
}
.admin-tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: var(--color-text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}
.admin-tab-btn:hover { color: var(--color-primary); }
.admin-tab-btn.is-active {
    color: var(--color-text);
    font-weight: 700;
    border-bottom-color: var(--color-primary);
}
.admin-help {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
    background: var(--color-bg-subtle);
    border-left: 3px solid var(--color-primary-50);
    padding: 10px 14px;
    border-radius: 6px;
}
.admin-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.admin-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    font-family: inherit;
    box-shadow: var(--shadow-primary);
}
.admin-btn-primary:hover {
    background: var(--color-primary-dark);
    box-shadow: var(--shadow-primary-lg);
}
.admin-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-success);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.25);
}
.admin-btn-secondary:hover { background: #1B5E20; box-shadow: 0 2px 6px rgba(46, 125, 50, 0.25); }
.admin-btn-ghost {
    background: white;
    color: var(--color-text-strong);
    border: 1.5px solid var(--color-border);
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.admin-btn-ghost:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-20); }

/* Сохранение совместимости со старым именем кнопки */
.admin-btn-save { /* deprecated alias */
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--color-primary); color: white;
    border: none; border-radius: 10px; padding: 9px 18px;
    font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
    box-shadow: var(--shadow-primary);
    transition: background 0.2s, box-shadow 0.2s;
}
.admin-btn-save:hover { background: var(--color-primary-dark); box-shadow: var(--shadow-primary-lg); }

.admin-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    padding: 18px 20px;
}
.admin-card .empty-placeholder { padding: 24px; }

.admin-form-card {
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 16px;
}
.admin-form-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 12px;
}
.admin-form-grid {
    display: grid;
    grid-template-columns: 140px 1fr 1fr;
    gap: 12px;
    align-items: end;
}
.admin-form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 6px;
}
.admin-field { display: flex; flex-direction: column; gap: 4px; }
.admin-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.admin-input {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--color-text);
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}
.admin-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-25);
}
.admin-input:disabled {
    background: var(--color-bg-subtle);
    color: var(--color-text-muted);
    cursor: not-allowed;
}

.admin-error {
    color: var(--color-danger);
    font-size: 12px;
    margin-top: 8px;
    min-height: 16px;
}
.admin-modal-narrow { max-width: 440px; }
.admin-modal-help {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 10px;
}
.admin-temp-user {
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--color-text-strong);
}
.admin-temp-password {
    flex: 1;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg-subtle);
    color: var(--color-text);
}
.admin-temp-hint {
    font-size: 11px;
    color: var(--color-success);
    margin-top: 6px;
    min-height: 14px;
}

@media (max-width: 768px) {
    .admin-wrap { padding: 16px; }
    .admin-form-grid { grid-template-columns: 1fr; }
    .admin-tab-btn { padding: 8px 12px; font-size: 13px; }
}

