/* ── css/citizen/base.css ── */
/* ========================================================================
   CITIZEN DASHBOARD - BASE STYLES
   Extracted from inline styles in citizen_dashboard.html
   Version: 1.0.0
   ======================================================================== */

/* ========================================================================
   THEME OVERRIDES (scoped) - avoid global :root conflicts
   ======================================================================== */

body[data-dashboard-theme="citizen"] {
    /* Layout sizes: single source in citizen_dashboard.css (CSS-4) */
    /* Keep sidebar offset in sync with the shared dashboard header */
    --citizen-header-height: var(--header-height, 64px);
}

/* ========================================================================
   RESET & BASE
   ======================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.6;
    overflow: hidden; /* ✅ ИСПРАВЛЕНО: Убираем скроллинг body, скроллинг только в панелях */
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* mobile browser chrome-safe viewport */
}

/* ========================================================================
   BOOTSTRAP FALLBACK (invalid config)
   ======================================================================== */
.citizen-bootstrap-fallback {
    margin: 1rem;
    padding: 1rem;
    border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-sm);
}

.citizen-bootstrap-fallback__title {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--danger);
}

.citizen-bootstrap-fallback__text {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.citizen-toast-fallback {
    position: fixed;
    z-index: 100000;
    right: 1rem;
    bottom: max(1rem, env(safe-area-inset-bottom));
    max-width: min(28rem, calc(100vw - 2rem));
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    color: var(--text-primary, var(--dark));
    background: var(--bg-elevated, var(--white));
    box-shadow: 0 12px 32px color-mix(in srgb, var(--dark) 22%, transparent);
    font-size: 0.9rem;
}

/* ✅ ИСПРАВЛЕНО: Разрешаем overflow для body когда открыта полноэкранная карточка */
body.fullscreen-active {
    overflow: hidden; /* Оставляем hidden для предотвращения скроллинга фона */
}

/* ========================================================================
   DASHBOARD HEADER (shared)
   Citizen dashboard uses shared header from _base_dashboard.html.
   Keep only citizen-specific content styling here.
   ======================================================================== */
body[data-dashboard-theme="citizen"] .dashboard-header .header-right {
    gap: 0.75rem;
}

/* Study Selector */
.study-selector-container {
    margin-left: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.study-selector-container label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.study-selector-container select.input-style {
    padding: 6px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-300);
    background-color: var(--bg-elevated);
    min-width: 220px;
    max-width: 340px;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.study-selector-container select.input-style:hover {
    border-color: var(--primary);
}

.study-selector-container select.input-style:focus {
     border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 10%, transparent);
}

/* Hide until JS confirms multiple studies are available */
#study-selector-wrapper {
    display: none;
}

.citizen-header-actions {
    display: flex;
    gap: 10px;
}

.citizen-new-ui-btn {
    background: var(--color-primary);
    border: none;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--color-primary) 40%, transparent);
    position: relative;
}

.citizen-new-ui-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger);
    color: var(--text-inverse);
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 700;
}

.header-meta {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.meta-item .icon {
    font-size: 1.25rem;
}

/* ========================================================================
   MAIN DASHBOARD LAYOUT
   ======================================================================== */
.dashboard-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Sidebars */
.dashboard-sidebar {
    background: var(--bg-secondary);
    padding: 1.5rem;
    /* overflow и height теперь управляются на уровне .dashboard-sidebar-left/right */
}

.dashboard-sidebar-left {
    width: var(--sidebar-left-width);
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    overflow-y: auto; /* Скроллинг только в панели */
    overscroll-behavior: contain; /* Изолировать скроллинг */
    -webkit-overflow-scrolling: touch; /* Плавный скролл на iOS */
    overflow-x: hidden;
    /* Fit the available height of .dashboard-main (so footer can exist without being pushed off-screen) */
    height: 100%;
    max-height: 100%;
    position: relative; /* ✅ ИСПРАВЛЕНО: relative вместо sticky для правильного скроллинга */
    scrollbar-width: thin;
    scrollbar-color: var(--gray-400) transparent;
}

.dashboard-sidebar-left::-webkit-scrollbar {
    width: 6px;
}

.dashboard-sidebar-left::-webkit-scrollbar-track {
    background: transparent;
}

.dashboard-sidebar-left::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 3px;
}

.dashboard-sidebar-left::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

.dashboard-sidebar-right {
    width: var(--sidebar-right-width);
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    overflow-y: auto; /* Скроллинг только в панели */
    overscroll-behavior: contain; /* Изолировать скроллинг */
    -webkit-overflow-scrolling: touch; /* Плавный скролл на iOS */
    overflow-x: hidden;
    /* Fit the available height of .dashboard-main (so footer can exist without being pushed off-screen) */
    height: 100%;
    max-height: 100%;
    position: relative; /* ✅ ИСПРАВЛЕНО: relative вместо sticky для правильного скроллинга */
    padding-bottom: 80px; /* Отступ для футера с ролями */
    scrollbar-width: thin;
    scrollbar-color: var(--gray-400) transparent;
}

/* Right sidebar: industrial compact spacing */
.dashboard-sidebar-right .sidebar-section {
    margin-bottom: 1.1rem;
}

.dashboard-sidebar-right .sidebar-title {
    margin-bottom: 0.6rem;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
}

.dashboard-sidebar-right::-webkit-scrollbar {
    width: 6px;
}

.dashboard-sidebar-right::-webkit-scrollbar-track {
    background: transparent;
}

.dashboard-sidebar-right::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 3px;
}

.dashboard-sidebar-right::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* Main Content Area */
.dashboard-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    /* Nested flex children (.content-wrapper / .view-pane) need this for scrolling instead of clipping */
    min-height: 0;
    overflow-x: hidden; /* ✅ ИСПРАВЛЕНО: Только горизонтальный overflow скрыт */
    overflow-y: visible !important; /* ✅ ИСПРАВЛЕНО: Разрешаем видимость выпадающих меню из view-switcher */
    background: var(--bg-primary);
    position: relative; /* ✅ ИСПРАВЛЕНО: Для правильного стекирования */
    z-index: 1; /* ✅ ИСПРАВЛЕНО: Базовый z-index для контента */
}

/* Sidebar Sections */
.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}


/* Action Buttons Container */
.action-buttons-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: var(--text-primary);
    text-align: left;
    font-weight: 500;
}

.action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.action-btn span:first-child {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* ✅ ИСПРАВЛЕНО: .cards-container удален, так как он конфликтует с #heroes-pane .cards-container */
/* Стили для cards-container теперь только в компонентах (heroes.css, news.css и т.д.) */

/* Dashboard Grid for Report Cards */
.dashboard-grid-inner {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    padding: 1rem;
}

@media (max-width: 1024px) {
    .dashboard-grid-inner {
        grid-template-columns: 1fr;
    }
}

/* Report Cards */
.report-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.report-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.report-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.report-card.fullscreen {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90vw !important;
    max-width: 1400px !important;
    max-height: 90vh !important;
    z-index: var(--z-modal) !important;
    overflow-y: auto !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3) !important;
    margin: 0 !important;
    animation: zoomIn 0.2s ease;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================================================
   VIEW SWITCHER TABS
   ======================================================================== */
.view-switcher {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem;
    display: flex !important;
    gap: 0.5rem;
    overflow-x: auto;
    flex-shrink: 0;
    position: relative !important; /* ✅ УПРОЩЕНО: Обычное позиционирование в потоке */
    z-index: 100 !important; /* ✅ УПРОЩЕНО: Выше карты, но ниже модальных окон */
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.view-switcher::-webkit-scrollbar {
    height: 4px;
}

.view-switcher::-webkit-scrollbar-track {
    background: transparent;
}

.view-switcher::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-xs);
}

.view-switcher::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.view-tab {
    padding: 0.625rem 1.25rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: 2px solid transparent;
    outline-offset: 2px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 2.5rem;
}

.view-tab::before {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    transform: scaleX(0);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.view-tab:focus-visible {
    outline-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--status-info) 15%, transparent);
}

.view-tab:hover:not(.active) {
    background: var(--bg-hover);
    color: var(--primary);
    transform: translateY(-1px);
}

.view-tab.active {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
    box-shadow: 0 2px 4px color-mix(in srgb, var(--status-info) 20%, transparent);
    font-weight: 600;
}

.view-tab.active::before {
    transform: scaleX(1);
}

a.view-tab {
    text-decoration: none;
}

a.view-tab:hover {
    text-decoration: none;
}

/* ========================================================================
   CONTENT WRAPPER & VIEW PANES
   ======================================================================== */
.content-wrapper {
    position: relative;
    flex: 1;
    overflow: hidden;
    background: var(--bg-primary);
}

.view-pane {
    display: none;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 1.5rem;
}

.view-pane.active {
    display: block;
}

#map-pane {
    padding: 0 !important; /* ✅ ИСПРАВЛЕНО: Убираем все отступы */
    margin: 0 !important; /* ✅ ИСПРАВЛЕНО: Убираем все отступы */
    position: absolute !important; /* ✅ ИСПРАВЛЕНО: Абсолютное позиционирование */
    top: 0 !important; /* ✅ ИСПРАВЛЕНО: Карта начинается с самого верха */
    left: 0;
    width: 100%;
    height: 100%;
}

#citizenMap {
    width: 100%;
    height: 100%;
}

/* ========================================================================
   NO COORDINATES SIDEBAR (for events without geolocation)
   ======================================================================== */
.no-coords-sidebar {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 300px;
    max-height: clamp(200px, 46vh, 400px);
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: var(--z-fixed);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, opacity 0.3s ease;
    border: 2px solid var(--warning);
}

@media (max-height: 600px) {
    .no-coords-sidebar {
        max-height: 60vh;
    }
}

/* Телефон (аудит 02.09, Алматы): панель «Без точной геолокации» с 64
   позициями и жёлтым предупреждением для исследователя занимала весь первый
   экран карты у горожанина. На ≤768px остаётся только компактная плашка
   внизу карты со счётчиком; тап по ней открывает тот же модал со списком
   (обработчик уже висит на .no-coords-header). */
@media (max-width: 768px) {
    .no-coords-sidebar {
        top: auto;
        bottom: 12px;
        left: 12px;
        right: 12px;
        width: auto;
        max-height: none;
    }
    .no-coords-sidebar .no-coords-list,
    .no-coords-sidebar .no-coords-info,
    .no-coords-sidebar .no-coords-subtitle {
        display: none;
    }
    .no-coords-sidebar .no-coords-header {
        padding: 0.5rem 0.875rem;
    }
    .no-coords-sidebar.hidden {
        transform: translateY(120px);
    }
}

.no-coords-sidebar.hidden {
    transform: translateX(350px);
}

.no-coords-header {
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, var(--warning) 0%, var(--danger) 100%);
    color: var(--text-inverse);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    border-bottom: 2px solid color-mix(in srgb, var(--bg-primary) 20%, transparent);
    flex-shrink: 0;
    border-radius: 10px 10px 0 0;
}

.no-coords-actions {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    margin-left: 8px;
}

.no-coords-btn {
    border: 1px solid color-mix(in srgb, var(--bg-primary) 35%, transparent);
    background: color-mix(in srgb, var(--bg-primary) 18%, transparent);
    color: var(--text-inverse);
    border-radius: 10px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 800;
    line-height: 1;
}

.no-coords-btn:hover {
    background: color-mix(in srgb, var(--bg-primary) 28%, transparent);
}

.no-coords-enable-chip {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: calc(var(--z-fixed) + 1);
    border: 1px solid color-mix(in srgb, var(--dark) 18%, transparent);
    background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
    color: var(--text-primary);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--dark) 18%, transparent);
    cursor: pointer;
    display: none;
}

.no-coords-enable-chip:hover {
    transform: translateY(-1px);
}

.no-coords-header h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.no-coords-count {
    background: color-mix(in srgb, var(--bg-primary) 25%, transparent);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    font-weight: 700;
}

.no-coords-list {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem;
    flex: 1;
    min-height: 0;
    max-height: calc(46vh - 80px);
}

.no-coords-list::-webkit-scrollbar {
    width: 8px;
}

.no-coords-list::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.no-coords-list::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: var(--radius-sm);
    transition: background 0.3s ease;
}

.no-coords-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.no-coords-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--bg-secondary);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    cursor: default;
}

.no-coords-item:hover {
    background: var(--bg-hover);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.no-coords-item.crime { border-left-color: var(--danger); }
.no-coords-item.eco { border-left-color: var(--success); }
.no-coords-item.event { border-left-color: var(--warning); }

.no-coords-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.no-coords-item-icon { font-size: 1.25rem; }

.no-coords-item-type {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.no-coords-item-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.no-coords-item-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.no-coords-item-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* ✅ ИСПРАВЛЕНО: Добавлены стили для группировки парсеров в no-coords sidebar */
.no-coords-parser-group {
    margin-bottom: 1rem;
}

.no-coords-parser-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    border-left: 3px solid;
}

.no-coords-parser-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ========================================================================
   CARDS
   ======================================================================== */
.cards-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ✅ ИСПРАВЛЕНО: .card удален, так как он конфликтует с #heroes-pane .card и .hero-card */
/* Стили для карточек теперь только в компонентах (heroes.css, news.css и т.д.) */

/* ========================================================================
   BUTTONS
   ======================================================================== */





.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* ========================================================================
   FEED TABS
   ======================================================================== */
.feed-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border);
}

.feed-tab {
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.feed-tab:hover {
    color: var(--primary);
}

.feed-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.feed-content {
    display: none;
}

.feed-content.active {
    display: block;
}

/* ========================================================================
   UTILITIES
   ======================================================================== */
.loading-text {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

.text-muted {
    color: var(--text-muted);
}

.error-message {
    color: var(--danger);
    text-align: center;
    padding: 1rem;
}

.loading-state-small {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ========================================================================
   EVENT CARDS
   ======================================================================== */
.event-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: var(--transition);
}

.event-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-light);
}

.event-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.event-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.event-card .btn {
    width: 100%;
    justify-content: center;
}

.events-list {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.25rem;
}

.events-list::-webkit-scrollbar {
    width: 6px;
}

.events-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.events-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.events-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ========================================================================
   LLM / AI ROLES - ВЕРТИКАЛЬНАЯ ВЕРСТКА (ОТВЕТ СВЕРХУ, КНОПКИ СНИЗУ)
   ======================================================================== */
/* ✅ НОВОЕ: Вертикальная компоновка для AI-ролей */
.ai-roles-container-vertical {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
}

.llm-controls-bottom {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-shrink: 0;
}

.llm-roles-section {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.llm-roles-section h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Старая двухколоночная верстка (deprecated, оставлена для обратной совместимости) */
.ai-roles-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .ai-roles-container {
        grid-template-columns: 1fr;
    }
}

.llm-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.llm-free-query {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.llm-free-query h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.llm-free-query-input {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.llm-free-query textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
}

.llm-free-query textarea:focus {
     border-color: var(--primary);
}

.llm-free-query-btn {
    align-self: flex-end;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s ease;
}

.llm-free-query-btn:hover {
    background: var(--primary-dark);
}

.llm-free-query-btn:disabled {
    background: var(--border);
    cursor: not-allowed;
}

.llm-response-area {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    min-height: 200px;
    max-height: 500px;
    transition: opacity 0.3s ease;
    overflow-y: auto;
}

.llm-response-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.llm-response-header h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--primary);
}

.llm-response-header .user-query {
    margin: 0;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-left: 3px solid var(--primary);
    font-style: italic;
    color: var(--text-secondary);
}

.llm-response-content {
    line-height: 1.6;
    color: var(--text-primary);
}

.llm-response-content h2,
.llm-response-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.llm-response-content h2:first-child,
.llm-response-content h3:first-child {
    margin-top: 0;
}

.llm-response-content p {
    margin-bottom: 1rem;
}

.llm-response-content ul,
.llm-response-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.llm-response-content li {
    margin-bottom: 0.5rem;
}

.llm-response-content dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
}

.llm-response-content dt {
    font-weight: 600;
    color: var(--text-primary);
}

.llm-response-content dd {
    margin-left: 0;
    color: var(--text-secondary);
}

.llm-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.llm-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    color: var(--text-primary);
}

.llm-btn-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.llm-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.llm-btn:active {
    transform: translateX(2px);
}

.llm-export-controls {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

/* ========================================================================
   TOAST CONTAINER
   ======================================================================== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: var(--z-toast);
    pointer-events: none;
}

.toast-container > * {
    pointer-events: auto;
}

/* ========================================================================
   FULLSCREEN OVERLAY
   ======================================================================== */
.fullscreen-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
}

.fullscreen-overlay.active {
    display: block;
}

/* ========================================================================
   SCROLLBAR STYLES (GLOBAL)
   ======================================================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========================================================================
   MASONRY GRID (for news/art moodboards)
   ======================================================================== */
/* ✅ ИСПРАВЛЕНО: Исключаем #news-grid-container из masonry-grid, так как у него свои стили */
.masonry-grid:not(#news-grid-container) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
    opacity: 0;
    transition: opacity 0.5s;
}

.masonry-grid.loaded {
    opacity: 1;
}

/* ========================================================================
   NEWS LAYOUT
   ======================================================================== */
.news-layout {
    display: flex;
    gap: 1.5rem;
    height: 100%;
}

.news-sources-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    overflow-y: auto;
    max-height: calc(100vh - 240px);
    max-height: calc(100dvh - 240px);
}

.news-sources-sidebar .sidebar-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.news-sources-sidebar .sidebar-title i {
    color: var(--primary);
}

#news-sources-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.news-source-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-primary);
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.news-source-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 4px color-mix(in srgb, var(--status-info) 15%, transparent);
    transform: translateX(2px);
}

.news-source-icon {
    font-size: 1.1rem;
}

.news-source-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.news-main {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
}

.loading-spinner-small {
    width: 24px;
    height: 24px;
    border: 2px solid color-mix(in srgb, var(--status-info) 20%, transparent);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

/* News/Art Cards */
/* ✅ ИСПРАВЛЕНО: Стили .news-card удалены из base.css, так как они определены в components/news.css */
/* Оставляем только стили для .art-card, которые используются в moodboard */
.art-card {
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.art-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.art-card-image {
    height: 180px;
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

.art-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.art-card-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.art-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ✅ ИСПРАВЛЕНО: Стили .news-card-source, .news-card-title, .news-card-description удалены, так как они определены в components/news.css */
.art-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.art-card-description {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    flex-grow: 1;
}

/* Art Card Specific */
.art-card-type {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-lg);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.art-card-author {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-style: italic;
}

.art-card-footer {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.art-card-location,
.art-card-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.art-card-geomarker {
    background: color-mix(in srgb, var(--status-info) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--status-info) 30%, transparent);
    border-radius: var(--radius-md);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--primary);
    padding: 0;
}

.art-card-geomarker:hover {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px color-mix(in srgb, var(--status-info) 30%, transparent);
}

.art-card-geomarker svg {
    width: 20px;
    height: 20px;
}

/* ✅ ИСПРАВЛЕНО: Стили .news-card для drag-and-drop удалены, так как они определены в components/news.css */
.art-card[draggable="true"] {
    cursor: move;
}

.art-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.art-card.drag-over {
    border: 2px solid var(--primary);
    background: color-mix(in srgb, var(--status-info) 5%, transparent);
}

/* ✅ ИСПРАВЛЕНО: Стили .news-action-btn удалены из base.css, так как они определены в components/news.css */

/* ========================================================================
   MAP MARKERS - PULSING ANIMATION
   ======================================================================== */
.custom-map-icon.pulsing-marker > div {
    animation: pulse-marker 2s infinite;
}

@keyframes pulse-marker {
    0% {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger-dark) 70%, transparent);
        transform: scale(1);
    }
    70% {
        box-shadow: 0 0 0 15px color-mix(in srgb, var(--danger-dark) 0%, transparent);
        transform: scale(1.1);
    }
    100% {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger-dark) 0%, transparent);
        transform: scale(1);
    }
}

/* ========================================================================
   PARSERS STATUS
   ======================================================================== */
.parsers-status-container {
    font-size: 0.85rem;
    min-width: 0;
}

.parsers-summary {
    margin-bottom: 0.75rem;
}

.parsers-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.parsers-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    transition: width 0.3s ease;
}

.parsers-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-icon {
    font-size: 0.9rem;
}

.stat-value {
    font-weight: 600;
}

.stat-error .stat-icon,
.stat-error .stat-value {
    color: var(--danger);
}

/* Orchestrator status */
.orchestrator-status {
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    border: 1px solid var(--border);
}

.orchestrator-status .status-icon {
    font-size: 1rem;
}

.orchestrator-status.status-running {
    background: var(--status-info-bg);
    border-color: var(--info);
}

.orchestrator-status.status-success {
    background: color-mix(in srgb, var(--success) 12%, var(--bg-primary));
    border-color: var(--success);
}

.orchestrator-status.status-error {
    background: var(--status-danger-bg);
    border-color: var(--danger);
}

/* Parsers list */
.parsers-list {
    /* Industrial UX: avoid nested scroll areas inside the sidebar.
       Let the right sidebar scroll naturally. */
    max-height: none;
    overflow: visible;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.parsers-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.parsers-group-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    padding-left: 0.25rem;
}

.parser-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    background: var(--bg-secondary);
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    position: relative;
}

.parser-item:hover {
    border-color: rgba(0, 0, 0, 0.12);
    background: var(--bg-hover);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

/* ✅ ИСПРАВЛЕНО: Эмодзи иконка парсера (тип данных) */
.parser-emoji-icon {
    font-size: 1.1rem;
    width: 24px;
    height: 24px;
    text-align: center;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    filter: grayscale(0.1);
    transition: transform 0.2s ease;
}

.parser-item:hover .parser-emoji-icon {
    transform: scale(1.1);
}

/* ✅ ИСПРАВЛЕНО: Иконка статуса парсера (✓, ✗, ⟳ и т.д.) */
.parser-status-icon {
    font-size: 0.85rem;
    width: 18px;
    height: 18px;
    text-align: center;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    line-height: 1;
    margin-left: -0.25rem; /* Слегка перекрываем с эмодзи для компактности */
}

/* Старый класс для обратной совместимости */
.parser-icon {
    font-size: 0.9rem;
    width: 20px;
    height: 20px;
    text-align: center;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    line-height: 1;
}

.parser-name {
    flex: 1;
    min-width: 0; /* Позволяет тексту сжиматься */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 60px); /* ✅ ИСПРАВЛЕНО: учитываем эмодзи-иконку, статус-иконку и отступы */
    word-break: break-word; /* ✅ ДОБАВЛЕНО: предотвращает вылезание длинных слов */
    font-weight: 500;
    color: var(--text-primary);
}

.parser-error-icon {
    color: var(--warning);
    cursor: help;
}

/* ✅ ИСПРАВЛЕНО: Parser status colors с улучшенными стилями */
.parser-success {
    background: var(--status-success-bg);
    border-color: color-mix(in srgb, var(--success) 20%, transparent);
}

.parser-success .parser-status-icon {
    color: var(--success);
    font-weight: 700;
}

.parser-success .parser-emoji-icon {
    filter: grayscale(0);
}

.parser-error {
    background: var(--status-danger-bg);
    border-color: color-mix(in srgb, var(--danger) 20%, transparent);
}

.parser-error .parser-status-icon {
    color: var(--danger);
    font-weight: 700;
}

.parser-error .parser-emoji-icon {
    filter: grayscale(0.3);
    opacity: 0.8;
}

.parser-running {
    background: var(--status-info-bg);
    border-color: color-mix(in srgb, var(--info) 20%, transparent);
    animation: pulse-running 1.5s infinite;
}

.parser-running .parser-status-icon {
    color: var(--info);
    animation: spin 2s linear infinite;
    font-weight: 700;
}

.parser-running .parser-emoji-icon {
    filter: grayscale(0);
    animation: pulse-emoji 1.5s ease-in-out infinite;
}

.parser-pending,
.parser-not-started {
    opacity: 0.7;
    background: var(--bg-secondary);
}

.parser-pending .parser-status-icon,
.parser-not-started .parser-status-icon {
    color: var(--text-secondary);
    opacity: 0.6;
}

.parser-pending .parser-emoji-icon,
.parser-not-started .parser-emoji-icon {
    filter: grayscale(0.5);
    opacity: 0.7;
}

@keyframes pulse-running {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes pulse-emoji {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ========================================================================
   COMMUNITY INITIATIVES WIDGET
   ======================================================================== */
.community-initiatives-widget {
    font-size: 0.9rem;
}

.community-initiatives-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.initiative-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    transition: all 0.2s ease;
}

.initiative-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.initiative-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.initiative-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.initiative-type {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-sm);
    font-weight: 500;
    white-space: nowrap;
    margin-left: 0.5rem;
}

.initiative-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0.5rem 0;
    line-height: 1.4;
}

.initiative-audience {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0.25rem 0;
    font-style: italic;
}

.initiative-progress {
    margin: 0.75rem 0;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

.initiative-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease;
    user-select: none;
}

.initiative-checkbox-label:hover {
    background: var(--bg-hover);
}

.initiative-interest-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.initiative-interest-checkbox:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.community-initiatives-empty {
    padding: 1rem;
    text-align: center;
}

/* ========================================================================
   RESPONSIVE - small screens (v2)
   ======================================================================== */

/* Большие телефоны */
@media (max-width: 640px) {
    .action-btn {
        min-height: 44px;
        font-size: 0.875rem;
    }

    .stories-layout {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .layer-controls-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Маленькие телефоны */
@media (max-width: 480px) {
    .action-btn {
        padding: 0.625rem 0.75rem;
        font-size: 0.8125rem;
    }

    .sidebar-section-title {
        font-size: 0.75rem;
    }

    .map-controls {
        bottom: 70px; /* Место для мобильной навигации */
    }
}
/* ── css/citizen_dashboard.css ── */
/**
 * Modern Light Theme Dashboard for Citizens
 * Version 4.0 - Complete fixed version with River of Time support
 * Production-ready code with unified design system
 *
 * SELECTOR SCOPE: Rules use body[data-dashboard-theme="citizen"] (CSS-1:
 * duplicate .dashboard-body selectors removed). Unprefixed classes apply
 * when this file is loaded (citizen page).
 * Unprefixed classes like .action-btn apply only when this file is loaded (citizen page).
 */

/* ========================================================================
   THEME OVERRIDES (scoped) - avoid global :root conflicts
   ======================================================================== */

body[data-dashboard-theme="citizen"] {
    /* Layout sizes only (colors come from variables.css + dashboard-themes.css) */
    /* DS-02 (этап 1): экран на AppShell (ds_layout='workspace') — ширины из
       --ds-* токенов, clamp — fallback. Полная overview-перестройка (ТЗ §5,
       правая панель не постоянная) — отдельный дизайн-этап. */
    --sidebar-left-width: var(--ds-panel-left-w, clamp(280px, 25vw, 400px));
    --sidebar-right-width: var(--ds-panel-right-w, clamp(240px, 20vw, 320px));
    /* CSS-10: Цвета иконок карты для единообразия и темизации */
    --map-icon-crime: var(--danger-dark);
    --map-icon-eco: var(--success-dark);
    --map-icon-events: var(--warning);
    --map-icon-art: var(--danger-light);
    --map-icon-tourist: var(--info-dark);
    --map-icon-comments: var(--info);
    --map-icon-teams: var(--color-accent);
    --map-icon-projects: var(--color-accent);
    --btn-font-xs: 0.65rem;
    --btn-font-sm: 0.75rem;
    --btn-font-md: 0.8rem;
    --btn-font-lg: 0.9rem;
}

@media (max-width: 1200px) {
    body[data-dashboard-theme="citizen"] {
        --sidebar-left-width: var(--ds-panel-left-w, 300px);
        --sidebar-right-width: var(--ds-panel-right-w, 260px);
    }
}

@media (max-width: 1024px) {
    body[data-dashboard-theme="citizen"] {
        --sidebar-left-width: var(--ds-panel-left-w, 280px);
        --sidebar-right-width: var(--ds-panel-right-w, 240px);
    }
}

/* ✅ ИСПРАВЛЕНО: Более общие селекторы для применения стилей независимо от класса dashboard-body */
body[data-dashboard-theme="citizen"] {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Font inheritance from body — no need for universal selector (performance) */

/* === LOADING PROGRESS BAR (top of page) === */
.citizen-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent, var(--info));
    z-index: 9999;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.citizen-loading-bar.active {
    transform: scaleX(0.7);
    transition: transform 8s cubic-bezier(0.1, 0.5, 0.3, 1);
}

.citizen-loading-bar.done {
    transform: scaleX(1);
    transition: transform 0.2s ease;
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.3s ease 0.2s;
}

/* === PERFORMANCE: content-visibility for off-screen sections === */
.view-pane:not(.active) {
    content-visibility: auto;
    contain-intrinsic-size: auto 500px;
}

/* === SKELETON LOADING ANIMATION (enhanced) === */
@keyframes skeleton-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 0.3; }
    100% { opacity: 0.6; }
}

.skeleton-line {
    height: 1em;
    background: var(--border);
    border-radius: var(--radius-sm);
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    margin-bottom: 0.5em;
}

.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 70%; }
.skeleton-line.long { width: 90%; }

.skeleton-card {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    background: var(--bg-card, var(--white));
}

.skeleton-card .skeleton-line:last-child { margin-bottom: 0; }

/* ✅ УНИФИЦИРОВАНО: Базовые размеры шрифтов как в Пульсе системы */
body[data-dashboard-theme="citizen"] p,
body[data-dashboard-theme="citizen"] span,
body[data-dashboard-theme="citizen"] div {
    font-size: inherit;
    line-height: inherit;
}

/* CSS-8: Дорогой селектор [style*="font-size"] удалён; используйте классы в шаблонах при необходимости */

body[data-dashboard-theme="citizen"] .dashboard-sidebar-right button,
body[data-dashboard-theme="citizen"] .dashboard-sidebar-right .btn,
body[data-dashboard-theme="citizen"] .dashboard-sidebar-right .action-btn {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
}

/* ✅ УНИФИЦИРОВАНО: Стили для слоев (layers) в правой панели */
body[data-dashboard-theme="citizen"] .dashboard-sidebar-right .layer-controls-meta__title {
    font-size: 0.75rem !important;
    font-weight: 700 !important;
}

body[data-dashboard-theme="citizen"] .dashboard-sidebar-right .layer-controls-meta__sub {
    font-size: 0.75rem !important;
}

body[data-dashboard-theme="citizen"] .dashboard-header,
body[data-dashboard-theme="citizen"] .dashboard-content,
body[data-dashboard-theme="citizen"] .dashboard-sidebar-left,
body[data-dashboard-theme="citizen"] .dashboard-sidebar-right {
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.4;
}

body[data-dashboard-theme="citizen"] .dashboard-sidebar-right {
    font-family: inherit;
}

body[data-dashboard-theme="citizen"] button,
body[data-dashboard-theme="citizen"] input,
body[data-dashboard-theme="citizen"] select,
body[data-dashboard-theme="citizen"] textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ✅ УНИФИЦИРОВАНО: Размеры шрифтов как в Пульсе системы */
body[data-dashboard-theme="citizen"] .dashboard-sidebar-left .sidebar-title,
body[data-dashboard-theme="citizen"] .dashboard-sidebar-right .sidebar-title {
    font-size: 0.75rem;
    line-height: 1.2;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 600;
}

body[data-dashboard-theme="citizen"] .dashboard-sidebar-right .action-btn,
body[data-dashboard-theme="citizen"] .action-btn {
    font-size: 0.75rem;
    line-height: 1.3;
    font-weight: 600;
    /* F-07: общий .btn даёт nowrap+overflow:hidden — «Предложить идею /
       Встречу» резалось на «…ВСТРЕЧ». Кнопки действий переносят текст. */
    white-space: normal;
}

body[data-dashboard-theme="citizen"] .action-btn .action-btn-text {
    min-width: 0;
    overflow-wrap: break-word;
}

body[data-dashboard-theme="citizen"] .dashboard-sidebar-right .action-btn--layer {
    font-size: 0.75rem;
    line-height: 1.2;
    font-weight: 600;
}

body[data-dashboard-theme="citizen"] .dashboard-sidebar-right .btn,
body[data-dashboard-theme="citizen"] .dashboard-sidebar-right .btn-sm,
body[data-dashboard-theme="citizen"] .dashboard-sidebar-right .btn-outline-primary,
body[data-dashboard-theme="citizen"] .dashboard-sidebar-right .btn-primary {
    font-size: 0.75rem;
    line-height: 1.2;
    font-family: inherit;
    font-weight: 500;
}

body[data-dashboard-theme="citizen"] .dashboard-content > .view-switcher .view-tab {
    font-family: inherit;
    font-size: 0.75rem;
    line-height: 1.2;
    font-weight: 500;
}

/* ========================================================================
   LIGHT THEME ONLY - Dark theme removed for consistency
   ======================================================================== */

/* ========================================================================
   CITIZEN SPECIFIC LAYOUT & COMPONENTS
   ======================================================================== */

.header-weather {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.action-buttons-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ✅ ИСПРАВЛЕНО: Улучшенные стили для кнопок парсеров в правой панели */
/* ✅ УНИФИЦИРОВАНО: Размеры шрифтов как в Пульсе системы */
body[data-dashboard-theme="citizen"] .action-btn,
.action-btn {
    width: 100%;
    padding: var(--btn-padding-md);
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
    font-size: 0.75rem;
    line-height: 1.3;
    min-height: var(--btn-height-md);
    position: relative;
    overflow: hidden; /* для ripple */
    font-family: inherit;
}

/* ✅ УНИФИЦИРОВАНО: Размеры шрифтов как в Пульсе системы */
body[data-dashboard-theme="citizen"] .action-btn--layer,
.action-btn--layer {
    padding: var(--btn-padding-sm);
    border-width: 1px;
    border-radius: var(--radius-lg);
    font-size: 0.75rem;
    font-weight: 600;
    min-height: var(--btn-height-sm);
    box-shadow: none;
    font-family: inherit;
}

/* Compact layer chips — same style as left sidebar nav buttons */
.layer-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-lg);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.3;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    font-family: inherit;
}
.layer-chip:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.layer-chip.active {
    background: var(--info);
    color: var(--text-inverse);
    border-color: var(--info);
    font-weight: 600;
}
.layer-chip.active:hover {
    background: var(--info);
    border-color: var(--info);
}
.layer-control-row {
    display: inline-flex;
    margin: 2px;
}

.action-btn--layer:hover {
    transform: none;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--status-info) 12%, transparent);
}

.action-btn--layer > span {
    gap: 0.4rem;
}

/* Map layer control row: toggle button + help */
.layer-control-row {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
}

.layer-control-row .action-btn--layer {
    flex: 1 1 auto;
}

.layer-help-btn {
    flex: 0 0 auto;
    width: 34px;
    min-height: var(--btn-height-sm);
    border-radius: var(--radius-lg);
    border: 1px solid var(--primary-lighter);
    background: color-mix(in srgb, var(--primary) 8%, var(--bg-primary));
    color: var(--primary-dark);
    font-weight: 900;
    cursor: pointer;
}

.layer-help-btn:hover {
    background: color-mix(in srgb, var(--primary) 15%, var(--bg-primary));
    border-color: var(--primary-lighter);
}

.layer-help-btn:focus {
    outline: 2px solid color-mix(in srgb, var(--status-info) 35%, transparent);
    outline-offset: 2px;
}

.layer-controls-meta {
    display: flex;
    /* Панель живёт в узком правом сайдбаре (~200px): текст и кнопка
       только в колонку, ряд сжимает текст до слова-в-строку. */
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    margin-bottom: 0.75rem;
}

.layer-controls-meta__text {
    flex: 1;
    min-width: 0;
}

/* ✅ УНИФИЦИРОВАНО: Размеры шрифтов как в Пульсе системы */
body[data-dashboard-theme="citizen"] .layer-controls-meta__title,
.layer-controls-meta__title {
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    color: var(--text-primary);
    line-height: 1.25;
}

body[data-dashboard-theme="citizen"] .layer-controls-meta__sub,
.layer-controls-meta__sub {
    margin-top: 0.25rem;
    font-size: 0.75rem !important;
    color: var(--text-muted);
    line-height: 1.25;
}

.layer-controls-meta__btn {
    flex: 0 0 auto;
    width: 100%;
    padding: var(--btn-padding-sm);
    min-height: var(--btn-height-sm);
    font-size: var(--btn-font-sm);
    white-space: nowrap;
}

.action-btn {
    flex-direction: column;
    align-items: flex-start;
}

.action-btn > span {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.3;
}

.action-btn-icon {
    font-size: 1.25rem;
}

.action-btn-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 400;
}

.action-btn[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: var(--text-inverse);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.action-btn[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% - 4px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--text-primary);
    z-index: 1000;
}

.action-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--info);
    transform: translateX(4px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--status-info) 15%, transparent);
}

.action-btn:active:not(.disabled) {
    transform: translateX(2px) scale(0.98);
    box-shadow: 0 1px 2px color-mix(in srgb, var(--status-info) 10%, transparent);
    transition-duration: 0.05s;
}

/* Ripple (coords are set via JS: --ripple-x / --ripple-y) */
.action-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at var(--ripple-x, 50%) var(--ripple-y, 50%),
        color-mix(in srgb, var(--status-info) 30%, transparent) 0%,
        transparent 60%
    );
    opacity: 0;
    transform: scale(0);
    transition: transform 0.4s ease, opacity 0.3s ease;
    pointer-events: none;
}

.action-btn:active::after {
    opacity: 1;
    transform: scale(2);
}

.action-btn.loading {
    pointer-events: none;
    position: relative;
    color: transparent;
}

/* While loading, hide ripple to avoid visual noise */
.action-btn.loading::after {
    opacity: 0;
    transform: none;
    transition: none;
}

/* Loading shimmer uses ::before (ripple already uses ::after) */
.action-btn.loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        color-mix(in srgb, var(--bg-primary) 40%, transparent) 50%,
        transparent 100%
    );
    animation: citizenBtnShimmer 1.5s infinite;
    border-radius: inherit;
    pointer-events: none;
    transform: translateX(-100%);
}

@keyframes citizenBtnShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Skeleton для карточек */
.card-skeleton {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    animation: citizenCardPulse 2s ease-in-out infinite;
}

@keyframes citizenCardPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.action-btn.active {
    background: var(--status-info-bg);
    border-color: var(--info);
    border-width: 2px;
    color: var(--info);
    font-weight: 700;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--status-info) 20%, transparent), inset 0 1px 0 color-mix(in srgb, var(--bg-primary) 50%, transparent);
}

.action-btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--info);
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.action-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-btn.disabled:hover {
    transform: none;
    background: var(--bg-card);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

/* Project and Event Cards */
.project-card, .event-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: var(--transition);
}

.project-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.project-title {
    margin-bottom: 1rem;
}

.project-funding-progress {
    margin-bottom: 1rem;
}

.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.3s ease;
}

.progress-label {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.project-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.card-meta {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.meta-tag {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.event-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.apply-btn {
    margin-top: auto;
}

/* Project Details Content Styles */
.project-details-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.project-details-content h4:first-child {
    margin-top: 0;
}

.markdown-content p {
    line-height: 1.7;
    margin-bottom: 1rem;
}

.team-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.team-member {
    padding: 0.75rem;
    background-color: var(--bg-secondary);
    border-radius: var(--radius);
}

/* ✅ СИСТЕМНОЕ РЕШЕНИЕ: content-wrapper должен иметь position: relative для правильного позиционирования панелей */
.content-wrapper {
    position: relative;
    z-index: 0 !important; /* ✅ СИСТЕМНОЕ РЕШЕНИЕ: Ниже view-switcher (9999), чтобы карта не перекрывала меню */
    margin-top: 0;
    padding-top: 0; /* ✅ ИСПРАВЛЕНО: Убираем padding-top, так как меню fixed и не занимает место */
}

/* ТЗ 5.3: удалены бесполезные ::before/::after (pointer-events: none не блокировали клики). view-switcher перехватывает клики за счёт z-index. */
.content-wrapper {
    pointer-events: auto;
}

/* View Panes */
.view-pane {
    display: none; /* По умолчанию все панели скрыты */
    width: 100%;
    height: 100%;
    overflow-y: auto; /* Прокрутка для всех панелей, кроме карты */
    padding: 1.5rem;
    position: absolute; /* ✅ ИСПРАВЛЕНО: Абсолютное позиционирование для наложения панелей */
    top: 0 !important; /* ✅ ИСПРАВЛЕНО: Убираем все отступы сверху */
    left: 0;
    z-index: 0; /* ✅ ИСПРАВЛЕНО: Ниже view-switcher (2000), чтобы карта не перекрывала меню */
    clip-path: none; /* ✅ ИСПРАВЛЕНО: Убираем обрезку, так как меню fixed */
}

.view-pane.active {
    display: block; /* Активная панель становится видимой */
    clip-path: none; /* ✅ ИСПРАВЛЕНО: Убираем обрезку, так как меню fixed */
}

/* ТЗ 5.1: центрирование контента в текстовых панелях при широком экране */
body[data-dashboard-theme="citizen"] #report-pane.active,
body[data-dashboard-theme="citizen"] #sentiments-pane.active,
body[data-dashboard-theme="citizen"] #heroes-pane.active,
body[data-dashboard-theme="citizen"] #stories-pane.active {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
}

/* Специальный стиль для панели AI-ролей */
#ai_roles-pane.active {
    display: flex; /* AI-роли используют flex для вертикального расположения */
    flex-direction: column;
}

/* Особые стили для панели с картой */
#map-pane {
    padding: 0 !important; /* ✅ ИСПРАВЛЕНО: Убираем все отступы */
    margin: 0 !important; /* ✅ ИСПРАВЛЕНО: Убираем все отступы */
    overflow: hidden; /* Убираем прокрутку */
    position: absolute !important; /* ✅ ИСПРАВЛЕНО: Абсолютное позиционирование для наложения */
    top: 0 !important; /* ✅ ИСПРАВЛЕНО: Карта начинается с самого верха */
    left: 0;
    z-index: 0; /* ✅ ИСПРАВЛЕНО: Карта должна быть ниже других панелей */
    clip-path: none !important; /* ✅ ИСПРАВЛЕНО: Убираем обрезку карты */
}

/* ✅ ИСПРАВЛЕНО: Карта не должна перекрывать область меню (первые ~150px) */
#map-pane.active {
    pointer-events: auto; /* Включаем pointer-events для карты */
}

#map-pane.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 150px; /* Высота области меню */
    z-index: 2001; /* Выше меню, чтобы блокировать карту */
    pointer-events: none; /* Прозрачная область, не перехватывает события */
    background: transparent;
}

/* ✅ ИСПРАВЛЕНО: Ограничиваем z-index всех Leaflet элементов, чтобы они не перекрывали меню */
#map-pane .leaflet-container,
#map-pane .leaflet-pane,
#map-pane .leaflet-map-pane,
#map-pane .leaflet-tile-pane,
#map-pane .leaflet-overlay-pane,
#map-pane .leaflet-shadow-pane,
#map-pane .leaflet-marker-pane,
#map-pane .leaflet-tooltip-pane,
#map-pane .leaflet-popup-pane {
    z-index: 0 !important;
}

/* ✅ ИСПРАВЛЕНО: Leaflet контролы должны быть видны, но ниже меню */
#map-pane .leaflet-control-container,
#map-pane .leaflet-top,
#map-pane .leaflet-bottom,
#map-pane .leaflet-left,
#map-pane .leaflet-right,
#map-pane .leaflet-control {
    z-index: 100 !important; /* Выше карты, но ниже меню (9999) */
}

/* ✅ ИСПРАВЛЕНО: Ограничиваем z-index Leaflet popup, чтобы они не перекрывали меню */
#map-pane .leaflet-popup,
#map-pane .leaflet-popup-content-wrapper,
#map-pane .leaflet-popup-tip {
    z-index: 100 !important; /* Выше карты, но ниже меню (2000+) */
}

#citizenMap {
    width: 100%;
    height: 100%;
}

.map-alert-badge {
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
    border: 1px solid color-mix(in srgb, var(--status-info) 18%, transparent);
    border-radius: var(--radius-lg);
    box-shadow: 0 14px 32px color-mix(in srgb, var(--dark) 16%, transparent);
    backdrop-filter: blur(4px);
    max-width: min(360px, 85%);
    z-index: var(--z-widget);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.map-alert-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 36px color-mix(in srgb, var(--dark) 20%, transparent);
}

.map-alert-badge .badge-icon {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--status-info-bg);
    color: var(--info);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--bg-primary) 70%, transparent);
}

.map-alert-badge .badge-text {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: var(--text-primary);
}

.map-alert-badge .badge-title {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
    color: var(--text-primary);
}

.map-alert-badge .badge-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.map-alert-badge .badge-subtitle strong {
    color: var(--info);
}

.agent-chat {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    box-shadow: 0 12px 32px color-mix(in srgb, var(--dark) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--gray-400) 18%, transparent);
    min-height: 360px;
}

.agent-chat-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.agent-chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, var(--info-dark) 0%, var(--info) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: var(--text-inverse);
    box-shadow: 0 8px 18px color-mix(in srgb, var(--status-info) 35%, transparent);
}

.agent-chat-header-text {
    flex: 1;
}

.agent-chat-delete {
    margin-left: auto;
}

.agent-chat-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.agent-chat-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.agent-chat-messages {
    flex: 1;
    overflow-y: auto;
    max-height: 420px;
    padding-right: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.agent-chat-placeholder {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    border: 1px dashed color-mix(in srgb, var(--gray-400) 50%, transparent);
}

.agent-chat-placeholder-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.chat-message {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-width: 70%;
}

.chat-message--assistant {
    align-self: flex-start;
}

.chat-message--user {
    align-self: flex-end;
    text-align: left;
}

.chat-message-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.chat-message--user .chat-message-meta {
    justify-content: flex-end;
}

.chat-author {
    font-weight: 600;
    color: var(--text-primary);
}

.chat-time {
    font-size: 0.75rem;
}

.chat-badge {
    background: color-mix(in srgb, var(--info) 15%, var(--bg-primary));
    color: var(--info-dark);
    font-size: 0.75rem;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.chat-bubble {
    border-radius: var(--radius-xl);
    padding: 0.85rem 1rem;
    line-height: 1.55;
    font-size: 0.95rem;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--dark) 8%, transparent);
}

.chat-message--assistant .chat-bubble {
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 6%, var(--bg-primary)) 0%, color-mix(in srgb, var(--primary) 12%, var(--bg-primary)) 100%);
    color: var(--text-primary);
}

.chat-message--user .chat-bubble {
    background: var(--info-dark);
    color: var(--text-inverse, var(--white));
}

/* ────────────────────────────────────────────────────────────────────
   Типографика markdown-ответов AI-ролей (dashboard горожанина).
   AI возвращает markdown (заголовки, списки, bold, ссылки, код) —
   рендерится через showdown.Converter в .chat-bubble. Без этих правил
   браузерные defaults давали слипшиеся абзацы и простыни списков.
   ──────────────────────────────────────────────────────────────────── */
.chat-message--assistant .chat-bubble > *:first-child { margin-top: 0; }
.chat-message--assistant .chat-bubble > *:last-child  { margin-bottom: 0; }

.chat-message--assistant .chat-bubble p {
    margin: 0 0 0.6rem 0;
}

/* Stage 3 direction A: «обновлено N ago · 🔄 Обновить» под pregen-ответом.
   Появляется только когда сервер вернул source=='pregen'. Для свежих LLM-
   ответов блок не рендерится в DOM. */
.ai-answer-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color, var(--border));
    font-size: max(12px, 0.78rem);
    color: var(--text-secondary);
    flex-wrap: wrap;
}
.ai-answer-meta .ai-answer-staleness {
    opacity: 0.8;
}
.ai-answer-meta .ai-answer-refresh {
    margin-left: auto;
    padding: 0.2rem 0.6rem;
    font-size: max(12px, 0.78rem);
    line-height: 1.3;
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease;
}
.ai-answer-meta .ai-answer-refresh:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--accent-primary, var(--color-primary));
}
.ai-answer-meta .ai-answer-refresh:disabled {
    opacity: 0.6;
    cursor: wait;
}

.chat-message--assistant .chat-bubble h1,
.chat-message--assistant .chat-bubble h2,
.chat-message--assistant .chat-bubble h3,
.chat-message--assistant .chat-bubble h4 {
    margin: 1rem 0 0.5rem 0;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}
.chat-message--assistant .chat-bubble h1 { font-size: 1.2rem; }
.chat-message--assistant .chat-bubble h2 { font-size: 1.1rem; }
.chat-message--assistant .chat-bubble h3 { font-size: 1.02rem; }
.chat-message--assistant .chat-bubble h4 { font-size: 0.98rem; color: var(--text-secondary, var(--text-primary)); }

.chat-message--assistant .chat-bubble ul,
.chat-message--assistant .chat-bubble ol {
    margin: 0.4rem 0 0.8rem 0;
    padding-left: 1.4rem;
}
.chat-message--assistant .chat-bubble li {
    margin: 0.25rem 0;
}
.chat-message--assistant .chat-bubble li > ul,
.chat-message--assistant .chat-bubble li > ol {
    margin: 0.25rem 0;
}

.chat-message--assistant .chat-bubble strong,
.chat-message--assistant .chat-bubble b {
    font-weight: 700;
}

.chat-message--assistant .chat-bubble a {
    color: var(--info, var(--info-dark));
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-word;
}
.chat-message--assistant .chat-bubble a:hover {
    text-decoration: none;
}

.chat-message--assistant .chat-bubble code {
    background: color-mix(in srgb, var(--dark) 8%, transparent);
    padding: 0.1em 0.35em;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.88em;
}

.chat-message--assistant .chat-bubble pre {
    background: color-mix(in srgb, var(--dark) 6%, transparent);
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 0.6rem 0;
    font-size: 0.85rem;
    line-height: 1.45;
}
.chat-message--assistant .chat-bubble pre code {
    background: transparent;
    padding: 0;
    font-size: inherit;
}

.chat-message--assistant .chat-bubble blockquote {
    margin: 0.6rem 0;
    padding: 0.5rem 0.9rem;
    border-left: 3px solid color-mix(in srgb, var(--primary) 45%, transparent);
    background: color-mix(in srgb, var(--primary) 5%, transparent);
    color: var(--text-secondary, var(--text-primary));
    border-radius: 0 var(--radius) var(--radius) 0;
}

.chat-message--assistant .chat-bubble table {
    border-collapse: collapse;
    margin: 0.6rem 0;
    font-size: 0.9rem;
    width: 100%;
    overflow-x: auto;
    display: block;
}
.chat-message--assistant .chat-bubble th,
.chat-message--assistant .chat-bubble td {
    border: 1px solid color-mix(in srgb, var(--gray-400) 30%, transparent);
    padding: 0.45rem 0.7rem;
    text-align: left;
}
.chat-message--assistant .chat-bubble th {
    background: color-mix(in srgb, var(--gray-400) 10%, transparent);
    font-weight: 600;
}

.chat-message--assistant .chat-bubble hr {
    border: 0;
    border-top: 1px solid color-mix(in srgb, var(--gray-400) 30%, transparent);
    margin: 0.8rem 0;
}

/* dl из JSON-ответов (legacy branch в handleLlmQuery) */
.chat-message--assistant .chat-bubble dl {
    margin: 0 0 0.5rem 0;
}
.chat-message--assistant .chat-bubble dt {
    margin-top: 0.55rem;
    font-weight: 700;
    color: var(--text-primary);
}
.chat-message--assistant .chat-bubble dd {
    margin: 0.2rem 0 0.55rem 0.8rem;
}
.chat-message--assistant .chat-bubble dd ul {
    margin: 0.2rem 0;
    padding-left: 1.1rem;
}

.agent-chat-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.agent-chat-input {
    width: 100%;
    border: 1px solid color-mix(in srgb, var(--gray-400) 35%, transparent);
    border-radius: var(--radius-lg);
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.agent-chat-input:focus {
     border-color: var(--info);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-info) 18%, transparent);
}

.agent-chat-form-actions {
    display: flex;
    justify-content: flex-end;
}

.agent-chat-form-actions .btn {
    min-width: 120px;
}

#report-pane,
#social-pane,
#ai-pane,
#stories-pane,
#heroes-pane,
#history-pane,
#sentiments-pane,
#cultural_map-pane {
    overflow-y: auto;
}

/* ========================================================================
   STORIES (Memories) — two-column layout with LLM explanation panel
   ======================================================================== */

.stories-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
    align-items: start;
}

.stories-list-col {
    min-width: 0;
}

.stories-sidecards {
    position: sticky;
    top: 0.75rem;
    align-self: start;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--bg-elevated);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--dark) 8%, transparent);
    overflow: hidden;
    max-height: calc(100vh - 140px);
    padding: 0.9rem;
    overflow: auto;
}

.stories-sidecards__empty {
    font-size: 0.9rem;
}

.stories-sidecard {
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 0.85rem;
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--dark) 6%, transparent);
}

.stories-sidecard__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.stories-sidecard__title {
    font-weight: 800;
    color: var(--text-primary);
    font-size: 0.95rem;
    overflow-wrap: break-word;
    word-break: break-word;
}

.stories-sidecard__meta {
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

.stories-sidecard__body {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.story-item--selected {
    outline: 2px solid color-mix(in srgb, var(--status-info) 35%, transparent);
    outline-offset: 2px;
    border-radius: var(--radius-xl);
}

.story-action-btn.is-sent {
    opacity: 0.85;
}

@media (min-width: 900px) {
    .stories-layout {
        grid-template-columns: minmax(400px, 1fr) 320px;
    }
}

@media (min-width: 1200px) {
    .stories-layout {
        grid-template-columns: minmax(500px, 1fr) 380px;
    }
}

@media (max-width: 899px) {
    .stories-layout {
        padding: 0.75rem;
    }
    .stories-sidecards {
        position: static;
        max-height: none;
    }
}

/* ✅ ИСПРАВЛЕНО: Добавляем position: relative к контейнеру всей вкладки карты.
   Теперь дочерние элементы с position: absolute будут позиционироваться относительно него. */
#map-pane {
    position: absolute !important; /* ✅ ИСПРАВЛЕНО: Абсолютное позиционирование для наложения */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Прячем все, что выходит за пределы */
    z-index: 0; /* ✅ ИСПРАВЛЕНО: Карта должна быть ниже других панелей */
}

#citizenMap {
    width: 100%;
    height: 100%;
}


.custom-popup h4 {
    margin: 0 0 0.5rem 0;
    color: var(--primary);
}

/* ✅ УЛУЧШЕНО: Базовые стили для всех маркеров на карте */
.custom-map-icon {
    font-size: 1.2rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    text-align: center;
    line-height: 1;
    /* Allow SVG pins (40px) to overflow the marker container without clipping */
    overflow: visible !important;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--bg-elevated);
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    overflow: visible;
    flex-shrink: 0;
    border: 2.5px solid color-mix(in srgb, var(--bg-primary) 95%, transparent);
    /* No transform transition — prevents marker jumping during map zoom/pan.
       Only animate box-shadow for hover effect. */
    transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.custom-map-icon:hover {
    transform: scale(1.15);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3), 0 2px 5px rgba(0, 0, 0, 0.15);
    z-index: calc(var(--z-widget) + 1);
}

/* ✅ НОВОЕ: Стили для разных типов парсеров */
.custom-map-icon.pride {
    background: var(--danger-lightest);
    border: 2.5px solid var(--danger-light);
    box-shadow: 0 3px 10px color-mix(in srgb, var(--danger-light) 30%, transparent), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.custom-map-icon.crime {
    background: var(--status-danger-bg);
    border: 2.5px solid var(--map-icon-crime, var(--danger-dark));
    box-shadow: 0 3px 10px color-mix(in srgb, var(--danger-dark) 30%, transparent), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.custom-map-icon.eco {
    background: var(--status-success-bg);
    border: 2.5px solid var(--map-icon-eco, var(--success-dark));
    box-shadow: 0 3px 10px color-mix(in srgb, var(--success-dark) 30%, transparent), 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ✅ НОВОЕ: Стили для событий (city_events) */
.custom-map-icon.city-events,
.custom-map-icon[data-type="city_events"] {
    background: var(--status-warning-bg);
    border: 2.5px solid var(--warning);
    box-shadow: 0 3px 10px color-mix(in srgb, var(--warning) 30%, transparent), 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ✅ НОВОЕ: Стили для арт-объектов (art_objects) */
.custom-map-icon.art-objects,
.custom-map-icon[data-type="art_objects"] {
    background: var(--status-danger-bg);
    border: 2.5px solid var(--danger-light);
    box-shadow: 0 3px 10px color-mix(in srgb, var(--danger-light) 30%, transparent), 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ✅ НОВОЕ: Стили для туристических мест (tourist_spots) */
.custom-map-icon.tourist-spots,
.custom-map-icon[data-type="tourist_spots"] {
    background: var(--status-info-bg);
    border: 2.5px solid var(--info-dark);
    box-shadow: 0 3px 10px color-mix(in srgb, var(--status-info) 30%, transparent), 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ✅ НОВОЕ: Стили для комментариев (comments) */
.custom-map-icon.comments,
.custom-map-icon[data-type="comments"] {
    background: var(--status-info-bg);
    border: 2.5px solid var(--info);
    box-shadow: 0 3px 10px color-mix(in srgb, var(--status-info) 30%, transparent), 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ✅ НОВОЕ: Стили для команд (teams) */
.custom-map-icon.teams,
.custom-map-icon[data-type="teams"] {
    background: var(--accent-light);
    border: 2.5px solid var(--color-accent);
    box-shadow: 0 3px 10px color-mix(in srgb, var(--status-success) 30%, transparent), 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ✅ НОВОЕ: Стили для проектов (projects) */
.custom-map-icon.projects,
.custom-map-icon[data-type="projects"] {
    background: var(--accent-light);
    border: 2.5px solid var(--color-accent);
    box-shadow: 0 3px 10px color-mix(in srgb, var(--color-accent) 30%, transparent), 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ✅ ДОБАВЛЕНО: Стили для иконок вернакулярных районов */
.custom-map-icon.district-center {
    background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
    border: 2px solid currentColor;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.custom-map-icon.district-center:hover {
    transform: scale(1.15);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.35);
    z-index: calc(var(--z-widget) + 1);
}

.custom-map-icon.district-center .default-marker {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    box-sizing: border-box; /* ✅ ИСПРАВЛЕНО: учитываем border */
    overflow: hidden; /* ✅ ДОБАВЛЕНО: обрезаем содержимое */
    flex-shrink: 0; /* ✅ ДОБАВЛЕНО: маркер не сжимается */
}

/* ✅ УЛУЧШЕНО: Стили для default-marker (emoji иконки) */
.default-marker {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
    flex-shrink: 0;
    font-size: 1.1rem;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

.comment-marker-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-marker {
    font-size: 1.25rem;
    background: var(--bg-elevated);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--primary);
}

.news-marker-wrapper {
    animation: pulse 2s infinite;
}

.news-marker {
    font-size: 1.5rem;
    background: var(--bg-elevated);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--info);
}

.map-icon.project {
    border-color: var(--primary);
}

/* ✅ УЛУЧШЕНО: Стили для SVG маркеров (pin-стиль) */
.svg-marker-pin {
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 2.5px solid white;
    box-sizing: border-box;
    overflow: hidden;
    /* Only animate box-shadow — NOT transform.
       'transition: all' was causing markers to jump because
       it animated rotate(-45deg) during map interactions. */
    transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.custom-map-icon:hover .svg-marker-pin {
    transform: rotate(-45deg) scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), 0 3px 6px rgba(0, 0, 0, 0.25);
}

.svg-marker-pin svg {
    transform: rotate(45deg);
    width: 18px;
    height: 18px;
    color: var(--text-inverse);
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Map Popup Styles */
.map-popup-content {
    font-family: var(--font-sans);
    min-width: 200px;
    max-width: 300px;
}

.popup-title {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.popup-main-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.popup-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.popup-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.popup-source {
    font-size: 0.8rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.popup-source a {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.2s ease;
}

.popup-source a:hover {
    opacity: 0.7;
    text-decoration: underline;
}

/* Блок цитаты снизу карты отключён — цитаты показываются облачками над районами */
#districtQuoteOverlay {
    display: none !important;
}

/* ——— Comic-style speech bubbles above districts ——— */
.comic-speech-bubble-marker {
    background: none !important;
    border: none !important;
}

.comic-speech-bubble {
    position: relative;
    min-width: 200px;
    max-width: 280px;
    padding: 12px 16px 10px;
    background: var(--bg-elevated);
    border: 2.5px solid var(--gray-800);
    border-radius: var(--radius-xl);
    box-shadow:
        3px 3px 0 var(--gray-800),
        0 8px 20px rgba(0, 0, 0, 0.15);
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--text-primary);
    text-align: left;
    pointer-events: auto;
    animation: comicBubbleAppear 0.4s ease-out;
}
.comic-bubble-expandable { cursor: pointer; }
.comic-bubble-expanded {
    max-width: 360px;
    max-height: 300px;
    overflow-y: auto;
}
.comic-bubble-full {
    font-style: italic;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Comic tail — the triangle pointer down */
.comic-bubble-tail {
    position: absolute;
    left: 50%;
    bottom: -16px;
    margin-left: -10px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 16px solid var(--gray-800);
}
.comic-bubble-tail::after {
    content: '';
    position: absolute;
    left: -8px;
    top: -18px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 14px solid var(--white);
}

.comic-bubble-text {
    font-style: italic;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    line-height: 1.4;
}

.comic-bubble-question {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-bottom: 4px;
    line-height: 1.3;
    max-height: 2.6em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.comic-bubble-author {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    border-top: 1px solid var(--border);
    padding-top: 5px;
    margin-top: 4px;
}

@keyframes comicBubbleAppear {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Keep old class for backward compat */
.district-quote-cloud-marker {
    background: none !important;
    border: none !important;
}

.district-quote-cloud-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-top: 8px;
    border-top: 1px solid color-mix(in srgb, var(--dark) 8%, transparent);
}

.district-quote-cloud-meta-item {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}

.district-quote-cloud-meta-label {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.district-quote-cloud-meta--anonymous {
    border-top: none;
    padding-top: 0;
    font-style: italic;
    color: var(--text-muted);
}

/* ——— Попап района: контент 380px, секции, статистика (ТЗ 2.1, 1.3, 6.1) ——— */
.district-popup .leaflet-popup-content,
.district-popup .maplibregl-popup-content,
.district-popup-content {
    max-width: 380px;
    min-width: 260px;
}
.popup-quote-section {
    margin: 8px 0;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary, var(--color-primary));
}
.popup-quote-question {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    line-height: 1.3;
}
.popup-quote-text {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 4px;
}
.popup-quote-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}
.district-popup-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.district-route-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary, var(--gray-800));
    margin-bottom: 6px;
}
.district-route-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.district-popup-title {
    margin: 0 0 8px 0;
    color: var(--district-color, var(--text-primary));
}
.district-popup-mentions {
    margin: 4px 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.district-popup-layers-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.district-stats-container {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.district-stats-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.district-stats-loading .loading-spinner-small {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 2px solid var(--gray-200, var(--border));
    border-top-color: var(--primary, var(--color-primary));
    border-radius: 50%;
    animation: citizen-spin 0.7s linear infinite;
}
@keyframes citizen-spin {
    to { transform: rotate(360deg); }
}
.district-stats-scrollable {
    max-height: 300px;
    overflow-y: auto;
    font-size: 12px;
    color: var(--text-secondary);
}
.district-stats-responses {
    margin-bottom: 8px;
}
.district-stats-bar-group {
    margin-top: 10px;
}
.district-stats-bar-title {
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 6px;
}
.district-stats-bar-empty {
    font-size: 12px;
    color: var(--text-muted);
}
.district-stats-bar-row {
    margin: 4px 0;
}
.district-stats-bar-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
}
.district-stats-bar-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}
.district-stats-bar-value {
    color: var(--text-primary, var(--dark));
}
.district-stats-bar-track {
    height: 6px;
    margin-top: 4px;
    background: var(--gray-200, var(--border));
    border-radius: 999px;
    overflow: hidden;
}
.district-stats-bar-fill {
    height: 6px;
    border-radius: 999px;
}
.district-stats-fill-green { background: var(--success); }
.district-stats-fill-blue { background: var(--info); }
.district-stats-fill-red { background: var(--danger); }
.district-stats-empty {
    text-align: center;
    padding: 12px 0;
}
.district-stats-empty-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 10px 0;
}
.district-stats-empty-btn {
    padding: 6px 14px;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
}
.district-stats-empty-btn:hover {
    background: var(--gray-100, var(--bg-tertiary));
}
.district-stats-error {
    font-size: 0.85rem;
    color: var(--danger);
}
.district-more-quotes-btn {
    margin-top: 4px;
    padding: 2px 8px;
    font-size: 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}
.district-more-quotes-btn:hover {
    color: var(--primary);
}

/* ✅ ИСПРАВЛЕНО: Убеждаемся что полигоны районов видимы */
#map-pane .leaflet-overlay-pane svg {
    z-index: 1 !important;
}

#map-pane .leaflet-overlay-pane svg path {
    stroke-opacity: 1 !important;
}

#pending-districts-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 24px color-mix(in srgb, var(--dark) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--status-success) 25%, transparent);
    backdrop-filter: blur(6px);
    z-index: var(--z-widget);
}

#pending-districts-badge .badge-icon {
    font-size: 1.6rem;
}

#pending-districts-badge .badge-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.35;
}

#pending-districts-badge .badge-title {
    font-weight: 600;
    color: var(--text-primary);
}

#pending-districts-badge .badge-title span {
    color: var(--primary-dark);
}

#pending-districts-badge .badge-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
/* Что именно исправлено */

.district-quote-card {
    position: absolute;
    max-width: 260px;
    --district-quote-bg: color-mix(in srgb, var(--dark) 94%, transparent);
    --district-quote-text: var(--white);
    --district-quote-muted: var(--gray-400);
    --district-quote-accent: var(--info-light);
    --district-quote-border: color-mix(in srgb, var(--info-light) 55%, transparent);
    --district-quote-shadow: color-mix(in srgb, var(--dark) 45%, transparent);
    background: var(--district-quote-bg);
    color: var(--district-quote-text);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    box-shadow: 0 18px 32px var(--district-quote-shadow);
    padding: 16px 18px;
    transform: translate(-50%, -50%);
    transition: transform 0.4s ease, opacity 0.4s ease;
    opacity: 0;
    border-left: 4px solid var(--district-quote-border);
    pointer-events: auto;
    cursor: grab;
    user-select: none;
}

.district-quote-card.visible {
    opacity: 1;
}

.district-quote-card.dragging {
    cursor: grabbing;
    box-shadow: 0 24px 42px var(--district-quote-shadow);
}

.district-quote-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--district-quote-accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.district-quote-text {
    margin: 10px 0 12px;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--district-quote-text);
}

.district-quote-question {
    font-size: 0.75rem;
    color: var(--district-quote-muted);
    margin-bottom: 8px;
}

.district-quote-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.district-quote-actions span {
    color: var(--district-quote-muted);
    font-size: 0.75rem;
}

.district-quote-actions button {
    border: none;
    background: color-mix(in srgb, var(--info-light) 16%, transparent);
    color: var(--district-quote-accent);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.district-quote-actions button:hover {
    background: color-mix(in srgb, var(--info-light) 26%, transparent);
}

.district-quote-close {
    border: none;
    background: transparent;
    color: var(--district-quote-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
    transition: color 0.2s ease;
}

.district-quote-close:hover {
    color: var(--district-quote-accent);
}

.district-quote-empty {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: color-mix(in srgb, var(--dark) 65%, transparent);
    color: var(--text-inverse);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 320px;
    pointer-events: none;
}

/* Time River Progress Card */
.time-river-progress-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin: 0 1rem 1rem;
    box-shadow: var(--shadow-sm);
    display: none;
}

.time-river-progress-card.active {
    display: block;
}

.time-river-progress-card.is-error {
    border-color: color-mix(in srgb, var(--danger) 60%, transparent);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--danger) 15%, transparent);
}

.time-river-progress-card .progress-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.time-river-progress-card h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.time-river-progress-card .progress-message {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.time-river-progress-card .progress-stage {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--info);
    background: var(--bg-tertiary);
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    white-space: nowrap;
}

.progress-bar-shell {
    position: relative;
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 999px;
    margin: 0.75rem 0;
    overflow: hidden;
}

.progress-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    transition: width 0.4s ease;
}

.time-river-progress-card .progress-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.time-river-progress-card .progress-value {
    font-weight: 600;
    color: var(--text-primary);
}

.time-river-progress-card.is-error .progress-stage {
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 12%, transparent);
}

.time-river-progress-card.is-error .progress-bar-fill {
    background: var(--danger);
}

/* Data Quality Cards */
.data-quality-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.quality-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.65rem;
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.quality-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.quality-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.quality-value--zero {
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.quality-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-quality-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.9rem;
    box-shadow: var(--shadow-sm);
}

.data-quality-card h4 {
    margin: 0 0 0.35rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.data-quality-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.data-quality-card li {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.data-quality-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Knowledge Layers Card */
.kb-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.9rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.kb-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.kb-stat-pill {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 0.5rem;
    text-align: center;
}

.kb-stat-pill .label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.kb-stat-pill .value {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.kb-card-header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-start;
}

.kb-card-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.kb-card-caption {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.kb-card-actions {
    display: inline-flex;
    gap: 0.35rem;
}

.kb-card-btn {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.78rem;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.kb-card-btn.primary {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
}

.kb-card-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.kb-card-btn.is-disabled,
.kb-card-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.kb-card-btn.is-spinning::after {
    content: '';
    width: 0.85rem;
    height: 0.85rem;
    border: 2px solid color-mix(in srgb, var(--bg-primary) 40%, transparent);
    border-top-color: var(--text-inverse);
    border-radius: 50%;
    display: inline-block;
    margin-left: 0.4rem;
    animation: spin 0.8s linear infinite;
}

.kb-layer-preview {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.kb-section-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 0.4rem;
}

.kb-layer-empty {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.kb-card-footnote {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    gap: 0.5rem;
}

.kb-card-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--primary);
    font-size: 0.75rem;
    cursor: pointer;
    text-decoration: underline;
}

.kb-card-link:hover {
    opacity: 0.8;
}

/* DS-03 (§12): kb-studio удалён — канон components/kb-studio.css
   (унификация: grid 240px/14px vs прежних 220px/0.75rem) */

.kb-graph-svg {
    width: 100%;
    height: 100%;
}

.kb-pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.kb-pill {
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    border: 1px solid color-mix(in srgb, var(--status-info) 20%, transparent);
    background: color-mix(in srgb, var(--status-info) 8%, transparent);
    color: var(--info);
}

.kb-pill strong {
    font-weight: 600;
}

.kb-fact-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kb-fact-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.65rem;
    background: var(--bg-tertiary);
    font-size: 0.85rem;
    color: var(--text-primary);
}

.kb-fact-item small {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.kb-fact-source {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.kb-empty {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Parser Period Control */
.parser-period-control {
    padding: 0.5rem 0;
}

/* Industrial: period buttons must wrap instead of overflowing sidebar width */
.citizen-period-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.citizen-period-btn-group > .btn {
    flex: 1 1 8.5rem; /* wrap on narrow sidebar */
    min-width: 0;
    white-space: nowrap;
}

.citizen-period-apply {
    width: 100%;
}

.period-value-display {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
}

.period-slider {
    width: 100%;
    height: 6px;
    border-radius: var(--radius-xs);
    background: var(--bg-tertiary);
     -webkit-appearance: none;
    appearance: none;
}

.period-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.period-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--status-info) 20%, transparent);
}

.period-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.period-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--status-info) 20%, transparent);
}

.period-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Feed Styles */
.feed-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
}

.feed-item {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    animation: fadeIn 0.5s ease-out both;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.feed-item:hover {
    background: var(--bg-hover);
    border-color: var(--secondary);
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.feed-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.feed-source {
    font-size: 0.813rem;
    font-weight: 600;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.feed-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.feed-text {
    font-size: 0.938rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.feed-item.with-image {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.story-item.story-item--with-author {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.story-item .story-body {
    flex: 1;
    min-width: 0;
}

.story-author-card {
    flex: 0 0 240px;
    max-width: 240px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, color-mix(in srgb, var(--status-info) 6%, transparent), color-mix(in srgb, var(--status-info) 2%, transparent));
    padding: 0.75rem 0.8rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.story-author-avatar {
    width: 64px;
    height: 64px;
    margin: 0 auto 0.75rem auto;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-tertiary);
    border: 2px solid white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.story-author-avatar svg {
    width: 100%;
    height: 100%;
    display: block;
}

.story-author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-author-card__title {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.story-author-card__row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    font-size: 0.82rem;
    line-height: 1.25;
    padding: 0.18rem 0;
}

.story-author-card__label {
    color: var(--text-muted);
    white-space: normal;
    font-size: 0.75rem;
}

.story-author-card__value {
    color: var(--text-primary);
    font-weight: 600;
    text-align: left;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    word-break: break-word;
}

.story-author-card--empty .story-author-card__value {
    font-weight: 700;
}

/* Кнопки под воспоминанием: текст обязан помещаться целиком.
   В узкой колонке nowrap-кнопка ужималась флексом ниже ширины текста и
   обрезалась краем («Добавить в Реку времен…» — скриншот 24.08). */
.story-item .feed-actions .story-action-btn {
    white-space: normal;
    text-align: left;
    line-height: 1.25;
    flex: 0 1 auto;
    min-width: 0;
    overflow: visible;
}

@media (max-width: 720px) {
    .story-item.story-item--with-author {
        flex-direction: column;
    }
    .story-author-card {
        flex: none;
        max-width: none;
        width: 100%;
    }
    .story-author-avatar {
        margin: 0 0 0.75rem 0;
    }
}

.feed-image {
    flex-shrink: 0;
    width: 120px;
    height: 90px;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
}

.feed-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.feed-item:hover .feed-image img {
    transform: scale(1.05);
}

.feed-content {
    flex: 1;
    min-width: 0;
}

.feed-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0.5rem 0;
    line-height: 1.3;
}

.story-item .cultural-codes {
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-light);
}

.cultural-code-tag {
    display: inline-block;
    background-color: var(--primary-light);
    color: var(--primary-dark);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    margin: 0 0.5rem 0.5rem 0;
}

/* AI Pane Styles */
#ai-pane {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.5rem;
}

/* ✅ ИСПРАВЛЕНО: Панель AI-ролей должна скрываться, когда не активна */
#ai_roles-pane {
    display: none; /* По умолчанию скрыта */
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.5rem;
}

#ai_roles-pane.active {
    display: flex; /* Показываем только когда активна */
}

.ai-roles-container-vertical {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
}

.ai-roles-container-vertical .agent-chat.llm-chat {
    min-height: 560px;
}

.ai-roles-container-vertical .agent-chat-messages {
    max-height: 560px;
}

.llm-response-area {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

/* ✅ КРИТИЧЕСКОЕ ИСПРАВЛЕНИЕ: Горизонтальная сетка с уменьшенными кнопками */
.llm-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    flex-shrink: 0;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.llm-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    box-shadow: var(--shadow-sm);
    min-height: 40px;
}

.llm-btn span {
    font-size: 1rem;
    margin-bottom: 0;
    line-height: 1;
}

.llm-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-inverse);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* AI Agent pane (Citizen): чище шапка и встроенный селектор стиля */
.agent-pane-card { display: flex; flex-direction: column; }
.agent-pane-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-bottom: 0.75rem !important;
    border-bottom: 1px solid var(--border);
}
.agent-pane-header-main h3 { margin: 0 0 0.25rem; }
.agent-pane-subtitle {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.agent-pane-body { padding-top: 1rem; }

/* Inline вариант селектора стиля — в шапке вместо отдельной плашки */
.ai-personality-selector--inline {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.ai-personality-selector--inline .ai-personality-label {
    display: inline-flex;
    align-items: center;
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

/* Auto-tag badge для авто-инсайтов AI (раньше показывался текстом "auto") */
.agent-feed-auto-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--status-info) 12%, transparent);
    color: var(--info-dark);
    text-transform: lowercase;
    letter-spacing: 0.03em;
}
.agent-feed-auto-badge::before { content: "⚡"; font-size: 0.78rem; }

/* ✅ НОВОЕ: Стили для переключателя характера AI */
.personality-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.personality-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary-light);
    color: var(--text-primary);
}

.personality-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-inverse);
    font-weight: 600;
}

.personality-btn.active:hover {
    background: var(--primary-dark);
}

.ai-personality-selector {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--card-bg, var(--bg-secondary));
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color, var(--border));
}

.ai-personality-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.llm-personality-selector {
    animation: fadeIn 0.3s ease-out;
}

/* fadeIn keyframes moved to static/css/components/animations.css */

.llm-export-controls {
    width: 100%;
    max-width: 900px;
    text-align: right;
    display: none;
}

.citizen-ai-role-hint {
    font-size: 0.9rem;
    text-align: center;
}

.citizen-roles-instruction {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.citizen-mb-2rem {
    margin-bottom: 2rem;
}

#time-river-container {
    width: 100%;
    height: 100%;
}

#no-coords-sidebar {
    display: none;
}

.no-coords-title {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
}

.no-coords-subtitle {
    opacity: 0.9;
    font-size: 0.75rem;
    display: block;
}

.citizen-period-hint {
    font-size: 0.85rem;
    margin: 0 0 0.75rem 0;
}

.citizen-period-btn-group {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.citizen-period-value-display {
    margin-top: 0.5rem;
}

.citizen-period-value-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

#period-value-text {
    font-weight: 600;
    font-size: 1rem;
}

.citizen-period-apply {
    width: 100%;
    margin-top: 0.5rem;
}

.llm-response-content {
    white-space: pre-wrap;
}

.llm-response-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

.llm-response-content th,
.llm-response-content td {
    border: 1px solid var(--border-light);
    padding: 0.5em;
}

.llm-response-content th {
    background-color: var(--bg-hover);
}

.llm-response-content h1,
.llm-response-content h2,
.llm-response-content h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.llm-response-content ul,
.llm-response-content ol {
    margin-left: 1.5rem;
}

.llm-response-content dl {
    margin: 1rem 0;
}

.llm-response-content dt {
    font-weight: bold;
    color: var(--text-primary);
    margin-top: 1rem;
}

.llm-response-content dd {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
    color: var(--text-secondary);
}

/* Report Styles */
.report-container {
    padding: 1.5rem;
    background: var(--bg-primary);
    min-height: 100%;
}

.report-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

#llm-summary-container {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 2px solid var(--primary-light);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 2rem;
    min-height: 300px;
    max-height: 600px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.llm-summary-content p {
    margin-bottom: 1.25rem;
    text-align: justify;
}

.llm-summary-content > * + h2 {
    margin-top: 2.5rem;
}

.dashboard-grid-inner {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* ✅ ИЗМЕНЕНО: Максимум 2 колонки в ряд */
    gap: 1.5rem;
}

.analysis-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

/* ✅ НОВОЕ: Collapsed state для карточек */
.analysis-card.collapsed .analysis-card-body {
    display: none;
}

.analysis-card-body {
    margin-top: 1rem;
}

/* ✅ НОВОЕ: AI Explanation стили */
.ai-explanation {
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, color-mix(in srgb, var(--info) 8%, var(--bg-primary)) 0%, color-mix(in srgb, var(--info) 15%, var(--bg-primary)) 100%);
    border: 2px solid var(--info);
    border-radius: var(--radius-md);
    animation: fadeIn 0.3s ease-out;
}

/* @keyframes slideDown — use shared fadeIn from components/animations.css */

.ai-explanation-header {
    margin-bottom: 0.75rem;
}

.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: var(--info);
    color: var(--text-inverse);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
}

.ai-explanation-content {
    color: var(--text-primary);
    line-height: 1.6;
}

.ai-explanation-content.truncated {
    max-height: 150px;
    overflow: hidden;
    position: relative;
}

.ai-explanation-content.truncated::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, transparent, var(--bg-primary));
}

.ai-explanation-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.ai-explanation-toggle:hover {
    color: var(--primary);
}

.ai-explanation-expand {
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--primary);
    transition: all 0.2s;
}

.ai-explanation-expand:hover {
    background: var(--primary);
    color: var(--text-inverse);
}

.ai-explanation-content ul,
.ai-explanation-content ol {
    margin: 0.5rem 0 0.5rem 1.5rem;
}

.chart-container {
    position: relative;
    height: 300px;
    margin-top: 1rem;
}

.wordcloud-container {
    width: 100%;
    height: 300px;
    margin-top: 1rem;
}

blockquote {
    font-style: italic;
    color: var(--text-secondary);
    border-left: 3px solid var(--primary);
    padding-left: 1rem;
    margin: 1rem 0;
}

/* Sentiment Sliders */
#sentiment-sliders {
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

#sentiment-sliders .sliders-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 2rem;
}

.sentiment-slider-group {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.sentiment-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: var(--radius-sm);
    background: linear-gradient(to right, var(--danger), var(--warning), var(--success));
     transition: opacity 0.2s;
}

.sentiment-slider:hover {
    opacity: 0.8;
}

.sentiment-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.sentiment-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.sentiment-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.sentiment-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

#sentiment-aggregate-chart {
    margin-top: 0.5rem;
    padding: 0.5rem 1.25rem 1.25rem 1.25rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* ========================================================================
   HEROES HALL OF FAME STYLES
   ======================================================================== */

/* ✅ ИСПРАВЛЕНО: Все стили для #heroes-pane удалены из citizen_dashboard.css, так как они дублируют стили из components/heroes.css */
/* Стили для героев теперь централизованы в static/css/components/heroes.css */

/* ========================================================================
   CULTURAL MAP STYLES
   ======================================================================== */

.cultural-map-container {
    padding: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* ========================================================================
   Time River modal & controls
   ======================================================================== */

#history-pane {
    position: absolute !important; /* ✅ ИСПРАВЛЕНО: Абсолютное позиционирование для наложения */
    top: 0;
    left: 0;
}

.history-floating-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: var(--z-fixed);
    align-items: center;
}

.history-floating-actions .btn {
    background: color-mix(in srgb, var(--dark) 70%, transparent);
    color: var(--text-inverse);
    border: none;
    backdrop-filter: blur(8px);
    box-shadow: 0 12px 25px color-mix(in srgb, var(--dark) 35%, transparent);
    transition: background 0.2s ease, transform 0.2s ease;
}

.history-floating-actions .btn:hover {
    background: color-mix(in srgb, var(--status-info) 90%, transparent);
    transform: translateY(-1px);
}

.history-fullscreen-btn {
    border-radius: 999px;
    padding: 0.55rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: none;
    background: color-mix(in srgb, var(--dark) 85%, transparent);
    color: var(--text-inverse);
    box-shadow: 0 12px 25px color-mix(in srgb, var(--dark) 35%, transparent);
    backdrop-filter: blur(8px);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.history-fullscreen-btn:hover {
    background: color-mix(in srgb, var(--status-info) 95%, transparent);
    transform: translateY(-1px);
}

.history-fullscreen-btn__icon {
    font-size: 1rem;
    line-height: 1;
}

@media (max-width: 768px) {
    .history-floating-actions {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
}

.time-river-modal {
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--dark) 92%, transparent);
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 3vw, 3rem);
    z-index: var(--z-modal-backdrop);
}

.time-river-modal.is-active {
    display: flex;
}

.time-river-modal__dialog {
    width: min(1200px, 100%);
    height: min(92vh, 100%);
    background: var(--bg-card, var(--dark));
    border-radius: var(--radius-xl);
    border: 1px solid color-mix(in srgb, var(--bg-primary) 5%, transparent);
    box-shadow: 0 25px 65px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.time-river-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid color-mix(in srgb, var(--bg-primary) 8%, transparent);
}

.time-river-modal__header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.time-river-modal__header p {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    color: color-mix(in srgb, var(--bg-primary) 60%, transparent);
}

.time-river-modal__actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.modal-close-btn {
    border: none;
    background: color-mix(in srgb, var(--bg-primary) 8%, transparent);
    color: inherit;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
}

.modal-close-btn:hover {
    background: color-mix(in srgb, var(--bg-primary) 20%, transparent);
}

.time-river-modal__body {
    flex: 1;
    padding: 1rem 1.5rem 1.5rem;
    background: radial-gradient(circle at top, color-mix(in srgb, var(--status-info) 12%, transparent), transparent 60%);
}

#time-river-modal-canvas {
    width: 100%;
    height: 100%;
    min-height: 420px;
    border-radius: var(--radius-lg);
    background: var(--dark);
}

.time-river-modal__backdrop {
    position: absolute;
    inset: 0;
}

/* Модальные окна «Пройти опрос» — в общем стиле дашборда горожанина */
.survey-form-modal {
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--dark) 50%, transparent);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 3vw, 2rem);
    z-index: var(--z-modal-backdrop, 1100);
}
.survey-form-modal.is-active {
    display: flex;
}
.survey-form-modal__backdrop {
    position: absolute;
    inset: 0;
    cursor: pointer;
}
.survey-form-modal__dialog {
    width: min(900px, 100%);
    max-height: 90vh;
    background: var(--bg-primary);
    border-radius: var(--radius-lg, 16px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}
.survey-form-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}
.survey-form-modal__header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, var(--dark));
}
.survey-form-modal__body {
    flex: 1;
    min-height: 0;
    padding: 0;
}
.survey-form-modal__body--relative {
    position: relative;
}
.survey-form-iframe-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: var(--bg-primary);
    z-index: 1;
}
.survey-form-iframe-loading[aria-hidden="true"] {
    display: none;
}
.survey-form-iframe-loading__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--urbanist-primary, var(--color-primary));
    border-radius: 50%;
    animation: survey-iframe-spin 0.8s linear infinite;
}
@keyframes survey-iframe-spin {
    to { transform: rotate(360deg); }
}
.survey-form-iframe-loading__text {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-muted);
}
.survey-form-iframe-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: var(--bg-primary);
    z-index: 2;
    padding: 1.5rem;
}
.survey-form-iframe-fallback__text {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-muted);
    text-align: center;
}
#survey-form-iframe {
    display: block;
    width: 100%;
    height: 70vh;
    min-height: 400px;
    border: none;
}

/* Модалка выбора «Как пройти опрос?» */
#survey-how-modal .survey-form-modal__dialog {
    max-width: 440px;
}
#survey-how-modal .survey-form-modal__body {
    padding: 1.25rem 1.5rem;
    color: var(--text-primary, var(--dark));
}
#survey-how-modal .survey-form-modal__body p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.45;
}
#survey-how-modal .survey-how-choice-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}
#survey-how-modal .survey-how-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-md, 12px);
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary, var(--dark));
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
#survey-how-modal .survey-how-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--border-dark, var(--gray-300));
}
#survey-how-modal .survey-how-btn--primary {
    background: linear-gradient(135deg, var(--info) 0%, var(--info-dark) 100%);
    border-color: var(--info);
    color: var(--text-inverse);
}
#survey-how-modal .survey-how-btn--primary:hover {
    background: var(--info-dark);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--status-info) 35%, transparent);
}
#survey-how-via-profile-panel {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px dashed var(--border);
}
#survey-how-via-profile-panel .survey-how-btn,
#survey-how-via-profile-panel .btn {
    margin-bottom: 0.5rem;
}
#survey-how-via-profile-panel a.btn-link.small {
    display: block;
    margin-top: 0.75rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}
#survey-how-via-profile-panel a.btn-link.small:hover {
    color: var(--info);
}

/* Ссылка для репоста анкеты */
#survey-how-modal .survey-how-repost-block {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px dashed var(--border);
}
#survey-how-modal .survey-how-repost-label {
    margin-bottom: 0.5rem;
}
#survey-how-modal .survey-how-repost-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
#survey-how-modal .survey-how-repost-input {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
    background: var(--bg-secondary);
    color: var(--text-primary, var(--dark));
}
#survey-how-modal .survey-how-repost-copy-btn {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .history-floating-actions {
        top: 0.75rem;
        right: 0.75rem;
    }

    .history-floating-actions .btn {
        font-size: 0.75rem;
        padding: 0.35rem 0.65rem;
    }

    .time-river-modal__dialog {
        border-radius: 0;
        height: 100%;
    }
}

.stats-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats-row .stat-card {
    flex: 1;
    background: var(--bg-card);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid var(--border);
}

.stats-row .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.stats-row .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ✅ ИСПРАВЛЕНО: Убрана начальная невидимость (opacity: 0)
 * ПРОБЛЕМА: Карточки с background-image не триггерят imagesLoaded → класс .loaded не добавляется → opacity остается 0
 * РЕШЕНИЕ: Карточки видимы по умолчанию, анимация появления через CSS animation в самих карточках
 */
.masonry-grid {
    width: 100%;
    opacity: 1;  /* Видимы по умолчанию */
    transition: opacity 0.3s ease-in-out;
}

/* Класс .loaded оставлен для обратной совместимости, но больше не влияет на видимость */
.masonry-grid.loaded {
    opacity: 1;
}

/* ✅ ИСПРАВЛЕНО: Исключаем .news-card из этого стиля, так как стили для новостей определены в components/news.css */
/* .news-card стили удалены - они теперь только в components/news.css */
.art-card {
    width: calc(33.333% - 14px);
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s, transform 0.3s;
}

/* ✅ ИСПРАВЛЕНО: Стили .news-card удалены - они определены в components/news.css */
.art-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.art-card-image {
    width: 100%;
    max-height: 400px;
    overflow: hidden;
    background-color: var(--bg-secondary);
}

.art-card-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.art-card:hover img {
    transform: scale(1.05);
}

.art-card-content {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.art-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.art-card-type {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.art-card-geomarker {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.art-card-geomarker:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.art-card-geomarker svg {
    width: 14px;
    height: 14px;
}

/* ✅ ИСПРАВЛЕНО: Стили .news-card-title удалены - они определены в components/news.css */
.art-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
}

.art-card-author {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ✅ ИСПРАВЛЕНО: Стили .news-card-description удалены - они определены в components/news.css */
.art-card-description {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    flex-grow: 1;
    margin-top: 0.75rem;
}

.art-card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.art-card-location,
.art-card-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.art-card-date {
    margin-top: 0.25rem;
}

.temp-highlight-marker {
    font-size: 2rem;
    animation: pulse-target 1.5s ease-out 2;
}

/* -------------------------------------------------------------------------
   RIVER OF TIME STYLES REMOVED FROM HERE
   Styles are now centralized in static/css/river_of_time.css
   ------------------------------------------------------------------------- */

/* Data initialization toast (first run) */
@keyframes citizenSlideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes citizenSlideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

.data-initialization-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--color-primary);
    color: var(--text-inverse);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: var(--z-toast);
    max-width: 400px;
    animation: citizenSlideInRight 0.5s ease-out;
}

.data-initialization-notification.is-hiding {
    animation: citizenSlideOutRight 0.5s ease-in;
}

.data-init-toast {
    display: flex;
    align-items: center;
    gap: 12px;
}

.data-init-toast__icon {
    font-size: 32px;
    flex: 0 0 auto;
}

.data-init-toast__title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
}

.data-init-toast__text {
    margin: 0;
    font-size: 14px;
    opacity: 0.95;
}

.data-init-toast__footer {
    margin-top: 10px;
}

.data-init-toast__progress-shell {
    background: color-mix(in srgb, var(--bg-primary) 20%, transparent);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 4px;
}

.data-init-toast__progress {
    background: var(--bg-elevated);
    height: 4px;
    border-radius: var(--radius-xs);
    width: 0%;
}

@keyframes citizenToastProgress {
    from { width: 0%; }
    to { width: 100%; }
}

.data-init-toast__progress.is-animating {
    animation: citizenToastProgress 30s linear forwards;
}

.data-init-toast__hint {
    opacity: 0.8;
}

/* Loading placeholder shimmer (previously injected by JS) */
.data-loading-placeholder {
    background: var(--bg-tertiary);
    background-size: 200% 100%;
    animation: citizenLoadingShimmer 1.5s infinite;
    border-radius: var(--radius-md);
    padding: 20px;
    margin: 10px 0;
}

@keyframes citizenLoadingShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Pulsing marker (previously injected by JS) */
.pulsing-marker > div {
    animation: citizenPulseMarker 2s infinite;
}

@keyframes citizenPulseMarker {
    0% { box-shadow: 0 2px 8px color-mix(in srgb, var(--danger-dark) 30%, transparent); transform: scale(1); }
    50% { box-shadow: 0 2px 20px color-mix(in srgb, var(--danger-dark) 80%, transparent); transform: scale(1.1); }
    100% { box-shadow: 0 2px 8px color-mix(in srgb, var(--danger-dark) 30%, transparent); transform: scale(1); }
}

/* ========================================================================
   COMMUNITY INITIATIVES (JS-rendered card list)
   ======================================================================== */

.initiative-item {
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
}

.initiative-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 8px;
}

.initiative-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.initiative-type {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.initiative-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 8px 0;
    line-height: 1.4;
}

.initiative-progress {
    margin: 8px 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.3s;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.initiative-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-top: 12px;
    padding: 8px;
    border-radius: var(--radius);
    background: var(--bg-secondary);
    transition: background 0.2s;
}

.initiative-checkbox-label.is-checked {
    background: color-mix(in srgb, var(--success) 12%, var(--bg-primary));
    cursor: default;
}

.initiative-interest-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.initiative-checkbox-label.is-checked .initiative-interest-checkbox {
    cursor: default;
}

.initiative-checkbox-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 400;
}

.initiative-checkbox-label.is-checked .initiative-checkbox-text {
    color: var(--status-success);
    font-weight: 500;
}

.info-placeholder {
    color: var(--text-muted);
    padding: 2rem;
    text-align: center;
    font-style: italic;
}

/* ========================================================================
   RESPONSIVE DESIGN
   ======================================================================== */

/* Mobile sidebar controls (Citizen): hidden on desktop, enabled under 768px */
.citizen-mobile-sidebars-controls {
    display: none;
}

.citizen-mobile-sidebar-overlay {
    display: none;
}

@media (max-width: 1200px) {
    /* ✅ ИСПРАВЛЕНО: Стили .news-card удалены - они определены в components/news.css */
    .art-card {
        width: calc(50% - 10px);
    }
}

@media (max-width: 768px) {
    .citizen-mobile-sidebars-controls {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        margin-right: 10px;
    }

    .citizen-mobile-sidebar-btn {
        width: 42px;
        height: 42px;
        border-radius: var(--radius-lg);
        border: 1px solid color-mix(in srgb, var(--dark) 12%, transparent);
        background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
        color: var(--text-primary);
        font-size: 18px;
        line-height: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 10px 22px color-mix(in srgb, var(--dark) 12%, transparent);
        cursor: pointer;
        backdrop-filter: blur(6px);
        transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    }

    .citizen-mobile-sidebar-btn:hover {
        transform: translateY(-1px);
        background: color-mix(in srgb, var(--bg-tertiary) 98%, transparent);
        box-shadow: 0 14px 28px color-mix(in srgb, var(--dark) 16%, transparent);
    }

    /* Mobile polish: toggle icon animation (if SVG is used) */
    .citizen-mobile-sidebar-btn svg {
        transition: transform 0.3s ease;
        transform-origin: 50% 50%;
    }

    .citizen-mobile-sidebar-btn.is-active svg {
        transform: rotate(180deg);
    }

    .citizen-mobile-sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: color-mix(in srgb, var(--dark) 45%, transparent);
        opacity: 0;
        pointer-events: none;
        z-index: var(--z-sidebar-overlay); /* below sidebars, above content */
        transition: opacity 0.2s ease;
    }

    .citizen-mobile-sidebar-overlay.is-active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Mobile polish: blur the backdrop when a sidebar is open */
    .citizen-mobile-sidebar-overlay.is-active {
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }

    body[data-dashboard-theme="citizen"] {
        --sidebar-left-width: 100%;
        --sidebar-right-width: 100%;
    }

    .dashboard-sidebar-left,
    .dashboard-sidebar-right {
        position: fixed;
        top: var(--citizen-header-height, 65px);
        bottom: 0;
        left: -100%;
        height: auto;
        z-index: var(--z-sidebar);
        transition: left 0.3s;
        box-shadow: var(--shadow-lg);
        max-height: calc(100vh - var(--citizen-header-height, 65px));
    }

    .dashboard-sidebar-right {
        left: auto;
        right: -100%;
        transition: right 0.3s;
    }

    .dashboard-sidebar-left.open {
        left: 0;
    }

    .dashboard-sidebar-right.open {
        right: 0;
    }

    .llm-buttons {
        grid-template-columns: 1fr;
    }

    .dashboard-grid-inner {
        grid-template-columns: 1fr;
    }

    .feed-item.with-image {
        flex-direction: column;
    }

    .feed-image {
        width: 100%;
        height: 200px;
    }

    /* ✅ ИСПРАВЛЕНО: Стили для #heroes-pane в медиа-запросе удалены, так как они дублируют стили из components/heroes.css */

    #history-pane .control-panel,
    #history-pane .stats-panel,
    #history-pane .legend,
    #history-pane .river-floating-controls {
        position: relative;
        margin: 10px;
        width: calc(100% - 20px);
    }

    #sentiment-sliders {
        padding: 1rem;
    }

    .sentiment-slider-group {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    #sentiment-aggregate-chart {
        padding: 0 1rem 1.5rem 1rem;
    }

    /* ✅ ИСПРАВЛЕНО: Стили .news-card удалены - они определены в components/news.css */
    .art-card {
        width: 100%;
    }

    .cultural-map-container {
        padding: 1rem;
    }
}

@media (max-width: 640px) {
    .action-btn {
        min-height: var(--btn-height-md); /* touch target */
        font-size: var(--btn-font-md);
    }

    .stories-layout {
        padding: 0.75rem;
    }

    /* === MOBILE BOTTOM NAVIGATION === */
    .citizen-mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        display: flex;
        background: var(--bg-card, var(--white));
        border-top: 1px solid var(--border);
        z-index: 1100;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .citizen-mobile-bottom-nav__item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        font-size: 12px;
        color: var(--text-secondary, var(--gray-500));
        border: none;
        background: none;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        min-height: 44px;
        padding: 4px 0;
    }

    .citizen-mobile-bottom-nav__item.active {
        color: var(--accent, var(--info));
    }

    .citizen-mobile-bottom-nav__icon {
        font-size: 20px;
        line-height: 1;
    }

    .citizen-mobile-bottom-nav__label {
        font-size: 12px;
        line-height: 1;
        white-space: nowrap;
    }

    /* Pad content above bottom nav */
    .dashboard-content,
    .citizen-main-content {
        padding-bottom: 64px !important;
    }

    /* Enlarged touch targets for all interactive elements */
    button, a, input, select, textarea {
        min-height: 44px;
    }

    /* Cards in single column */
    .cards-grid, .projects-grid, .heroes-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    /* Larger fonts for readability */
    .view-pane h2, .view-pane h3 {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .action-btn {
        padding: var(--btn-padding-sm);
    }

    .layer-controls-meta {
        flex-direction: column;
        align-items: stretch;
    }

    .layer-controls-meta__btn {
        width: 100%;
    }

    .citizen-mobile-sidebar-btn {
        width: 48px;
        height: 48px;
        border-radius: 50%;
    }
}

/* === TABLET LAYOUT (641px — 1024px) === */
@media (min-width: 641px) and (max-width: 1024px) {
    .dashboard-content .cards-grid,
    .dashboard-content .projects-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
}

/* === EMPTY STATES === */
.citizen-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-secondary, var(--gray-500));
    min-height: 200px;
}

.citizen-empty-state__icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.citizen-empty-state__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.citizen-empty-state__text {
    font-size: 0.9rem;
    max-width: 320px;
    line-height: 1.5;
}

/* === GPU ACCELERATION for animated elements === */
.action-btn,
.project-card,
.event-card,
.custom-map-icon,
.citizen-mobile-bottom-nav__item {
    will-change: transform;
}

/* Remove will-change after animation settles (prevent memory waste) */
.action-btn:not(:hover),
.project-card:not(:hover),
.event-card:not(:hover) {
    will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
    .action-btn,
    .project-card,
    .event-card {
        transition: none;
    }

    .action-btn:hover {
        transform: none;
    }

    .action-btn.loading::before {
        animation: none;
        transform: none;
        opacity: 0.5;
    }

    .card-skeleton {
        animation: none;
        opacity: 0.7;
    }
}

/* ========================================================================
   TOP NAV TABS (Citizen view switcher)
   ======================================================================== */
/* ТЗ 5.4: единая шкала z-index — view-switcher выше карты (0) и попапов (100) */
.dashboard-content > .view-switcher {
    position: relative;
    z-index: 500;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    pointer-events: auto;
}

.dashboard-content > .view-switcher .view-tab {
    border: 1px solid transparent;
    background: transparent;
    border-radius: var(--radius-md);
    padding: 0.45rem 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

/* Mobile: горизонтальный view-switcher скрыт, навигация только через bottom-nav + "Ещё" sheet.
   Сохраняем classNames для desktop-логики (≥641px), но прячем на ≤640px чтобы не дублировать. */
@media (max-width: 640px) {
    .dashboard-content > .view-switcher {
        display: none !important;
    }
}

/* === MOBILE MORE-SHEET (bottom drawer для secondary tabs) === */
.citizen-mobile-more-sheet {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1200;
}
.citizen-mobile-more-sheet.is-open { display: block; }

.citizen-mobile-more-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--dark) 55%, transparent);
    backdrop-filter: blur(2px);
    animation: citizenSheetFade 0.2s ease-out;
}

.citizen-mobile-more-sheet__panel {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    background: var(--bg-card, var(--white));
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    padding: 12px 16px calc(20px + env(safe-area-inset-bottom));
    max-height: 75vh;
    overflow-y: auto;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.18);
    animation: citizenSheetSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.citizen-mobile-more-sheet__handle {
    width: 44px;
    height: 4px;
    background: var(--border);
    border-radius: 999px;
    margin: 0 auto 12px;
}

.citizen-mobile-more-sheet__title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary, var(--gray-800));
    margin-bottom: 12px;
    text-align: center;
}

.citizen-mobile-more-sheet__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.citizen-mobile-more-sheet__btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 76px;
    padding: 10px 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary, var(--gray-800));
    font: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, transform 0.1s;
}
.citizen-mobile-more-sheet__btn:active {
    background: var(--bg-hover, var(--bg-tertiary));
    transform: scale(0.97);
}

.citizen-mobile-more-sheet__btn-icon {
    font-size: 22px;
    line-height: 1;
}
.citizen-mobile-more-sheet__btn-label {
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    color: var(--text-secondary);
}

@keyframes citizenSheetFade {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes citizenSheetSlide {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.dashboard-content > .view-switcher .view-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-dark);
}

.dashboard-content > .view-switcher .view-tab.active {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

/* ========================================================================
   PRINT STYLES
   ======================================================================== */

@media print {
    .dashboard-sidebar-left,
    .dashboard-sidebar-right,
    .view-switcher,
    .action-buttons-container,
    .control-panel,
    .stats-panel,
    .legend,
    .river-floating-controls {
        display: none;
    }

    .dashboard-content {
        width: 100%;
        margin: 0;
    }

    .analysis-card {
        page-break-inside: avoid;
    }
}

/* ✅ ИСПРАВЛЕНО: Добавлены стили для оверлея загрузки карты */
.map-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: color-mix(in srgb, var(--bg-secondary) 70%, transparent); /* Полупрозрачный фон */
    z-index: var(--z-widget); /* Выше чем карта, ниже сайдбаров/модалов */
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

/* ========================================================================
   FULLSCREEN CARD STYLES - FIX for disappearing cards
   ======================================================================== */

/* ✅ ИСПРАВЛЕНО: Добавлены стили для fullscreen-overlay */
.fullscreen-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    transition: opacity 0.3s ease;
}

.fullscreen-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* ✅ ИСПРАВЛЕНО: Overlay не должен перехватывать клики на карточке */
.fullscreen-overlay.active ~ *,
body.fullscreen-active .analysis-card.fullscreen {
    pointer-events: auto;
}

/* ✅ ИСПРАВЛЕНО: Убираем overflow с body когда fullscreen активен */
body.fullscreen-active {
    overflow: hidden;
}

.analysis-card.fullscreen {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 90vw !important;
    max-width: 1400px !important;
    max-height: 90vh !important;
    z-index: var(--z-modal) !important;
    overflow-y: auto !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5) !important;
    margin: 0 !important;
    pointer-events: auto !important;
    background: var(--bg-card) !important;
    animation: fullscreenFadeIn 0.3s ease-out forwards;
}

@keyframes fullscreenFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.fullscreen-placeholder {
    background: var(--bg-secondary);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.fullscreen-placeholder::before {
    content: "Карточка в полноэкранном режиме";
}

/* AI Explain Button в fullscreen */
.ai-explain-btn {
    background: var(--color-primary);
    color: var(--text-inverse);
    border: none;
}

.ai-explain-btn:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--color-primary) 40%, transparent);
}

.ai-explain-btn span {
    font-size: 1.2rem;
}

/* AI Explanation Container */
.ai-explanation {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-xl);
    background: var(--bg-secondary);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-lg);
    animation: slideDown 0.3s ease-out;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--color-primary) 15%, transparent);
}

.ai-explanation ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
    list-style-type: disc;
}

.ai-explanation li {
    margin: 0.25rem 0;
    line-height: 1.6;
}

/* @keyframes slideDown — duplicate removed, uses fadeIn from components/animations.css */

.ai-explanation h4 {
    margin: 0 0 var(--spacing-md) 0;
    color: var(--primary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.ai-explanation h4::before {
    content: "🤖";
    font-size: 1.3rem;
}

.ai-explanation p {
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
}
/* ==================================================================
   PARSER BUTTONS IN DISTRICT POPUPS
   ================================================================== */

/* Vernacular district popup: keep it compact and never hide under the header */
.leaflet-popup.district-popup .leaflet-popup-content-wrapper {
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
    pointer-events: auto;
}

.leaflet-popup.district-popup .leaflet-popup-content {
    max-height: none;
    overflow: visible;
    margin: 10px 12px;
    pointer-events: auto;
}

.leaflet-popup.district-popup .leaflet-popup-content h4 {
    font-size: 1.05rem;
    line-height: 1.3;
}

.leaflet-popup.district-popup .district-stats-container {
    max-height: none;
    overflow: visible;
}

/* Блок маршрутов в попапе вернакулярного района */
.leaflet-popup.district-popup .district-route-buttons-block,
.leaflet-popup-content .district-route-buttons-block {
    pointer-events: auto;
    position: relative;
    z-index: 2;
}
.leaflet-popup.district-popup .district-route-buttons,
.leaflet-popup-content .district-route-buttons {
    min-height: 40px;
    align-items: center;
}

/* Кнопки «Будни» / «Выходные» — хорошо заметны и удобны для тапа/клика */
.leaflet-popup.district-popup .district-route-btn,
.leaflet-popup-content .district-route-btn {
    pointer-events: auto !important;
    cursor: pointer !important;
    position: relative;
    z-index: 3;
    user-select: none;
    touch-action: manipulation;
    min-height: 38px;
    min-width: 100px;
    padding: 8px 14px !important;
    border-radius: var(--radius-md) !important;
    font-size: 13px !important;
    font-weight: 600;
    border: 1px solid var(--gray-400) !important;
    background: var(--bg-secondary) !important;
    color: var(--text-primary);
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.leaflet-popup.district-popup .district-route-btn:hover,
.leaflet-popup-content .district-route-btn:hover {
    background: var(--info-lightest) !important;
    border-color: var(--info) !important;
    color: var(--status-info);
}
.leaflet-popup.district-popup .district-route-btn:active,
.leaflet-popup-content .district-route-btn:active {
    background: var(--info-lighter) !important;
    transform: scale(0.98);
}
/* Будни — акцент синий */
.leaflet-popup.district-popup .district-route-btn[data-mode="weekday"]:hover,
.leaflet-popup-content .district-route-btn[data-mode="weekday"]:hover {
    background: var(--primary-lightest) !important;
    border-color: var(--color-primary) !important;
    color: var(--primary-dark);
}
/* Выходные — акцент оранжевый */
.leaflet-popup.district-popup .district-route-btn[data-mode="weekend"]:hover,
.leaflet-popup-content .district-route-btn[data-mode="weekend"]:hover {
    background: var(--warning-lightest) !important;
    border-color: var(--warning) !important;
    color: var(--warning-dark);
}

/* ✅ FIX: Более специфичные селекторы для Leaflet popup */
.leaflet-popup-content .parser-buttons-container,
.leaflet-popup-content-wrapper .parser-buttons-container,
.map-popup-content .parser-buttons-container {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
}

/* ✅ FIX: Еще более специфичные селекторы для кнопок парсеров в Leaflet popup */
/* Оставляем !important только для критичных свойств, которые переопределяют Leaflet */
.leaflet-popup-content-wrapper .leaflet-popup-content .parser-button,
.leaflet-popup-content .parser-button,
.leaflet-popup-content-wrapper .parser-button,
.map-popup-content .parser-button,
.parser-button {
    background: var(--bg-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: normal; /* Разрешаем перенос текста */
    max-width: 160px; /* Увеличена максимальная ширина */
    min-width: 0;
    box-sizing: border-box;
    color: var(--text-secondary);
    line-height: 1.3; /* Увеличена высота строки для многострочного текста */
    word-wrap: break-word; /* Разрешаем перенос слов */
    word-break: break-word;
    margin: 0;
    font-family: inherit;
}

.leaflet-popup-content .parser-button:hover,
.leaflet-popup-content-wrapper .parser-button:hover,
.map-popup-content .parser-button:hover,
.parser-button:hover {
    background: var(--bg-hover);
    border-color: var(--gray-400);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.leaflet-popup-content .parser-button:active,
.leaflet-popup-content-wrapper .parser-button:active,
.map-popup-content .parser-button:active,
.leaflet-popup-content .parser-button.active,
.leaflet-popup-content-wrapper .parser-button.active,
.map-popup-content .parser-button.active,
.parser-button:active,
.parser-button.active {
    background: var(--info);
    color: var(--text-inverse);
    border-color: var(--info);
    box-shadow: 0 2px 6px color-mix(in srgb, var(--status-info) 30%, transparent);
}


/* ==================================================================
   MAP MARKERS - MODERN & BEAUTIFUL
   ================================================================== */

.custom-map-marker {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid white;
    transition: all 0.3s ease;
    cursor: pointer;
}

.custom-map-marker:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.marker-tourist { background: linear-gradient(135deg, var(--info), var(--info-dark)); color: var(--text-inverse); }
.marker-art { background: var(--color-accent); color: var(--text-inverse); }
.marker-event { background: var(--warning); color: var(--text-inverse); }
.marker-business { background: var(--warning); color: var(--text-inverse); }
.marker-community { background: var(--success); color: var(--text-inverse); }
.marker-news { background: var(--success); color: var(--text-inverse); }
.marker-eco { background: var(--success); color: var(--text-inverse); }
.marker-crime { background: linear-gradient(135deg, var(--danger), var(--danger-dark)); color: var(--text-inverse); }

/* ========================================================================
   ✅ НОВОЕ: Группированные вкладки (View Groups)
   ======================================================================== */
.view-group {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    z-index: 2000 !important; /* ✅ ИСПРАВЛЕНО: Выше всех Leaflet элементов (1000) и карты (0) */
    isolation: isolate; /* ✅ ИСПРАВЛЕНО: Создаем новый контекст стекирования */
}

.view-group-toggle {
    padding: 0.625rem 1.25rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.5rem;
}

.view-group-toggle:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.view-group-toggle .toggle-icon {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.view-group[aria-expanded="false"] .view-group-toggle .toggle-icon {
    transform: rotate(-90deg);
}

.view-group-items {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 180px;
    z-index: 10000 !important; /* ✅ СИСТЕМНОЕ РЕШЕНИЕ: Выше view-switcher (9999) и всех элементов */
    pointer-events: auto !important; /* ✅ СИСТЕМНОЕ РЕШЕНИЕ: Убеждаемся, что меню кликабельно */
    transform: translateZ(0); /* ✅ СИСТЕМНОЕ РЕШЕНИЕ: Создаем новый слой для GPU-ускорения */
    max-height: 400px;
    overflow-y: auto;
    opacity: 1;
    transition: opacity 0.2s ease, transform 0.2s ease, max-height 0.3s ease;
}

.view-group[aria-expanded="false"] .view-group-items {
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
    overflow: hidden;
    padding: 0;
    margin: 0;
    pointer-events: none;
}

.view-group-items .view-tab {
    width: 100%;
    justify-content: flex-start;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
}

.view-group-items .view-tab:hover {
    background: var(--bg-hover);
    transform: none;
}

/* ========================================================================
   ✅ НОВОЕ: Collapsible Sidebar Sections
   ======================================================================== */
.sidebar-section.collapsible {
    position: relative;
}

.sidebar-section-toggle {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: transform 0.2s ease, color 0.2s ease;
    z-index: 10;
}

.sidebar-section-toggle:hover {
    color: var(--primary);
}

.sidebar-section.collapsible .sidebar-section-content {
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    opacity: 1;
}

/* ✅ ИСПРАВЛЕНО: Добавлен скроллинг для контейнеров карточек в левой панели */
.sidebar-section-content {
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.sidebar-section-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-section-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-section-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-xs);
}

.sidebar-section-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Крупные кнопки в левой панели «Действия» — акцентные цвета */
.dashboard-sidebar-left .action-buttons-container .action-btn {
    min-height: 52px;
    font-size: 0.9rem;
    padding: 0.65rem 0.9rem;
}
.dashboard-sidebar-left .action-buttons-container .action-btn-link {
    text-decoration: none;
    color: inherit;
}
.dashboard-sidebar-left .action-buttons-container .action-btn-link:hover {
    color: inherit;
}
.dashboard-sidebar-left .action-buttons-container .action-btn:nth-child(1) {
    border-left: 4px solid var(--info-dark);
    background: var(--status-info-bg);
}
.dashboard-sidebar-left .action-buttons-container .action-btn:nth-child(2) {
    border-left: 4px solid var(--success-dark);
    background: var(--status-success-bg);
}
.dashboard-sidebar-left .action-buttons-container .action-btn:nth-child(3) {
    border-left: 4px solid var(--accent);
    background: var(--accent-light);
}
.dashboard-sidebar-left .action-buttons-container .action-btn:nth-child(4) {
    border-left: 4px solid var(--warning-dark);
    background: var(--status-warning-bg);
}
.dashboard-sidebar-left .action-buttons-container .action-btn:hover {
    box-shadow: 0 4px 14px color-mix(in srgb, var(--dark) 12%, transparent);
}

.sidebar-section-content .cards-container,
.sidebar-section-content .community-initiatives-container,
.sidebar-section-content .events-list,
.sidebar-section-content #citizen-environment-widget,
.sidebar-section-content #citizen-safety-widget {
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-section.collapsible.collapsed .sidebar-section-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.sidebar-section.collapsible.collapsed .sidebar-section-toggle {
    transform: rotate(-90deg);
}

@media (max-width: 1200px) {
    .view-group-items {
        position: fixed;
        top: auto;
        left: auto;
        right: 1rem;
        margin-top: 0.5rem;
    }
}

/* ========================================================================
   OFFLINE BANNER (Пункт 9)
   ======================================================================== */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--danger);
    color: var(--text-inverse);
    padding: 0.75rem 1rem;
    text-align: center;
    font-weight: 600;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ========================================================================
   PROGRESS BAR (Пункт 8)
   ======================================================================== */
.loading-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-xs);
    margin-top: 1rem;
    overflow: hidden;
}

.loading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--info-dark), var(--info));
    border-radius: var(--radius-xs);
    transition: width 0.3s ease;
}

/* ========================================================================
   EXPANDED EVENT CARDS (Пункт 11)
   ======================================================================== */
.event-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-width: 0;
}

.event-card-header,
.event-card-body {
    min-width: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
}
.event-card-header strong,
.event-card-body .event-description,
.event-card-body .event-location {
    word-break: break-word;
    overflow-wrap: anywhere;
}
.event-datetime {
    flex-wrap: wrap;
}

.event-card-category {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: color-mix(in srgb, var(--status-info) 10%, transparent);
    color: var(--info);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 600;
}

.event-card.event-free {
    border-left: 3px solid var(--success);
}

.event-datetime {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.event-time {
    margin-left: 0.5rem;
    color: var(--text-muted);
}

.event-location {
    margin-bottom: 0.5rem;
}

.event-price {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--success);
}

.event-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.event-share-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.event-share-btn:hover {
    background: var(--bg-tertiary);
}

/* ========================================================================
   FULLSCREEN BUTTON HINT (Пункт 13)
   ======================================================================== */
.pulse-hint {
    animation: pulse-scale 2s ease-in-out 3;
    position: relative;
}

/* @keyframes pulse — moved to components/animations.css (uses pulse-scale) */

.hint-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary, var(--info-dark));
    color: var(--text-inverse);
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: var(--radius-md);
    font-weight: 600;
    white-space: nowrap;
}

/* ================================================================
   CITIZEN COMMUNITIES MINI-DASHBOARD
   ================================================================ */

/* Profile card */
.ctz-comm-profile {
    margin-bottom: 16px;
}
.ctz-comm-profile__loading,
.ctz-comm-error {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.ctz-comm-error { color: var(--color-danger, var(--danger)); }

.ctz-comm-profile__inner {
    background: var(--bg-card, var(--white));
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--radius-xl);
    padding: 16px;
}
.ctz-comm-kpi-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.ctz-comm-kpi {
    flex: 1 1 80px;
    min-width: 80px;
    text-align: center;
    padding: 12px 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color, var(--border));
    transition: border-color 0.15s;
}
.ctz-comm-kpi:hover {
    border-color: var(--primary, var(--info-dark));
}
.ctz-comm-kpi strong {
    display: block;
    font-size: 1.2rem;
    line-height: 1.2;
}
.ctz-comm-kpi small {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Grid: two columns */
.ctz-comm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}
@media (max-width: 900px) {
    .ctz-comm-grid { grid-template-columns: 1fr; }
}

/* Sections */
.ctz-comm-section {
    margin-bottom: 16px;
}
.ctz-comm-section__title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 10px;
    letter-spacing: -0.01em;
}
.ctz-comm-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.ctz-comm-empty {
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 8px 0;
    margin: 0;
}

/* Welcome onboarding block for new users */
.ctz-comm-welcome {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-top: 14px;
    padding: 16px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--status-success) 6%, transparent), color-mix(in srgb, var(--success) 6%, transparent));
    border: 1px solid color-mix(in srgb, var(--status-success) 18%, transparent);
    border-radius: var(--radius-lg);
}
.ctz-comm-welcome__icon {
    font-size: 2rem;
    flex-shrink: 0;
}
.ctz-comm-welcome__body strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}
.ctz-comm-welcome__body p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.45;
}

/* Improved empty state for available communities */
.ctz-comm-empty-state {
    padding: 20px 16px;
    text-align: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-color, var(--border));
}
.ctz-comm-empty-state__text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 6px;
}
.ctz-comm-empty-state__hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

/* Available communities hint */
.ctz-comm-available-hint {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0 0 8px;
    padding: 0;
}

/* Available community card highlight */
.ctz-comm-card--available {
    border-color: color-mix(in srgb, var(--status-success) 25%, transparent);
}
.ctz-comm-card--available:hover {
    border-color: color-mix(in srgb, var(--status-success) 40%, transparent);
}

/* Join button inside card */
.ctz-comm-join-btn {
    margin-top: 8px;
    width: 100%;
}

/* Hobby matching form */
.ctz-hobby-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-top: 12px;
}
.ctz-hobby-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    resize: none;
    background: var(--bg-card, var(--white));
    color: var(--text-primary);
    transition: border-color 0.2s;
}
.ctz-hobby-input:focus {
     border-color: var(--primary, var(--color-primary));
}
.ctz-hobby-input::placeholder {
    color: var(--text-muted);
}

/* Hobby results area */
.ctz-hobby-results {
    margin-top: 14px;
}
.ctz-hobby-loading {
    display: flex;
    align-items: center;
    padding: 14px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}
.ctz-hobby-section {
    margin-bottom: 14px;
}
.ctz-hobby-section__title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--text-primary);
}
.ctz-hobby-section__subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 8px;
}
.ctz-hobby-no-matches {
    font-size: 0.88rem;
    color: var(--text-secondary);
    padding: 10px 0;
    margin: 0;
}

/* Matched community card (hobby results) */
.ctz-hobby-match-card {
    border: 1px solid color-mix(in srgb, var(--success) 25%, transparent);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-card, var(--white));
    margin-bottom: 8px;
    transition: box-shadow 0.2s;
}
.ctz-hobby-match-card:hover {
    box-shadow: 0 2px 12px color-mix(in srgb, var(--success) 12%, transparent);
}
.ctz-hobby-match-card__body {
    padding: 12px 14px;
}
.ctz-hobby-match-card__head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}
.ctz-hobby-match-card__desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 4px 0;
}
.ctz-hobby-match-card__relevance {
    font-size: 0.82rem;
    color: var(--success);
    margin: 4px 0 8px;
    font-style: italic;
}
.ctz-hobby-match-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.ctz-hobby-match-card__footer .btn {
    flex-shrink: 0;
}

/* Suggested new community card (hobby results) */
.ctz-hobby-suggest-card {
    border: 1px dashed color-mix(in srgb, var(--status-success) 30%, transparent);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, color-mix(in srgb, var(--status-success) 3%, transparent), color-mix(in srgb, var(--status-success) 3%, transparent));
    margin-bottom: 8px;
}
.ctz-hobby-suggest-card__body {
    padding: 12px 14px;
}
.ctz-hobby-suggest-card__body strong {
    font-size: 0.9rem;
    color: var(--text-primary);
}
.ctz-hobby-suggest-card__body p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 4px 0;
}
.ctz-hobby-suggest-card__reason {
    color: var(--primary, var(--color-primary)) !important;
    font-style: italic;
}

/* Community cards */
.ctz-comm-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ctz-comm-card {
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--bg-card, var(--white));
    transition: box-shadow 0.2s, transform 0.15s;
}
.ctz-comm-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    transform: translateY(-1px);
}
.ctz-comm-card__cover {
    height: 100px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-secondary);
}
.ctz-comm-card__body {
    padding: 12px 14px;
}
.ctz-comm-card__head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.ctz-comm-card__head strong {
    font-size: 0.95rem;
}
.ctz-comm-type {
    font-size: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 1px 6px;
    color: var(--text-secondary);
}
.ctz-comm-role {
    font-size: 0.75rem;
    background: color-mix(in srgb, var(--status-info) 10%, transparent);
    border-radius: var(--radius);
    padding: 1px 6px;
    color: var(--primary, var(--info-dark));
    font-weight: 600;
}
.ctz-comm-card__desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 6px;
    line-height: 1.35;
}
.ctz-comm-card__meta {
    display: flex;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.ctz-comm-card__links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.ctz-comm-link {
    font-size: 0.8rem;
    color: var(--primary, var(--info-dark));
    cursor: pointer;
    text-decoration: none;
    padding: 3px 8px;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--status-info) 6%, transparent);
    transition: background 0.15s;
}
.ctz-comm-link:hover {
    background: color-mix(in srgb, var(--status-info) 14%, transparent);
    text-decoration: none;
}
.ctz-comm-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Linked structures */
.ctz-comm-linked-item {
    padding: 8px 10px;
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--radius-md);
    margin-bottom: 6px;
    background: var(--bg-card, var(--white));
}
.ctz-comm-linked-item strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 2px;
}
.ctz-comm-linked-item .ctz-comm-meta a {
    color: var(--primary, var(--info-dark));
    text-decoration: none;
}

/* Activity feed */
.ctz-comm-feed {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 420px;
    overflow-y: auto;
}
.ctz-comm-feed-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color, var(--border));
    background: var(--bg-card, var(--white));
}
.ctz-comm-feed-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 2px;
}
.ctz-comm-feed-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.ctz-comm-feed-title {
    font-size: 0.88rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ctz-comm-feed-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* Actions row */
.ctz-comm-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

/* Meeting archives */
.ctz-comm-archive-item {
    padding: 8px 10px;
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--radius-md);
    background: var(--bg-card, var(--white));
}
.ctz-comm-archive-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}
.ctz-comm-archive-notes {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 4px 0;
    line-height: 1.35;
}
.ctz-comm-archive-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

/* Modal */
.ctz-comm-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
}

/* Ghost button (modals, cancel, close) */
.ctz-comm-modal .ghost-btn,
.ctz-comm-modal__foot .ghost-btn {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color, var(--gray-300));
    background: var(--bg-card, var(--white));
    cursor: pointer;
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--text-primary);
    transition: all 0.15s;
}
.ctz-comm-modal .ghost-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
}
.ctz-comm-modal__head .ghost-btn {
    padding: 4px 8px;
    font-size: 1.2rem;
    line-height: 1;
    border: none;
    background: transparent;
}
.ctz-comm-modal__head .ghost-btn:hover {
    background: var(--bg-secondary);
}
.ctz-comm-modal__card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.ctz-comm-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color, var(--border));
}
.ctz-comm-modal__head h3 {
    margin: 0;
    font-size: 1.05rem;
}
.ctz-comm-modal__body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ctz-comm-modal__foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color, var(--border));
}
.ctz-comm-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.88rem;
    font-weight: 500;
}
.ctz-comm-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.88rem;
    background: var(--bg-secondary);
    color: var(--text-primary, var(--dark));
}
.ctz-comm-input:focus {
     border-color: var(--primary, var(--info-dark));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--status-info) 15%, transparent);
}

/* Right sidebar: Social career */
.ctz-career-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.ctz-career-label {
    font-size: 0.82rem;
    font-weight: 500;
    min-width: 80px;
}
.ctz-career-track {
    flex: 1;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.ctz-career-fill {
    height: 100%;
    background: var(--primary, var(--info-dark));
    border-radius: var(--radius-sm);
    transition: width 0.4s ease;
}
.ctz-career-fill--green {
    background: var(--color-success, var(--success));
}
.ctz-career-value {
    font-size: 0.82rem;
    font-weight: 600;
    min-width: 28px;
    text-align: right;
}

/* Achievements */
.ctz-achievements {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ctz-achievement {
    font-size: 0.85rem;
    padding: 6px 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color, var(--border));
}

/* Quick actions */
.ctz-quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========================================================================
   OKC Citizen Tab Styles
   ======================================================================== */
.okc-citizen-container {
    padding: 0;
}
.okc-citizen-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border-color, var(--border));
    padding-bottom: 0;
    overflow-x: auto;
}
.okc-tab {
    padding: 8px 16px;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary, var(--gray-500));
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s;
}
.okc-tab:hover {
    color: var(--text-primary);
}
.okc-tab.active {
    color: var(--accent, var(--color-primary));
    border-bottom-color: var(--accent, var(--color-primary));
}
.okc-section {
    display: none;
}
.okc-section.active {
    display: block;
}

/* Afisha cards grid */
.okc-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.okc-event-card {
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-primary);
    transition: box-shadow 0.2s;
}
.okc-event-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.okc-card-img {
    height: 140px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-secondary);
}
.okc-card-body {
    padding: 12px 14px;
}
.okc-card-date {
    font-size: 0.8rem;
    color: var(--accent, var(--color-primary));
    font-weight: 600;
    margin-bottom: 4px;
}
.okc-card-title {
    margin: 0 0 4px;
    font-size: 1rem;
    line-height: 1.3;
}
.okc-card-location {
    font-size: 0.82rem;
    color: var(--text-secondary, var(--gray-500));
    margin-bottom: 6px;
}
.okc-card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary, var(--gray-500));
    margin: 0 0 8px;
    line-height: 1.4;
}
.okc-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Centers & Spaces */
.okc-centers-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.okc-center-card {
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--radius-lg);
    padding: 16px;
    background: var(--bg-primary);
}
.okc-center-title {
    margin: 0 0 4px;
    font-size: 1.1rem;
}
.okc-center-addr {
    font-size: 0.85rem;
    color: var(--text-secondary, var(--gray-500));
    margin-bottom: 12px;
}
.okc-spaces-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.okc-space-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}
.okc-space-info {
    flex: 1;
    min-width: 0;
}
.okc-space-cap {
    margin-left: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary, var(--gray-500));
}
.okc-space-equip {
    font-size: 0.8rem;
    color: var(--text-secondary, var(--gray-500));
    margin-top: 2px;
}

/* Booking wizard */
.okc-booking-card {
    border: 1px solid var(--accent, var(--color-primary));
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-top: 16px;
    background: var(--bg-primary);
}
.okc-booking-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.okc-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}
.okc-input {
    padding: 8px 10px;
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 400;
    background: var(--bg-primary);
    color: var(--text-primary);
}
.okc-input:focus {
     border-color: var(--accent, var(--color-primary));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--status-success) 15%, transparent);
}

/* Talent */
.okc-talent-status {
    padding: 14px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.6;
}
.okc-talent-status--active {
    background: var(--bg-secondary);
    border: 1px solid var(--success-lighter);
}
.okc-talent-status--pending {
    background: var(--warning-lightest);
    border: 1px solid var(--warning-lighter);
}
.okc-talent-badge {
    font-weight: 600;
    margin-bottom: 6px;
}
.okc-talent-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.okc-talent-analysis {
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color, var(--border));
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Communities in OKC tab */
.okc-communities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.okc-community-card {
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s ease, transform .15s ease;
}
.okc-community-card:hover {
    box-shadow: 0 6px 18px color-mix(in srgb, var(--dark) 12%, transparent);
    transform: translateY(-2px);
}
.okc-cc-cover {
    height: 90px;
    background-size: cover;
    background-position: center;
    background-color: var(--border);
    /* fallback-градиент, если нет обложки (cover_image_url) */
    background-image: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
}
.okc-cc-cover--ph {
    display: flex;
    align-items: center;
    justify-content: center;
}
.okc-cc-cover--ph span {
    font-size: 2.4rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.22));
}
.okc-cc-body {
    padding: 12px 14px 14px;
}

/* Responsive */
/* Space photos & floor plan */
.okc-space-photos {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    overflow-x: auto;
}
.okc-space-thumb {
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.okc-floor-plan-link {
    font-size: 0.8rem;
    color: var(--accent, var(--color-primary));
    margin-left: 8px;
}

/* Community badge in afisha */
.okc-community-badge {
    display: inline-block;
    background: var(--accent-light);
    color: var(--color-primary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    margin-left: 6px;
}

/* Org structure */
.okc-org-block {
    margin: 10px 0;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color, var(--border));
}
.okc-org-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 0.9rem;
}
.okc-org-item {
    line-height: 1.5;
}
.okc-council-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.okc-council-member {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--radius);
    font-size: 0.82rem;
}
.okc-residents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 8px;
}
.okc-resident-card {
    padding: 10px;
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    font-size: 0.85rem;
}
.okc-resident-photo {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 6px;
}

/* Gantt */
.okc-gantt-container {
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--radius-md);
    padding: 8px;
    background: var(--bg-primary);
}

/* Volunteering */
.okc-volunteer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.okc-volunteer-card {
    padding: 14px;
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--radius-md);
    background: var(--bg-primary);
}
.okc-volunteer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.okc-volunteer-type {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent, var(--color-primary));
    text-transform: uppercase;
}
.okc-volunteer-deadline {
    font-size: 0.78rem;
    color: var(--text-secondary, var(--gray-500));
}

/* Propose idea */
.okc-propose-idea {
    background: var(--bg-primary);
}

@media (max-width: 640px) {
    .okc-cards-grid {
        grid-template-columns: 1fr;
    }
    .okc-communities-grid {
        grid-template-columns: 1fr;
    }
    .okc-volunteer-grid {
        grid-template-columns: 1fr;
    }
    .okc-residents-grid {
        grid-template-columns: 1fr;
    }
    .okc-space-item {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Status banner over the map: stale_cache / pending / empty. */
.map-status-banner {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--dark) 15%, transparent);
    pointer-events: none;
    max-width: 80%;
    text-align: center;
    font-weight: 500;
}
.map-status-banner--stale_cache {
    background: color-mix(in srgb, var(--warning-light) 95%, transparent);   /* amber */
    color: var(--gray-800);
}
.map-status-banner--pending {
    background: color-mix(in srgb, var(--status-info) 95%, transparent);   /* blue */
    color: var(--white);
}
.map-status-banner--empty {
    background: color-mix(in srgb, var(--gray-400) 95%, transparent);  /* slate */
    color: var(--gray-800);
}

/* Redirect notice внутри удалённого communities-pane (см. 2026-05-12 reorg) */
.communities-redirect-notice {
    max-width: 720px;
    margin: 24px auto;
    padding: 24px 28px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated, var(--bg-secondary));
    color: var(--text-primary);
}
.communities-redirect-notice h3 { margin: 0 0 8px; font-size: 1.1rem; }
.communities-redirect-notice ul { margin: 8px 0 0 1.2em; padding: 0; }
.communities-redirect-notice li { margin: 6px 0; line-height: 1.55; }
.communities-redirect-notice a { color: var(--primary); font-weight: 600; }

/* ============================================================
   Шапка дашборда горожанина: убираем служебные/аналитические и
   внутренние контролы — житель видит сразу полезное, без шума.
   • Исследование/кампания и Срез данных — аналитические переключатели
     (дублируют друг друга); JS по-прежнему авто-применяет первое
     исследование, поэтому данные грузятся сразу (элементы лишь скрыты).
   • LLM-токены/стоимость — внутренний биллинг платформы, не для жителя.
   • AI-копилот (Автопилот/Лог) — профессиональный инструмент.
   ============================================================ */
body[data-dashboard-theme="citizen"] #study-selector-wrapper,
body[data-dashboard-theme="citizen"] #data-slice-selector-wrapper,
body[data-dashboard-theme="citizen"] #llm-balance-widget,
body[data-dashboard-theme="citizen"] #copilot-inbox-panel {
    display: none !important;
}

/* Период новостей — компактный фильтр в табе «Новости» (перенесён из
   бывшей служебной секции «Окно данных» правой панели). */
.news-period-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.news-period-toolbar .news-period-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary, var(--gray-500));
}

/* Аудит 2026-07-03: сепараторы смысловых групп в десктопном view-switcher
   (карта · данные · общение · память · действие). На мобильных switcher скрыт. */
.dashboard-content > .view-switcher .view-switcher-sep {
    width: 1px;
    align-self: stretch;
    margin: 4px 2px;
    background: var(--border);
    flex: 0 0 auto;
}

/* ТЗ F-05/§6.6 (2026-07-17): сгруппированный view-switcher — верхний ряд
   5 смысловых групп + нижний ряд вкладок активной группы (вкладки чужих
   групп получают hidden в activateViewGroup). Сепараторы 2026-07-03
   упразднены вместе с плоским рядом. На ≤640px свитчер скрыт (bottom-nav). */
.dashboard-content > .view-switcher {
    flex-direction: column;
    gap: 0.4rem;
}
.view-switcher .view-switcher-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.view-switcher .view-switcher-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-top: 1px dashed var(--border);
    padding-top: 0.4rem;
}
.view-switcher .view-tab[hidden] {
    display: none;
}
.view-switcher .view-group-btn {
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}
.view-switcher .view-group-btn:hover {
    border-color: var(--primary, var(--info-dark));
    color: var(--text-primary);
}
.view-switcher .view-group-btn.active {
    background: var(--primary, var(--info-dark));
    border-color: var(--primary, var(--info-dark));
    color: var(--white);
}
/* ── css/cultural_map.css ── */
/**
 * Cultural Map Styles - Pinterest Edition
 * Version 2.0
 */

/* ========================================================================
   LAYOUT
   ======================================================================== */

/* DS-03 delta: полноэкранная карта — фиксированная высота под собственный
   хедер (65px), канонный flex-поток dashboard-base не подходит full-bleed
   карте. Остальное — канон. */
.dashboard-main {
    display: flex;
    height: calc(100vh - 65px);
    overflow: hidden;
}

.cultural-map-container {
    display: flex;
    width: 100%;
    height: 100%;
    gap: 0;
}

/* Citizen dashboard: cultural map should fill center pane */
#cultural_map-pane {
    padding: 0;
    overflow: hidden;
}

#cultural_map-pane .cultural-map-container {
    max-width: none;
    margin: 0;
    padding: 0;
    height: 100%;
}

#cultural_map-pane .map-panel,
#cultural_map-pane .moodboard-panel {
    height: 100%;
}

#cultural_map-pane .moodboard-panel {
    overflow-y: auto;
    max-width: none;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

#cultural_map-pane .moodboard-panel > * {
    width: 100%;
}

#cultural_map-pane .inspiration-board {
    width: 100%;
}

#cultural_map-pane .map-container,
#cultural_map-pane #cultural-map {
    width: 100%;
    height: 100%;
}

/* Map Panel - Left Side */
.map-panel {
    flex: 1.5;
    position: relative;
    background: var(--bg-secondary);
}

.map-container {
    width: 100%;
    height: 100%;
}

#cultural-map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Moodboard Panel - Right Side */
.moodboard-panel {
    flex: 1;
    background: var(--bg-secondary);
    overflow-y: auto;
    padding: 1.5rem;
    border-left: 1px solid var(--border);
    max-width: 600px;
}

/* ========================================================================
   MAP CONTROLS
   ======================================================================== */

.map-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
}

.map-control-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.map-control-btn:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.map-control-btn:active {
    transform: translateY(0);
}

/* ========================================================================
   VIEW SWITCHER
   ======================================================================== */

.cultural-map-container .view-switcher-container {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
}

.cultural-map-container .view-switcher {
    display: inline-flex;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 0.25rem;
    gap: 0.25rem;
    box-shadow: var(--shadow-sm);
}

.cultural-map-container .view-btn {
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
}

.cultural-map-container .view-btn:hover {
    background: var(--bg-hover);
    color: var(--gray-900);
}

.cultural-map-container .view-btn.active {
    background: var(--primary);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
}

.cultural-map-container .view-btn svg {
    width: 18px;
    height: 18px;
}

/* View Mode Classes */
.cultural-map-container.view-grid .map-panel {
    display: none;
}

.cultural-map-container.view-map .moodboard-panel {
    display: none;
}

.cultural-map-container.view-map .map-panel {
    flex: 1;
    max-width: 100%;
}

.cultural-map-container.view-split .map-panel,
.cultural-map-container.view-split .moodboard-panel {
    display: flex;
}

/* ========================================================================
   STATISTICS
   ======================================================================== */

.stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-top: 0.25rem;
}

/* ========================================================================
   FILTERS
   ======================================================================== */

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: var(--primary);
    background: var(--bg-secondary);
    transform: translateY(-1px);
}

.filter-btn.active {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
}

/* ========================================================================
   SEARCH & ACTIONS
   ======================================================================== */

.search-actions {
    margin-bottom: 1.5rem;
}

/* ========================================================================
   ART OBJECTS GRID - PINTEREST STYLE
   ======================================================================== */

.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    align-items: start;
}

/* ✅ НОВОЕ: Легкие Pinterest-style карточки */
.art-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    break-inside: avoid;
    display: flex;
    flex-direction: column;
    border: none;
}

.art-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* ✅ НОВОЕ: Изображение с overlay (название и категория НА фото) */
.art-card-image {
    width: 100%;
    height: 0;
    padding-bottom: 75%; /* 4:3 соотношение */
    position: relative;
    overflow: hidden;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.art-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.art-card:hover .art-card-image img {
    transform: scale(1.03);
}

/* ✅ НОВОЕ: Плейсхолдер для карточек без изображения */
.art-card-image-placeholder {
    background: var(--color-primary);
}

.art-card-image-placeholder::before {
    content: '🎨';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    opacity: 0.3;
}

/* ✅ НОВОЕ: Overlay с названием и категорией НА изображении */
.art-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.5) 50%, rgba(0, 0, 0, 0) 100%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.art-card:hover .art-card-overlay {
    opacity: 1;
}

/* ✅ НОВОЕ: Категория на фото - легкая надпись */
.art-card-overlay .art-card-type {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
    backdrop-filter: blur(8px);
    align-self: flex-start;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Цвета категорий */
.art-card[data-type="Событие"] .art-card-type {
    background: color-mix(in srgb, var(--art-event) 95%, transparent);
    color: var(--text-inverse);
}

.art-card[data-type="Инсталляция"] .art-card-type {
    background: color-mix(in srgb, var(--art-visual) 95%, transparent);
    color: var(--text-inverse);
}

.art-card[data-type="Стрит-арт"] .art-card-type {
    background: color-mix(in srgb, var(--art-street) 95%, transparent);
    color: var(--text-inverse);
}

.art-card[data-type="Музыка"] .art-card-type {
    background: color-mix(in srgb, var(--art-music) 95%, transparent);
    color: var(--text-inverse);
}

.art-card[data-type="Изобразительное искусство"] .art-card-type {
    background: color-mix(in srgb, var(--art-visual) 95%, transparent);
    color: var(--text-inverse);
}

.art-card[data-type="Дизайн"] .art-card-type {
    background: color-mix(in srgb, var(--art-design) 95%, transparent);
    color: var(--text-inverse);
}

/* ✅ НОВОЕ: Название на фото - белый текст с тенью */
.art-card-overlay .art-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-inverse);
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ✅ НОВОЕ: Легкий контент под изображением */
.art-card-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.art-card-author {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.art-card-description {
    color: var(--gray-500);
    font-size: 13px;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ✅ NEW: Cultural Codes Badges */
.art-card-codes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
    margin-bottom: 4px;
}

.cultural-code-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-transform: lowercase;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
}

.cultural-code-badge:hover {
    background: var(--border);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Cultural code color variants (optional enhancement) */
.cultural-code-badge[data-code="memory"] {
    background: var(--warning-lightest);
    border-color: var(--warning-light);
    color: var(--warning-dark);
}

.cultural-code-badge[data-code="culture"] {
    background: var(--accent-light);
    border-color: var(--art-visual);
    color: var(--art-visual);
}

.cultural-code-badge[data-code="innovation"] {
    background: var(--info-lightest);
    border-color: var(--info-light);
    color: var(--status-info);
}

.cultural-code-badge[data-code="nature"] {
    background: var(--status-success-bg);
    border-color: var(--success);
    color: var(--status-success);
}

.art-card-location {
    font-size: 12px;
    color: var(--gray-400);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ✅ НОВОЕ: Кнопки-иконки вместо текстовых кнопок */
.art-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    justify-content: flex-end;
}

.art-card-actions .btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.art-card-actions .btn-icon:hover {
    background: var(--bg-hover);
    transform: scale(1.1);
}

/* ========================================================================
   EMPTY STATE
   ======================================================================== */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state-text {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

/* ✅ Problem #7 FIX: Generating state styles */
.generating-state {
    animation: pulse 2s ease-in-out infinite;
}

.generating-state .empty-state-icon {
    animation: spin 2s linear infinite;
}

/* @keyframes rotate — use shared 'spin' from components/animations.css */
/* @keyframes pulse — moved to components/animations.css */

.generating-progress {
    max-width: 400px;
    margin: 0 auto;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-hover);
    border-radius: var(--radius-xs);
    overflow: hidden;
    margin-top: 1rem;
}

.progress-bar-fill {
    height: 100%;
    background: var(--success);
    background-size: 200% 100%;
    animation: progress-fill 1.5s ease-in-out infinite;
}

@keyframes progress-fill {
    0% { width: 0%; background-position: 0% 50%; }
    50% { width: 100%; background-position: 100% 50%; }
    100% { width: 0%; background-position: 0% 50%; }
}

/* ========================================================================
   LOADING STATE
   ======================================================================== */

/* .loading-spinner standardized in static/css/components/loading.css */

/* ========================================================================
   MODAL OVERRIDES
   ======================================================================== */

#art-modal .modal-content {
    max-width: 600px;
}

#art-modal .modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

/* ========================================================================
   MAP MARKER STYLES
   ======================================================================== */

.art-marker {
    background: var(--bg-elevated);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: var(--shadow-md);
    border: 2px solid white;
    transition: var(--transition-fast);
    cursor: pointer;
}

.art-marker:hover {
    transform: scale(1.15);
    box-shadow: var(--shadow-lg);
}

/* Type-specific marker styles */
.art-marker.street-art {
    background: var(--art-street);
}

.art-marker.music {
    background: var(--art-music);
}

.art-marker.visual-art {
    background: var(--art-visual);
}

.art-marker.design {
    background: var(--art-design);
}

.art-marker.event {
    background: var(--art-event);
}

/* OKC events — события из ленты общественно-культурного центра.
   Подмешиваются backend'ом, отличаются ярким цветом + календарная иконка. */
.art-marker.okc-event {
    background: var(--danger-light);
    box-shadow: 0 2px 6px color-mix(in srgb, var(--danger) 50%, transparent);
    border: 2px solid white;
}

.art-marker.other {
    background: var(--art-other);
}

/* ========================================================================
   RESPONSIVE
   ======================================================================== */

@media (max-width: 1024px) {
    .cultural-map-container {
        flex-direction: column;
    }

    .map-panel {
        height: 50vh;
        flex: none;
    }

    .moodboard-panel {
        flex: 1;
        border-left: none;
        border-top: 1px solid var(--border);
        max-width: 100%;
    }

    .map-controls {
        top: 0.5rem;
        right: 0.5rem;
    }
}

@media (max-width: 768px) {
    .moodboard-panel {
        padding: 1rem;
    }

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

    .stats-row {
        grid-template-columns: 1fr;
    }

    .filter-buttons {
        padding: 0.75rem;
    }

    .filter-btn {
        font-size: 0.8125rem;
        padding: 0.375rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .art-card-content {
        padding: 10px;
    }

    .art-card-actions {
        flex-direction: row;
        justify-content: center;
    }
}
/* ── css/neuro_art_studio.css ── */
/* Neuro-Art Studio — 3D Knowledge Graph Visualization */

/* ── Container ─────────────────────────────────────────────────────── */
/* Дефолт — светлый холст (бумага). Тёмные палитры (cyberpunk, matrix…)
   сами переустанавливают `.backgroundColor` через ForceGraph3D, поэтому
   при их выборе canvas уходит в чёрный через WebGL clear, а тулбар/кайма
   остаются нейтрально-светлыми. */
#neuro-art-view {
    display: none;
    flex-direction: column;
    height: 100%;
    background:
        radial-gradient(1200px 400px at 20% -10%, rgba(31, 61, 43, 0.10), transparent 70%),
        radial-gradient(900px 500px at 100% 120%, color-mix(in srgb, var(--info) 8%, transparent), transparent 70%),
        var(--white);
    border: 1px solid color-mix(in srgb, var(--dark) 8%, transparent);
    border-radius: 14px;
    overflow: hidden;
    position: relative;
}
/* Тонкая «аура» по периметру — subtle animated conic gradient,
   едва заметна, но создаёт ощущение «живого» инструмента. */
#neuro-art-view::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: conic-gradient(from var(--neuro-aura-angle, 0deg),
        rgba(31, 61, 43, 0.35),
        color-mix(in srgb, var(--danger-light) 25%, transparent),
        color-mix(in srgb, var(--info) 25%, transparent),
        color-mix(in srgb, var(--success) 25%, transparent),
        rgba(31, 61, 43, 0.35));
    -webkit-mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
    opacity: 0.55;
    animation: neuro-aura-rotate 18s linear infinite;
    z-index: 2;
}
@property --neuro-aura-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}
@keyframes neuro-aura-rotate {
    to { --neuro-aura-angle: 360deg; }
}
/* Fallback для браузеров без @property — просто opacity-дыхание. */
@supports not (background: conic-gradient(from 0deg, #000, #000)) {
    #neuro-art-view::before {
        background: linear-gradient(135deg, rgba(31, 61, 43, 0.25), color-mix(in srgb, var(--danger-light) 20%, transparent), color-mix(in srgb, var(--info) 20%, transparent));
        animation: neuro-aura-breathe 6s ease-in-out infinite;
    }
    @keyframes neuro-aura-breathe {
        0%, 100% { opacity: 0.35; }
        50%      { opacity: 0.7; }
    }
}

#neuro-art-view.show {
    display: flex;
}

/* ── Mood / Vibe bar ────────────────────────────────────────────────── */
/* Тонкая полоса «настроений» — один клик разом настраивает сцену +
   цвет + FX-preset + режим автосмены. Для медиа-художника это
   быстрый способ попасть в нужный vibe без копания в sliders. */
.neuro-art-moodbar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.85rem;
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.96),
        color-mix(in srgb, var(--bg-secondary) 92%, transparent));
    backdrop-filter: blur(10px) saturate(1.1);
    -webkit-backdrop-filter: blur(10px) saturate(1.1);
    border-bottom: 1px solid rgba(31, 61, 43, 0.12);
    flex-wrap: wrap;
    position: relative;
    z-index: 11;
}
.moodbar-title {
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gray-500);
    padding: 0 0.35rem;
    font-weight: 600;
}
.mood-tile {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid rgba(31, 61, 43, 0.18);
    background: rgba(255, 255, 255, 0.7);
    color: var(--gray-700);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}
.mood-tile::after {
    /* Лёгкий gradient sheen, раскрывается при hover */
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 0%, rgba(31, 61, 43, 0.18) 45%, transparent 100%);
    transform: translateX(-120%);
    transition: transform 0.6s ease;
    pointer-events: none;
}
.mood-tile:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(31, 61, 43, 0.4);
    box-shadow: 0 6px 16px -6px rgba(31, 61, 43, 0.35);
}
.mood-tile:hover::after { transform: translateX(120%); }
.mood-tile.is-active {
    background: linear-gradient(135deg, rgba(31, 61, 43, 0.95), rgba(31, 61, 43, 0.95));
    color: var(--white);
    border-color: rgba(31, 61, 43, 0.9);
    box-shadow: 0 8px 22px -8px rgba(31, 61, 43, 0.7);
}
.mood-tile .mood-emoji {
    font-size: 0.95rem;
    line-height: 1;
}
.moodbar-spacer { flex: 1; }
.moodbar-help {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid color-mix(in srgb, var(--dark) 12%, transparent);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.moodbar-help:hover {
    color: var(--primary-dark);
    border-color: rgba(31, 61, 43, 0.5);
    background: rgba(31, 61, 43, 0.08);
}

/* ── Toolbar ───────────────────────────────────────────────────────── */
.neuro-art-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.9rem;
    padding: 0.7rem 1rem;
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.88),
        color-mix(in srgb, var(--bg-secondary) 92%, transparent));
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    border-bottom: 1px solid color-mix(in srgb, var(--dark) 8%, transparent);
    z-index: 10;
    position: relative;
}

.neuro-art-toolbar .toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.2rem 0.55rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(31, 61, 43, 0.1);
    position: relative;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.neuro-art-toolbar .toolbar-group:hover {
    border-color: rgba(31, 61, 43, 0.28);
    background: rgba(255, 255, 255, 0.8);
}
/* Section captions — маленький монохром label над группой */
.neuro-art-toolbar .toolbar-group[data-section]::before {
    content: attr(data-section);
    position: absolute;
    top: -9px;
    left: 10px;
    padding: 0 5px;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-accent);
    background: inherit;
    opacity: 0.75;
    font-weight: 600;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), color-mix(in srgb, var(--bg-secondary) 92%, transparent));
    border-radius: 3px;
}

.neuro-art-toolbar label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    white-space: nowrap;
}

.neuro-art-toolbar select,
.neuro-art-toolbar input[type="range"] {
    background: var(--bg-card);
    border: 1px solid color-mix(in srgb, var(--dark) 15%, transparent);
    color: var(--dark);
    border-radius: var(--radius);
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
}

.neuro-art-toolbar select {
    min-width: 140px;
}

.neuro-art-toolbar input[type="range"] {
    width: 80px;
    accent-color: var(--color-primary);
}

.neuro-art-toolbar .range-value {
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 2ch;
    text-align: center;
}

/* ── Buttons ───────────────────────────────────────────────────────── */
.neuro-art-toolbar .btn-neuro {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid color-mix(in srgb, var(--dark) 15%, transparent);
    border-radius: var(--radius-md);
    color: var(--dark);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-neuro.btn-generate {
    background:
        linear-gradient(135deg, var(--color-primary), var(--color-accent), var(--danger-light), var(--color-primary));
    background-size: 280% 280%;
    color: var(--white);
    border-color: transparent;
    box-shadow: 0 4px 14px -4px rgba(31, 61, 43, 0.55),
                0 0 0 1px rgba(31, 61, 43, 0.35) inset;
    animation: neuro-generate-shimmer 9s ease infinite;
    position: relative;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.btn-neuro.btn-generate::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--danger-light) 35%, transparent), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.btn-neuro.btn-generate:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px -6px rgba(31, 61, 43, 0.75),
                0 0 0 1px color-mix(in srgb, var(--danger-light) 55%, transparent) inset;
}
.btn-neuro.btn-generate:hover::after { opacity: 1; }
@keyframes neuro-generate-shimmer {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.btn-neuro.btn-generate.loading {
    opacity: 0.6;
    pointer-events: none;
}

.btn-neuro.btn-screenshot {
    background: color-mix(in srgb, var(--success) 15%, transparent);
    color: var(--success-light);
    border-color: color-mix(in srgb, var(--success) 30%, transparent);
}

.btn-neuro.btn-screenshot:hover {
    background: color-mix(in srgb, var(--success) 25%, transparent);
}

.btn-neuro.btn-record {
    background: color-mix(in srgb, var(--danger) 15%, transparent);
    color: var(--danger-light);
    border-color: color-mix(in srgb, var(--danger) 30%, transparent);
    position: relative;
}

.btn-neuro.btn-record:hover {
    background: color-mix(in srgb, var(--danger) 25%, transparent);
}

.btn-neuro.btn-record.recording {
    background: color-mix(in srgb, var(--danger) 40%, transparent);
    color: var(--white);
    animation: rec-pulse 1s ease-in-out infinite;
}

.rec-icon {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
}

.btn-neuro.btn-record.recording .rec-icon {
    background: var(--bg-card);
}

@keyframes rec-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ── Canvas area ───────────────────────────────────────────────────── */
/* Wrapper holds the 3D canvas + the absolute-positioned FX drawer.
   Must be a flex-column so `#neuro-art-canvas` can flex:1 as before —
   otherwise the canvas collapses to height:0 (black screen bug). */
#neuro-art-canvas-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#neuro-art-canvas {
    flex: 1;
    position: relative;
    min-height: 400px;
    /* Светлый placeholder — до первого generate() canvas пустой.
       После generate() ForceGraph3D перекрашивает clear-color под палитру. */
    background: var(--bg-card);
}

#neuro-art-canvas canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* Fade-in wash — проигрывается при переключении сцены, чтобы переход
   не был «дёрганым» (canvas мгновенно обновляется, оверлей даёт артисту
   мягкое дыхание ≈0.6 c). Триггерится JS через `.scene-transition`. */
#neuro-art-canvas-wrap.scene-transition::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%,
        rgba(255, 255, 255, 0.08),
        rgba(31, 61, 43, 0.20) 45%,
        color-mix(in srgb, var(--dark) 0%, transparent) 85%);
    pointer-events: none;
    animation: neuro-scene-flash 0.7s ease-out forwards;
    z-index: 15;
    mix-blend-mode: screen;
}
@keyframes neuro-scene-flash {
    0%   { opacity: 0; transform: scale(0.92); }
    35%  { opacity: 1; transform: scale(1.0); }
    100% { opacity: 0; transform: scale(1.05); }
}

/* ── Status bar ────────────────────────────────────────────────────── */
.neuro-art-statusbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 1rem;
    background: color-mix(in srgb, var(--bg-secondary) 97%, transparent);
    border-top: 1px solid color-mix(in srgb, var(--dark) 10%, transparent);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.neuro-art-stats {
    display: flex;
    gap: 1rem;
}

.neuro-art-stats span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* ── Placeholder state ─────────────────────────────────────────────── */
.neuro-art-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    color: var(--gray-400);
    text-align: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}
/* Мягкая аура под иконкой — намёк на «живое поле» ещё до первого рендера */
.neuro-art-placeholder .placeholder-aura {
    position: absolute;
    inset: 10% 20%;
    background:
        radial-gradient(circle at 30% 40%, rgba(31, 61, 43, 0.22), transparent 55%),
        radial-gradient(circle at 70% 70%, color-mix(in srgb, var(--danger-light) 18%, transparent), transparent 55%),
        radial-gradient(circle at 50% 80%, color-mix(in srgb, var(--info) 18%, transparent), transparent 50%);
    filter: blur(40px);
    animation: neuro-placeholder-drift 14s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}
@keyframes neuro-placeholder-drift {
    0%   { transform: translate(-4%, 2%) scale(1.0); }
    50%  { transform: translate(3%, -2%) scale(1.08); }
    100% { transform: translate(-2%, 3%) scale(1.02); }
}
.neuro-art-placeholder > *:not(.placeholder-aura) { position: relative; z-index: 1; }

.neuro-art-placeholder .placeholder-icon {
    font-size: 4.5rem;
    opacity: 0.55;
    animation: neuro-placeholder-pulse 3.2s ease-in-out infinite;
    filter: drop-shadow(0 6px 20px rgba(31, 61, 43, 0.35));
}
@keyframes neuro-placeholder-pulse {
    0%, 100% { transform: scale(1.0); opacity: 0.55; }
    50%      { transform: scale(1.07); opacity: 0.85; }
}

.neuro-art-placeholder .placeholder-text {
    font-size: 1.15rem;
    font-weight: 600;
    max-width: 340px;
    line-height: 1.4;
    background: linear-gradient(135deg, var(--primary-dark), var(--color-accent) 40%, var(--danger-light));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 0.01em;
}

.neuro-art-placeholder .placeholder-hint {
    font-size: 0.82rem;
    opacity: 0.8;
    max-width: 420px;
    color: var(--text-secondary);
}

.neuro-art-placeholder .placeholder-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.25rem;
    max-width: 520px;
}
.neuro-art-placeholder .placeholder-chips span {
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(31, 61, 43, 0.2);
    color: var(--primary-dark);
    font-size: 0.75rem;
    font-weight: 500;
    backdrop-filter: blur(6px);
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .neuro-art-toolbar {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .neuro-art-toolbar .toolbar-group {
        flex-wrap: wrap;
    }

    .neuro-art-toolbar select {
        min-width: 100px;
    }
}

/* ── Neuro-art checkbox in other dashboards ────────────────────────── */
.neuro-art-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.neuro-art-option input[type="checkbox"] {
    accent-color: var(--color-primary);
}

.neuro-art-option label {
    font-size: 0.85rem;
    color: var(--gray-500);
    cursor: pointer;
}

.neuro-art-option .neuro-art-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem 0.4rem;
    background: linear-gradient(135deg, rgba(31, 61, 43, 0.15), rgba(31, 61, 43, 0.15));
    color: var(--primary-light);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

/* ── FX Constructor drawer ─────────────────────────────────────────── */
.fx-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: 340px;
    max-width: 90vw;
    height: 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), color-mix(in srgb, var(--bg-secondary) 98%, transparent));
    backdrop-filter: blur(12px);
    border-left: 1px solid rgba(31, 61, 43, 0.2);
    box-shadow: -12px 0 40px color-mix(in srgb, var(--dark) 12%, transparent);
    color: var(--dark);
    font-size: 12px;
    overflow-y: auto;
    transform: translateX(110%);
    transition: transform 0.28s ease-out;
    z-index: 20;
    padding-bottom: 1rem;
}
.fx-drawer.is-open {
    transform: translateX(0);
}

.fx-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.8rem;
    background: color-mix(in srgb, var(--bg-secondary) 98%, transparent);
    border-bottom: 1px solid rgba(31, 61, 43, 0.2);
    z-index: 1;
}
.fx-header strong {
    font-size: 13px;
    color: var(--primary-dark);
    letter-spacing: 0.02em;
}
.fx-header select {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid color-mix(in srgb, var(--dark) 15%, transparent);
    color: var(--dark);
    border-radius: var(--radius);
    padding: 0.28rem 0.45rem;
    font-size: 12px;
}
.fx-btn {
    background: var(--bg-card);
    border: 1px solid color-mix(in srgb, var(--dark) 15%, transparent);
    color: var(--primary-dark);
    border-radius: var(--radius);
    padding: 0.3rem 0.55rem;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    transition: background 0.15s;
}
.fx-btn:hover { background: rgba(31, 61, 43, 0.12); }

.fx-section {
    padding: 0.75rem 0.9rem 0.4rem 0.9rem;
    border-bottom: 1px dashed rgba(31, 61, 43, 0.15);
}
.fx-section h4 {
    margin: 0 0 0.45rem 0;
    font-size: 12px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.fx-row {
    display: grid;
    grid-template-columns: 110px 1fr 52px;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    color: var(--dark);
}
.fx-row > span:first-child {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fx-row input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}
.fx-row input[type="checkbox"] {
    justify-self: start;
    accent-color: var(--primary);
}
.fx-val {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--primary);
    text-align: right;
}

.btn-neuro.btn-fx {
    background: linear-gradient(135deg, rgba(31, 61, 43, 0.12), rgba(31, 61, 43, 0.12));
    border-color: rgba(31, 61, 43, 0.35);
    color: var(--primary-dark);
}
.btn-neuro.btn-fx.is-open {
    background: linear-gradient(135deg, rgba(31, 61, 43, 0.5), rgba(31, 61, 43, 0.5));
    border-color: rgba(31, 61, 43, 0.7);
    color: var(--white);
}

/* ── Tier 5 Broadcast / Media Art Production ─────────────────────── */

/* Broadcast mode buttons: state=active цвет = бирюза / пурпур чтобы
   оператор сразу видел что режим ON при взгляде на тулбар. */
.btn-neuro.btn-autonomous {
    background: linear-gradient(135deg, color-mix(in srgb, var(--success) 12%, transparent), color-mix(in srgb, var(--info-light) 12%, transparent));
    border-color: color-mix(in srgb, var(--success) 35%, transparent);
    color: var(--status-success);
}
.btn-neuro.btn-autonomous.is-active {
    background: linear-gradient(135deg, color-mix(in srgb, var(--success) 50%, transparent), color-mix(in srgb, var(--info-light) 50%, transparent));
    border-color: color-mix(in srgb, var(--success) 70%, transparent);
    color: var(--white);
    animation: autonomous-pulse 2.6s ease-in-out infinite;
}
@keyframes autonomous-pulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 35%, transparent); }
    50%      { box-shadow: 0 0 0 10px color-mix(in srgb, var(--success) 0%, transparent); }
}

.btn-neuro.btn-broadcast {
    background: linear-gradient(135deg, color-mix(in srgb, var(--danger-light) 12%, transparent), color-mix(in srgb, var(--danger) 12%, transparent));
    border-color: color-mix(in srgb, var(--danger-light) 35%, transparent);
    color: var(--status-danger);
}
.btn-neuro.btn-broadcast.is-active {
    background: linear-gradient(135deg, color-mix(in srgb, var(--danger-light) 55%, transparent), color-mix(in srgb, var(--danger) 55%, transparent));
    border-color: color-mix(in srgb, var(--danger) 70%, transparent);
    color: var(--white);
}

/* Tier 7 — Presenter Window (dual-monitor output button). */
.btn-neuro.btn-presenter {
    background: linear-gradient(135deg, color-mix(in srgb, var(--info) 12%, transparent), rgba(31, 61, 43, 0.12));
    border-color: color-mix(in srgb, var(--info) 35%, transparent);
    color: var(--status-info);
}
.btn-neuro.btn-presenter.is-active {
    background: linear-gradient(135deg, color-mix(in srgb, var(--info) 55%, transparent), rgba(31, 61, 43, 0.55));
    border-color: color-mix(in srgb, var(--info) 70%, transparent);
    color: var(--white);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--info) 45%, transparent);
}

/* Broadcast mode — `#neuro-art-view.broadcast-mode`:
   весь viewport занимает canvas; тулбар, status bar, FX drawer скрыты.
   Оператор может нажать Esc чтобы выйти, F — toggle fullscreen,
   A — autonomous motion. */
#neuro-art-view.broadcast-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: var(--dark);
    border-radius: 0;
    border: none;
}
#neuro-art-view.broadcast-mode .neuro-art-toolbar,
#neuro-art-view.broadcast-mode .neuro-art-statusbar,
#neuro-art-view.broadcast-mode .fx-drawer {
    display: none !important;
}
#neuro-art-view.broadcast-mode #neuro-art-canvas-wrap {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark);
}

/* Aspect ratio letterboxing. Применяется в broadcast-режиме; в обычном
   canvas-wrap просто заполняет flex-container без констрейнтов.
   Используется `aspect-ratio` CSS property + max-width/max-height
   для корректной вписки в viewport с сохранением пропорций. */
#neuro-art-view.broadcast-mode #neuro-art-canvas-wrap[data-aspect="16:9"] #neuro-art-canvas,
#neuro-art-view.broadcast-mode #neuro-art-canvas-wrap[data-aspect="21:9"] #neuro-art-canvas,
#neuro-art-view.broadcast-mode #neuro-art-canvas-wrap[data-aspect="32:9"] #neuro-art-canvas,
#neuro-art-view.broadcast-mode #neuro-art-canvas-wrap[data-aspect="9:16"] #neuro-art-canvas,
#neuro-art-view.broadcast-mode #neuro-art-canvas-wrap[data-aspect="1:1"] #neuro-art-canvas,
#neuro-art-view.broadcast-mode #neuro-art-canvas-wrap[data-aspect="4:3"] #neuro-art-canvas,
#neuro-art-view.broadcast-mode #neuro-art-canvas-wrap[data-aspect="dci_4k"] #neuro-art-canvas {
    width: auto !important;
    height: auto !important;
    max-width: 100vw;
    max-height: 100vh;
    flex: none;
}

#neuro-art-view.broadcast-mode #neuro-art-canvas-wrap[data-aspect="16:9"] #neuro-art-canvas { aspect-ratio: 16 / 9; width: min(100vw, calc(100vh * 16 / 9)) !important; }
#neuro-art-view.broadcast-mode #neuro-art-canvas-wrap[data-aspect="21:9"] #neuro-art-canvas { aspect-ratio: 21 / 9; width: min(100vw, calc(100vh * 21 / 9)) !important; }
#neuro-art-view.broadcast-mode #neuro-art-canvas-wrap[data-aspect="32:9"] #neuro-art-canvas { aspect-ratio: 32 / 9; width: min(100vw, calc(100vh * 32 / 9)) !important; }
#neuro-art-view.broadcast-mode #neuro-art-canvas-wrap[data-aspect="9:16"] #neuro-art-canvas { aspect-ratio: 9 / 16; height: min(100vh, calc(100vw * 16 / 9)) !important; width: auto !important; }
#neuro-art-view.broadcast-mode #neuro-art-canvas-wrap[data-aspect="1:1"]  #neuro-art-canvas { aspect-ratio: 1 / 1;  width: min(100vw, 100vh) !important; height: min(100vw, 100vh) !important; }
#neuro-art-view.broadcast-mode #neuro-art-canvas-wrap[data-aspect="4:3"]  #neuro-art-canvas { aspect-ratio: 4 / 3;  width: min(100vw, calc(100vh * 4 / 3)) !important; }
#neuro-art-view.broadcast-mode #neuro-art-canvas-wrap[data-aspect="dci_4k"] #neuro-art-canvas { aspect-ratio: 256 / 135; width: min(100vw, calc(100vh * 256 / 135)) !important; }

/* Hotkey overlay hint — показывается 2с после включения broadcast-режима */
#neuro-art-view.broadcast-mode::after {
    content: "B — выйти · A — авто-движение · F — fullscreen · P — presenter · R — генерировать · Esc — выход";
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.55);
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 12px;
    font-family: var(--font-mono);
    backdrop-filter: blur(6px);
    pointer-events: none;
    animation: broadcast-hint-fade 2s ease-out 3s forwards;
}
@keyframes broadcast-hint-fade {
    to { opacity: 0; }
}

@media (max-width: 640px) {
    .fx-drawer { width: 100%; }
}

/* ── Live HUD overlay (top-left of canvas) ──────────────────────────── */
/* Показывает сцену · схему · пульс (час+луна). Артист видит «пульс города»
   не отрывая взгляд от холста. Прозрачная glass-плитка. Скрывается
   автоматически в broadcast-mode чтобы не пачкать кадр. */
.neuro-art-hud {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 12;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--dark) 38%, transparent);
    color: rgba(255, 255, 255, 0.92);
    font-size: 12px;
    letter-spacing: 0.04em;
    backdrop-filter: blur(10px) saturate(1.3);
    -webkit-backdrop-filter: blur(10px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, 0.14);
    pointer-events: none;
    font-family: var(--font-sans);
    box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.neuro-art-hud.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.neuro-art-hud.is-hidden { display: none; }
.hud-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success-light);
    box-shadow: 0 0 10px var(--success-light);
    animation: hud-dot-pulse 1.6s ease-in-out infinite;
}
@keyframes hud-dot-pulse {
    0%, 100% { opacity: 0.7; transform: scale(1.0); }
    50%      { opacity: 1;   transform: scale(1.35); }
}
.hud-scene   { font-weight: 600; letter-spacing: 0.05em; }
.hud-scheme  { opacity: 0.85; }
.hud-pulse   { font-family: var(--font-mono); opacity: 0.7; }
.hud-sep     { opacity: 0.35; }
/* В broadcast-mode прячем (чтобы не пачкать live-кадр) */
#neuro-art-view.broadcast-mode .neuro-art-hud,
#neuro-art-view.broadcast-mode .neuro-art-rotate-ring { display: none !important; }

/* Для светлых схем (paper_white, ink_wash) HUD тоже светлый —
   тёмный текст на glass, чтобы читалось на белом холсте. */
#neuro-art-view.light-scheme .neuro-art-hud {
    background: rgba(255, 255, 255, 0.78);
    color: var(--gray-800);
    border-color: color-mix(in srgb, var(--dark) 12%, transparent);
    box-shadow: 0 8px 24px -8px color-mix(in srgb, var(--dark) 25%, transparent);
}
#neuro-art-view.light-scheme .hud-sep { color: var(--gray-500); }

/* ── Scene rotation progress ring (top-right) ───────────────────────── */
/* Видно только когда «Авто-сцены» > 0. SVG circle fills via
   stroke-dashoffset из JS. Тонкий, ненавязчивый. */
.neuro-art-rotate-ring {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    z-index: 12;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.neuro-art-rotate-ring.is-visible { opacity: 0.85; }
.neuro-art-rotate-ring.is-hidden { display: none; }
.neuro-art-rotate-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    filter: drop-shadow(0 2px 8px rgba(31, 61, 43, 0.45));
}
.neuro-art-rotate-ring .ring-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 2.5;
}
.neuro-art-rotate-ring .ring-progress {
    fill: none;
    stroke: url(#neuroart-ring-grad);
    stroke: var(--primary-light);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 100.53;  /* 2π·16 */
    stroke-dashoffset: 100.53;
    transition: stroke-dashoffset 0.2s linear;
}
#neuro-art-view.light-scheme .neuro-art-rotate-ring .ring-track   { stroke: color-mix(in srgb, var(--dark) 15%, transparent); }
#neuro-art-view.light-scheme .neuro-art-rotate-ring .ring-progress{ stroke: var(--color-primary); }

/* ── Help modal ─────────────────────────────────────────────────────── */
.neuro-art-help-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.neuro-art-help-modal.is-hidden { display: none; }
.help-backdrop {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--dark) 55%, transparent);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: neuro-help-fadein 0.25s ease-out;
}
.help-card {
    position: relative;
    max-width: 760px;
    width: 100%;
    max-height: 86vh;
    overflow: auto;
    background: linear-gradient(180deg, var(--white), var(--bg-secondary));
    border: 1px solid rgba(31, 61, 43, 0.25);
    border-radius: var(--radius-xl);
    box-shadow: 0 24px 60px -16px color-mix(in srgb, var(--dark) 40%, transparent),
                0 0 0 1px rgba(31, 61, 43, 0.25);
    color: var(--dark);
    animation: neuro-help-pop 0.3s cubic-bezier(0.22, 1.2, 0.36, 1);
}
@keyframes neuro-help-fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes neuro-help-pop {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.4rem;
    border-bottom: 1px solid rgba(31, 61, 43, 0.15);
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), color-mix(in srgb, var(--bg-secondary) 92%, transparent));
    backdrop-filter: blur(10px);
    z-index: 1;
}
.help-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-dark), var(--color-accent) 45%, var(--danger-light));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.help-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--dark) 12%, transparent);
    background: rgba(255, 255, 255, 0.85);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.help-close:hover {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    color: var(--danger-dark);
    border-color: color-mix(in srgb, var(--danger) 40%, transparent);
}
.help-body {
    padding: 1rem 1.4rem 1.4rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.1rem 1.4rem;
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--gray-700);
}
.help-body section h4 {
    margin: 0 0 0.45rem 0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
    font-weight: 700;
}
.help-body ul, .help-body ol {
    margin: 0;
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.help-body .help-keys {
    padding-left: 0;
    list-style: none;
}
.help-body .help-keys li {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.help-body kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 5px;
    border: 1px solid color-mix(in srgb, var(--dark) 18%, transparent);
    background: linear-gradient(180deg, var(--white), var(--bg-tertiary));
    color: var(--gray-800);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 1px 0 color-mix(in srgb, var(--dark) 8%, transparent);
}
.help-body strong { color: var(--dark); }
@media (max-width: 640px) {
    .help-body { grid-template-columns: 1fr; }
}
/* ── css/components/moodboard.css ── */
/**
 * Moodboard Component Styles - Pinterest-style Cultural Map
 * Стили для компонента культурной карты в стиле мудборда
 * Version: 1.0
 */

/* ============================================
   PINTEREST-STYLE MOODBOARD GRID
   ============================================ */
.moodboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    grid-auto-rows: 90px;
    gap: 18px;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.moodboard-grid.loaded {
    opacity: 1;
}

/* ✅ ИСПРАВЛЕНО: Режимы отображения мудборда с явной визуальной разницей */
.moodboard-grid.moodboard-grid-mode {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    grid-auto-rows: auto;
    gap: 15px;
}

.moodboard-grid.moodboard-grid-mode .moodboard-card {
    height: auto;
    min-height: 90px;
}

.moodboard-grid.moodboard-board-mode {
    display: block;
    columns: 4;
    column-gap: 20px;
    column-fill: balance;
}

@media (max-width: 1200px) {
    .moodboard-grid.moodboard-board-mode {
        columns: 3;
    }
}

@media (max-width: 768px) {
    .moodboard-grid.moodboard-board-mode {
        columns: 2;
    }
}

.moodboard-grid.moodboard-board-mode .moodboard-card {
    break-inside: avoid;
    margin-bottom: 20px;
    display: inline-block;
    width: 100%;
    height: auto;
    min-height: 120px;
}

/* ✅ ИСПРАВЛЕНО: Режимы для контейнера pane */
#cultural_map-pane.moodboard-grid-mode .moodboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    grid-auto-rows: 90px;
}

#cultural_map-pane.moodboard-board-mode .moodboard-grid {
    display: block;
    columns: 3;
    column-gap: 20px;
}

#cultural_map-pane.moodboard-board-mode .moodboard-grid .moodboard-card {
    break-inside: avoid;
    margin-bottom: 20px;
    display: inline-block;
    width: 100%;
}

/* ============================================
   РАЗМЕРЫ КАРТОЧЕК (Pinterest-style)
   ============================================ */
.moodboard-card.moodboard-small {
    grid-row: span 3;
}

.moodboard-card.moodboard-medium {
    grid-row: span 4;
}

.moodboard-card.moodboard-large {
    grid-row: span 6;
}

.moodboard-card.moodboard-wide {
    grid-column: span 2;
    grid-row: span 4;
}

/* ============================================
   КАРТОЧКА АРТЕФАКТА
   ============================================ */
.moodboard-card {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--bg-elevated);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.5s ease-out backwards;
    text-decoration: none;
    color: inherit;
}

.moodboard-card:hover {
    transform: none;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
    text-decoration: none;
}

/* @keyframes fadeInUp — moved to components/animations.css */

/* Dragging state */
.moodboard-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

/* Drop target indicator */
.moodboard-card.drag-over {
    outline: 2px dashed var(--primary, var(--info-dark));
    outline-offset: 4px;
    transform: scale(1.02);
}

/* Dismiss button */
.moodboard-dismiss {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: var(--white);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.moodboard-card:hover .moodboard-dismiss {
    opacity: 1;
}

.moodboard-dismiss:hover {
    background: color-mix(in srgb, var(--danger-dark) 80%, transparent);
}

/* When geo button is also present, offset dismiss to avoid overlap */
.moodboard-card .moodboard-geo ~ .moodboard-dismiss {
    right: 56px;
}

/* Corner decoration */
.moodboard-corner {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.03) 50%);
    pointer-events: none;
}

/* ============================================
   ИЗОБРАЖЕНИЕ АРТЕФАКТА
   ============================================ */
.moodboard-img {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 140px;
    overflow: hidden;
}

.moodboard-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.moodboard-card:hover .moodboard-img img {
    transform: none;
}

/* Overlay gradient */
.moodboard-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.4) 100%);
    pointer-events: none;
}

/* Карточки без изображения */
.moodboard-no-img {
    display: flex;
    align-items: center;
    justify-content: center;
}

.moodboard-emoji {
    font-size: 4.5rem;
    opacity: 0.9;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.1));
    animation: floatEmoji 3s ease-in-out infinite;
}

@keyframes floatEmoji {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ============================================
   КОНТЕНТ КАРТОЧКИ
   ============================================ */
.moodboard-content {
    position: relative;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-elevated);
    flex-shrink: 0;
}

/* Badge с типом артефакта */
.moodboard-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-inverse);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
}

.moodboard-badge .badge-icon {
    font-size: 0.9rem;
}

.moodboard-badge .badge-text {
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Кнопка геолокации */
.moodboard-geo {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.moodboard-geo:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.moodboard-geo:active {
    transform: scale(1.05);
}

/* Заголовок */
.moodboard-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Автор */
.moodboard-author {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 4px;
}

.moodboard-author .author-icon {
    font-size: 0.9rem;
}

.moodboard-author .author-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Описание */
.moodboard-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Метаданные */
.moodboard-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: auto;
    padding-top: 6px;
}

.moodboard-meta .meta-item {
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 2px;
}

/* ============================================
   СТАТИСТИКА МУДБОРДА
   ============================================ */
.moodboard-stats {
    display: flex;
    gap: 20px;
    padding: 16px 20px;
    background: var(--color-primary);
    color: var(--text-inverse);
    border-radius: var(--radius-lg);
    margin: 0 20px 16px 20px;
    flex-wrap: wrap;
    justify-content: space-around;
}

/* ============================================
   MY CULTURAL SUBMISSIONS STRIP (PERSISTENT)
   ============================================ */
.moodboard-my-cards {
    padding: 0 20px 10px;
}

.my-mood-strip {
    background: color-mix(in srgb, var(--dark) 4%, transparent);
    border: 1px solid color-mix(in srgb, var(--dark) 6%, transparent);
    border-radius: 14px;
    padding: 12px 12px;
}

.my-mood-strip-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.my-mood-strip-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.my-mood-card {
    background: var(--bg-elevated);
    border: 1px solid color-mix(in srgb, var(--gray-400) 35%, transparent);
    border-radius: 14px;
    padding: 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 10px 22px color-mix(in srgb, var(--dark) 8%, transparent);
}

.my-mood-card--pending { border-color: color-mix(in srgb, var(--warning) 45%, transparent); }
.my-mood-card--approved { border-color: color-mix(in srgb, var(--success) 45%, transparent); }
.my-mood-card--rejected { border-color: color-mix(in srgb, var(--danger) 45%, transparent); opacity: 0.85; }
.my-mood-card--revoked { border-color: color-mix(in srgb, var(--gray-400) 60%, transparent); opacity: 0.8; }

.my-mood-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.my-mood-kind {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    background: color-mix(in srgb, var(--gray-400) 18%, transparent);
    padding: 3px 8px;
    border-radius: 999px;
}

.my-mood-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.my-mood-title {
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
    font-size: 0.92rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.my-mood-img {
    width: 100%;
    max-height: 140px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 1px solid color-mix(in srgb, var(--gray-400) 25%, transparent);
}

.my-mood-actions {
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
}

.moodboard-stats .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.moodboard-stats .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}

.moodboard-stats .stat-label {
    font-size: 0.8rem;
    opacity: 0.9;
    font-weight: 500;
}

/* ============================================
   EMPTY STATE
   ============================================ */
#cultural_map-pane .moodboard-grid + .empty-state,
#cultural_map-pane .empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

#cultural_map-pane .empty-state .empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

#cultural_map-pane .empty-state h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

#cultural_map-pane .empty-state p {
    font-size: 0.95rem;
    color: var(--gray-500);
    margin: 0;
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */

/* Планшеты */
@media (max-width: 768px) {
    .moodboard-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        grid-auto-rows: 80px;
        gap: 14px;
        padding: 16px;
    }

    .moodboard-stats {
        margin: 0 16px 12px 16px;
        padding: 12px 16px;
        gap: 16px;
    }

    .moodboard-stats .stat-value {
        font-size: 1.5rem;
    }

    .moodboard-card.moodboard-wide {
        grid-column: span 1; /* Отменяем широкие карточки на планшетах */
    }
}

/* Мобильные */
@media (max-width: 480px) {
    .moodboard-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        grid-auto-rows: 70px;
        gap: 12px;
        padding: 12px;
    }

    .moodboard-emoji {
        font-size: 3rem;
    }

    .moodboard-badge {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .moodboard-geo {
        width: 30px;
        height: 30px;
        font-size: 0.95rem;
    }

    .moodboard-title {
        font-size: 0.9rem;
    }

    .moodboard-author,
    .moodboard-desc {
        font-size: 0.8rem;
    }

    .moodboard-meta {
        font-size: 0.75rem;
    }

    .moodboard-stats {
        margin: 0 12px 10px 12px;
        padding: 10px 12px;
        gap: 12px;
    }

    .moodboard-stats .stat-value {
        font-size: 1.3rem;
    }

    .moodboard-stats .stat-label {
        font-size: 0.75rem;
    }
}

/* ============================================
   ПЕЧАТЬ
   ============================================ */
@media print {
    .moodboard-grid {
        display: block;
        columns: 3;
        column-gap: 20px;
    }

    .moodboard-card {
        break-inside: avoid;
        margin-bottom: 20px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .moodboard-card:hover {
        transform: none;
    }

    .moodboard-geo {
        display: none;
    }

    .moodboard-stats {
        break-after: page;
    }
}

/* ============================================
   INSPIRATION BOARD 2.0
   ============================================ */
.inspiration-board {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 1rem 0 2rem;
}

.board-hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
    padding: 2.5rem;
    border-radius: var(--radius-2xl);
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at top left, color-mix(in srgb, var(--status-info) 45%, transparent), var(--dark));
    background-size: cover;
    background-position: center;
    color: var(--white);
    min-height: 280px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.board-hero:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 60px color-mix(in srgb, var(--dark) 22%, transparent);
}

.board-hero:focus {
    outline: 2px solid color-mix(in srgb, var(--bg-primary) 55%, transparent);
    outline-offset: 2px;
}

.board-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, color-mix(in srgb, var(--dark) 70%, transparent), transparent 60%);
    pointer-events: none;
}

.board-hero-content {
    position: relative;
    z-index: 1;
    max-width: 640px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.board-hero-content h2 {
    font-size: clamp(1.9rem, 3vw, 2.6rem);
    margin: 0;
    line-height: 1.2;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.25rem 0.9rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-primary) 15%, transparent);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.board-hero .hero-media {
    position: relative;
    z-index: 1;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 45px color-mix(in srgb, var(--dark) 35%, transparent);
}

.board-hero .hero-meta {
    font-weight: 600;
    color: color-mix(in srgb, var(--bg-primary) 85%, transparent);
}

.board-section {
    background: var(--bg-elevated);
    border-radius: 20px;
    padding: 1.75rem;
    box-shadow: 0 24px 60px color-mix(in srgb, var(--dark) 8%, transparent);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.board-section-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.board-section-accent {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 18px;
}

.accent-icon {
    font-size: 1.8rem;
}

.board-section-accent h3 {
    margin: 0;
    font-size: 1.35rem;
}

.board-section-accent p {
    margin: 0.2rem 0 0;
    color: var(--text-secondary);
}

.board-cards {
    display: grid;
    gap: 1.25rem;
}

.board-section[data-layout="mosaic"] .board-cards {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.board-section[data-layout="spotlight"] .board-cards {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.board-card {
    position: relative;
    border-radius: 18px;
    padding: 1.5rem;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-height: 180px;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gray-400) 25%, transparent);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.board-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 26px color-mix(in srgb, var(--dark) 12%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--gray-400) 28%, transparent);
}

.board-card:focus {
    outline: 2px solid color-mix(in srgb, var(--status-info) 35%, transparent);
    outline-offset: 2px;
}

.board-card-link {
    color: var(--info);
    text-decoration: none;
    font-weight: 600;
}

.board-card-link:hover {
    text-decoration: underline;
}
.board-card-pill {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.board-card h4 {
    margin: 0;
    font-size: 1.15rem;
    color: var(--text-primary);
}

.board-card p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

.board-card-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.board-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.board-card-tags span {
    background: var(--bg-elevated);
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    border: 1px solid color-mix(in srgb, var(--gray-400) 50%, transparent);
}

.board-card-media {
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--dark);
    min-height: 160px;
}

.board-card-media img,
.board-card-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.board-card-media-video video {
    background: var(--text-primary);
}

.board-media-caption {
    display: block;
    padding: 0.5rem 0.9rem;
    font-size: 0.8rem;
    color: color-mix(in srgb, var(--bg-secondary) 85%, transparent);
}

.board-card-source {
    font-size: 0.82rem;
    color: var(--text-primary);
    opacity: 0.7;
}

@media (max-width: 768px) {
    .board-hero {
        padding: 1.5rem;
    }

    .board-section {
        padding: 1.25rem;
    }
}

/* =========================================================================
   Board card dismiss button (2026-05-13) — для режима «📋 Доска»
   ========================================================================= */
.board-card {
    position: relative;
}
.board-card-dismiss {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--dark) 55%, transparent);
    border: none;
    color: var(--white);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease, transform 0.15s;
    backdrop-filter: blur(4px);
}
.board-card:hover .board-card-dismiss,
.board-card:focus-within .board-card-dismiss {
    opacity: 1;
}
.board-card-dismiss:hover {
    background: color-mix(in srgb, var(--danger-dark) 85%, transparent);
    transform: scale(1.1);
}
.board-card-dismiss:focus-visible {
    opacity: 1;
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Mobile: всегда видимая кнопка (нет hover-state) */
@media (hover: none) and (pointer: coarse) {
    .board-card-dismiss,
    .moodboard-dismiss {
        opacity: 0.6;
    }
}
/* ── css/components/news.css ── */
/**
 * News Component Styles - Social Media News Display
 * Стили для компонента новостей из социальных сетей
 * Version: 1.0
 */

/* ============================================
   NEWS GRID LAYOUT
   ============================================ */
/* ✅ ИСПРАВЛЕНО: Увеличена специфичность для переопределения masonry-grid стилей */
/* ✅ ИСПРАВЛЕНО: Увеличена минимальная ширина карточек для более широкого отображения */
#news-grid-container {
    display: grid !important;
    /* UX: исторически карточки были в 2 колонки (не "портянкой" в одну).
       Делаем 2 колонки на десктопе и плавно сваливаемся в 1 на мобиле. */
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 2rem !important;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#news-grid-container.loaded {
    opacity: 1;
}

/* Loading/empty states must be visible even before .loaded is added */
#news-grid-container:has(.loading-state),
#news-grid-container:has(.news-empty-state) {
    opacity: 1;
}

/* Служебные элементы (empty-state, лоадер, ошибка) — на всю ширину сетки,
   иначе они зажимаются в одну узкую колонку двухколоночного грида. */
#news-grid-container > :not(.news-card) {
    grid-column: 1 / -1;
}

/* ============================================
   NEWS SOURCES SIDEBAR
   ============================================ */
.news-sources-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    overflow-y: auto;
    max-height: calc(100vh - 240px);
}

.news-sources-sidebar .sidebar-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.news-sources-sidebar .sidebar-title i {
    color: var(--primary, var(--info));
}

#news-sources-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Citizen UX: sources list can be huge; keep it compact and scrollable. */
.sources-grid {
    max-height: 260px;
    overflow: auto;
    padding-right: 6px;
}

.sources-grid::-webkit-scrollbar {
    width: 8px;
}

.sources-grid::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--gray-400) 55%, transparent);
    border-radius: 999px;
}

.sources-grid::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--gray-500) 65%, transparent);
}

/* Source Item */
.news-source-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-primary);
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.news-source-item:hover {
    border-color: var(--primary, var(--info));
    box-shadow: 0 2px 4px rgba(44, 82, 130, 0.15);
    transform: translateX(2px);
    text-decoration: none;
}

.news-source-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.news-source-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================
   NEWS CARD
   ============================================ */
.news-card {
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--bg-card, white);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.5s ease-out backwards;
    animation-delay: var(--news-anim-delay, 0s);
    height: 100%;
}

/* ============================================
   DISMISS (X) BUTTON
   ============================================ */
.news-card-dismiss {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    color: var(--text-inverse);
    border: none;
    border-radius: 50%;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

/* Desktop: скрываем и показываем по ховеру */
@media (hover: hover) and (pointer: fine) {
    .news-card-dismiss {
        opacity: 0;
    }
    .news-card:hover .news-card-dismiss {
        opacity: 1;
    }
}

/* Touch / mobile: всегда видна полупрозрачно */
.news-card:active .news-card-dismiss,
.news-card-dismiss:focus {
    opacity: 1;
}

.news-card-dismiss:hover {
    background: color-mix(in srgb, var(--danger-dark) 85%, transparent);
    transform: scale(1.15);
    opacity: 1;
}

.news-card--dismissing {
    opacity: 0;
    transform: scale(0.9) translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.news-card--positive {
    border-left: 6px solid var(--success-dark);
}

.news-card--negative {
    border-left: 6px solid var(--danger-dark);
}

.news-card--neutral {
    border-left: 6px solid var(--gray-500);
}

.news-sentiment-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    margin-bottom: 0.25rem;
    color: var(--text-inverse);
    background: var(--gray-500);
}

.news-sentiment-badge--positive {
    background: var(--success);
}

.news-sentiment-badge--negative {
    background: var(--danger);
}

.news-sentiment-badge--neutral {
    background: var(--gray-500);
}

.news-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.12);
    border-color: var(--primary, var(--info));
}

/* Drag and Drop */
.news-card[draggable="true"] {
    cursor: move;
}

.news-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.news-card.drag-over {
    border: 2px solid var(--primary, var(--info));
    background: rgba(44, 82, 130, 0.05);
}

/* ============================================
   NEWS CARD IMAGE
   ============================================ */
.news-card-image {
    height: 240px;
    background-size: cover;
    background-position: center;
    background-color: var(--text-inverse);
    overflow: hidden;
    position: relative;
    background-image: var(--news-image);
}

.news-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.news-card:hover .news-card-image img {
    transform: scale(1.05);
}

/* ============================================
   NEWS CARD CONTENT
   ============================================ */
.news-card-content {
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 1rem;
}

/* Header */
.news-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted, var(--gray-500));
    margin: 0;
}

.news-card-source {
    font-weight: 600;
    color: var(--primary, var(--info));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.news-card-date {
    flex-shrink: 0;
    margin-left: 0.5rem;
}

/* Platform Badge */
.news-platform-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-inverse);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--news-platform-color, var(--gray-500));
}

.news-card-title-link {
    color: inherit;
    text-decoration: none;
}

.news-card-title-link:hover {
    text-decoration: underline;
}

/* ============================================
   NEWS EXPLANATION (inline-free)
   ============================================ */
.news-explanation {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary, var(--info));
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.news-explanation.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.news-explanation[hidden] {
    display: none !important;
}

.news-explanation-title-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.news-explanation-icon {
    color: var(--primary, var(--info));
    margin-right: 0.5rem;
}

.news-explanation-title {
    color: var(--info);
}

.news-explanation-content {
    line-height: 1.6;
    color: var(--text-secondary);
}

.news-explanation-paragraph {
    margin: 0;
}

.news-explanation-paragraph--spaced {
    margin-top: 0.75rem;
}

.news-action-btn.is-done {
    opacity: 0.6;
    cursor: default;
}

.news-sources-empty {
    font-size: 0.85rem;
    text-align: center;
    color: var(--text-muted, var(--gray-500));
    margin: 0.25rem 0;
}

.news-sources-empty--error {
    color: var(--danger);
}

.news-explanation-modal-title {
    font-weight: 600;
    margin-bottom: 1rem;
}

.news-explanation-modal-meta {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.news-explanation-modal-content {
    white-space: pre-wrap;
    line-height: 1.6;
    max-height: 60vh;
    overflow-y: auto;
}

/* ============================================
   NEWS EMPTY/STATUS STATES (inline-free)
   ============================================ */
.news-empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Citizen UX: empty state actions */
.news-empty-actions {
    margin-top: 0.75rem;
    display: flex;
    justify-content: center;
}

.news-refresh-btn {
    appearance: none;
    border: 1px solid rgba(44, 82, 130, 0.35);
    background: rgba(44, 82, 130, 0.08);
    color: var(--info);
    font-weight: 600;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.news-refresh-btn:hover {
    background: rgba(44, 82, 130, 0.12);
    border-color: rgba(44, 82, 130, 0.55);
    transform: translateY(-1px);
}

.news-refresh-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.news-empty-state--error {
    color: var(--danger);
}

.news-empty-icon {
    font-size: 48px;
    margin-bottom: 1rem;
}

.news-empty-hint {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

.news-status-badge {
    display: inline-block;
    color: var(--text-inverse);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.news-status-badge--collecting {
    background: var(--info);
}

.news-status-badge--discovering {
    background: var(--primary);
}

.news-status-badge--warning {
    background: var(--warning);
}

.news-status-badge--error {
    background: var(--danger);
}

.kb-news-badge {
    background: var(--info) !important;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--info) 25%, transparent);
}

.kb-news-context {
    margin-top: 0.5rem;
    padding: 0.75rem 0.9rem;
    border-radius: 10px;
    background: color-mix(in srgb, var(--info) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--info) 20%, transparent);
}

.kb-context-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    color: var(--status-info);
    letter-spacing: 0.08em;
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.kb-entity-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.kb-entity-chip {
    background: color-mix(in srgb, var(--info) 15%, transparent);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Title */
.news-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.02em;
    word-spacing: 0.05em;
}

.news-card-geotag-row {
    margin-top: 0.5rem;
}

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

.news-card-title a:hover {
    color: var(--primary, var(--info));
}

/* Description */
.news-card-description {
    font-size: 0.975rem;
    line-height: 1.75;
    color: var(--text-secondary);
    flex-grow: 1;
    margin: 0 0 0.75rem 0;
    letter-spacing: 0.01em;
    word-spacing: 0.1em;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 0.4rem;
    white-space: pre-line;
    display: block;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--gray-400) 80%, transparent) transparent;
    border-radius: var(--radius);
    position: relative;
}

/* Indicator: show a subtle fade at the bottom when the description has overflow */
.news-card-description::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to bottom, transparent, var(--bg-card, white));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.news-card-description.has-overflow::after {
    opacity: 1;
}

.news-card-description::-webkit-scrollbar {
    width: 6px;
}

.news-card-description::-webkit-scrollbar-track {
    background: transparent;
}

.news-card-description::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--gray-400) 75%, transparent);
    border-radius: var(--radius);
}

/* ============================================
   NEWS CARD ACTIONS
   ============================================ */
.news-card-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.news-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 0.8rem;
    background: var(--bg-secondary, var(--bg-tertiary));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.news-action-btn:hover {
    background: var(--primary, var(--info));
    color: var(--text-inverse);
    border-color: var(--primary, var(--info));
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(44, 82, 130, 0.2);
}

.news-action-btn:active {
    transform: translateY(0);
}

.news-action-btn i {
    font-size: 0.9rem;
}

.news-action-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.news-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   EMPTY STATE (scoped to News module to avoid cross-module conflicts)
   ============================================ */
#news-pane .empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

#news-pane .empty-state .empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

#news-pane .empty-state h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

#news-pane .empty-state p {
    font-size: 0.95rem;
    color: var(--gray-500);
    margin: 0;
}

/* ============================================
   LOADING STATE
   ============================================ */
#news-pane .loading-state {
    text-align: center;
    padding: 3rem 2rem;
}

/* .loading-spinner standardized in static/css/components/loading.css */

#news-pane .loading-state p {
    color: var(--text-muted, var(--gray-500));
    font-size: 0.95rem;
}

/* @keyframes fadeInUp — moved to components/animations.css */

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */

/* Планшеты */
@media (max-width: 1024px) {
    #news-grid-container {
        /* Планшеты: всё ещё 2 колонки, пока физически помещается */
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 1.25rem;
        padding: 1.25rem;
    }

    .news-sources-sidebar {
        width: 240px;
    }
}

/* Мобильные устройства */
@media (max-width: 768px) {
    #news-grid-container {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }

    .news-sources-sidebar {
        width: 100%;
        max-height: 200px;
        margin-bottom: 1rem;
    }

    .news-card-image {
        height: 160px;
    }

    .news-card-description {
        max-height: 150px;
    }

    .news-action-btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.6rem;
    }
}

@media (max-width: 480px) {
    .news-card-content {
        padding: 0.85rem;
    }

    .news-card-title {
        font-size: 1rem;
        -webkit-line-clamp: 5;
        line-clamp: 5;
    }

    .news-card-description {
        font-size: 0.85rem;
    }

    .news-action-btn {
        flex-direction: column;
        gap: 0.2rem;
        padding: 0.5rem 0.4rem;
    }

    .news-action-btn i {
        font-size: 1.1rem;
    }
}

/* ============================================
   КНОПКА "ЕЩЕ НОВОСТЕЙ"
   ============================================ */
.news-load-more-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    margin-top: 1rem;
}

.news-load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: var(--primary, var(--color-primary));
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(31, 61, 43, 0.2);
}

.news-load-more-btn:hover:not(:disabled) {
    background: var(--primary-hover, var(--primary));
    box-shadow: 0 4px 12px rgba(31, 61, 43, 0.3);
    transform: translateY(-2px);
}

.news-load-more-btn:active:not(:disabled) {
    transform: translateY(0);
}

.news-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.news-load-more-icon {
    font-size: 1.25rem;
}

.news-load-more-text {
    font-weight: 500;
}

.news-load-more-count {
    font-size: 0.875rem;
    opacity: 0.8;
    font-weight: 400;
}

@media (max-width: 768px) {
    .news-load-more-btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.9375rem;
    }
}

/* ============================================
   ПЕЧАТЬ
   ============================================ */
@media print {
    #news-grid-container {
        display: block;
        columns: 2;
        column-gap: 20px;
    }

    .news-card {
        break-inside: avoid;
        margin-bottom: 20px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .news-card:hover {
        transform: none;
    }

    .news-card-actions {
        display: none;
    }

    .news-sources-sidebar {
        display: none;
    }
}

/* ============================================
   UGC NEWS STYLES
   ============================================ */

/* UGC Card Highlighting */
.news-card-ugc {
    border: 2px solid var(--warning);
    background: var(--warning-lightest);
}

/* Tags */
.news-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.news-tag {
    display: inline-block;
    padding: 4px 10px;
    background: color-mix(in srgb, var(--primary) 15%, var(--bg-primary));
    color: var(--primary-dark);
    border-radius: var(--radius-lg);
    font-size: 12px;
    font-weight: 500;
}

/* ============================================
   GEOTAG BUTTON STYLES
   ============================================ */
.news-geotag-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    margin-left: 8px;
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px color-mix(in srgb, var(--success) 20%, transparent);
}

.news-geotag-btn:hover {
    background: var(--success-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px color-mix(in srgb, var(--success) 30%, transparent);
}

.news-geotag-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px color-mix(in srgb, var(--success) 20%, transparent);
}
/* ── css/ugc_submission.css ── */
/**
 * UGC Submission Styles
 * Styling for news submission and channel suggestion modals
 */

/* Modal Container */
.ugc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ugc-modal.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Backdrop */
.ugc-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

/* Modal Content */
.ugc-modal-content {
    position: relative;
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
    animation: ugc-slideUp 0.3s ease;
}

@keyframes ugc-slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal Header */
.ugc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--border);
    background: var(--color-primary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.ugc-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-inverse);
}

.ugc-modal-close {
    background: color-mix(in srgb, var(--bg-primary) 20%, transparent);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    color: var(--text-inverse);
    transition: background 0.2s ease;
}

.ugc-modal-close:hover {
    background: color-mix(in srgb, var(--bg-primary) 30%, transparent);
}

/* Form Styles */
.ugc-form {
    padding: 24px;
}

.ugc-form-group {
    margin-bottom: 20px;
}

.ugc-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
}

.ugc-form-group input[type="text"],
.ugc-form-group input[type="url"],
.ugc-form-group select,
.ugc-form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: var(--font-sans);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.ugc-form-group input[type="text"]:focus,
.ugc-form-group input[type="url"]:focus,
.ugc-form-group select:focus,
.ugc-form-group textarea:focus {
     border-color: var(--color-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 10%, transparent);
}

.ugc-form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* Character Counter */
.ugc-char-counter {
    text-align: right;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.ugc-char-counter span {
    font-weight: 600;
    color: var(--text-secondary);
}

/* Help Text */
.ugc-help-text {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Notice */
.ugc-form-notice {
    background: color-mix(in srgb, var(--warning) 15%, var(--bg-primary));
    border-left: 4px solid var(--warning);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.ugc-form-notice p {
    margin: 0;
    font-size: 14px;
    color: var(--warning);
    line-height: 1.5;
}

/* Form Actions */
.ugc-form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.ugc-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ugc-btn-primary {
    background: var(--color-primary);
    color: var(--text-inverse);
}

.ugc-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px color-mix(in srgb, var(--color-primary) 40%, transparent);
}

.ugc-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ugc-btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.ugc-btn-secondary:hover {
    background: var(--bg-hover);
}

/* Status Messages */
.ugc-status {
    display: none;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-top: 16px;
    font-size: 14px;
    font-weight: 500;
}

.ugc-status.is-visible {
    display: block;
}

.ugc-status-success {
    background: color-mix(in srgb, var(--success) 15%, var(--bg-primary));
    color: var(--success);
    border: 1px solid var(--success);
}

.ugc-status-error {
    background: color-mix(in srgb, var(--danger) 15%, var(--bg-primary));
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* CTA Cards in News Section */
.ugc-cta-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.ugc-cta-card {
    background: var(--color-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    color: var(--text-inverse);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.ugc-cta-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, color-mix(in srgb, var(--bg-primary) 10%, transparent) 0%, transparent 70%);
    pointer-events: none;
}

.ugc-cta-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--color-primary) 40%, transparent);
}

.ugc-cta-icon {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.ugc-cta-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.ugc-cta-description {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.5;
}

/* UGC News Badge */
.news-ugc-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, var(--warning) 0%, var(--warning-dark) 100%);
    color: var(--text-inverse);
    padding: 4px 12px;
    border-radius: var(--radius-lg);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.news-ugc-badge::before {
    content: '👤';
}

/* Responsive Design */
@media (max-width: 640px) {
    .ugc-modal-content {
        width: 95%;
        max-height: 95vh;
        border-radius: var(--radius-lg);
    }

    .ugc-modal-header {
        padding: 20px;
    }

    .ugc-modal-header h2 {
        font-size: 20px;
    }

    .ugc-form {
        padding: 20px;
    }

    .ugc-form-actions {
        flex-direction: column;
    }

    .ugc-btn {
        width: 100%;
    }

    .ugc-cta-cards {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   COMPACT UGC BUTTONS (NEW DESIGN)
   ============================================ */

.ugc-compact-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 24px 0;
    flex-wrap: wrap;
}

.ugc-compact-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--color-primary);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--color-primary) 30%, transparent);
}

.ugc-compact-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--color-primary) 40%, transparent);
}

.ugc-compact-btn:active {
    transform: translateY(0);
}

.ugc-btn-icon {
    font-size: 18px;
}

.ugc-btn-text {
    font-size: 14px;
}

/* News Sources Footer */
.news-sources-footer {
    margin-top: 32px;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.sources-footer-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sources-footer-title i {
    color: var(--info);
}

.sources-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.sources-grid a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

.sources-grid a:hover {
    background: var(--bg-tertiary);
    border-color: var(--border);
    transform: translateY(-1px);
}

.sources-grid .source-icon {
    font-size: 16px;
}

/* Vertical Layout (no sidebar) */
.news-layout-vertical {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 1.5rem;
}

/* Hide old CTA cards */
.ugc-cta-cards {
    display: none;
}

/* Responsive */
@media (max-width: 640px) {
    .ugc-compact-buttons {
        flex-direction: column;
    }

    .ugc-compact-btn {
        width: 100%;
        justify-content: center;
    }

    .news-sources-footer {
        padding: 16px;
    }

    .sources-grid {
        gap: 8px;
    }

    .sources-grid a {
        font-size: 13px;
        padding: 6px 12px;
    }
}
/* ── css/components/heroes.css ── */
/**
 * Люди города — карточки в общем стиле системы.
 *
 * ИСТОРИЯ. Раньше этот файл назывался «D&D Character Card Style»: тёмная
 * подложка, пергамент, золотые рамки, шрифт Cinzel, 3D-переворот и значки
 * редкости (ЛЕГЕНДА/ЭПИК/РЕДКИЙ). Прямое требование user 2026-08-20:
 * «карточки в общем стиле, сейчас они у нас вычурные, надо чтобы был единый
 * стиль у всей системы». Раздел про реальных людей города не должен выглядеть
 * как коллекционная игра — оформление там сообщало о человеке больше, чем
 * данные, и сообщало неправду.
 *
 * ТЕПЕРЬ: базовый .card из components/cards.css + токены дизайн-системы.
 * Никаких собственных цветов-литералов, никакой декоративной типографики.
 * Разметку строит static/js/components/heroes.js (.person-card).
 */

/* ============================================
   КОНТЕЙНЕР РАЗДЕЛА
   ============================================ */
#heroes-pane {
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-secondary, var(--bg-primary));
}

/* ============================================
   ЗАГОЛОВОК
   ============================================ */
#heroes-pane .header {
    margin-bottom: 20px;
}

#heroes-pane .header.header--spaced {
    margin-top: 2rem;
}

#heroes-pane h1,
#heroes-pane h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px;
}

#heroes-pane .subtitle {
    color: var(--text-secondary, var(--text-light));
    font-size: 0.875rem;
    font-weight: 400;
    margin: 0;
}

/* ============================================
   СЕТКА КАРТОЧЕК
   ============================================ */
#heroes-pane .cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    align-items: start;
}

/* ============================================
   КАРТОЧКА ЧЕЛОВЕКА
   Высота НЕ фиксируется: у карточек разный объём данных, и обрезать
   описание ради ровной сетки — значит прятать содержание.
   ============================================ */
.person-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: var(--card-padding, 16px);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.35s ease, transform 0.35s ease,
                box-shadow 0.15s ease, border-color 0.15s ease;
    transition-delay: var(--hero-delay, 0s);
}

.person-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .person-card {
        transition: none;
        opacity: 1;
        transform: none;
    }
}

/* Личность прошлого — единственная карточка с акцентной линией: это
   содержательное различие (исторический деятель, а не житель сегодня),
   а не украшение. */
.person-card--past {
    border-left: 3px solid var(--primary, var(--accent));
}

.person-card__head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.person-card__avatar {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary, var(--bg-secondary));
    border: 1px solid var(--border-light, var(--border-color, var(--border)));
}

.person-card__avatar--team {
    border-radius: var(--card-radius-sm, 8px);
}

.person-card__photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.person-card__initials {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-secondary, var(--text-light));
}

.person-card__ident {
    min-width: 0;
    flex: 1 1 auto;
}

.person-card__name {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    margin: 0;
    text-wrap: balance;
}

/* Чем занимается. Не звание — занятие. */
.person-card__role {
    font-size: 0.8125rem;
    color: var(--text-secondary, var(--text-light));
    margin: 2px 0 0;
    line-height: 1.35;
}

/* ============================================
   ЧИПЫ: происхождение данных и эпоха
   ============================================ */
.person-card__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.person-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.6875rem;
    line-height: 1.6;
    color: var(--text-secondary, var(--text-light));
    background: var(--bg-tertiary, var(--bg-secondary));
    border: 1px solid var(--border-light, var(--border-color, var(--border)));
    white-space: nowrap;
}

.person-chip--past {
    color: var(--primary, var(--accent));
    border-color: color-mix(in srgb, var(--primary, var(--accent)) 35%, transparent);
    background: color-mix(in srgb, var(--primary, var(--accent)) 8%, transparent);
    font-weight: 600;
}

/* ============================================
   ТЕКСТ И ЦИТАТА
   ============================================ */
.person-card__desc {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
    margin: 0;
}

/* Цитата — чужие слова о человеке. Отбита слева линией и подписана
   источником, чтобы её нельзя было прочесть как утверждение системы. */
.person-card__quote {
    margin: 0;
    padding: 8px 0 8px 12px;
    border-left: 2px solid var(--border-light, var(--border-color, var(--border)));
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-secondary, var(--text-light));
    font-style: italic;
}

.person-card__quote cite {
    display: block;
    margin-top: 4px;
    font-style: normal;
    font-size: 0.75rem;
    color: var(--text-muted, var(--text-light));
}

/* ============================================
   ПОДВАЛ: упоминания, ссылки, «Подробнее»
   ============================================ */
.person-card__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--border-light, var(--border-color, var(--border)));
}

.person-card__mentions {
    font-size: 0.75rem;
    color: var(--text-secondary, var(--text-light));
    font-variant-numeric: tabular-nums;
}

/* «Источники не приложены» — честное состояние, а не ошибка: приглушаем,
   но не прячем (по нему видно, какие карточки нечем проверить). */
.person-card__mentions--none {
    color: var(--text-muted, var(--text-light));
    font-style: italic;
}

.person-card__more {
    margin-left: auto;
    background: none;
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--card-radius-sm, 8px);
    padding: 4px 10px;
    font-size: 0.75rem;
    font-family: inherit;
    color: var(--text-secondary, var(--text-light));
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.person-card__more:hover {
    background: var(--bg-tertiary, var(--bg-secondary));
    color: var(--text-primary);
}

.person-card__more:focus-visible {
    outline: 2px solid var(--primary, var(--accent));
    outline-offset: 2px;
}

/* ============================================
   ДЕТАЛИ (раскрываются кнопкой)
   ============================================ */
.person-card__details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 4px;
}

.person-card__details[hidden] {
    display: none;
}

.person-detail h4 {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, var(--text-light));
    margin: 0 0 6px;
}

.person-list {
    margin: 0;
    padding-left: 16px;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--text-secondary, var(--text-light));
}

.person-list li + li {
    margin-top: 4px;
}

.person-list strong {
    color: var(--text-primary);
    font-weight: 600;
}

.person-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.person-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--card-radius-sm, 8px);
    background: var(--bg-tertiary, var(--bg-secondary));
    color: var(--text-secondary, var(--text-light));
    font-size: 0.75rem;
}

/* ============================================
   СОЦИАЛЬНЫЕ ССЫЛКИ
   ============================================ */
#heroes-pane .social-links,
.person-card .social-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

#heroes-pane .social-link,
.person-card .social-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary, var(--text-light));
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

#heroes-pane .social-link:hover,
.person-card .social-link:hover {
    color: var(--text-primary);
    border-bottom-color: currentColor;
}

#heroes-pane .social-link svg,
.person-card .social-link svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}

/* ============================================
   МЕТА, ПУСТЫЕ СОСТОЯНИЯ, ЗАГРУЗКА
   ============================================ */
#heroes-pane .heroes-meta {
    font-size: 0.75rem;
    color: var(--text-secondary, var(--text-light));
    margin: -8px 0 16px;
    padding: 8px 12px;
    background: var(--bg-tertiary, var(--bg-secondary));
    border: 1px solid var(--border-light, var(--border-color, var(--border)));
    border-radius: var(--card-radius-sm, 8px);
}

#heroes-pane .heroes-meta strong {
    font-weight: 600;
    color: var(--text-primary);
}

#heroes-pane .info-placeholder {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary, var(--text-light));
}

#heroes-pane .info-placeholder p {
    margin-bottom: 0.5rem;
}

#heroes-pane .info-placeholder--panel {
    background: var(--card-bg, var(--bg-primary));
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--card-radius, 12px);
    padding: 2rem;
}

#heroes-pane .info-placeholder__title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

#heroes-pane .info-placeholder__title--error {
    color: var(--danger);
}

#heroes-pane .info-placeholder__text {
    font-size: 0.875rem;
    color: var(--text-secondary, var(--text-light));
    margin-top: 0.5rem;
    margin-bottom: 0;
}

.heroes-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem 2rem;
}

.heroes-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-light, var(--border-color, var(--border)));
    border-top-color: var(--primary, var(--accent));
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .heroes-spinner { animation-duration: 2.5s; }
}

.heroes-loading-text {
    text-align: center;
    color: var(--text-secondary, var(--text-light));
}

.heroes-loading-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.heroes-loading-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary, var(--text-light));
    margin: 0.35rem 0 0;
}

/* ============================================
   СЕКЦИЯ «ЕЩЁ ЛЮДИ ИЗ БАЗЫ ЗНАНИЙ»
   ============================================ */
.kb-highlight-section {
    margin-top: 2rem;
}

.kb-highlight-section .header {
    margin-bottom: 16px;
}

/* ============================================
   АДАПТИВ
   ============================================ */
@media (max-width: 768px) {
    #heroes-pane {
        padding: 12px;
    }

    #heroes-pane .cards-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    #heroes-pane h1,
    #heroes-pane h2 {
        font-size: 1.125rem;
    }
}
/* ── css/agent-feed.css ── */
/**
 * AI Expert Agent Feed Styles
 * Version: 1.0
 */

/* Основной контейнер ленты */
.agent-feed-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    max-height: 600px;
    overflow-y: auto;
}

/* Элемент ленты */
.agent-feed-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    animation: fadeInUp 0.3s ease;
}

.agent-feed-item:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Заголовок элемента */
.agent-feed-item-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.agent-feed-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.agent-feed-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-grow: 1;
}

.agent-feed-type {
    font-weight: 600;
    font-size: 0.875rem;
}

.agent-feed-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Контент */
.agent-feed-content {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
    white-space: pre-wrap;
}

/* Теги */
.agent-feed-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.agent-feed-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-radius: var(--radius-lg);
    font-size: 0.75rem;
    font-weight: 500;
}

/* Пустое состояние */
.agent-feed-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.agent-feed-empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.agent-feed-empty h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.agent-feed-empty p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    max-width: 400px;
}

.start-agent-btn {
    padding: 0.75rem 1.5rem;
    font-weight: 600;
}

/* Загрузка */
.agent-feed-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.agent-feed-loading p {
    margin-top: 1rem;
    color: var(--text-muted);
}

/* Ошибка */
.agent-feed-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.agent-feed-error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.agent-feed-error p {
    color: var(--danger);
    margin-bottom: 1.5rem;
}

/* @keyframes fadeInUp — moved to components/animations.css */

/* Скроллбар */
.agent-feed-list::-webkit-scrollbar {
    width: 6px;
}

.agent-feed-list::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.agent-feed-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.agent-feed-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .agent-feed-list {
        padding: 0.5rem;
        gap: 0.75rem;
    }

    .agent-feed-item {
        padding: 0.75rem;
    }

    .agent-feed-empty {
        padding: 2rem 1rem;
    }

    .agent-feed-empty-icon {
        font-size: 3rem;
    }
}
/* ── css/ai_mayor.css ── */
/* ============================================================================
 * ai_mayor.css — «🤖 ИИ-Мэр · Теневая Мэрия»
 * Terminal / technocratic theme for the Citizen dashboard AI-Mayor view.
 * EVERYTHING scoped under `.aimayor` so styles can't leak into other panes.
 * No external assets — crest avatar, scanlines and glow are pure CSS/SVG.
 * Honors prefers-reduced-motion.
 * ========================================================================== */

.aimayor {
  --aim-bg:        #0a0e14;
  --aim-bg-2:      #0d1320;
  --aim-panel:     #111826;
  --aim-panel-2:   #0c1422;
  --aim-border:    #1d2c44;
  --aim-grid:      rgba(56, 189, 248, 0.06);
  --aim-text:      var(--gray-300);
  --aim-text-dim:  var(--gray-500);
  --aim-text-mut:  #44546b;
  --aim-cyan:      #22d3ee;   /* AI accent */
  --aim-green:     var(--success-light);   /* AI / success */
  --aim-amber:     var(--warning);   /* real city hall accent */
  --aim-orange:    #fb923c;
  --aim-red:       var(--danger-light);
  --aim-mono: ui-monospace, "JetBrains Mono", "Fira Code", "SFMono-Regular",
              "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;

  position: relative;
  color: var(--aim-text);
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(34, 211, 238, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, color-mix(in srgb, var(--warning) 7%, transparent), transparent 55%),
    linear-gradient(180deg, var(--aim-bg-2), var(--aim-bg));
  font-family: var(--aim-mono);
  font-size: 14px;
  line-height: 1.5;
  border-radius: 14px;
  padding: clamp(14px, 2.2vw, 28px);
  overflow: hidden;
  border: 1px solid var(--aim-border);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.04),
              0 24px 60px -28px rgba(0, 0, 0, 0.8);
}

/* faint technical grid + scanlines overlay */
.aimayor::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--aim-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--aim-grid) 1px, transparent 1px);
  background-size: 36px 36px, 36px 36px;
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 40%, transparent 100%);
  opacity: 0.7;
  z-index: 0;
}
.aimayor::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
      180deg, rgba(255, 255, 255, 0.018) 0, rgba(255, 255, 255, 0.018) 1px,
      transparent 2px, transparent 4px);
  z-index: 0;
}
.aimayor > * { position: relative; z-index: 1; }

.aimayor a { color: var(--aim-cyan); text-decoration: none; }
.aimayor a:hover { text-decoration: underline; }

/* ───────────────────────── Header / crest ───────────────────────── */
.aimayor__header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--aim-border);
}
.aimayor__crest {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.55));
}
.aimayor__crest svg { width: 100%; height: 100%; display: block; }
.aimayor__crest .aim-spin { transform-origin: 50px 50px; animation: aim-rotate 18s linear infinite; }
.aimayor__crest .aim-pulse { animation: aim-corepulse 2.6s ease-in-out infinite; transform-origin: 50px 50px; }

.aimayor__titlewrap { flex: 1 1 240px; min-width: 220px; }
.aimayor__title {
  margin: 0;
  font-size: clamp(15px, 2.1vw, 22px);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--white);
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(34, 211, 238, 0.35);
}
.aimayor__subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--aim-text-dim);
  letter-spacing: 0.04em;
}
.aimayor__status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--aim-green);
  letter-spacing: 0.05em;
}
.aimayor__status .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--aim-green);
  box-shadow: 0 0 8px var(--aim-green);
  animation: aim-blink 1.6s steps(2, jump-none) infinite;
}
.aimayor__header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ───────────────────────── Buttons ───────────────────────── */
.aim-btn {
  font-family: var(--aim-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--aim-border);
  background: var(--dark);
  color: var(--aim-text);
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.aim-btn:hover { border-color: var(--aim-cyan); box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.25), 0 0 18px -6px var(--aim-cyan); }
.aim-btn:active { transform: translateY(1px); }
.aim-btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.aim-btn--cyan   { border-color: rgba(34, 211, 238, 0.5); color: var(--info-lightest); }
.aim-btn--amber  { border-color: color-mix(in srgb, var(--warning) 50%, transparent); color: #fde68a; }
.aim-btn--cyan:hover  { box-shadow: 0 0 0 1px rgba(34,211,238,0.4), 0 0 18px -4px var(--aim-cyan); }
.aim-btn--amber:hover { border-color: var(--aim-amber); box-shadow: 0 0 0 1px color-mix(in srgb, var(--warning) 40%, transparent), 0 0 18px -4px var(--aim-amber); }
.aim-btn--primary {
  border-color: rgba(34, 211, 238, 0.6);
  background: linear-gradient(180deg, rgba(34,211,238,0.18), rgba(34,211,238,0.05));
  color: var(--info-lightest);
  font-weight: 700;
}
.aim-btn--ghost { background: transparent; }
.aim-btn--lg { padding: 12px 22px; font-size: 13px; }

/* ───────────────────────── Disclaimer ───────────────────────── */
.aim-disclaimer {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: linear-gradient(180deg, color-mix(in srgb, var(--warning) 8%, transparent), color-mix(in srgb, var(--warning) 3%, transparent));
  border: 1px solid color-mix(in srgb, var(--warning) 32%, transparent);
  border-left: 3px solid var(--aim-amber);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 18px;
  font-size: 12px;
  line-height: 1.55;
  color: #e7c98f;
}
.aim-disclaimer__icon { flex: 0 0 auto; font-size: 14px; line-height: 1.3; }

/* ───────────────────────── Section ───────────────────────── */
.aim-section { margin: 26px 0; }
.aim-section__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.aim-section__title {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--info-lighter);
}
.aim-section__title .hash { color: var(--aim-cyan); }
.aim-section__hint { font-size: 12px; color: var(--aim-text-mut); }
.aim-rule {
  flex: 1 1 60px;
  height: 1px;
  background: linear-gradient(90deg, var(--aim-border), transparent);
  align-self: center;
}

/* ───────────────────────── Terminal / agenda ───────────────────────── */
.aim-terminal {
  background: var(--aim-panel-2);
  border: 1px solid var(--aim-border);
  border-radius: 10px;
  padding: 14px 16px;
  min-height: 120px;
  box-shadow: inset 0 0 40px -20px rgba(34, 211, 238, 0.4);
}
.aim-terminal__bar {
  display: flex; align-items: center; gap: 6px;
  margin: -4px -4px 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--aim-border);
}
.aim-terminal__bar i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.aim-terminal__bar i:nth-child(1) { background: #ff5f57; }
.aim-terminal__bar i:nth-child(2) { background: #febc2e; }
.aim-terminal__bar i:nth-child(3) { background: #28c840; }
.aim-terminal__bar span { margin-left: 8px; font-size: 12px; color: var(--aim-text-mut); letter-spacing: 0.1em; }
.aim-term-line {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--aim-text);
  opacity: 0;
  transform: translateY(2px);
  animation: aim-line-in 0.34s ease forwards;
}
.aim-term-line .tag { font-weight: 700; }
.aim-term-line .tag.boot   { color: var(--aim-green); }
.aim-term-line .tag.scan   { color: var(--aim-cyan); }
.aim-term-line .tag.data   { color: var(--primary-light); }
.aim-term-line .tag.warn   { color: var(--aim-amber); }
.aim-term-line .tag.exec   { color: var(--aim-orange); }
.aim-term-line .tag.note   { color: var(--aim-text-dim); }
.aim-term-line .tag.standby{ color: var(--aim-red); }
.aim-term-caret::after {
  content: "▋";
  color: var(--aim-cyan);
  animation: aim-blink 1s steps(2, jump-none) infinite;
}

/* ───────────────────────── Battles ───────────────────────── */
.aim-battles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 980px) { .aim-battles { grid-template-columns: 1fr 1fr; } }

.aim-battle {
  background: linear-gradient(180deg, var(--aim-panel), var(--aim-panel-2));
  border: 1px solid var(--aim-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.aim-battle__topic {
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--aim-border);
  background: linear-gradient(90deg, rgba(34,211,238,0.05), color-mix(in srgb, var(--warning) 5%, transparent));
}
.aim-battle__cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 560px) { .aim-battle__cols { grid-template-columns: 1fr; } }

.aim-side { padding: 12px 14px; min-width: 0; }
.aim-side--real { border-right: 1px solid var(--aim-border); }
@media (max-width: 560px) { .aim-side--real { border-right: 0; border-bottom: 1px solid var(--aim-border); } }
.aim-side__label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; margin-bottom: 8px;
}
.aim-side--real .aim-side__label { color: var(--aim-amber); }
.aim-side--ai   .aim-side__label { color: var(--aim-cyan); }
.aim-side--ai {
  background: linear-gradient(180deg, rgba(34,211,238,0.04), transparent);
}
.aim-side__title { font-weight: 700; color: var(--white); font-size: 12.5px; margin-bottom: 5px; }
.aim-side__body { font-size: 12px; line-height: 1.6; color: var(--aim-text); }
.aim-side__body p { margin: 0 0 7px; }
.aim-side__body ul { margin: 0 0 7px; padding-left: 18px; }
.aim-side__body h3, .aim-side__body h4 { margin: 8px 0 4px; font-size: 12.5px; color: var(--info-lightest); }
.aim-side__body strong { color: var(--white); }
.aim-chip {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--aim-border);
  color: var(--aim-text-dim);
  margin: 6px 6px 0 0;
}
.aim-chip--budget { border-color: color-mix(in srgb, var(--success-light) 40%, transparent); color: var(--success-lighter); }
.aim-chip--time   { border-color: color-mix(in srgb, var(--primary-light) 40%, transparent); color: #c3c9ff; }
.aim-side__src { display: inline-block; margin-top: 6px; font-size: 12px; }

.aim-critique {
  margin: 0 14px 12px;
  padding: 9px 12px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--gray-300);
  background: color-mix(in srgb, var(--primary-light) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary-light) 22%, transparent);
  border-radius: var(--radius-md);
}
.aim-critique__label { color: var(--primary-lighter); font-weight: 700; letter-spacing: 0.06em; }

/* Vote widget */
.aim-vote { padding: 0 14px 14px; }
.aim-vote__buttons { display: flex; gap: 8px; margin-bottom: 10px; }
.aim-vote__btn {
  flex: 1 1 0;
  font-family: var(--aim-mono);
  font-size: 12px;
  padding: 9px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid var(--aim-border);
  background: var(--dark);
  color: var(--aim-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease, background 0.15s ease;
}
.aim-vote__btn:active { transform: translateY(1px); }
.aim-vote__btn--real:hover { border-color: var(--aim-amber); box-shadow: 0 0 14px -6px var(--aim-amber); }
.aim-vote__btn--ai:hover   { border-color: var(--aim-cyan);  box-shadow: 0 0 14px -6px var(--aim-cyan); }
.aim-vote__btn.is-chosen.aim-vote__btn--real {
  border-color: var(--aim-amber);
  background: linear-gradient(180deg, color-mix(in srgb, var(--warning) 22%, transparent), color-mix(in srgb, var(--warning) 6%, transparent));
  color: var(--warning-lightest);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warning) 40%, transparent);
}
.aim-vote__btn.is-chosen.aim-vote__btn--ai {
  border-color: var(--aim-cyan);
  background: linear-gradient(180deg, rgba(34,211,238,0.22), rgba(34,211,238,0.06));
  color: var(--info-lightest);
  box-shadow: inset 0 0 0 1px rgba(34,211,238,0.4);
}
.aim-bar {
  height: 22px;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  border: 1px solid var(--aim-border);
  background: var(--dark);
  font-size: 12px;
  font-weight: 700;
}
.aim-bar__seg {
  display: flex; align-items: center;
  min-width: 0;
  transition: width 0.5s cubic-bezier(.4,0,.2,1);
  white-space: nowrap;
  overflow: hidden;
}
.aim-bar__seg--real {
  background: linear-gradient(90deg, color-mix(in srgb, var(--warning) 85%, transparent), rgba(251,146,60,0.6));
  color: var(--dark);
  justify-content: flex-start;
  padding-left: 8px;
}
.aim-bar__seg--ai {
  background: linear-gradient(90deg, rgba(34,211,238,0.55), rgba(34,211,238,0.9));
  color: var(--dark);
  justify-content: flex-end;
  padding-right: 8px;
}
.aim-vote__meta {
  display: flex; justify-content: space-between;
  margin-top: 6px;
  font-size: 12px;
  color: var(--aim-text-mut);
}
.aim-battle__foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 0 14px 14px;
}

/* ───────────────────────── Decisions desk ───────────────────────── */
.aim-decisions { display: flex; flex-direction: column; gap: 12px; }
.aim-decision {
  background: linear-gradient(180deg, var(--aim-panel), var(--aim-panel-2));
  border: 1px solid var(--aim-border);
  border-radius: 11px;
  padding: 14px 16px;
}
.aim-decision__top { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.aim-decision__title { margin: 0; font-size: 14px; font-weight: 700; color: var(--white); flex: 1 1 200px; }
.aim-decision__chips { display: flex; gap: 6px; flex-wrap: wrap; }
.aim-decision__meta {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 10px; font-size: 12px; color: var(--aim-text-dim);
}
.aim-decision__body {
  margin-top: 10px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--aim-text);
  border-top: 1px dashed var(--aim-border);
  padding-top: 10px;
  display: none;
}
.aim-decision.is-open .aim-decision__body { display: block; }
.aim-decision__body p { margin: 0 0 8px; }
.aim-decision__body ul, .aim-decision__body ol { margin: 0 0 8px; padding-left: 20px; }
.aim-decision__body h1, .aim-decision__body h2, .aim-decision__body h3 {
  margin: 10px 0 6px; font-size: 13px; color: var(--info-lightest); letter-spacing: 0.02em;
}
.aim-decision__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.aim-badge-promoted {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--success-lighter);
  border: 1px solid color-mix(in srgb, var(--success-light) 45%, transparent);
  background: color-mix(in srgb, var(--success-light) 8%, transparent);
  border-radius: var(--radius-md);
  padding: 7px 12px;
}
.aim-like {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--aim-mono); font-size: 12px;
  cursor: pointer; user-select: none;
  border: 1px solid var(--aim-border);
  background: transparent;
  color: var(--aim-text-dim);
  border-radius: 999px;
  padding: 5px 11px;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}
.aim-like:hover { color: var(--aim-red); border-color: var(--aim-red); }
.aim-like:active { transform: scale(0.94); }
.aim-like.is-liked { color: var(--aim-red); border-color: color-mix(in srgb, var(--danger-light) 50%, transparent); }

/* ───────────────────────── Memes gallery ───────────────────────── */
.aim-memes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.aim-meme {
  background: linear-gradient(180deg, var(--aim-panel), var(--aim-panel-2));
  border: 1px solid var(--aim-border);
  border-radius: 11px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.aim-meme__img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--dark);
  display: block;
  border-bottom: 1px solid var(--aim-border);
}
.aim-meme__caption-card {
  flex: 1 1 auto;
  min-height: 140px;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  padding: 20px 16px;
  font-size: 13px; line-height: 1.5; font-weight: 700;
  color: var(--white);
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(34,211,238,0.10), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.02) 0 10px, transparent 10px 20px);
  border-bottom: 1px solid var(--aim-border);
}
.aim-meme__body { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.aim-meme__caption { font-size: 12px; line-height: 1.5; color: var(--aim-text); }
.aim-meme__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* Аудит 2026-07-03: подпись-панчлайн и строка-источник под мемом */
.aim-meme__cap { font-size: 12.5px; line-height: 1.45; color: var(--aim-text); font-weight: 600; }
.aim-meme__src { font-size: 12px; line-height: 1.45; color: var(--aim-muted, #7c8aa0); }

/* ───────────────────────── Empty / loading / error states ───────────────────────── */
.aim-state {
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed var(--aim-border);
  border-radius: var(--radius-lg);
  background: var(--aim-panel-2);
}
.aim-state__title { font-size: 14px; color: var(--info-lightest); letter-spacing: 0.08em; margin: 0 0 8px; }
.aim-state__text { font-size: 12px; color: var(--aim-text-dim); margin: 0 auto 16px; max-width: 460px; line-height: 1.6; }
.aim-empty-line { font-size: 12.5px; color: var(--aim-text-dim); }
.aim-empty-line .tag.standby { color: var(--aim-red); font-weight: 700; }

.aim-skeleton {
  height: 90px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--dark) 25%, var(--gray-800) 37%, var(--dark) 63%);
  background-size: 400% 100%;
  animation: aim-shimmer 1.4s ease infinite;
  border: 1px solid var(--aim-border);
}
.aim-spinner {
  width: 26px; height: 26px;
  margin: 0 auto 12px;
  border: 2px solid var(--aim-border);
  border-top-color: var(--aim-cyan);
  border-radius: 50%;
  animation: aim-rotate 0.9s linear infinite;
}

.aim-muted { color: var(--aim-text-mut); font-size: 12px; }
.aim-empty-mini { color: var(--aim-text-mut); font-size: 12px; padding: 8px 2px; }
/* Застой ленты: «нечем обновиться» — спокойная подсказка, «не собирается» —
   заметная. Разные состояния не должны выглядеть одинаково. */
.aim-empty-mini--warn {
  color: var(--aim-text, inherit);
  border-left: 3px solid var(--warning);
  background: color-mix(in srgb, var(--warning) 8%, transparent);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

/* ───────────────────────── Animations ───────────────────────── */
@keyframes aim-rotate   { to { transform: rotate(360deg); } }
@keyframes aim-corepulse{ 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }
@keyframes aim-blink    { 0%,49% { opacity: 1; } 50%,100% { opacity: 0.25; } }
@keyframes aim-line-in  { to { opacity: 1; transform: translateY(0); } }
@keyframes aim-shimmer  { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

@media (prefers-reduced-motion: reduce) {
  .aimayor *,
  .aimayor *::before,
  .aimayor *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .aim-term-line { opacity: 1 !important; transform: none !important; }
}

/* ── Счётчики жизнеобеспечения (Метаболизм города) ── */
.aimayor .aim-vitals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.aimayor .aim-vital {
  border: 1px solid var(--aim-border);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
  background: rgba(34, 211, 238, 0.05);
}
.aimayor .aim-vital__icon { font-size: 1.5rem; line-height: 1; }
.aimayor .aim-vital__num {
  font-family: var(--aim-mono);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--aim-cyan);
  text-shadow: 0 0 12px rgba(34, 211, 238, 0.45);
  margin: 6px 0 2px;
  letter-spacing: .5px;
  font-variant-numeric: tabular-nums;
}
.aimayor .aim-vital__label { font-size: .8rem; opacity: .85; }
.aimayor .aim-vital__hint { font-size: 0.75rem; opacity: .5; margin-top: 3px; }
.aimayor .aim-vitals__note { font-size: 0.75rem; opacity: .55; margin-top: 8px; }

/* ── Хроника администрации ── */
.aimayor .aim-chron { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.aimayor .aim-chron__item {
  font-size: .82rem; line-height: 1.45; padding: 8px 11px;
  border-left: 3px solid var(--warning);  /* amber = сторона администрации */
  background: color-mix(in srgb, var(--warning) 7%, transparent); border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.aimayor .aim-chron__tag { font-size: 0.75rem; opacity: .75; font-weight: 600; margin-right: 5px; white-space: nowrap; }
.aimayor .aim-chron__item a { color: var(--warning); }

/* ════════════ ИИ-Мэр v2.0: настроение / кофе / спойлер / прямая линия ════════════ */

/* 🎭 Настроение Мэра */
.aimayor .aim-mood {
  display: flex; align-items: center; gap: 12px;
  margin: 10px 0 4px; padding: 12px 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--success-light) 8%, transparent), rgba(34,211,238,.05));
  border: 1px solid var(--aim-border); border-radius: var(--radius-lg);
  position: relative; z-index: 1;
}
.aimayor .aim-mood__emoji { font-size: 30px; line-height: 1; }
.aimayor .aim-mood__label { color: var(--aim-cyan); font-weight: 600; font-size: 13px; }
.aimayor .aim-mood__note { color: var(--aim-text-dim); font-size: 12.5px; margin-top: 2px; }

/* ☕️ Утренний кофе */
.aimayor .aim-coffee__list { display: flex; flex-direction: column; gap: 12px; }
.aimayor .aim-coffee__card {
  background: var(--aim-panel); border: 1px solid var(--aim-border);
  border-left: 3px solid var(--aim-amber); border-radius: var(--radius-lg); padding: 12px 14px;
}
.aimayor .aim-coffee__date { color: var(--aim-amber); font-size: 12px; margin-bottom: 6px; }
.aimayor .aim-coffee__body { color: var(--aim-text); font-size: 13.5px; line-height: 1.55; }
.aimayor .aim-coffee__body p { margin: 0 0 6px; }
.aimayor .aim-coffee__foot { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.aimayor .aim-coffee__src { color: var(--aim-cyan); font-size: 12px; text-decoration: none; }

/* 🎓 ELI5-спойлер */
.aimayor .aim-spoiler { margin: 8px 0 4px; }
.aimayor .aim-spoiler__toggle {
  background: color-mix(in srgb, var(--warning) 10%, transparent); color: var(--aim-amber);
  border: 1px dashed color-mix(in srgb, var(--warning) 45%, transparent); border-radius: 10px;
  padding: 7px 12px; font-family: var(--aim-mono); font-size: 12.5px; cursor: pointer;
  transition: background .15s;
}
.aimayor .aim-spoiler__toggle:hover { background: color-mix(in srgb, var(--warning) 18%, transparent); }
.aimayor .aim-spoiler__body { display: none; }
.aimayor .aim-spoiler.is-open .aim-spoiler__body {
  display: block; margin-top: 8px; padding: 12px 14px;
  background: var(--aim-panel-2); border: 1px solid var(--aim-border);
  border-radius: 10px; color: var(--aim-text); font-size: 13px; line-height: 1.6;
}
.aimayor .aim-spoiler__body p { margin: 0 0 6px; }
.aimayor .aim-spoiler__body ol, .aimayor .aim-spoiler__body ul { margin: 4px 0 6px 18px; }

/* 💬 Прямая линия (чат) */
.aimayor .aim-chat__thread {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 380px; overflow-y: auto; padding: 4px 2px 8px;
}
.aimayor .aim-chat__bubble {
  max-width: 88%; padding: 9px 12px; border-radius: var(--radius-lg);
  border: 1px solid var(--aim-border); font-size: 13px; line-height: 1.5;
}
.aimayor .aim-chat__bubble--ai { align-self: flex-start; background: var(--aim-panel); border-left: 3px solid var(--aim-cyan); }
.aimayor .aim-chat__bubble--user { align-self: flex-end; background: color-mix(in srgb, var(--success-light) 8%, transparent); border-right: 3px solid var(--aim-green); }
.aimayor .aim-chat__who { font-size: 12px; color: var(--aim-text-dim); margin-bottom: 3px; }
.aimayor .aim-chat__text { color: var(--aim-text); }
.aimayor .aim-chat__text p { margin: 0 0 5px; }
.aimayor .aim-chat__typing span { animation: aim-type-blink 1.2s infinite; opacity: .35; }
.aimayor .aim-chat__typing span:nth-child(2) { animation-delay: .2s; }
.aimayor .aim-chat__typing span:nth-child(3) { animation-delay: .4s; }
@keyframes aim-type-blink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.aimayor .aim-chat__form { display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; }
.aimayor .aim-chat__input {
  flex: 1; resize: vertical; min-height: 42px; max-height: 120px;
  background: var(--aim-panel-2); color: var(--aim-text);
  border: 1px solid var(--aim-border); border-radius: 10px;
  padding: 9px 12px; font-family: var(--aim-mono); font-size: 13px;
}
.aimayor .aim-chat__input:focus { border-color: var(--aim-cyan); }

/* btn-модификаторы */
.aimayor .aim-btn--sm { padding: 4px 9px; font-size: 12px; }
.aimayor .aim-btn--primary {
  background: linear-gradient(135deg, var(--aim-cyan), var(--aim-green));
  color: var(--dark); font-weight: 600; border: none; cursor: pointer;
  border-radius: 10px; padding: 9px 16px; font-family: var(--aim-mono);
}
.aimayor .aim-btn--primary:hover { filter: brightness(1.08); }

@media (prefers-reduced-motion: reduce) {
  .aimayor .aim-chat__typing span { animation: none; opacity: .6; }
}
/* ── css/city_tv.css ── */
/* static/css/city_tv.css — Городское Медиа-ТВ (Urban TV), вертикальный свайпер.
   Немонетарный контент-модуль. Нативный CSS scroll-snap (без библиотек).
   Тёмная витрина видео; тема-независимо (медиа лучше на тёмном фоне). */

.ctv-root {
    position: relative;
    width: 100%;
    height: 78vh;
    height: 78dvh;
    min-height: 460px;
    background: var(--dark);
    border-radius: 14px;
    overflow: hidden;
}

.ctv-scroller {
    height: 100%;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.ctv-scroller::-webkit-scrollbar { display: none; }

.ctv-item {
    position: relative;
    height: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark);
    overflow: hidden;
}

.ctv-media-wrap {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ctv-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
    display: block;
}
iframe.ctv-media { object-fit: initial; }

.ctv-media-fallback {
    position: relative;
    background-color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.ctv-media-poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ctv-play {
    position: relative;
    z-index: 1;
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.92);
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.6));
}

/* Затемняющий градиент снизу + инфо-оверлей */
.ctv-overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: 18px 16px 26px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.32) 55%, rgba(0, 0, 0, 0) 100%);
    pointer-events: none;
}
.ctv-overlay a,
.ctv-overlay button { pointer-events: auto; }

.ctv-meta { max-width: 78%; color: var(--white); }
.ctv-title {
    margin: 0 0 6px;
    font-size: 1.06rem;
    font-weight: 700;
    line-height: 1.25;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}
.ctv-desc {
    margin: 0 0 8px;
    font-size: 0.88rem;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.86);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ctv-topics { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ctv-chip {
    font-size: 0.76rem;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: var(--white);
    backdrop-filter: blur(4px);
}

.ctv-cta {
    display: inline-block;
    margin-top: 4px;
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--info-dark);
    color: var(--white);
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 2px 12px color-mix(in srgb, var(--info-dark) 40%, transparent);
}
.ctv-cta:hover { background: var(--info-dark); }

.ctv-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding-bottom: 4px;
}
.ctv-like {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: none;
    border: 0;
    color: var(--white);
    cursor: pointer;
    font-size: 0.78rem;
}
.ctv-heart {
    font-size: 2rem;
    line-height: 1;
    transition: transform 0.15s ease;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}
.ctv-like:active .ctv-heart { transform: scale(1.3); }
.ctv-like[data-liked="1"] .ctv-heart { color: var(--danger-light); }

/* Статусы (loading / empty / error) — честные состояния (rule #34) */
.ctv-status {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--gray-300);
    text-align: center;
    padding: 24px;
    background: var(--dark);
}
.ctv-status-err { color: var(--danger-lighter); }
.ctv-retry,
.ctv-refresh {
    padding: 8px 18px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    color: var(--text-code);
    cursor: pointer;
}
.ctv-retry:hover,
.ctv-refresh:hover { background: rgba(255, 255, 255, 0.08); }
.ctv-spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--info-light);
    animation: ctv-spin 0.9s linear infinite;
}
@keyframes ctv-spin { to { transform: rotate(360deg); } }

.ctv-sentinel { height: 1px; }

@media (max-width: 640px) {
    .ctv-root { height: 82vh; height: 82dvh; border-radius: 0; }
    .ctv-meta { max-width: 72%; }
}
/* ── css/impact_shares.css ── */
/* static/css/impact_shares.css — вкладка «💚 Мой вклад» (impact-акции).
   Немонетарный репутационный слой. Тема-независимо (использует токены). */

.impact-root { padding: 16px; max-width: 960px; margin: 0 auto; }

.impact-balance-card {
    text-align: center;
    padding: 24px 20px;
    border-radius: var(--radius-xl);
    background: color-mix(in srgb, var(--success) 12%, transparent);
    border: 1px solid var(--border-color, var(--border));
    margin-bottom: 20px;
}
.impact-balance-num { font-size: 2.8rem; font-weight: 800; color: var(--success); line-height: 1; }
.impact-balance-label { font-size: 0.95rem; color: var(--text-muted, var(--gray-500)); margin-top: 4px; }
.impact-hint {
    margin: 12px auto 0; max-width: 560px;
    font-size: 0.85rem; color: var(--text-muted, var(--gray-500)); line-height: 1.4;
}

.impact-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .impact-cols { grid-template-columns: 1fr; } }

.impact-section {
    border: 1px solid var(--border-color, var(--border));
    border-radius: var(--radius-lg); padding: 14px 16px; background: var(--surface-raised, var(--white));
}
.impact-h3 { margin: 0 0 10px; font-size: 1rem; font-weight: 700; }

.impact-lb-list { list-style: none; margin: 0; padding: 0; }
.impact-lb-row {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 4px; border-bottom: 1px solid var(--border-color-subtle, var(--bg-tertiary));
}
.impact-lb-row:last-child { border-bottom: 0; }
.impact-lb-rank { width: 28px; text-align: center; font-weight: 700; }
.impact-lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.impact-lb-val { font-weight: 700; color: var(--success); }

.impact-hist-list { list-style: none; margin: 0; padding: 0; }
.impact-hist-row {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 4px; border-bottom: 1px solid var(--border-color-subtle, var(--bg-tertiary));
}
.impact-hist-row:last-child { border-bottom: 0; }
.impact-hist-kind { font-size: 0.88rem; }
.impact-hist-reason {
    flex: 1; font-size: 0.78rem; color: var(--text-muted, var(--gray-500));
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.impact-hist-val { margin-left: auto; font-weight: 700; }
.impact-hist-val.is-pos { color: var(--success); }
.impact-hist-val.is-neg { color: var(--danger); }

.impact-empty {
    padding: 18px; text-align: center; color: var(--text-muted, var(--gray-500));
    font-size: 0.88rem;
}
.impact-status { padding: 40px 16px; text-align: center; color: var(--text-muted, var(--gray-500)); }
.impact-status-err { color: var(--danger); margin-bottom: 12px; }
.impact-spinner {
    width: 30px; height: 30px; margin: 0 auto 12px; border-radius: 50%;
    border: 3px solid rgba(0,0,0,0.1); border-top-color: var(--success);
    animation: impact-spin 0.9s linear infinite;
}
@keyframes impact-spin { to { transform: rotate(360deg); } }
/* ── css/securities.css ── */
/* static/css/securities.css — вкладка «💰 Инвестиции» (долевые бумаги проектов).
   Монетарный контур Городской Биржи. Тема-независимо (использует токены). */

.sec-root { padding: 16px; max-width: 1000px; margin: 0 auto; }

.sec-intro {
    padding: 16px 18px; border-radius: 14px; margin-bottom: 18px;
    background: color-mix(in srgb, var(--info-dark) 10%, transparent);
    border: 1px solid var(--border-color, var(--border));
}
.sec-h3 { margin: 0 0 12px; font-size: 1.05rem; font-weight: 700; }
.sec-intro .sec-h3 { margin-bottom: 6px; }
.sec-intro-text { margin: 0; font-size: 0.88rem; color: var(--text-muted, var(--gray-500)); line-height: 1.45; }

.sec-section { margin-bottom: 22px; }

.sec-locked-banner {
    display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap;
    padding: 12px 16px; margin-bottom: 18px; border-radius: var(--radius-lg);
    font-size: 0.86rem; line-height: 1.45;
    background: color-mix(in srgb, var(--warning) 10%, transparent); border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
    color: var(--text, var(--gray-800));
}
.sec-locked-modal { font-size: 0.92rem; line-height: 1.5; margin: 0; }

.sec-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px;
}
.sec-card {
    border: 1px solid var(--border-color, var(--border)); border-radius: var(--radius-lg);
    padding: 14px 16px; background: var(--surface-raised, var(--white));
    display: flex; flex-direction: column; gap: 8px;
}
.sec-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sec-card-title { margin: 0; font-size: 0.98rem; font-weight: 700; line-height: 1.25; }
.sec-card-price { font-weight: 800; color: var(--info-dark); white-space: nowrap; }
.sec-card-price small { font-weight: 500; color: var(--text-muted, var(--gray-500)); font-size: 0.72rem; }
.sec-card-desc { margin: 0; font-size: 0.82rem; color: var(--text-muted, var(--gray-500)); line-height: 1.4; }

.sec-progress {
    height: 7px; border-radius: 999px; overflow: hidden;
    background: var(--border-color-subtle, var(--bg-tertiary));
}
.sec-progress-bar {
    height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, var(--success), var(--info-dark)); transition: width .3s ease;
}
.sec-card-meta { display: flex; justify-content: space-between; font-size: 0.76rem; color: var(--text-muted, var(--gray-500)); }
.sec-card-remaining { font-weight: 600; }
.sec-card-actions { display: flex; gap: 8px; margin-top: 4px; }
.sec-card-actions .btn { flex: 1; }

.sec-hold-list { list-style: none; margin: 0; padding: 0;
    border: 1px solid var(--border-color, var(--border)); border-radius: var(--radius-lg); overflow: hidden; }
.sec-hold-row {
    display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; align-items: center;
    padding: 10px 14px; border-bottom: 1px solid var(--border-color-subtle, var(--bg-tertiary)); font-size: 0.86rem;
}
.sec-hold-row:last-child { border-bottom: 0; }
.sec-hold-head { font-weight: 700; background: var(--surface-sunken, var(--bg-secondary)); font-size: 0.78rem;
    color: var(--text-muted, var(--gray-500)); text-transform: uppercase; letter-spacing: .02em; }
.sec-hold-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-hold-shares { text-align: center; font-weight: 600; }
.sec-hold-invested { text-align: right; font-weight: 700; color: var(--info-dark); }

.sec-empty, .sec-muted { padding: 18px; text-align: center; font-size: 0.86rem; color: var(--text-muted, var(--gray-500)); }
.sec-status { text-align: center; padding: 40px 16px; }
.sec-status-err { color: var(--danger-dark); margin-bottom: 12px; }
.sec-spinner {
    width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%;
    border: 3px solid var(--border-color, var(--border)); border-top-color: var(--info-dark);
    animation: sec-spin .8s linear infinite;
}
@keyframes sec-spin { to { transform: rotate(360deg); } }

/* ─── Модалка ─── */
.sec-modal-overlay {
    position: fixed; inset: 0; z-index: 4000;
    background: color-mix(in srgb, var(--dark) 55%, transparent); display: flex; align-items: center; justify-content: center;
    padding: 16px; backdrop-filter: blur(3px);
}
.sec-modal {
    width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
    background: var(--surface-raised, var(--white)); border-radius: var(--radius-xl);
    border: 1px solid var(--border-color, var(--border)); box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.sec-modal-head { display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--border-color-subtle, var(--bg-tertiary)); }
.sec-modal-head h3 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.sec-modal-close { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer;
    color: var(--text-muted, var(--gray-500)); }
.sec-modal-body { padding: 18px 20px; }
.sec-modal-foot { display: flex; justify-content: flex-end; gap: 10px;
    padding: 14px 20px; border-top: 1px solid var(--border-color-subtle, var(--bg-tertiary)); }

.sec-buy-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sec-buy-row label { flex: 1; font-size: 0.9rem; }
.sec-buy-input { width: 96px; padding: 8px 10px; border-radius: var(--radius-md);
    border: 1px solid var(--border-color, var(--border)); font-size: 1rem; text-align: right; }
.sec-buy-total { font-size: 1.05rem; margin-bottom: 16px; }
.sec-buy-total b { color: var(--info-dark); }

.sec-buy-disclaimer {
    background: color-mix(in srgb, var(--danger-dark) 6%, transparent); border: 1px solid color-mix(in srgb, var(--danger-dark) 25%, transparent);
    border-radius: 10px; padding: 12px 14px; margin-bottom: 14px;
}
.sec-buy-disclaimer h4 { margin: 0 0 8px; font-size: 0.9rem; color: var(--danger-dark); }
.sec-buy-disclaimer ul { margin: 0; padding-left: 18px; font-size: 0.82rem; line-height: 1.5; }
.sec-legal-note { margin: 8px 0 0; font-size: 0.76rem; color: var(--text-muted, var(--gray-500)); }
.sec-disclaimer-mini { margin: 12px 0 0; font-size: 0.78rem; color: var(--danger-dark); }

.sec-consent { display: flex; gap: 8px; align-items: flex-start; font-size: 0.84rem; line-height: 1.4; cursor: pointer; }
.sec-consent input { margin-top: 3px; flex-shrink: 0; }

.sec-detail-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0; }
.sec-detail-stats > div { text-align: center; padding: 10px 6px; border-radius: 10px;
    background: var(--surface-sunken, var(--bg-secondary)); border: 1px solid var(--border-color-subtle, var(--bg-tertiary)); }
.sec-detail-stats b { display: block; font-size: 1.1rem; color: var(--info-dark); }
.sec-detail-stats span { font-size: 0.72rem; color: var(--text-muted, var(--gray-500)); }
.sec-detail-h4 { margin: 14px 0 8px; font-size: 0.92rem; }
.sec-div-list { margin: 0; padding-left: 18px; font-size: 0.84rem; line-height: 1.6; }
.sec-div-status { color: var(--text-muted, var(--gray-500)); font-size: 0.78rem; }

:root[data-theme="dark"] .sec-hold-head,
:root[data-theme="dark"] .sec-detail-stats > div { background: rgba(255,255,255,0.04); }
