:root {
    --primary: var(--color-primary);
    --primary-light: var(--color-primary-10);
    --dark: #111111;
    --light: #FFFFFF;
    --grey-bg: #F4F5F7;
    --border: #e0e0e0;
    --gold: #FFD700;
    --purple: #9b59b6;
    --danger: #e74c3c;
    --blue-soft: #f0f7ff;
}

/* --- SIDEBAR COMPONENTS --- */
#sidebarContent{
    color: white;
}

.sb-header {
    padding: 5px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sb-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
}

.control-group {
    margin-bottom: 20px;
    flex-shrink: 0;
}

.cg-title {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 10px;
    color: #777;
}

/* Toggles */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    cursor: pointer;
}
.toggle-label { font-size: 13px; }
.toggle-switch {
    width: 32px; height: 18px; background: #ddd; border-radius: 10px;
    position: relative; transition: 0.3s;
}
.toggle-switch::after {
    content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 14px; height: 14px;
    background: #fff; border-radius: 50%; transition: 0.3s;
}

.toggle-row.active .toggle-switch { background: var(--primary); }
.toggle-row.active .toggle-switch::after { inset-inline-start: 16px; }

/* --- CANVAS & GRAPH --- */
#graph { flex: 1; display: flex; flex-direction: column; min-width: 0;}

.canvas-wrapper {
    flex: 1;
    width:100%; height: 100%; position: relative; cursor: grab;
    background: radial-gradient(circle at center, #fcfcfc 0%, #f0f2f5 100%);
    overflow: hidden; min-width: 0;
}
.canvas-wrapper:active { cursor: grabbing; }

.graph-overlay {
    position: absolute;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    z-index: 10;
}

.overlay-title {
    font-size: 11px; font-weight: 600; color: #999;
    text-transform: uppercase; border-bottom: 1px solid #eee;
    margin-bottom: 8px; padding-bottom: 4px;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

.overlay-collapse-btn {
    cursor: pointer;
    color: #bbb;
    font-size: 11px;
    padding: 2px 4px;
    flex-shrink: 0;
}
.overlay-collapse-btn:hover { color: var(--primary); }

/* Свёрнутый оверлей: видна только строка заголовка */
.graph-overlay.collapsed .overlay-title {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    cursor: default;
}
.graph-overlay.collapsed > *:not(.overlay-title) {
    display: none;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 6px 8px; /* Добавили отступы, чтобы фон смотрелся красиво */
    margin-bottom: 2px;
    border-radius: 6px; /* Закругленные углы */
    cursor: pointer;
    transition: all 0.2s ease; /* Плавное переключение */
}

/* Состояние при наведении (hover) */
.legend-item:hover {
    background-color: #f5f5f5;
}

/* Состояние при клике (выбранный отдел) */
.legend-item.active {
    background-color: var(--primary-light); /* Светло-оранжевый фон */
    font-weight: 600;
    color: var(--primary); /* Оранжевый текст */
}

.dot { width: 8px; height: 8px; border-radius: 50%; }

/* Zoom Controls */
.zoom-controls { position: absolute; bottom: 65px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 500; }
.zoom-btn {
    width: 36px; height: 36px; background: #fff; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); cursor: pointer; color: #555;
}
.zoom-btn:hover { background: var(--primary); color: #fff; }

/* --- ЛЕНТА ВИДЖЕТОВ (METRICS RIBBON) --- */
.metrics-ribbon {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 5px;
    scroll-behavior: smooth;
    /* Тонкий скроллбар для Firefox */
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

/* Кастомизация скроллбара для Chrome/Safari */
.metrics-ribbon::-webkit-scrollbar { height: 6px; }
.metrics-ribbon::-webkit-scrollbar-track { background: transparent; }
.metrics-ribbon::-webkit-scrollbar-thumb {
    background: rgba(173, 201, 235, 0.5);
    border-radius: 10px;
}
.metrics-ribbon::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* --- РАЗДЕЛИТЕЛЬ СЕКЦИЙ В RIBBON --- */
.ribbon-section-divider {
    flex: 0 0 auto;
    align-self: stretch;
    display: flex;
    align-items: center;
    writing-mode: vertical-lr;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-sec);
    padding: 0 6px;
    border-inline-end: 2px solid var(--border);
    margin-inline-end: 4px;
    opacity: 0.6;
}

/* --- КАРТОЧКА ВИДЖЕТА (RIBBON ITEM) --- */
.ribbon-item {
    flex: 0 0 340px; /* Фиксированная ширина как в sample.html */
    background: #ffffff;
    border: 1px solid #EDF0F2;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 12px 24px -4px rgba(145, 158, 171, 0.12);
    position: relative;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

.ribbon-item:hover { transform: translateY(-3px); }

/* Полоска статуса сверху */
.ribbon-item::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px; border-radius: 16px 16px 0 0;
    background-color: var(--cap-color, transparent);
}

/* Элементы внутри KPI карточки */
.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.kpi-title-text {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-sec);
    text-transform: uppercase;
}
.kpi-icon-circle {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}

.kpi-number {
    font-size: 32px;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 8px;
}

.kpi-footer {
    padding-top: 10px;
    border-top: 1px dashed #EDF0F2;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.kpi-subtext {
    font-size: 11px;
    color: var(--text-sec);
    line-height: 1.4;
}
.kpi-footer .kpi-subtext {
    margin-top: auto;
}

/* --- КОНТЕЙНЕРЫ ДЛЯ ЧАРТОВ --- */
.chart-card-body {
    height: 225px;
    width: 100%;
    margin-top: 10px;
    position: relative;
}

.chart-zoom-controls {
    position: absolute;
    bottom: 6px;
    right: 6px;
    display: flex;
    flex-direction: row;
    gap: 4px;
    z-index: 10;
}

.chart-zoom-btn {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-sec);
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    backdrop-filter: blur(4px);
}

.chart-zoom-btn:hover {
    background: var(--primary, #6366f1);
    color: #fff;
    border-color: var(--primary, #6366f1);
}

/* Дашборды с scatter/donut внутри tab-view — высота привязана к высоте панели */
.bp-inner-dashboard {
    display: flex;
    height: calc(50vh - 160px);
    min-height: 240px;
    gap: 20px;
    padding: 10px;
    overflow: hidden;
}

/* Квадранты для Матрицы Колодцев */
.matrix-grid {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
    z-index: 0; opacity: 0.05; pointer-events: none;
}
.q-risk { background: var(--danger); }
.q-warn { background: var(--warning); }
.q-safe { background: var(--success); }

/* Louvain/communities (.lv-*) — moved to lens/primitives/ribbon/CommunitiesPanel.css, colocated
   with the primitive; that tab's CSS was already exclusive to it. */

/* #view-summary (BottomPanel's tab container, was the mount point for HealthCard on the graph/
   dynamic pages) удалён 2026-09-27 вместе с BOTTOM PANEL выше — обе страницы, которые его
   использовали, удалены; Momentum монтирует HealthCard в свой собственный #momPanel, не сюда. */

/* --- DETAILS POPUP (DP) --- */
.dp-header { display: flex; align-items: flex-start; gap: 15px; margin-bottom: 0; }
.dp-avatar { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.1); flex-shrink: 0; }
.dp-name { font-size: 16px; font-weight: 700; margin-bottom: 2px; }

.dp-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0; }
.dp-stat-box { background: #f8f9fa; padding: 10px; border-radius: 8px; text-align: center; border: 1px solid var(--stat-color, var(--primary))18; }
.dp-val { font-weight: 700; color: var(--stat-color, var(--primary)); font-size: 20px; }
.dp-lbl { font-size: 10px; color: #999; text-transform: uppercase; margin-top: 2px; }

/* AI Section */
.ai-text { font-size: 12px; line-height: 1.5; color: #004085; }

.ai-more-btn {
    width: 100%; padding: 12px; margin: 10px 0;
    background: linear-gradient(135deg, #F0F7FF 0%, var(--color-primary-10) 100%);
    border: 1px solid var(--primary); border-radius: 8px;
    color: var(--primary); cursor: pointer; font-weight: 600;
    position: relative; overflow: hidden;
    animation: pulse-glow 2.5s ease-in-out infinite;
    transition: 0.3s;
}

/* Skills Tags */
.skill-tag {
    display: inline-block; padding: 4px 10px; margin: 2px;
    border-radius: 12px; font-size: 11px; font-weight: 500;
}
.skill-tag.hard { background: #bbdefb; color: #1565c0; border: 1px solid #64b5f6; }
.skill-tag.soft { background: #c8e6c9; color: #388e3c; border: 1px solid #81c784; }

/* Messages */
.msg-section { margin-top: 4px; }
.msg-section + .msg-section { margin-top: 10px; }
.msg-title { font-size: 10px; font-weight: 700; color: var(--text-sec); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); padding-bottom: 4px; margin-bottom: 6px; display: block; }
.msg-list { list-style: none; padding: 0; }
.msg-item { background: #fafafa; border: 1px solid #eee; padding: 7px 10px; border-radius: 8px; margin-bottom: 5px; font-size: 12px; }
.msg-text { line-height: 1.4; color: var(--text-main); }
.msg-meta { font-size: 10px; color: #999; display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.msg-user { flex: 1; }
.msg-weight { font-weight: 700; color: #6366f1; white-space: nowrap; }

/* --- ANIMATIONS --- */
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 8px color-mix(in srgb, var(--color-primary) 30%, transparent); }
    50% { box-shadow: 0 0 16px color-mix(in srgb, var(--color-primary) 50%, transparent); }
}
