/* style.css */
body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: #1a1a1a;
    color: #f0f0f0;
}

#app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Левая панель */
#left-panel {
    flex: 0 0 300px;
    min-width: 280px;
    max-width: 340px;
    background-color: #1f1f1f;
    border-right: 2px solid #404040;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.left-panel-header {
    padding: 16px;
    background-color: #171717;
    border-bottom: 2px solid #404040;
}

.left-panel-header h2 {
    margin: 0;
    font-size: 1.15rem;
    color: #3b82f6;
}

.region-label {
    color: #9ca3af;
    font-size: 0.85rem;
    margin-top: 4px;
}

.ws-status {
    margin-top: 8px;
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 4px;
    display: block;
    width: 100%;
    box-sizing: border-box;
    line-height: 1.25;
    min-height: 26px;
}

.map-sync-row {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    min-height: 28px;
    height: 28px;
}

.map-sync-status {
    flex: 1;
    min-width: 0;
    font-size: 0.75rem;
    color: #94a3b8;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(148, 163, 184, 0.1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    box-sizing: border-box;
}

.map-sync-status.syncing {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
}

.map-sync-status.ok {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
}

.map-sync-status.error {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
}

.map-sync-btn {
    border: none;
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0;
}

.map-sync-btn:hover {
    background: rgba(99, 102, 241, 0.35);
    color: #e0e7ff;
}

.map-sync-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ws-status-connected {
    color: #10b981;
    background: rgba(16, 185, 129, 0.12);
}

.ws-status-connecting {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
}

.ws-status-disconnected {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
}

.left-panel-tabs {
    display: none;
}

.nav-tree {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    border-bottom: 1px solid #404040;
    background: #171717;
    flex-shrink: 0;
}

.nav-tree-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #cbd5e1;
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
}

.nav-tree-item:hover {
    background: rgba(59, 130, 246, 0.15);
}

.nav-tree-item.active {
    background: rgba(59, 130, 246, 0.28);
    color: #f8fafc;
    font-weight: 600;
}

.nav-tree-item.role-hidden {
    display: none;
}

.left-nav-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.nav-panel {
    display: none;
}

.nav-panel.active {
    display: block;
}

.nav-panel.role-hidden {
    display: none !important;
}

.nav-panel-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 6px;
    color: #e2e8f0;
}

.nav-panel-desc {
    font-size: 0.78rem;
    color: #94a3b8;
    margin: 0 0 10px;
}

.center-user-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding: 6px 8px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 6px;
    font-size: 0.78rem;
    min-height: 40px;
    box-sizing: border-box;
}

.center-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.center-user-role {
    color: #94a3b8;
    font-size: 0.72rem;
}

.center-logout-btn {
    background: transparent;
    border: 1px solid #475569;
    color: #e2e8f0;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
}

#center-login-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
}

#center-login-overlay.hidden {
    display: none;
}

.center-login-card {
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 12px;
    padding: 24px;
    width: min(360px, 92vw);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.center-login-card h2 {
    margin: 0;
    font-size: 1.1rem;
}

.center-login-card label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    color: #cbd5e1;
}

.center-login-card input {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #475569;
    background: #0f172a;
    color: #f8fafc;
}

.center-login-error {
    color: #f87171;
    font-size: 0.8rem;
    min-height: 1em;
}

.left-panel-tabs,
.left-tab-btn {
    display: none !important;
}

.setting-label-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setting-label-stack span {
    font-size: 0.88rem;
    color: #e2e8f0;
}

.setting-block {
    margin-bottom: 12px;
    padding: 12px;
    background-color: #333;
    border-radius: 6px;
}

.setting-block-highlight {
    border: 1px solid #2563eb;
    background-color: #2a3344;
}

.left-panel-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px;
    scrollbar-gutter: stable;
}

.left-panel-body::-webkit-scrollbar {
    width: 10px;
}

.left-panel-body::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 5px;
}

.left-panel-body::-webkit-scrollbar-track {
    background: #262626;
}

.left-tab-panel {
    display: none;
}

.left-tab-panel.active {
    display: block;
}

.setting-label {
    display: block;
    color: #d1d5db;
    font-size: 0.88rem;
    line-height: 1.5;
}

.setting-input {
    padding: 4px 6px;
    margin: 6px 4px 0 0;
    background: #444;
    color: white;
    border: 1px solid #555;
    border-radius: 4px;
}

.setting-input-sm {
    width: 56px;
}

.setting-input-md {
    width: 68px;
}

.setting-hint {
    font-size: 0.78rem;
    color: #9ca3af;
    margin-top: 6px;
    line-height: 1.35;
}

.action-btn-full {
    width: 100%;
    margin-bottom: 10px;
    text-align: left;
    font-size: 0.82rem;
    padding: 10px 12px;
}

#map-section {
    flex: 1;
    min-width: 0;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    background-color: #333;
}

.map-blur {
    filter: blur(2px);
    transition: filter 0.3s ease;
}

.map-controls {
    position: absolute;
    top: 20px;
    left: 50px;
    z-index: 1000;
    display: flex;
    gap: 10px;
}

.control-btn {
    background-color: #2563eb;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    transition: background-color 0.2s;
}

.control-btn:hover {
    background-color: #1d4ed8;
}

.control-btn.drone-btn {
    background-color: #dc2626;
}

.control-btn.drone-btn:hover {
    background-color: #b91c1c;
}

#panel-section {
    flex: 0 0 34%;
    min-width: 300px;
    max-width: 480px;
    background-color: #262626;
    border-left: 2px solid #404040;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 16px 20px;
    background-color: #171717;
    border-bottom: 2px solid #404040;
    flex-shrink: 0;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #3b82f6;
}

.panel-content {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    overflow-y: auto;
}

/* === Панель обстановки (вкладки МОГ / БПЛА / Лог) === */
.situation-toolbar {
    padding: 8px 12px 0;
    flex-shrink: 0;
}

.situation-filter {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px solid #4b5563;
    background: #1f1f1f;
    color: #e5e7eb;
    font-size: 0.85rem;
}

.situation-filter:focus {
    outline: none;
    border-color: #3b82f6;
}

.situation-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    flex-shrink: 0;
    border-bottom: 1px solid #404040;
}

.situation-tab {
    flex: 1;
    padding: 8px 6px;
    border: none;
    border-radius: 6px 6px 0 0;
    background: #333;
    color: #9ca3af;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.situation-tab:hover {
    background: #404040;
    color: #e5e7eb;
}

.situation-tab.active {
    background: #3b82f6;
    color: #fff;
}

.situation-count {
    display: inline-block;
    min-width: 1.2em;
    padding: 0 5px;
    margin-left: 2px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.25);
    font-size: 0.75rem;
}

.situation-panels {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.situation-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.situation-panel.active {
    display: flex;
}

.situation-bulk {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 8px 12px;
    background: #1f1f1f;
    border-bottom: 1px solid #404040;
    flex-shrink: 0;
    font-size: 0.78rem;
}

.situation-bulk-label {
    color: #9ca3af;
    font-weight: 600;
}

.situation-bulk-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #d1d5db;
    cursor: pointer;
    user-select: none;
}

.situation-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px 12px;
    min-height: 0;
}

.situation-empty {
    color: #9ca3af;
    font-style: italic;
    font-size: 0.85rem;
    padding: 8px 4px;
}

.situation-status-group {
    margin-bottom: 10px;
}

.situation-status-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 6px 8px;
    margin-bottom: 4px;
    border: 1px solid #4b5563;
    border-radius: 6px;
    background: #383838;
    color: #e5e7eb;
    font-size: 0.8rem;
    cursor: pointer;
    text-align: left;
}

.situation-status-group-header:hover {
    background: #424242;
}

.situation-group-chevron {
    flex-shrink: 0;
    width: 14px;
    color: #9ca3af;
    font-size: 0.75rem;
}

.situation-group-status {
    flex: 1;
    font-size: 0.72rem !important;
}

.situation-group-count {
    flex-shrink: 0;
    min-width: 1.4rem;
    padding: 1px 6px;
    border-radius: 10px;
    background: #1f2937;
    color: #d1d5db;
    font-size: 0.72rem;
    text-align: center;
}

.situation-status-group-body .situation-card:last-child {
    margin-bottom: 0;
}

.situation-status-group.collapsed .situation-status-group-body {
    display: none;
}

.situation-card {
    background: #404040;
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 5px;
    border-left: 3px solid #3b82f6;
    font-size: 0.8rem;
    line-height: 1.35;
}

.situation-card.drone-card {
    border-left-color: #dc2626;
}

.situation-card.item-card-drift {
    border-left-color: #f59e0b;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.15) 0%, #404040 50%);
}

.situation-card.situation-card-resource-low {
    border-left-color: #ea580c;
    background: linear-gradient(90deg, rgba(251, 146, 60, 0.28) 0%, rgba(251, 146, 60, 0.1) 42%, #404040 100%);
}

.situation-card.situation-card-resource-low.item-card-drift {
    border-left-color: #ea580c;
    background: linear-gradient(90deg, rgba(251, 146, 60, 0.32) 0%, rgba(245, 158, 11, 0.12) 55%, #404040 100%);
}

.mog-resource-badge {
    flex-shrink: 0;
    font-size: 0.72rem;
    line-height: 1;
    margin-right: 2px;
}

.mog-resource-block-hint {
    color: #fdba74;
    font-size: 0.78rem;
    margin: 4px 0 6px;
    line-height: 1.35;
}

.situation-card-head {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.situation-expand-btn {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    font-size: 0.7rem;
    line-height: 1;
}

.situation-card.expanded .situation-expand-btn {
    transform: rotate(90deg);
}

.situation-card-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    color: #f3f4f6;
}

.situation-card-meta {
    color: #9ca3af;
    font-size: 0.72rem;
    margin: 2px 0 4px 24px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.situation-card-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: 20px;
}

.layer-chip {
    min-width: 28px;
    height: 26px;
    padding: 0 6px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #2f2f2f;
    color: #6b7280;
    font-size: 0.85rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.55;
    transition: opacity 0.15s, border-color 0.15s, background 0.15s;
}

.layer-chip.on {
    opacity: 1;
    border-color: #3b82f6;
    background: #1e3a5f;
    color: #e5e7eb;
}

.layer-chip.center-chip {
    border-color: #4b5563;
    opacity: 1;
    background: #374151;
}

.layer-chip.center-chip:hover {
    border-color: #60a5fa;
    background: #1e40af;
}

.situation-card-details {
    display: none;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #555;
    font-size: 0.78rem;
    color: #d1d5db;
}

.situation-card.expanded .situation-card-details {
    display: block;
}

.situation-card-details .item-actions {
    margin-top: 6px;
}

.situation-log-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #1f1f1f;
    border-bottom: 1px solid #404040;
    flex-shrink: 0;
}

.situation-log-clear {
    padding: 4px 10px;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

.situation-log-clear:hover {
    background: #b91c1c;
}

.situation-log,
#log-container.situation-log {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    min-height: 0;
    font-size: 0.78rem;
}

.section-box {
    background-color: #333;
    border-radius: 6px;
    padding: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    transition: all 0.2s ease;
}

.section-title {
    font-size: 1.1rem;
    margin-top: 0;
    margin-bottom: 8px;
    color: #9ca3af;
    border-bottom: 1px solid #4b5563;
    padding-bottom: 3px;
}

.item-card {
    background-color: #404040;
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 6px;
    border-left: 3px solid #3b82f6;
    font-size: 0.85rem;
    line-height: 1.3;
}

.item-card.drone-card {
    border-left-color: #dc2626;
}

.item-card.item-card-drift {
    border-left-color: #f59e0b;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.18) 0%, #404040 45%);
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.35);
    cursor: pointer;
}

.item-card.item-card-drift:hover {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.28) 0%, #454545 45%);
}

.drift-warning {
    color: #fbbf24;
    font-size: 0.8rem;
    margin-top: 4px;
    font-weight: 600;
}

.gps-spike-warning {
    color: #f87171;
    font-size: 0.8rem;
    margin-top: 4px;
    font-weight: 600;
}

.connectivity-online {
    color: #4ade80;
}

.connectivity-offline {
    color: #f87171;
}

.connections-entry {
    background: #2f2f2f;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-left: 3px solid #3b82f6;
}

.connections-entry.is-online {
    border-left-color: #22c55e;
}

.connections-entry.is-offline {
    border-left-color: #6b7280;
}

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

.connections-entry-title {
    font-weight: 700;
    color: #fff;
    flex: 1;
}

.btn-revoke-mog-session {
    flex-shrink: 0;
    padding: 4px 8px;
    font-size: 0.7rem;
    background: #7f1d1d;
    color: #fecaca;
    border: 1px solid #dc2626;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-revoke-mog-session:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.connections-devices {
    margin-top: 8px;
    padding-left: 12px;
    border-left: 2px solid #4b5563;
    color: #d1d5db;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.item-title {
    font-weight: bold;
    font-size: 1.0rem;
}

.item-status {
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 3px;
    background-color: #10b981;
    color: white;
}

.item-status.busy {
    background-color: #f59e0b;
}

.item-status.pending {
    background-color: #d97706;
}

.item-status.offline {
    background-color: #6b7280;
}

.item-details {
    color: #d1d5db;
    line-height: 1.3;
}

.item-actions {
    margin-top: 6px;
    display: flex;
    gap: 5px;
}

.action-btn {
    background-color: transparent;
    color: #9ca3af;
    border: 1px solid #6b7280;
    padding: 3px 6px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.2s;
}

.action-btn:hover {
    color: white;
    border-color: #9ca3af;
    background-color: #4b5563;
}

.decision-log-empty {
    color: #6b7280;
    font-style: italic;
    text-align: center;
    padding: 24px 12px;
    font-size: 0.85rem;
}

.log-entry.decision-success .log-main,
.log-entry.decision-fail .log-main,
.log-entry.decision-order .log-main,
.log-entry.decision-warn .log-main {
    font-weight: 600;
}

#log-container {
    flex: 1;
    overflow-y: auto;
    background-color: #171717;
    padding: 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
    min-height: 0;
    box-sizing: border-box;
}

.log-entry {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #333;
}

.log-time {
    color: #60a5fa;
    font-weight: bold;
}

.log-main {
    margin: 3px 0;
    color: #f3f4f6;
}

.log-details {
    color: #9ca3af;
    font-size: 0.7rem;
    padding-left: 8px;
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    background-color: #333;
    border-radius: 4px;
    margin-bottom: 6px;
    user-select: none;
}

.collapsible-header:hover {
    background-color: #404040;
}

.collapsible-content {
    max-height: 500px;
    overflow-y: auto;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 0 8px 0;
}

.collapsible-content.closed {
    max-height: 0;
    padding: 0;
    overflow: hidden;
}

.arrow-icon {
    transition: transform 0.2s ease;
}

.arrow-icon.open {
    transform: rotate(90deg);
}

.animate-log {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Подсветка приоритета дронов */
.drone-priority-critical {
    border-left-color: #ef4444;
}

.drone-priority-high {
    border-left-color: #f97316;
}

.drone-priority-medium {
    border-left-color: #eab308;
}

.drone-priority-low {
    border-left-color: #84cc16;
}

/* Эффект мерцания при обработке */
@keyframes pulse {
    0%, 100% {
        filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.3));
    }
    50% {
        filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
    }
}

.processing-flash {
    animation: pulse 1.5s ease-in-out;
}

#edit-mog-modal button {
    pointer-events: auto;
}

/* Вкладки модального окна перехвата */
.intercept-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid #404040;
    padding-bottom: 8px;
}

.intercept-tab-btn {
    flex: 1;
    padding: 8px 12px;
    background: #262626;
    color: #9ca3af;
    border: 1px solid #404040;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.intercept-tab-btn.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.intercept-tab-panel {
    display: none;
    max-height: 55vh;
    overflow-y: auto;
}

.intercept-tab-panel.active {
    display: block;
}

.intercept-info-block {
    margin-bottom: 15px;
    padding: 10px;
    background: #262626;
    border-radius: 6px;
}

.intercept-route-steps {
    list-style: none;
    padding: 0;
    margin: 0;
}

.intercept-route-steps li {
    padding: 8px 0;
    border-bottom: 1px solid #404040;
    font-size: 0.88rem;
}

.intercept-route-steps li:last-child {
    border-bottom: none;
}

.intercept-route-step-num {
    display: inline-block;
    min-width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    background: #2563eb;
    color: #fff;
    border-radius: 50%;
    font-size: 0.75rem;
    margin-right: 8px;
}

.item-status.pending {
    background: #d97706;
    color: #fff;
}

.intercept-highlight {
    color: #fbbf24;
    font-weight: bold;
}

.composition-section-title {
    color: #fff;
    font-size: 0.95rem;
    margin: 16px 0 8px;
    border-bottom: 1px solid #404040;
    padding-bottom: 4px;
}

.composition-row,
.composition-crew-grid .composition-row,
.composition-drone-row,
.composition-user-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.composition-row input[type="text"],
.composition-user-row input[type="text"],
.composition-user-row input[type="password"],
.composition-row select,
.composition-user-row select {
    flex: 1;
    min-width: 100px;
    padding: 6px;
    background: #444;
    border: 1px solid #555;
    color: #fff;
    border-radius: 4px;
}

.composition-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.composition-hint {
    color: #9ca3af;
    font-size: 0.82rem;
    margin: 0 0 8px;
}

.composition-vehicle-hint {
    color: #9ca3af;
    font-size: 0.82rem;
    margin-top: 6px;
}

.composition-weapons-list {
    margin: 6px 0 10px;
}

.composition-weapon-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    padding: 8px 10px;
    background: #3a3a3a;
    border: 1px solid #4b5563;
    border-radius: 6px;
}

.composition-weapon-name {
    flex: 1;
    min-width: 120px;
    color: #f3f4f6;
}

.composition-weapon-add {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.composition-weapon-add select {
    flex: 1;
    min-width: 160px;
    padding: 6px;
    background: #444;
    border: 1px solid #555;
    color: #fff;
    border-radius: 4px;
}

.composition-weapons-empty {
    color: #9ca3af;
    font-size: 0.85rem;
    margin-bottom: 8px;
    font-style: italic;
}

.composition-origin-tag {
    color: #9ca3af;
    font-size: 0.8rem;
}

.composition-min-hint {
    color: #9ca3af;
    font-size: 0.78rem;
}

.composition-users-list {
    margin: 6px 0;
    padding-left: 1.2rem;
    color: #d1d5db;
}

.mog-status-modal {
    display: flex;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    border: 1px solid #404040;
}

.mog-status-content {
    margin-top: 12px;
}

.mog-status-section {
    margin-bottom: 14px;
    padding: 12px;
    background: #333;
    border-radius: 6px;
}

.mog-status-section h4 {
    margin: 0 0 8px;
    font-size: 0.82rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mog-status-row {
    padding: 4px 0;
    line-height: 1.45;
}

.mog-status-list {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.mog-status-list li {
    padding: 6px 0;
    border-bottom: 1px solid #404040;
}

.mog-status-list li:last-child {
    border-bottom: none;
}

.orders-reports-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(920px, 94vw);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 16px 18px;
    background: #2a2a2a;
    border: 1px solid #404040;
}

.orders-reports-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.orders-reports-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #333;
    border-radius: 6px;
    border: 1px solid #404040;
}

.or-filter-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #d1d5db;
    font-size: 0.85rem;
}

.or-filter-input {
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #555;
    background: #1f1f1f;
    color: #f3f4f6;
    font-size: 0.85rem;
}

.or-filter-hint {
    flex: 1 1 100%;
    font-size: 0.78rem;
    color: #9ca3af;
    margin-top: 2px;
}

.catalog-admin-page {
    margin: 0;
    min-height: 100vh;
    background: #1a1a1a;
    color: #e5e7eb;
    font-family: Arial, sans-serif;
    padding: 16px 20px 24px;
    box-sizing: border-box;
}

.catalog-admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #404040;
}

.catalog-admin-header h1 {
    margin: 0 0 4px;
    font-size: 1.25rem;
    color: #fff;
}

.catalog-admin-subtitle {
    margin: 0;
    color: #9ca3af;
    font-size: 0.85rem;
}

.catalog-admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.catalog-admin-tabs {
    display: flex;
    gap: 8px;
    flex: 1;
}

.catalog-admin-tab {
    flex: 1;
    max-width: 220px;
    padding: 10px 14px;
    background: #404040;
    border: 1px solid #555;
    color: #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88rem;
}

.catalog-admin-tab.active {
    background: #b45309;
    border-color: #d97706;
    color: #fff;
}

.catalog-tab-panel {
    display: none;
}

.catalog-tab-panel.active {
    display: block;
}

.catalog-tab-actions {
    margin-bottom: 10px;
}

.catalog-table-wrap {
    max-height: calc(100vh - 200px);
}

.catalog-table-wrap .or-table {
    font-size: 0.78rem;
}

.catalog-table-wrap .or-table th,
.catalog-table-wrap .or-table td {
    white-space: nowrap;
    padding: 6px 8px;
}

.catalog-edit-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 3000;
}

.catalog-edit-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3001;
    width: min(520px, 96vw);
    max-height: 90vh;
    overflow: auto;
    background: #333;
    border: 1px solid #555;
    border-radius: 8px;
    padding: 16px 18px;
}

.catalog-edit-title {
    margin: 0 0 12px;
    color: #fff;
    font-size: 1rem;
}

.catalog-edit-form {
    display: grid;
    gap: 10px;
}

.catalog-edit-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.82rem;
    color: #d1d5db;
}

.catalog-edit-form input,
.catalog-edit-form select {
    padding: 7px 8px;
    background: #444;
    border: 1px solid #555;
    color: #fff;
    border-radius: 4px;
    font-size: 0.88rem;
}

.catalog-edit-form label.catalog-check-row {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.catalog-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.or-link-danger {
    color: #f87171;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    font-size: inherit;
    padding: 0;
}

.orders-reports-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.orders-reports-tab {
    flex: 1;
    padding: 8px 12px;
    background: #404040;
    border: 1px solid #555;
    color: #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.orders-reports-tab.active {
    background: #0ea5e9;
    border-color: #0284c7;
    color: #fff;
}

.or-badge {
    display: inline-block;
    min-width: 18px;
    padding: 0 6px;
    margin-left: 4px;
    background: #f59e0b;
    color: #111;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
}

.or-list-wrap {
    max-height: 52vh;
    overflow: auto;
    border: 1px solid #404040;
    border-radius: 6px;
    background: #1f1f1f;
}

.or-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.or-table th,
.or-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #333;
    text-align: left;
    color: #e5e7eb;
}

.or-table th {
    position: sticky;
    top: 0;
    background: #333;
    color: #9ca3af;
    font-weight: 600;
}

.or-table tr:hover td {
    background: #2a2a2a;
}

.or-empty {
    padding: 24px;
    color: #9ca3af;
    text-align: center;
}

.or-link {
    background: none;
    border: none;
    color: #38bdf8;
    cursor: pointer;
    padding: 0;
    font-size: inherit;
    text-decoration: underline;
}

.or-status-pending {
    color: #fbbf24;
}

.or-status-approved {
    color: #34d399;
}

.report-detail-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(1180px, 96vw);
    height: min(88vh, 860px);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 16px 18px;
    background: #2a2a2a;
    border: 1px solid #404040;
}

.report-detail-header {
    flex-shrink: 0;
    margin-bottom: 12px;
}

.report-detail-id {
    font-family: ui-monospace, monospace;
    font-size: 0.82em;
    color: #93c5fd;
    word-break: break-all;
}

.report-section-title {
    font-weight: 700;
    color: #f3f4f6;
    margin-bottom: 8px;
    font-size: 0.92rem;
}

.report-order-subtitle {
    margin-top: 10px;
    margin-bottom: 4px;
    font-weight: 600;
    color: #d1d5db;
    font-size: 0.85rem;
}

.report-order-section {
    border-left: 3px solid #3b82f6;
}

.report-detail-body {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 14px;
}

.report-detail-left {
    flex: 0 0 42%;
    overflow-y: auto;
    color: #e5e7eb;
    line-height: 1.5;
    font-size: 0.88rem;
}

.report-detail-map-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.report-detail-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 280px;
}

.report-detail-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.report-detail-tab {
    flex: 1;
    padding: 8px 12px;
    background: #404040;
    border: 1px solid #555;
    color: #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.report-detail-tab.active {
    background: #0ea5e9;
    border-color: #0284c7;
    color: #fff;
}

.report-detail-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.report-detail-panel-active {
    display: flex;
}

.report-detail-audit-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding-right: 4px;
    color: #e5e7eb;
    font-size: 0.88rem;
    line-height: 1.5;
}

.report-detail-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    font-size: 0.8rem;
    color: #d1d5db;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.report-detail-map {
    flex: 1;
    min-height: 240px;
    border-radius: 6px;
    border: 1px solid #404040;
    background: #1a1a1a;
}

.report-detail-map-hint {
    margin: 6px 0 0;
    font-size: 0.78rem;
    color: #9ca3af;
    flex-shrink: 0;
}

.report-mog-comment {
    white-space: pre-wrap;
    word-break: break-word;
    color: #e5e7eb;
    background: #333;
    border-left: 3px solid #6366f1;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 0.88rem;
    line-height: 1.45;
}

.report-detail-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid #404040;
    flex-shrink: 0;
}

.report-detail-section {
    margin-bottom: 12px;
    padding: 12px;
    background: #333;
    border-radius: 6px;
}

.report-resources-after-section {
    border-left: 3px solid #ea580c;
    background: linear-gradient(90deg, rgba(251, 146, 60, 0.12) 0%, #333 55%);
}

.report-resources-hint {
    margin: 0 0 8px;
    font-size: 0.78rem;
    color: #9ca3af;
    line-height: 1.35;
}

.report-resources-after-section > div {
    margin-bottom: 4px;
}

.report-resources-after-section > div:last-child {
    margin-bottom: 0;
}

.report-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.report-photos img {
    max-width: 140px;
    max-height: 100px;
    border-radius: 4px;
    border: 1px solid #555;
    cursor: pointer;
}

.legend-line {
    display: inline-block;
    width: 22px;
    height: 4px;
    border-radius: 2px;
    vertical-align: middle;
    margin-right: 4px;
}

.legend-planned {
    background: #22c55e;
}

.legend-actual {
    background: #3b82f6;
}

.order-detail-modal {
    max-width: 920px;
    width: min(96vw, 920px);
    max-height: 92vh;
}

.order-detail-body {
    overflow: auto;
    max-height: calc(92vh - 120px);
    padding-right: 4px;
}

.order-detail-content {
    font-size: 0.9rem;
    line-height: 1.45;
}

.order-audit-list {
    margin: 8px 0 0;
    padding-left: 1.2rem;
}

.order-audit-list li {
    margin-bottom: 6px;
}

.order-calc-log {
    max-height: 280px;
    overflow: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
}

.order-calc-log-entry {
    padding: 4px 0;
    border-bottom: 1px solid #404040;
}

.order-calc-log-entry.log-ok {
    color: #86efac;
}

.order-calc-log-entry.log-warn {
    color: #fcd34d;
}

.order-calc-log-ts {
    color: #9ca3af;
    margin-right: 8px;
}

.order-audit-table {
    font-size: 0.82rem;
    margin-top: 8px;
}

.order-audit-selected {
    background: rgba(34, 197, 94, 0.12);
}

.order-matrix-best {
    background: rgba(59, 130, 246, 0.2);
    font-weight: 600;
}

.order-params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px 16px;
}

.order-events-timeline {
    font-size: 0.85rem;
}

.order-event-row {
    padding: 4px 0;
    border-bottom: 1px solid #404040;
}

.order-event-time {
    color: #9ca3af;
    margin-right: 10px;
}


.composition-min-hint {
    color: #9ca3af;
    font-size: 0.75rem;
    margin-left: 6px;
}

.composition-origin-tag {
    font-size: 0.7rem;
    color: #6b7280;
    margin-left: 4px;
}

.composition-resource-alert {
    background: #451a1a;
    border: 1px solid #b91c1c;
    color: #fecaca;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 0.88rem;
}

.composition-fuel-hint {
    color: #9ca3af;
    font-size: 0.78rem;
    margin: 4px 0 8px;
}

.composition-replenish-row {
    display: block;
    margin-top: 14px;
    padding: 10px;
    background: #1e293b;
    border-radius: 6px;
    color: #fde68a;
}

.mog-status-empty {
    color: #9ca3af;
    font-style: italic;
    font-size: 0.85rem;
}

.mog-status-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.intercept-modal-wide {
    max-height: 90vh;
    overflow: hidden;
}

/* Чат Центр ↔ МОГ */
.chat-actions-block {
    margin: 12px 0;
    padding: 12px;
    background: linear-gradient(160deg, #1e3a5f 0%, #1e293b 100%);
    border: 1px solid #3b82f6;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.chat-actions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.chat-actions-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: 0.01em;
}

.chat-actions-sub {
    margin: 0 0 10px;
    font-size: 0.75rem;
    color: #93c5fd;
}

.chat-unread-badge {
    background: #f43f5e;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(244, 63, 94, 0.4);
}

.chat-participants-sidebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 10px;
    max-height: 220px;
    overflow-y: auto;
}

.chat-peers-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chat-peer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 8px 10px;
    background: #0f172a;
    border-radius: 8px;
    border: 1px solid #475569;
    cursor: pointer;
    font-size: 0.8rem;
    color: #f1f5f9;
    text-align: left;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    min-width: 0;
}

.chat-participants-sidebar .chat-peer-row {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 8px 6px;
}

.chat-float-peers .chat-peer-row {
    flex: 1 1 auto;
    min-width: 88px;
    max-width: 100%;
}

.chat-peer-row:hover {
    border-color: #60a5fa;
    background: #1e293b;
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.25);
}

.chat-peer-row.active {
    border-color: #38bdf8;
    background: #1d4ed8;
    box-shadow: 0 2px 8px rgba(29, 78, 216, 0.45);
    color: #fff;
}

.chat-peer-row.active .chat-peer-id {
    color: #dbeafe;
}

.chat-peer-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    color: inherit;
}

.chat-peer-id {
    font-size: 0.68rem;
    color: #94a3b8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-peer-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
}

.chat-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.7);
    flex-shrink: 0;
}

.chat-open-btn {
    background: linear-gradient(135deg, #2563eb, #4f46e5) !important;
    border: 1px solid #60a5fa;
    color: #fff !important;
    font-weight: 700;
}

.chat-open-btn:hover {
    filter: brightness(1.08);
}

.chat-float {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: min(520px, calc(100vw - 48px));
    height: min(540px, calc(100vh - 80px));
    display: flex;
    flex-direction: column;
    background: #0f172a;
    border: 1px solid #3b82f6;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(59, 130, 246, 0.2);
    z-index: 9000;
    overflow: hidden;
}

.chat-float.hidden {
    display: none;
}

.chat-float.minimized .chat-float-body {
    display: none;
}

.chat-float.minimized {
    height: auto;
    width: min(340px, calc(100vw - 48px));
}

.chat-float-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: linear-gradient(90deg, #1e40af, #312e81);
    border-bottom: 1px solid #3b82f6;
    cursor: move;
    user-select: none;
}

.chat-float-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #f8fafc;
}

.chat-float-controls {
    display: flex;
    gap: 6px;
}

.chat-ctrl-btn {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.35);
    color: #f8fafc;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.chat-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

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

.chat-float-peers {
    flex: 0 0 auto;
    padding: 8px 10px;
    border-bottom: 1px solid #334155;
    background: #1e293b;
    max-height: 110px;
    overflow-y: auto;
}

.chat-float-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: #0f172a;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #111827;
}

.chat-msg {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.4;
    word-break: break-word;
    color: #f9fafb;
}

.chat-msg.incoming {
    align-self: flex-start;
    background: #334155;
    border: 1px solid #475569;
    border-bottom-left-radius: 4px;
}

.chat-msg.outgoing {
    align-self: flex-end;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    border: 1px solid #60a5fa;
    border-bottom-right-radius: 4px;
}

.chat-msg-meta {
    font-size: 0.7rem;
    color: #cbd5e1;
    margin-bottom: 4px;
}

.chat-msg.outgoing .chat-msg-meta {
    color: #dbeafe;
}

.chat-msg-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.chat-msg-attachments img {
    max-width: 120px;
    max-height: 120px;
    border-radius: 6px;
    cursor: pointer;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-send-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #334155;
    background: #1e293b;
}

.chat-image-label {
    cursor: pointer;
    font-size: 1.25rem;
    padding: 6px;
    border-radius: 6px;
    background: #334155;
    line-height: 1;
}

.chat-image-label:hover {
    background: #475569;
}

.chat-image-hint {
    font-size: 0.72rem;
    color: #93c5fd;
    flex: 1 1 100%;
}

.chat-text-input {
    flex: 1;
    min-width: 120px;
    resize: vertical;
    max-height: 80px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #475569;
    background: #0f172a;
    color: #f8fafc;
    font-family: inherit;
    font-size: 0.88rem;
}

.chat-text-input::placeholder {
    color: #94a3b8;
}

.chat-text-input:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.25);
}

.chat-send-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.85rem;
}

.chat-send-btn:hover {
    filter: brightness(1.08);
}

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

.chat-empty-hint {
    color: #94a3b8;
    font-size: 0.82rem;
    text-align: center;
    padding: 14px 10px;
    line-height: 1.45;
    grid-column: 1 / -1;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 8px;
    border: 1px dashed #475569;
}

.chat-empty-hint strong {
    color: #e2e8f0;
    font-weight: 600;
}

/* Плавающая карточка оркестрации перехвата */
#engagement-float-panel {
    display: none;
    position: fixed;
    z-index: 12000;
    width: min(640px, 92vw);
    max-height: 85vh;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid #3b82f6;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    color: #e2e8f0;
    font-size: 0.88rem;
}

#engagement-float-panel.visible {
    display: flex;
    flex-direction: column;
}

.engagement-float-header {
    cursor: move;
    user-select: none;
    padding: 10px 12px;
    background: linear-gradient(90deg, #1e3a8a, #1e40af);
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.engagement-float-close {
    background: transparent;
    border: none;
    color: #93c5fd;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 4px;
}

.engagement-float-body {
    padding: 10px 12px 12px;
    overflow-y: auto;
}

.engagement-candidate-row {
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
    background: rgba(30, 41, 59, 0.7);
}

.engagement-candidate-row.leader {
    border-color: #f59e0b;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.35);
}

.engagement-candidate-row .prob-bar {
    height: 6px;
    background: #1e293b;
    border-radius: 3px;
    margin: 6px 0;
    overflow: hidden;
}

.engagement-candidate-row .prob-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #22c55e);
    border-radius: 3px;
}

.engagement-assign-mog-btn {
    width: 100%;
    margin-top: 6px;
    padding: 6px 8px;
    border: none;
    border-radius: 6px;
    background: #f59e0b;
    color: #111;
    font-weight: 700;
    cursor: pointer;
}

.engagement-assign-mog-btn:hover {
    background: #fbbf24;
}

.engagement-calc-params {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 10px;
    font-size: 0.8rem;
    line-height: 1.45;
}

.engagement-calc-params-title,
.engagement-calc-log-title,
.engagement-calc-results-title {
    font-weight: 700;
    color: #93c5fd;
    margin-bottom: 6px;
    font-size: 0.82rem;
}

.engagement-calc-log-wrap {
    max-height: 160px;
    overflow-y: auto;
    margin-bottom: 10px;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 6px 8px;
    background: rgba(15, 23, 42, 0.6);
}

.engagement-calc-log-line {
    font-size: 0.78rem;
    line-height: 1.35;
    padding: 3px 0;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.engagement-calc-log-line:last-child {
    border-bottom: none;
}

.engagement-calc-log-line .log-ts {
    color: #64748b;
    margin-right: 6px;
    font-variant-numeric: tabular-nums;
}

.engagement-calc-log-line.log-ok {
    color: #86efac;
}

.engagement-calc-log-line.log-warn {
    color: #fcd34d;
}

.engagement-calc-log-empty {
    color: #94a3b8;
    font-size: 0.78rem;
    font-style: italic;
}

.engagement-calc-results-title {
    margin-top: 4px;
}

.engagement-calc-panel-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.engagement-matrix-scroll {
    overflow: auto;
    max-height: 340px;
    border: 1px solid #334155;
    border-radius: 8px;
    margin-top: 6px;
}

.engagement-matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
}

.engagement-matrix-table th,
.engagement-matrix-table td {
    border: 1px solid #334155;
    padding: 6px 8px;
    vertical-align: top;
    text-align: center;
}

.engagement-matrix-table thead th {
    background: #1e3a8a;
    color: #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 2;
}

.matrix-point-col {
    text-align: left !important;
    min-width: 130px;
    background: rgba(30, 41, 59, 0.95);
    position: sticky;
    left: 0;
    z-index: 1;
}

.matrix-mog-col {
    min-width: 100px;
}

.matrix-coords {
    font-weight: 600;
    color: #93c5fd;
    font-variant-numeric: tabular-nums;
}

.matrix-tdrone {
    color: #64748b;
    font-size: 0.68rem;
    margin-top: 2px;
}

.matrix-cell {
    background: rgba(15, 23, 42, 0.5);
}

.matrix-cell-empty {
    color: #475569;
}

.matrix-cell-ok {
    background: rgba(34, 197, 94, 0.12);
}

.matrix-cell-warn {
    background: rgba(245, 158, 11, 0.1);
}

.matrix-cell-best {
    outline: 2px solid #f59e0b;
    background: rgba(245, 158, 11, 0.18);
}

.matrix-row-centroid .matrix-point-col {
    border-left: 3px solid #22c55e;
    background: rgba(34, 197, 94, 0.12);
}

.matrix-cone {
    font-weight: 700;
    color: #fcd34d;
}

.matrix-times {
    color: #94a3b8;
    margin-top: 3px;
    line-height: 1.3;
}

.matrix-margin {
    color: #86efac;
    margin-top: 2px;
}

.engagement-matrix-decision {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
    font-size: 0.82rem;
}

.engagement-matrix-pick-hint {
    color: #94a3b8;
    font-size: 0.75rem;
}

.engagement-calc-progress-wrap {
    background: rgba(30, 41, 59, 0.75);
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 10px;
}

.engagement-calc-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: #cbd5e1;
    margin-bottom: 6px;
}

.engagement-calc-progress-head strong {
    color: #93c5fd;
    font-size: 0.85rem;
}

.engagement-calc-progress-bar {
    height: 8px;
    border-radius: 999px;
    background: #1e293b;
    overflow: hidden;
    border: 1px solid #334155;
}

.engagement-calc-progress-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb, #38bdf8);
    transition: width 0.45s ease;
}

.engagement-calc-progress-ready .engagement-calc-progress-fill {
    background: linear-gradient(90deg, #d97706, #fbbf24);
}

.engagement-calc-progress-ready .engagement-calc-progress-head strong {
    color: #fbbf24;
}

.engagement-matrix-legend {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
    font-size: 0.75rem;
    color: #cbd5e1;
}

.engagement-matrix-legend-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: #e2e8f0;
}

.engagement-matrix-legend ul {
    margin: 0;
    padding-left: 1.1rem;
}

.engagement-matrix-legend li {
    margin-bottom: 3px;
}

.matrix-dist {
    font-size: 0.72rem;
    color: #94a3b8;
}

.engagement-matrix-empty {
    color: #94a3b8;
    font-style: italic;
    padding: 12px 0;
}

.engagement-matrix-assign-bar {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #334155;
}

/* Легенда зон перехвата (левый нижний угол карты) */
.engagement-zone-legend {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.78rem;
    color: #e2e8f0;
    max-width: 280px;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.engagement-legend-title {
    font-weight: 600;
    margin-bottom: 6px;
    color: #f8fafc;
}

.engagement-legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    line-height: 1.3;
}

.engagement-legend-swatch {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid;
}

/* Настройки цветов оркестрации */
.engagement-color-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.engagement-color-row {
    display: grid;
    grid-template-columns: 1fr auto 72px;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.engagement-color-name {
    color: #cbd5e1;
}

.engagement-color-input {
    width: 36px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

.engagement-opacity-input {
    width: 72px;
}

/* Toast сохранения на сервере */
.center-save-toast {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10000;
    max-width: min(360px, calc(100vw - 32px));
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.center-save-toast-visible {
    opacity: 1;
    transform: translateY(0);
}

.center-save-toast-ok {
    background: #065f46;
    color: #ecfdf5;
    border: 1px solid #10b981;
}

.center-save-toast-err {
    background: #7f1d1d;
    color: #fef2f2;
    border: 1px solid #ef4444;
}

/* Параметры целераспределения: значение + цвет в одной строке */
.targeting-param-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #404040;
}

.targeting-param-fields {
    flex: 1;
    min-width: 0;
}

.targeting-param-colors {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.targeting-static-label {
    display: block;
    color: #e5e7eb;
    font-size: 0.85rem;
    font-weight: 600;
}

.targeting-param-row-static {
    align-items: center;
}

/* Фильтры МОГ на правой панели */
.situation-mog-filters {
    padding: 8px 10px;
    background: #1f1f1f;
    border-bottom: 1px solid #404040;
    flex-shrink: 0;
}

.situation-mog-filters-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #9ca3af;
    margin-bottom: 6px;
}

.situation-mog-filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.78rem;
    color: #d1d5db;
    margin-bottom: 6px;
}

.situation-save-filters {
    width: 100%;
    margin-top: 4px;
    padding: 6px 8px;
    font-size: 0.78rem;
    background: #2563eb;
    border: none;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
}

.situation-save-filters:hover {
    background: #1d4ed8;
}

.situation-layer-legend {
    padding: 6px 10px 4px;
    background: #2a2a2a;
    border-bottom: 1px solid #404040;
    flex-shrink: 0;
}

.situation-layer-legend-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #9ca3af;
    margin-bottom: 4px;
}

.situation-layer-legend-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 8px;
    font-size: 0.72rem;
    color: #cbd5e1;
}

.situation-layer-legend-grid b {
    font-weight: 700;
}

/* Текущие расчёты — плавающая панель и отдельная страница */
.current-calcs-float {
    position: fixed;
    left: 24px;
    bottom: 24px;
    width: min(960px, calc(100vw - 48px));
    height: min(720px, calc(100vh - 80px));
    display: flex;
    flex-direction: column;
    background: #1e293b;
    border: 1px solid #2563eb;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(37, 99, 235, 0.25);
    z-index: 8900;
    overflow: hidden;
}

.current-calcs-float.hidden {
    display: none;
}

.current-calcs-float-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: linear-gradient(90deg, #1e3a8a, #1e40af);
    border-bottom: 1px solid #3b82f6;
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}

.current-calcs-float-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f8fafc;
}

.current-calcs-float-head-text {
    min-width: 0;
}

.current-calcs-float-controls {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.current-calcs-ctrl-btn {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.35);
    color: #f8fafc;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.current-calcs-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.current-calcs-float-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 10px;
    gap: 10px;
}

.current-calcs-updated {
    color: #94a3b8;
    font-size: 0.78rem;
    margin-top: 4px;
}

.current-calcs-table-wrap {
    flex: 1;
    min-height: 140px;
    overflow: auto;
    border: 1px solid #4b5563;
    border-radius: 8px;
    background: #1f1f1f;
}

.current-calcs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.76rem;
    color: #e5e7eb;
}

.current-calcs-table th,
.current-calcs-table td {
    border: 1px solid #404040;
    padding: 6px 8px;
    vertical-align: top;
    text-align: center;
}

.current-calcs-mog-col,
.current-calcs-corner {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #374151;
    font-weight: 600;
    text-align: left;
    min-width: 88px;
}

.current-calcs-drone-col {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #333;
    font-weight: 600;
    min-width: 100px;
}

.current-calcs-corner {
    z-index: 3;
}

.current-calcs-cell-clickable {
    cursor: pointer;
}

.current-calcs-cell-clickable:hover {
    background: #3f3f46;
}

.current-calcs-cell-ok {
    background: rgba(34, 197, 94, 0.12);
}

.current-calcs-cell-warn {
    background: rgba(245, 158, 11, 0.12);
}

.current-calcs-cell-empty {
    color: #fbbf24;
    font-size: 0.72rem;
}

.current-calcs-cell-rec {
    box-shadow: inset 0 0 0 2px #f59e0b;
}

.current-calcs-cell-selected {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

.current-calcs-empty {
    padding: 24px;
    color: #9ca3af;
    text-align: center;
}

.current-calcs-detail {
    flex: 0 0 auto;
    max-height: 36%;
    min-height: 96px;
    overflow-y: auto;
    border: 1px solid #4b5563;
    border-radius: 8px;
    padding: 12px;
    background: #1a1a1a;
    font-size: 0.82rem;
    color: #e5e7eb;
}

.current-calcs-detail-empty {
    color: #9ca3af;
    font-style: italic;
}

.current-calcs-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.current-calcs-detail-state {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: #1e3a8a;
    color: #bfdbfe;
}

.current-calcs-detail-block {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
}

.current-calcs-detail-title {
    font-weight: 700;
    color: #93c5fd;
    margin-bottom: 4px;
}

.current-calcs-warn {
    color: #fbbf24;
}

.current-calcs-log-wrap {
    max-height: 180px;
    overflow-y: auto;
}

.current-calcs-log-line {
    margin: 2px 0;
    line-height: 1.35;
}

.current-calcs-log-ts {
    color: #6b7280;
    margin-right: 6px;
}

.current-calcs-log-warn {
    color: #fbbf24;
}

.current-calcs-log-ok {
    color: #86efac;
}

.current-calcs-open-panel-btn {
    margin-top: 8px;
}

/* Отдельная страница /current-calculations */
body.current-calcs-page {
    margin: 0;
    min-height: 100vh;
    background: #0f172a;
    color: #e2e8f0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.current-calcs-access-denied {
    max-width: 480px;
    margin: 80px auto;
    padding: 24px;
    text-align: center;
    color: #fca5a5;
}

.current-calcs-standalone-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.current-calcs-standalone-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 24px 12px;
    border-bottom: 1px solid #334155;
    background: #1e293b;
    flex-shrink: 0;
}

.current-calcs-standalone-header h1 {
    margin: 0 0 4px;
    font-size: 1.5rem;
    font-weight: 700;
}

.current-calcs-standalone-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.current-calcs-standalone-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 16px 24px 24px;
    gap: 12px;
}

.current-calcs-page .current-calcs-table-wrap {
    flex: 1;
    max-height: none;
}

.current-calcs-page .current-calcs-detail {
    max-height: 32vh;
}

.current-calcs-open-panel-btn {
    margin-top: 8px;
    width: 100%;
}

