:root {
    --bg-color: #0b0f19; --panel-bg: #111827; --text-main: #f8fafc;
    --text-muted: #94a3b8; --accent: #3b82f6; --danger: #ef4444;
    --border-color: #1e293b; --highlight: #1f2937;
}

* { box-sizing: border-box; }

body {
    margin: 0; font-family: 'SF Mono', Consolas, 'Liberation Mono', Courier, monospace; 
    background-color: var(--bg-color); color: var(--text-main);
    display: grid; grid-template-rows: 60fr 40fr; grid-template-columns: 100%;
    width: 100vw; height: 100dvh; overflow: hidden;
}

#top-section { position: relative; width: 100%; height: 100%; border-bottom: 1px solid var(--border-color); background: #000; min-height: 0; }
#map { position: absolute; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; z-index: 1; }

#map-layers-panel {
    position: absolute; top: 15px; left: 15px; background: rgba(17, 24, 39, 0.85);
    border: 1px solid var(--border-color); border-radius: 4px; padding: 15px;
    z-index: 1000; min-width: 220px; max-height: 85%; overflow-y: auto;
    backdrop-filter: blur(8px); font-size: 0.8rem;
}
.panel-title { font-size: 0.8em; color: var(--text-muted); margin-bottom: 15px; font-weight: bold; letter-spacing: 1px; }
.layer-toggle { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; cursor: pointer; color: #cbd5e1; }
.layer-toggle input { accent-color: #10b981; width: 14px; height: 14px; }

#map-legend {
    position: absolute; bottom: 15px; left: 50%; transform: translateX(-50%);
    background: rgba(17, 24, 39, 0.85); border: 1px solid var(--border-color);
    padding: 8px 20px; border-radius: 20px; z-index: 1000; display: flex; gap: 15px;
    font-size: 0.7rem; text-transform: uppercase; backdrop-filter: blur(8px); white-space: nowrap;
}
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.square { display: inline-block; width: 10px; height: 10px; }
.triangle { display: inline-block; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 10px solid #eab308; }

#bottom-section { display: grid; grid-template-columns: 35fr 30fr 35fr; width: 100%; height: 100%; background-color: var(--bg-color); min-height: 0; }
.bottom-panel { display: flex; flex-direction: column; height: 100%; min-height: 0; border-right: 1px solid var(--border-color); }
.bottom-panel:last-child { border-right: none; }

.panel-header { padding: 8px 15px; background: #0f172a; border-bottom: 1px solid var(--border-color); font-size: 0.75rem; font-weight: bold; display: flex; justify-content: space-between; align-items: center; color: #94a3b8; height: 40px; flex-shrink: 0; }
.tabs { display: flex; gap: 8px; }
.tab { padding: 3px 6px; background: #1e293b; border-radius: 3px; cursor: pointer; font-size: 0.7rem;}
.badge { background: rgba(16, 185, 129, 0.2); color: #10b981; padding: 2px 6px; border-radius: 12px; border: 1px solid #10b981; }

.video-container { position: relative; width: 100%; flex-grow: 1; background: #000; }
.video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }

.webcam-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; flex-grow: 1; background: #000; padding: 2px; }
.webcam-feed { background: #000; position: relative; overflow: hidden; }
.webcam-feed iframe { position: absolute; top: -20%; left: 0; width: 100%; height: 140%; border: none; pointer-events: none; }
.webcam-label { position: absolute; bottom: 5px; left: 5px; background: rgba(0,0,0,0.7); padding: 2px 6px; font-size: 0.6rem; color: #fff; border-radius: 3px; z-index: 10; pointer-events: none; }

.ai-content { display: flex; flex-direction: column; flex-grow: 1; min-height: 0; background: #111827; }
.ai-card { background: #0f172a; margin: 10px; padding: 12px; border: 1px solid #334155; border-radius: 6px; border-left: 3px solid #3b82f6; font-size: 0.75rem; color: #cbd5e1; }
.ai-card-title { color: #60a5fa; font-weight: bold; margin-bottom: 5px; }

#news-feed { flex-grow: 1; overflow-y: auto; }
.feed-item { padding: 12px 15px; border-bottom: 1px solid var(--border-color); font-size: 0.75rem; font-family: -apple-system, sans-serif; }
.feed-item:hover { background-color: var(--highlight); }
.tag { background: var(--border-color); padding: 2px 6px; border-radius: 3px; font-size: 0.7rem; margin-right: 6px; color: #cbd5e1; }
.tag.alert { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border: 1px solid #ef4444; }
.timestamp { color: #64748b; font-size: 0.7rem; margin-top: 6px; font-family: monospace; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg-color); }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }