/* MESH OS — operator shell styles */

.mesh-shell { position: relative; background: #06070A; border: 1px solid var(--line); color: var(--text); font-family: var(--ff-body); display: grid; grid-template-rows: 44px 1fr 44px; grid-template-columns: 280px 1fr 340px; grid-template-areas: "top top top" "left map right" "bottom bottom bottom"; height: 720px; overflow: hidden; }
.mesh-shell.compact { height: 560px; grid-template-columns: 240px 1fr 300px; }

/* Top bar */
.mesh-top { grid-area: top; display: flex; align-items: center; gap: 0; background: #0A0C10; border-bottom: 1px solid var(--line); }
.mesh-brand { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-right: 1px solid var(--line); height: 100%; }
.mesh-brand .mark { font-family: var(--ff-display); font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.mesh-brand .mark .r { color: var(--accent); }
.mesh-brand .title { font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.2em; color: var(--muted); text-transform: uppercase; }
.mesh-clock { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-right: 1px solid var(--line); height: 100%; font-family: var(--ff-mono); font-size: 11px; color: var(--text-2); letter-spacing: 0.06em; }
.mesh-clock .live-d { width: 6px; height: 6px; background: var(--ok); border-radius: 50%; animation: pulse 1.4s infinite; }
.mesh-mode { display: flex; align-items: center; gap: 8px; padding: 0 14px; border-right: 1px solid var(--line); height: 100%; font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; }
.mesh-mode .mode-dot { width: 8px; height: 8px; background: var(--amber); }
.mesh-mode[data-mode="live"] .mode-dot { background: var(--ok); }
.mesh-mode[data-mode="incident"] .mode-dot { background: var(--accent); }
.mesh-mode[data-mode="tasking"] .mode-dot { background: var(--amber); }
.mesh-alert-count { margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-left: 1px solid var(--line); height: 100%; font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.12em; color: var(--accent); cursor: pointer; }
.mesh-alert-count:hover { background: var(--accent-wash); }
.mesh-alert-count .flame { font-size: 12px; }
.mesh-ops-icons { display: flex; height: 100%; border-left: 1px solid var(--line); }
.mesh-op-btn { width: 42px; display: grid; place-items: center; border-left: 1px solid var(--line); color: var(--muted); cursor: pointer; }
.mesh-op-btn:first-child { border-left: 0; }
.mesh-op-btn:hover { color: var(--text); background: var(--bg-2); }
.mesh-op-btn svg { width: 14px; height: 14px; }
.mesh-user { padding: 0 12px; display: flex; align-items: center; gap: 8px; border-left: 1px solid var(--line); height: 100%; font-family: var(--ff-mono); font-size: 11px; color: var(--text-2); }
.mesh-user .avatar { width: 22px; height: 22px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 700; }

/* Left rail */
.mesh-left { grid-area: left; background: #0A0C10; border-right: 1px solid var(--line); overflow-y: auto; }
.mesh-search { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.mesh-search input { flex: 1; background: transparent; border: 0; color: var(--text); font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.06em; outline: none; }
.mesh-search .search-icon { color: var(--muted); font-size: 12px; }
.mesh-search .filter-chip { font-family: var(--ff-mono); font-size: 10px; padding: 2px 6px; border: 1px solid var(--line-2); color: var(--muted); }

.mesh-section { border-bottom: 1px solid var(--line); }
.mesh-section-h { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); cursor: pointer; }
.mesh-section-h:hover { color: var(--text); }
.mesh-section-h .count { font-family: var(--ff-mono); font-size: 10px; color: var(--text-2); background: var(--bg-2); padding: 2px 6px; letter-spacing: 0.06em; }
.mesh-section-h .caret { font-size: 8px; transition: transform 0.15s; }
.mesh-section.collapsed .caret { transform: rotate(-90deg); }
.mesh-section.collapsed .mesh-section-body { display: none; }

.mesh-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid rgba(255,255,255,0.03); cursor: pointer; font-family: var(--ff-mono); font-size: 11px; color: var(--text-2); }
.mesh-row:hover { background: var(--bg-2); color: var(--text); }
.mesh-row.selected { background: var(--accent-wash); color: var(--text); border-left: 2px solid var(--accent); padding-left: 10px; }
.mesh-row .r-ic { width: 18px; height: 18px; display: grid; place-items: center; font-size: 11px; flex-shrink: 0; }
.mesh-row .r-id { font-weight: 500; }
.mesh-row .r-meta { margin-left: auto; color: var(--muted); font-size: 10px; display: flex; align-items: center; gap: 6px; }
.mesh-row .status-pill { font-family: var(--ff-mono); font-size: 9px; padding: 1px 5px; letter-spacing: 0.1em; text-transform: uppercase; }
.status-pill.available { color: var(--ok); border: 1px solid var(--ok); }
.status-pill.tasked { color: var(--amber); border: 1px solid var(--amber); }
.status-pill.degraded { color: var(--amber); background: rgba(245, 165, 36, 0.15); }
.status-pill.offline { color: var(--muted); border: 1px solid var(--muted); }

/* Map center */
.mesh-map { grid-area: map; position: relative; overflow: hidden; background: #0b0d12; }
.mesh-map-canvas { position: absolute; inset: 0; cursor: grab; }
.mesh-map-canvas:active { cursor: grabbing; }
.mesh-map-img { position: absolute; inset: 0; background-size: cover; background-position: center; filter: brightness(0.82) contrast(1.1) saturate(0.85); }
.mesh-map-overlay { position: absolute; inset: 0; background:
  radial-gradient(ellipse at 50% 40%, transparent 0%, rgba(6,7,10,0.4) 80%);
  pointer-events: none; }
.mesh-map-grid { position: absolute; inset: 0; pointer-events: none; opacity: 0.25; background-image:
  linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
  linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 48px 48px; }
.mesh-map-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mesh-map-svg .interactive { pointer-events: all; }

/* Map objects — TRACKS (moving threats) */
.m-track { position: absolute; transform: translate(-50%, -50%); cursor: pointer; pointer-events: all; }
.m-track .t-ring { width: 30px; height: 30px; border: 1.5px solid currentColor; border-radius: 50%; position: relative; display: grid; place-items: center; animation: ring-pulse 2.4s infinite; background: rgba(10,12,16,0.55); }
.m-track .t-icon { width: 16px; height: 16px; color: currentColor; display: grid; place-items: center; }
.m-track .t-icon svg { width: 16px; height: 16px; }
.m-track.human { color: var(--accent); }
.m-track.vehicle { color: #F5A524; }
.m-track.ship { color: #60A5FA; }
.m-track.wildlife { color: #4ADE80; }
.m-track.drone-unk { color: var(--accent); }
.m-track.fire { color: #FF5722; }
/* Label sits OFFSET from the ring so it never covers the icon. Anchor varies by t-anchor. */
.m-track .t-label { position: absolute; font-family: var(--ff-mono); font-size: 10px; padding: 3px 7px; background: rgba(10,12,16,0.92); border: 1px solid currentColor; white-space: nowrap; color: currentColor; letter-spacing: 0.06em; line-height: 1; pointer-events: none; }
.m-track .t-label::before { content: ''; position: absolute; background: currentColor; }
/* anchors: where the label sits relative to the ring center */
.m-track[data-anchor="r"] .t-label { left: 24px; top: 50%; transform: translateY(-50%); }
.m-track[data-anchor="r"] .t-label::before { left: -10px; top: 50%; width: 10px; height: 1px; transform: translateY(-50%); }
.m-track[data-anchor="l"] .t-label { right: 24px; top: 50%; transform: translateY(-50%); }
.m-track[data-anchor="l"] .t-label::before { right: -10px; top: 50%; width: 10px; height: 1px; transform: translateY(-50%); }
.m-track[data-anchor="t"] .t-label { left: 50%; bottom: 26px; transform: translateX(-50%); }
.m-track[data-anchor="t"] .t-label::before { left: 50%; bottom: -10px; width: 1px; height: 10px; transform: translateX(-50%); }
.m-track[data-anchor="b"] .t-label { left: 50%; top: 26px; transform: translateX(-50%); }
.m-track[data-anchor="b"] .t-label::before { left: 50%; top: -10px; width: 1px; height: 10px; transform: translateX(-50%); }
.m-track[data-anchor="tr"] .t-label { left: 22px; bottom: 22px; }
.m-track[data-anchor="tr"] .t-label::before { left: -8px; bottom: -8px; width: 12px; height: 1px; transform: rotate(45deg); transform-origin: left center; }
.m-track[data-anchor="tl"] .t-label { right: 22px; bottom: 22px; }
.m-track[data-anchor="tl"] .t-label::before { right: -8px; bottom: -8px; width: 12px; height: 1px; transform: rotate(-45deg); transform-origin: right center; }
.m-track[data-anchor="br"] .t-label { left: 22px; top: 22px; }
.m-track[data-anchor="br"] .t-label::before { left: -8px; top: -8px; width: 12px; height: 1px; transform: rotate(-45deg); transform-origin: left center; }
.m-track[data-anchor="bl"] .t-label { right: 22px; top: 22px; }
.m-track[data-anchor="bl"] .t-label::before { right: -8px; top: -8px; width: 12px; height: 1px; transform: rotate(45deg); transform-origin: right center; }
.m-track.selected .t-ring { background: currentColor; box-shadow: 0 0 0 3px rgba(255,255,255,0.18), 0 0 12px currentColor; }
.m-track.selected .t-icon { color: #fff; }
.m-asset.selected .a-shape { filter: drop-shadow(0 0 6px currentColor); }
.m-asset.selected .a-label { background: rgba(255,255,255,0.12); }
@keyframes ring-pulse { 0%, 100% { box-shadow: 0 0 0 0 currentColor; opacity: 1; } 50% { box-shadow: 0 0 0 8px transparent; opacity: 0.7; } }
@keyframes vd-scan { 0% { background-position: 0 -40%; } 100% { background-position: 0 140%; } }
.mesh-tl-track { position: relative; }
.tl-beat:hover { transform: translate(-50%, -50%) scaleY(1.35) !important; opacity: 1 !important; }
.mesh-shell.playback-mode .mesh-pb-tab[data-mode="playback"] { background: var(--accent); color: #fff; }
.mesh-shell.playback-mode .mesh-tl-fill { background: var(--amber); }

/* ASSETS (friendly infrastructure) */
.m-asset { position: absolute; transform: translate(-50%, -50%); pointer-events: all; cursor: pointer; }
.m-asset .a-shape { width: 22px; height: 22px; display: grid; place-items: center; color: #4ADE80; background: rgba(10,12,16,0.7); border: 1px solid currentColor; border-radius: 2px; }
.m-asset .a-shape svg { width: 14px; height: 14px; }
.m-asset.tasked .a-shape { color: var(--amber); }
.m-asset.degraded .a-shape { color: var(--amber); }
.m-asset.offline .a-shape { color: var(--muted); }
.m-asset .a-label { position: absolute; font-family: var(--ff-mono); font-size: 9.5px; padding: 2px 5px; background: rgba(10,12,16,0.92); color: currentColor; letter-spacing: 0.08em; white-space: nowrap; line-height: 1; pointer-events: none; }
.m-asset[data-anchor="r"] .a-label { left: 18px; top: 50%; transform: translateY(-50%); }
.m-asset[data-anchor="l"] .a-label { right: 18px; top: 50%; transform: translateY(-50%); }
.m-asset[data-anchor="t"] .a-label { left: 50%; bottom: 20px; transform: translateX(-50%); }
.m-asset[data-anchor="b"] .a-label { left: 50%; top: 20px; transform: translateX(-50%); }

.m-zone { position: absolute; border: 1.5px dashed var(--amber); background: rgba(245, 165, 36, 0.05); pointer-events: none; }
.m-zone.restricted { border-color: var(--accent); background: rgba(226, 67, 41, 0.06); }
.m-zone .z-label { position: absolute; top: 6px; left: 8px; font-family: var(--ff-mono); font-size: 10px; color: var(--amber); letter-spacing: 0.12em; text-transform: uppercase; padding: 2px 6px; background: rgba(10,12,16,0.8); }
.m-zone.restricted .z-label { color: var(--accent); }

.m-path { stroke: currentColor; fill: none; stroke-dasharray: 4 4; opacity: 0.6; }

/* Map corner HUD */
.map-hud { position: absolute; font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.12em; color: var(--muted); pointer-events: none; }
.map-hud.tl { top: 12px; left: 12px; }
.map-hud.tr { top: 12px; right: 12px; }
.map-hud.br { bottom: 12px; right: 12px; }
.map-hud.bl { bottom: 12px; left: 12px; }
.map-hud .hud-line { padding: 2px 0; display: flex; align-items: center; gap: 8px; }
.map-hud .key { color: var(--dim); }
.map-hud .val { color: var(--text-2); }

.map-compass { position: absolute; top: 16px; left: 16px; width: 42px; height: 42px; border: 1px solid var(--line-2); border-radius: 50%; display: grid; place-items: center; font-family: var(--ff-mono); font-size: 9px; color: var(--muted); background: rgba(10,12,16,0.7); }
.map-compass::before { content: 'N'; position: absolute; top: 3px; color: var(--accent); font-weight: 700; }

.map-scale { position: absolute; bottom: 14px; left: 14px; font-family: var(--ff-mono); font-size: 10px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.map-scale .bar { width: 60px; height: 2px; background: var(--text-2); position: relative; }
.map-scale .bar::before, .map-scale .bar::after { content: ''; position: absolute; width: 1px; height: 6px; background: var(--text-2); top: -4px; }
.map-scale .bar::after { right: 0; }

/* Right rail */
.mesh-right { grid-area: right; background: #0A0C10; border-left: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; }
.mesh-right-h { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; }
.mesh-right-h.incident { color: var(--accent); background: var(--accent-wash); }
.mesh-right-h .close { color: var(--muted); cursor: pointer; font-size: 14px; }
.mesh-right-h .close:hover { color: var(--text); }

.event-card { border-bottom: 1px solid var(--line); padding: 14px; cursor: pointer; transition: background 0.12s; position: relative; }
.event-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--amber); }
.event-card.crit::before { background: var(--accent); }
.event-card.info::before { background: var(--muted); }
.event-card:hover { background: var(--bg-2); }
.event-card.selected { background: var(--accent-wash); }
.event-card .ev-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.event-card .ev-ic { font-size: 14px; color: var(--accent); }
.event-card .ev-type { font-family: var(--ff-mono); font-size: 11px; color: var(--text); font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.event-card .ev-age { margin-left: auto; font-family: var(--ff-mono); font-size: 10px; color: var(--muted); }
.event-card .ev-id { font-family: var(--ff-mono); font-size: 12px; color: var(--text); }
.event-card .ev-zone { font-family: var(--ff-mono); font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Incident workbench */
.incident-body { flex: 1; overflow-y: auto; }
.inc-block { padding: 14px; border-bottom: 1px solid var(--line); }
.inc-block .kv { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-family: var(--ff-mono); font-size: 11px; }
.inc-block .kv .k { color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; font-size: 10px; }
.inc-block .kv .v { color: var(--text); }
.inc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.inc-actions .inc-btn { background: var(--bg-1); padding: 14px 10px; font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-2); cursor: pointer; transition: all 0.12s; }
.inc-actions .inc-btn:hover { background: var(--bg-3); color: var(--text); }
.inc-actions .inc-btn.primary { background: var(--accent); color: #fff; }
.inc-actions .inc-btn.primary:hover { background: #F05539; }

.video-dock { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.video-dock .vd-title { font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.video-dock .vd-frame { position: relative; aspect-ratio: 16/10; background: #000; border: 1px solid var(--line); overflow: hidden; }
.video-dock .vd-frame img { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; }
.video-dock .vd-overlay { position: absolute; inset: 0; pointer-events: none; }
.video-dock .vd-bbox { position: absolute; border: 1.5px solid var(--accent); }
.video-dock .vd-bbox .bb-label { position: absolute; top: -16px; left: 0; background: var(--accent); color: #fff; font-family: var(--ff-mono); font-size: 9px; letter-spacing: 0.1em; padding: 1px 4px; text-transform: uppercase; white-space: nowrap; }
.video-dock .vd-hud { position: absolute; font-family: var(--ff-mono); font-size: 9px; letter-spacing: 0.08em; color: #fff; text-shadow: 0 0 4px #000; }
.video-dock .vd-hud.tl { top: 6px; left: 6px; }
.video-dock .vd-hud.tr { top: 6px; right: 6px; }
.video-dock .vd-hud.br { bottom: 6px; right: 6px; }
.video-dock .vd-hud.bl { bottom: 6px; left: 6px; }

/* Bottom strip */
.mesh-bottom { grid-area: bottom; background: #0A0C10; border-top: 1px solid var(--line); display: flex; align-items: center; }
.mesh-playback { display: flex; align-items: center; height: 100%; border-right: 1px solid var(--line); }
.mesh-pb-tab { padding: 0 14px; font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); height: 100%; display: grid; place-items: center; cursor: pointer; border-right: 1px solid var(--line); }
.mesh-pb-tab.active { color: var(--ok); background: var(--bg-2); }
.mesh-pb-tab.active[data-mode="playback"] { color: var(--amber); }

.mesh-mission-chip.active { background: var(--accent); color: #fff !important; border-color: var(--accent) !important; }
.mesh-mission-chip:not(.active):hover { background: rgba(255,255,255,0.04); color: var(--ink); }

.mesh-controls { display: flex; align-items: center; gap: 6px; padding: 0 12px; border-right: 1px solid var(--line); height: 100%; }
.mesh-ctrl { width: 26px; height: 24px; display: grid; place-items: center; color: var(--text-2); cursor: pointer; font-size: 11px; }
.mesh-ctrl:hover { color: var(--accent); }
.mesh-speed { padding: 0 10px; font-family: var(--ff-mono); font-size: 10px; color: var(--muted); border: 1px solid var(--line-2); height: 20px; display: grid; place-items: center; cursor: pointer; letter-spacing: 0.08em; }
.mesh-speed:hover, .mesh-speed.active { color: var(--text); border-color: var(--text-2); }

.mesh-timeline { flex: 1; height: 100%; display: flex; align-items: center; padding: 0 14px; gap: 12px; border-right: 1px solid var(--line); }
.mesh-tl-time { font-family: var(--ff-mono); font-size: 10px; color: var(--muted); letter-spacing: 0.06em; width: 44px; }
.mesh-tl-track { flex: 1; height: 6px; background: var(--bg-2); border: 1px solid var(--line); position: relative; cursor: pointer; }
.mesh-tl-fill { position: absolute; top: 0; bottom: 0; left: 0; background: var(--accent); width: 0%; }
.mesh-tl-marker { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--amber); }
.mesh-tl-playhead { position: absolute; top: -4px; width: 2px; height: 14px; background: #fff; left: 0%; pointer-events: none; }

.mesh-health { display: flex; align-items: center; height: 100%; }
.mesh-health-item { padding: 0 12px; font-family: var(--ff-mono); font-size: 10px; letter-spacing: 0.1em; color: var(--text-2); border-right: 1px solid var(--line); height: 100%; display: flex; align-items: center; gap: 6px; }
.mesh-health-item:last-child { border-right: 0; }
.mesh-health-item .k { color: var(--muted); }
.mesh-health-item .bar-mini { width: 24px; height: 4px; background: var(--bg-2); position: relative; }
.mesh-health-item .bar-mini .f { position: absolute; top: 0; bottom: 0; left: 0; background: var(--ok); }
.mesh-health-item .bar-mini .f.warn { background: var(--amber); }
.mesh-health-item .bar-mini .f.bad { background: var(--accent); }

/* Ddecide-act loop viz */
.dda-loop { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--line); margin-top: 32px; }
.dda-step { background: var(--bg-1); padding: 20px; position: relative; transition: all 0.3s; }
.dda-step.active { background: var(--accent-wash); }
.dda-step .step-idx { font-family: var(--ff-mono); font-size: 10px; color: var(--muted); letter-spacing: 0.18em; }
.dda-step.active .step-idx { color: var(--accent); }
.dda-step .step-name { font-family: var(--ff-display); font-size: 18px; font-weight: 500; margin: 8px 0 10px; letter-spacing: -0.01em; }
.dda-step .step-desc { font-size: 12px; color: var(--muted); line-height: 1.45; }
.dda-step .step-bar { position: absolute; bottom: 0; left: 0; height: 2px; background: var(--accent); width: 0%; transition: width 0.3s linear; }
.dda-step.active .step-bar { width: 100%; }
@media (max-width: 820px) { .dda-loop { grid-template-columns: 1fr 1fr; } }

/* Mesh sim controls banner */
.mesh-caption { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--bg-1); border: 1px solid var(--line); border-bottom: 0; font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.mesh-caption .scenario { color: var(--accent); }
.mesh-caption .tips { display: flex; gap: 12px; }
.mesh-caption .tips kbd { font-family: var(--ff-mono); font-size: 10px; padding: 1px 6px; border: 1px solid var(--line-2); color: var(--text-2); background: var(--bg-2); }
