:root {
    --pulse-bg: var(--bg-base, #f5f7fb);
    --pulse-card: var(--bg-primary, #ffffff);
    --pulse-panel: color-mix(in srgb, var(--bg-primary) 95%, transparent);
    --pulse-border: var(--border, #e2e8f0);
    --pulse-text: var(--text-primary, #0f172a);
    --pulse-muted: var(--text-secondary, #64748b);
}

.ghost-btn--primary {
    color: var(--info);
}

.city-focus__kb {
    margin-top: 16px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
    color: var(--pulse-text);
    box-shadow: none;
    font-family: inherit;
}

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

.city-focus__kb-layers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.city-focus__kb-card {
    background: rgba(241, 245, 249, 0.7);
    border-radius: 14px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.city-focus__kb-card small {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(71, 85, 105, 0.9);
}

.city-focus__kb-card strong {
    font-size: 1.3rem;
}

.city-focus__kb-card ul {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    font-size: 0.8rem;
    color: rgba(71, 85, 105, 0.95);
}

.city-focus__kb-card li {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 4px;
}

.city-focus__kb-empty {
    padding: 12px;
    border-radius: 12px;
    border: 1px dashed rgba(148, 163, 184, 0.5);
    text-align: center;
    color: rgba(71, 85, 105, 0.95);
    font-size: 0.85rem;
}

.pulse-kb-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: var(--z-modal-backdrop);
    animation: kb-modal-in 250ms ease-out;
}

@keyframes kb-modal-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.pulse-kb-sheet {
    width: min(1200px, 96%);
    max-height: 92vh;
    background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    padding: 20px;
    box-shadow: 0 40px 120px rgba(2, 6, 23, 0.75);
    color: var(--pulse-text);
    overflow: hidden;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    animation: kb-sheet-in 250ms ease-out;
}

@keyframes kb-sheet-in {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.pulse-kb-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.pulse-kb-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pulse-kb-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.pulse-kb-column h4 {
    margin: 0 0 8px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(148, 163, 184, 0.9);
}

.pulse-kb-fact,
.pulse-kb-principle {
    background: rgba(241, 245, 249, 0.8);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    margin-bottom: 8px;
    color: var(--pulse-text);
    font-family: inherit;
}

.pulse-kb-fact__type {
    display: inline-block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--info);
    margin-bottom: 4px;
}

.pulse-kb-empty {
    padding: 14px;
    border-radius: 12px;
    border: 1px dashed rgba(148, 163, 184, 0.6);
    text-align: center;
    color: rgba(226, 232, 240, 0.75);
}

.pulse-kb-graph-wrap {
    min-height: 320px;
    height: min(55vh, 480px);
    flex-shrink: 0;
    position: relative;
    background: rgba(241, 245, 249, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 14px;
    overflow: hidden;
}

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

.pulse-kb-legend {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: color-mix(in srgb, var(--bg-primary) 85%, transparent);
    backdrop-filter: blur(8px);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.72rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    z-index: 2;
    cursor: pointer;
    transition: opacity 200ms;
}

.pulse-kb-legend--hidden {
    opacity: 0.3;
}

.pulse-kb-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 0;
}

.pulse-kb-toolbar-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--pulse-muted);
    cursor: pointer;
}

.pulse-kb-search {
    flex: 1;
    min-width: 180px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    font-size: 0.82rem;
    outline: none;
    transition: border-color 200ms;
}

.pulse-kb-search:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.pulse-kb-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--pulse-border);
    margin-bottom: 10px;
}

.pulse-kb-tab {
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--pulse-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 150ms;
}

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

.pulse-kb-bottom {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pulse-kb-tab-pane {
    display: none;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.pulse-kb-tab-pane--active {
    display: block;
}

.pulse-kb-fact-group {
    margin-bottom: 12px;
}

.pulse-kb-fact-group__title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--pulse-muted);
    padding: 4px 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
}

.pulse-kb-principle__confidence {
    height: 3px;
    border-radius: 2px;
    margin-top: 6px;
    background: var(--pulse-border);
}

.pulse-kb-principle__confidence-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 300ms;
}

.pulse-kb-fact--highlighted {
    background: rgba(59, 130, 246, 0.08);
    border-left: 3px solid var(--primary);
}

.pulse-kb-node-detail {
    padding: 14px;
    background: rgba(241, 245, 249, 0.6);
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.pulse-kb-node-detail__title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.pulse-kb-node-detail__type {
    display: inline-block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: 6px;
    color: var(--text-inverse);
    margin-bottom: 8px;
}

.pulse-kb-sheet--fullscreen {
    position: relative;
}

.pulse-kb-sheet--fullscreen .pulse-kb-graph-wrap {
    height: calc(90vh - 120px);
}

.pulse-kb-sheet--fullscreen .pulse-kb-bottom {
    position: absolute;
    right: 0;
    top: 60px;
    width: 340px;
    height: calc(90vh - 80px);
    overflow-y: auto;
    background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
    border-left: 1px solid var(--pulse-border);
}

.pulse-kb-graph-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    padding: 24px;
    text-align: center;
    color: var(--pulse-muted);
    font-size: 0.9rem;
}

.pulse-kb-graph-placeholder strong {
    display: block;
    margin-top: 8px;
    color: var(--pulse-text);
}

* {
    box-sizing: border-box;
}

body.pulse-body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: radial-gradient(circle at top, #fdfbff 0%, #f2f4fb 60%, #e7ecf6 100%);
    color: var(--pulse-text);
    min-height: 100vh;
    overflow: hidden;
}

.pulse-shell {
    min-height: 100vh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 16px 20px 20px;
    gap: 16px;
    overflow: hidden;
}

.pulse-shell.compact {
    padding: 8px 12px 12px;
    gap: 10px;
}

.pulse-shell.compact .stat-chip {
    padding: 4px 8px;
    min-width: 60px;
}

.pulse-shell.compact .panel-block {
    padding: 8px 10px;
}

/* ТЗ J4: состояние загрузки при первом запросе snapshot */
.pulse-shell.is-loading .pulse-stage {
    opacity: 0.7;
}
.pulse-shell.is-loading .header-stats .stat-chip strong {
    opacity: 0.6;
}

.top-list-item[role="button"] {
    cursor: pointer;
}

.pulse-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--pulse-panel);
    border-radius: 14px;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.05);
    position: relative;
    z-index: 10;
}

.pulse-title {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-hide-btn {
    border: 1px solid rgba(15, 23, 42, 0.10);
    background: color-mix(in srgb, var(--bg-primary) 65%, transparent);
    color: rgba(15, 23, 42, 0.7);
    border-radius: 999px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    flex-shrink: 0;
}

.panel-hide-btn:hover {
    transform: translateY(-1px);
    background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
    border-color: rgba(15, 23, 42, 0.18);
}

.panel-hide-btn--floating {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    pointer-events: auto;
}

.pulse-shell.is-left-hidden .pulse-panel--legend {
    display: none;
}
.pulse-shell.is-right-hidden .pulse-panel--stats {
    display: none;
}
.pulse-shell.city-focused .pulse-panel--stats {
    display: none;
}
.pulse-shell.is-core-hidden .core-console {
    display: none;
}
.pulse-shell.is-briefing-hidden .core-briefing {
    display: none;
}
.pulse-shell.is-caption-hidden .stage-caption {
    display: none;
}
.pulse-shell.is-missions-hidden .pulse-missions {
    display: none;
}

.pulse-shell.is-left-hidden .pulse-main {
    grid-template-columns: minmax(480px, 1fr) 280px;
}
.pulse-shell.is-right-hidden .pulse-main {
    grid-template-columns: 240px minmax(480px, 1fr);
}
.pulse-shell.is-left-hidden.is-right-hidden .pulse-main {
    grid-template-columns: 1fr;
}

.pulse-build {
    margin-left: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(15, 23, 42, 0.08);
    color: rgba(15, 23, 42, 0.72);
    letter-spacing: 0.02em;
}

.pulse-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--success);
    position: relative;
    display: inline-flex;
}

.pulse-indicator::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.4);
    animation: indicator-pulse 2s infinite;
}

@keyframes indicator-pulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(2); opacity: 0; }
    100% { transform: scale(1); opacity: 0; }
}

.pulse-subtitle {
    margin: 4px 0 0;
    color: var(--pulse-muted);
    font-size: 0.85rem;
}

.header-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stat-chip {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    min-width: 70px;
    border: 1px solid var(--border);
}

.stat-chip span {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--pulse-muted);
}

.stat-chip strong {
    font-size: 1rem;
    font-weight: 600;
}

.stat-chip--graph {
    min-width: 90px;
    align-items: stretch;
    gap: 4px;
}

#activity-sparkline {
    width: 100%;
    height: 20px;
}

.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 20px;
    background: color-mix(in srgb, var(--info) 15%, var(--bg-primary));
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.75rem;
}

.connection-status .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: indicator-pulse 2s infinite;
}

.connection-status.disconnected {
    background: color-mix(in srgb, var(--danger) 15%, var(--bg-primary));
    color: var(--danger);
}

.connection-status.disconnected .dot {
    background: var(--danger);
}

.pulse-main {
    display: grid;
    grid-template-columns: 240px minmax(480px, 1fr) 280px;
    gap: 16px;
    flex: 1;
    min-height: 0;
}

.pulse-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.pulse-panel--legend,
.pulse-panel--stats {
    overflow: hidden;
}

.pulse-panel--legend .panel-block,
.pulse-panel--stats .panel-block {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.pulse-panel--stats .panel-block.panel-block--tabs {
    flex: 0 0 auto;
    flex-shrink: 0;
}

.pulse-panel--stats .right-panel-section {
    flex: 1;
}

.pulse-panel--legend .panel-block + .panel-block,
.pulse-panel--stats .panel-block + .panel-block {
    flex: unset;
}

.panel-block {
    background: var(--pulse-panel);
    border-radius: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(15, 23, 42, 0.05);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.05);
}

.panel-block--mini {
    padding: 10px 12px;
}

.top-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.top-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 0.75rem;
}

.top-list-item .rank {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-inverse);
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-block--switchable {
    gap: 10px;
}

.block-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--pulse-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.block-title--with-tabs {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "title hide"
        "tabs tabs";
    align-items: center;
    row-gap: 8px;
}

.block-title--with-tabs > span {
    grid-area: title;
}

.block-title--with-tabs .panel-tabs {
    grid-area: tabs;
}

.block-title--with-tabs .panel-hide-btn {
    grid-area: hide;
    justify-self: end;
}

.panel-tabs {
    display: inline-flex;
    gap: 8px;
    background: var(--bg-tertiary);
    border-radius: 999px;
    padding: 2px;
}

.panel-tabs.panel-tabs--right {
    flex-direction: row;
    align-items: center;
    border-radius: 999px;
    width: 100%;
}

.panel-tabs.panel-tabs--right .panel-tab {
    flex: 1;
    width: auto;
    text-align: center;
    padding: 6px 10px;
}

.panel-tab {
    border: none;
    background: transparent;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    color: var(--pulse-muted);
    transition: background 0.2s ease, color 0.2s ease;
}

.panel-tab.active {
    background: var(--bg-elevated);
    color: var(--pulse-text);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.panel-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.legend-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    overflow: auto;
    flex: 1;
    min-height: 0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    background: var(--bg-secondary);
}

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

.legend-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid rgba(15, 23, 42, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.legend-content {
    flex: 1;
}

.legend-title {
    font-size: 0.8rem;
    font-weight: 600;
}

.legend-caption {
    font-size: 0.7rem;
    color: var(--pulse-muted);
}

.alerts-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    margin-top: 8px;
}

.is-hidden {
    display: none !important;
}
.city-alert {
    border-radius: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    background: #fdfbff;
}

.city-alert h4 {
    margin: 0 0 2px;
    font-size: 0.85rem;
}

.city-alert .metrics {
    display: flex;
    gap: 8px;
    font-size: 0.72rem;
    color: var(--pulse-muted);
}

.city-alert.low { border-color: var(--border); }
.city-alert.medium { border-color: #f97316; background: color-mix(in srgb, var(--warning) 10%, var(--bg-primary)); }
.city-alert.high { border-color: var(--danger); background: #feecec; }
/* ✅ ТЗ: Новый статус для городов без данных */
.city-alert.inactive {
    opacity: 0.5;
    border-left-color: var(--gray-400, #94a3b8);
}
.city-alert.inactive::before {
    content: '💤';
    margin-right: 8px;
}
/* ✅ ТЗ: Предупреждение о свежести данных */
.alert-warning {
    padding: 12px 16px;
    margin-bottom: 12px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--warning) 10%, var(--bg-primary));
    border-left: 3px solid #f59e0b;
    color: var(--warning);
    font-size: 0.85rem;
}
.alert-warning small {
    display: block;
    margin-top: 4px;
    opacity: 0.8;
    font-size: 0.75rem;
}

.pulse-stage {
    position: relative;
    background: color-mix(in srgb, var(--bg-primary) 85%, transparent);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.3);
    box-shadow: 0 40px 70px rgba(15, 23, 42, 0.1);
    height: 100%;
    min-height: 0;
}

.pulse-stage::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.08), transparent 55%),
        radial-gradient(circle at 80% 80%, rgba(59, 130, 246, 0.06), transparent 60%);
    opacity: 0.6;
    mix-blend-mode: multiply;
    pointer-events: none;
    animation: pulse-map-drift 18s ease-in-out infinite alternate;
}

@keyframes pulse-map-drift {
    0% { transform: translate3d(-2%, -2%, 0); }
    100% { transform: translate3d(2%, 2%, 0); }
}

.stage-map {
    position: absolute;
    inset: 0;
    filter: grayscale(0.1) saturate(0.8) contrast(1.05);
}

.orbit-overlay {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.city-focus {
    position: absolute;
    top: 16px;
    right: 16px;
    width: min(600px, 48vw);
    height: calc(100% - 48px);
    background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(20px);
    color: var(--pulse-text);
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: auto;
    z-index: 5;
    transition: opacity 0.2s ease, transform 0.2s ease;
    border: 1px solid rgba(148, 163, 184, 0.35);
    font-family: inherit;
}
.pulse-shell.city-focused .city-focus {
    width: min(700px, 55vw);
}
.city-focus.is-hidden {
    opacity: 0;
    transform: translateX(12px);
    pointer-events: none;
}
.city-focus__header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}
.city-focus__header h3 {
    margin: 4px 0 0;
    font-size: 1.1rem;
}
.city-focus__eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.65rem;
    color: rgba(71, 85, 105, 0.9);
}
.city-focus__header p {
    margin: 4px 0 0;
    color: rgba(71, 85, 105, 0.9);
}
.city-focus__body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
    overflow-y: auto;
}
.city-focus__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.city-focus__stat {
    background: rgba(241, 245, 249, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    padding: 8px 10px;
}
.city-focus__stat span {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(71, 85, 105, 0.9);
}
.city-focus__stat strong {
    display: block;
    margin-top: 4px;
    font-size: 0.95rem;
}
.city-focus__graph-card {
    background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    padding: 8px;
}
.city-focus__graph-card svg {
    width: 100%;
    height: 200px;
}
.city-focus__series {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(32px, 1fr));
    gap: 6px;
}
.city-focus__series-bar {
    background: rgba(241, 245, 249, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 12px;
    padding: 6px 4px;
    text-align: center;
    font-size: 0.7rem;
    color: rgba(15, 23, 42, 0.85);
}
.city-focus__series-bar span {
    display: block;
    height: 40px;
    margin-bottom: 4px;
    border-radius: 8px;
    background: linear-gradient(180deg, #38bdf8, #0ea5e9);
    width: 100%;
}
.city-focus__feed {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.city-focus__feed-item {
    background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    padding: 8px 10px;
}
.city-focus__feed-item strong {
    display: block;
    font-size: 0.85rem;
}
.city-focus__feed-item span {
    display: block;
    font-size: 0.7rem;
    color: rgba(71, 85, 105, 0.95);
    margin-top: 4px;
}
.city-focus__feed-item time {
    display: block;
    font-size: 0.65rem;
    color: rgba(100, 116, 139, 0.9);
    margin-top: 6px;
}
.city-focus__empty {
    text-align: center;
    font-size: 0.9rem;
    color: rgba(71, 85, 105, 0.95);
    padding: 16px;
    border-radius: 16px;
    border: 1px dashed rgba(148, 163, 184, 0.55);
}
.city-focus__empty p {
    margin: 0 0 4px;
    font-weight: 600;
    color: var(--pulse-text);
}
.city-focus__empty span {
    font-size: 0.8rem;
}

.core-console {
    position: absolute;
    top: 24px;
    left: 24px;
    transform: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    width: min(420px, 55%);
    text-align: left;
    pointer-events: auto;
}

.core-stack {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    width: 100%;
}

@media (max-width: 1500px) {
    .core-stack {
        grid-template-columns: minmax(140px, 1fr);
    }
}

.core-card {
    background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
    border-radius: 12px;
    padding: 10px 12px;
    text-align: center;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 15px 40px rgba(15, 23, 42, 0.1);
    pointer-events: auto;
}

.core-label {
    font-size: 0.7rem;
    color: var(--pulse-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.core-value {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 4px 0;
}

.core-sub {
    font-size: 0.75rem;
    color: var(--pulse-muted);
}

.core-briefing {
    width: 100%;
    background: #0f172a;
    border-radius: 12px;
    padding: 10px 12px;
    color: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.2);
    position: relative;
}

.core-briefing-toggle {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    font-size: 0.75rem;
}

.core-briefing-label {
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    color: rgba(248, 250, 252, 0.8);
    margin-bottom: 4px;
}

.core-briefing-desc {
    margin: 0 0 6px;
    font-size: 0.8rem;
    color: rgba(248, 250, 252, 0.9);
}

.core-briefing-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.core-briefing-list li {
    position: relative;
    padding-left: 14px;
    font-size: 0.8rem;
    color: rgba(248, 250, 252, 0.9);
}

.core-briefing-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 7px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38bdf8, #6366f1);
}

.role-orbits {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--orbit-size, 480px);
    height: var(--orbit-size, 480px);
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
}

.role-orbits:not(:hover) {
    opacity: 0.75;
}

.role-orbits:hover {
    opacity: 1;
}

.pulse-shell.city-focused .role-orbits:not(:hover) {
    opacity: 0.5;
}

.role-orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--bg-primary) 85%, transparent);
    border: 1.5px solid rgba(148, 163, 184, 0.5);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 2px;
    padding: 4px;
    pointer-events: auto;
    transition: transform 0.4s ease, box-shadow 0.3s ease, width 0.2s ease, height 0.2s ease;
    transform: translate(-50%, -50%) rotate(var(--angle)) translateY(calc(-1 * var(--radius))) rotate(calc(-1 * var(--angle)));
}

.role-orbits-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
    border: 1px solid rgba(148, 163, 184, 0.5);
    border-radius: 50%;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--pulse-muted);
    z-index: 20;
    pointer-events: auto;
    transition: box-shadow 0.2s ease;
}

.role-orbits-handle:hover {
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.15);
}

.role-orbits-handle:active {
    cursor: grabbing;
}

.orbit-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    z-index: 1;
    pointer-events: none;
}

.orbit-core__pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.2);
    animation: core-pulse 3s ease-in-out infinite;
}

.orbit-core__icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

@keyframes core-pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.3); opacity: 0.2; }
}

.role-orbit:hover,
.role-orbit.active {
    width: 72px;
    height: 72px;
    z-index: 10;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
}

.role-icon {
    font-size: 0.95rem;
}

.role-name {
    font-size: 0.6rem;
    font-weight: 600;
    line-height: 1.1;
    max-width: 48px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-value {
    font-size: 0.55rem;
    color: var(--pulse-muted);
}

.role-orbit:hover .role-name,
.role-orbit.active .role-name {
    font-size: 0.75rem;
    max-width: none;
    white-space: normal;
}

.role-orbit:hover .role-value,
.role-orbit.active .role-value {
    font-size: 0.7rem;
}

.role-orbit.alert {
    border-color: var(--accent);
    animation: orbit-pulse 2s infinite;
}

/* ТЗ C4: фон + blur для читаемости на карте */
.stage-caption {
    position: absolute;
    right: 20px;
    bottom: 20px;
    width: min(260px, 60%);
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #f8fafc;
    border-radius: 12px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3);
    pointer-events: auto;
}

.city-marker-pulse {
    position: relative;
    display: block;
    line-height: 0;
}

.city-marker-pulse .marker-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    z-index: 2;
    box-sizing: border-box;
}

.city-marker-pulse .marker-wave {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid;
    opacity: 0;
    animation: city-pulse-wave 2s ease-out infinite;
    box-sizing: border-box;
}

.city-marker-pulse .marker-wave--2 {
    animation-delay: 1s;
}

@keyframes city-pulse-wave {
    0% { width: 12px; height: 12px; opacity: 0.8; }
    100% { width: 50px; height: 50px; opacity: 0; }
}

.city-connection-line {
    stroke-dashoffset: 0;
    animation: connection-flow 3s linear infinite;
}

@keyframes connection-flow {
    to { stroke-dashoffset: -30; }
}

.federal-agent-marker {
    position: relative;
}

.federal-agent-marker .agent-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #a855f7, #6366f1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4);
    animation: agent-float 2s ease-in-out infinite;
}

.federal-agent-marker .agent-label {
    position: absolute;
    top: 36px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-inverse);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.65rem;
    white-space: nowrap;
}

@keyframes agent-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.agent-route-line { stroke-linecap: round; }
.agent-tooltip.leaflet-tooltip {
    background: rgba(15, 23, 42, 0.92);
    color: var(--text-inverse);
    border: 1px solid rgba(168, 85, 247, 0.4);
    font-size: 0.75rem;
    padding: 6px 10px;
    border-radius: 8px;
}
.city-label-tooltip.leaflet-tooltip {
    background: rgba(15, 23, 42, 0.85);
    color: #e2e8f0;
    border: none;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}
.federal-agent-marker.agent-breathing .agent-avatar {
    animation: agent-breathing-pulse 0.6s ease-out;
}
@keyframes agent-breathing-pulse {
    0% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4); }
    50% { transform: translate(-50%, -50%) scale(1.15); box-shadow: 0 6px 16px rgba(168, 85, 247, 0.6); }
    100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4); }
}

.caption-label {
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    color: rgba(248, 250, 252, 0.7);
    margin-bottom: 4px;
}

.caption-text {
    margin: 0 0 6px;
    font-size: 0.78rem;
    color: rgba(248, 250, 252, 0.9);
}

.caption-dynamic {
    font-size: 0.75rem;
    color: #c7d2fe;
    line-height: 1.4;
}

.project-satellite {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--sat-color, var(--accent));
    background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    transform: translate(-50%, -50%) rotate(var(--angle)) translateY(calc(-1 * var(--radius, 260px))) rotate(calc(-1 * var(--angle)));
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-satellite .satellite-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--sat-color, var(--accent));
}

.project-satellite .satellite-label {
    position: absolute;
    top: 22px;
    left: 50%;
    transform: translate(-50%, 8px);
    padding: 3px 6px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.85);
    color: var(--text-inverse);
    font-size: 0.6rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.project-satellite:hover {
    width: 24px;
    height: 24px;
    box-shadow: 0 20px 35px rgba(15, 23, 42, 0.28);
}

.project-satellite:hover .satellite-label {
    opacity: 1;
    transform: translate(-50%, 0);
}

#pulse-tooltip {
    position: fixed;
    background: rgba(15, 23, 42, 0.95);
    color: var(--text-inverse);
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.8rem;
    line-height: 1.4;
    pointer-events: none;
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.35);
    opacity: 0;
    transform: translate(-9999px, -9999px);
    transition: opacity 0.15s ease;
    z-index: var(--z-tooltip);
}

#pulse-tooltip.visible {
    opacity: 1;
}

#pulse-tooltip strong {
    display: block;
    margin-bottom: 4px;
}

#pulse-tooltip .tooltip-muted {
    color: rgba(226, 232, 240, 0.85);
    font-size: 0.75rem;
}

.map-pulse {
    position: relative !important;
    width: 40px !important;
    height: 40px !important;
    pointer-events: none !important;
    border: none !important;
    background: transparent !important;
    display: block;
    line-height: 0;
}

.map-pulse__wave {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--pulse-color, #6366f1);
    animation: map-pulse 1.4s ease-out forwards;
    display: block;
    transform-origin: center;
    box-sizing: border-box;
}

@keyframes map-pulse {
    0% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(0.3);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(3);
    }
}

.map-pulse.leaflet-div-icon,
.city-marker-pulse.leaflet-div-icon {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

@keyframes orbit-pulse {
    0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.35); }
    70% { box-shadow: 0 0 0 18px rgba(244, 63, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.live-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: auto;
    flex: 1;
    min-height: 0;
}

.live-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.live-stat-row.is-small {
    font-size: 0.78rem;
    color: rgba(100, 116, 139, 0.9);
}

.live-stat-row strong {
    font-size: 0.95rem;
    font-weight: 600;
}

.live-stat-row:last-child {
    border-bottom: none;
}

.live-stat-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.live-stat-row.has-hint .live-stat-right {
    align-items: flex-start;
}

.live-stat-hint {
    font-size: 0.7rem;
    color: #ea580c;
    background: rgba(234, 88, 12, 0.08);
    padding: 4px 6px;
    border-radius: 4px;
    width: 100%;
    line-height: 1.3;
}

.timeline-list {
    max-height: none;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-height: 0;
}

.timeline-entry {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    position: relative;
}

.timeline-entry::before {
    content: attr(data-type);
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--pulse-muted);
}

.timeline-title {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
}

.timeline-description {
    margin: 4px 0;
    font-size: 0.75rem;
    color: var(--pulse-muted);
}

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

.pulse-missions {
    background: var(--pulse-panel);
    border-radius: 16px;
    padding: 14px 20px;
    border: 1px solid rgba(15, 23, 42, 0.05);
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.07);
    flex-shrink: 0;
    max-height: 22vh;
    display: flex;
    flex-direction: column;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.section-heading h2 {
    margin: 2px 0 0;
    font-size: 1rem;
}

.eyebrow {
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: var(--pulse-muted);
}

.section-actions {
    display: flex;
    gap: 12px;
}

.ghost-btn {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #d0d5dd;
    background: var(--bg-elevated);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.ghost-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.missions-deck {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.missions-scroll {
    margin-top: 12px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
    flex: 1;
}

.missions-scroll::-webkit-scrollbar {
    width: 6px;
}

.missions-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 999px;
}

.mission-card {
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mission-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.mission-title {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
}

.mission-status {
    font-size: 0.65rem;
    padding: 3px 6px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.mission-status.running { background: color-mix(in srgb, var(--success) 15%, var(--bg-primary)); color: var(--success); }
.mission-status.pending { background: color-mix(in srgb, var(--warning) 15%, var(--bg-primary)); color: var(--warning); }
.mission-status.completed { background: color-mix(in srgb, var(--info) 15%, var(--bg-primary)); color: var(--text-primary); }
.mission-status.failed { background: color-mix(in srgb, var(--danger) 15%, var(--bg-primary)); color: var(--danger); }

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

.progress-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #22d3ee);
}

.mission-meta {
    font-size: 0.75rem;
    color: var(--pulse-muted);
    display: flex;
    justify-content: space-between;
}

/* Scrollbars */
.timeline-list::-webkit-scrollbar,
.alerts-stack::-webkit-scrollbar {
    width: 6px;
}

.timeline-list::-webkit-scrollbar-thumb,
.alerts-stack::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.5);
    border-radius: 999px;
}

@media (max-width: 1280px) {
    .pulse-main {
        grid-template-columns: 1fr;
    }
    .core-console {
        width: 90%;
    }
    .core-stack {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    .role-orbits {
        position: static;
        width: auto;
        height: auto;
    }
    .role-orbit {
        position: relative;
        transform: none;
        margin: 10px;
    }
}

/* ТЗ C5: стили печати — белый фон, скрытие интерактива */
@media print {
    .pulse-shell {
        background: var(--bg-elevated) !important;
    }
    .pulse-body,
    .pulse-main,
    .pulse-stage,
    .pulse-panel {
        background: var(--bg-elevated) !important;
    }
    .pulse-header,
    .header-stats,
    .stat-chip,
    .core-console,
    .stage-caption,
    .pulse-panel {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .ghost-btn,
    .panel-hide-btn,
    button[id^="pulse-"],
    #connection-status,
    .role-orbits-handle,
    .pulse-toggle-panels,
    .pulse-compact-toggle {
        display: none !important;
    }
    .pulse-stage .leaflet-control-container,
    .leaflet-control-zoom,
    .leaflet-control-attribution {
        display: none !important;
    }
    .top-list-item[role="button"] {
        cursor: default;
    }
}
