/* Overwatch Core — Mission Builder — Tactical Dark Theme */

:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2d2d2d;
    --bg-elevated: #353535;
    --border: #3a3a3a;
    --border-light: #444;

    --text-primary: #e8e8e8;
    --text-secondary: #999;
    --text-dim: #666;

    --accent-orange: #ff6b00;
    --accent-orange-dim: rgba(255, 107, 0, 0.15);
    --accent-blue: #4a9eff;
    --accent-blue-dim: rgba(74, 158, 255, 0.15);
    --accent-green: #00c853;
    --accent-green-dim: rgba(0, 200, 83, 0.15);
    --accent-red: #ff3d3d;
    --accent-red-dim: rgba(255, 61, 61, 0.15);
    --accent-yellow: #ffc107;

    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

    --accent-purple: #e040fb;
    --accent-purple-dim: rgba(224, 64, 251, 0.15);

    --radius: 6px;
    --radius-lg: 10px;
    --panel-width: 340px;
    --header-height: 48px;

    /* Drone color palette */
    --drone-1: #4a9eff;
    --drone-2: #ff6b00;
    --drone-3: #00c853;
    --drone-4: #e040fb;
    --drone-5: #ffc107;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Header */
#header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    -webkit-app-region: drag; /* Allow window drag from header in Electron */
    z-index: 1000;
    position: relative;
}

/* Electron: offset header-left for macOS traffic light buttons */
.electron-app #header {
    padding-left: 80px;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    min-width: 200px;
}

/* Make interactive elements non-draggable in Electron */
#header button, #header a, #header .seg-btn, #header .demo-mode-btn,
#header .alert-badge, #header .drone-status {
    -webkit-app-region: no-drag;
}

.header-right {
    justify-content: flex-end;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-text {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.logo-accent {
    color: var(--accent-orange);
    margin-left: 1px;
}

.mode-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 14px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    border: 1px solid var(--border);
}

.mode-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-blue);
}

.mode-indicator.flying .mode-dot {
    background: var(--accent-green);
    animation: pulse 1.5s infinite;
}

.mode-indicator.alert .mode-dot {
    background: var(--accent-orange);
    animation: pulse 0.8s infinite;
}

.mode-text {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.drone-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.status-dot.disconnected { background: var(--text-dim); }
.status-dot.connected { background: var(--accent-green); }
.status-dot.uploading { background: var(--accent-yellow); animation: pulse 1s infinite; }

.status-text {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1px;
    color: var(--text-dim);
}

/* Main Layout */
#main {
    display: flex;
    height: calc(100vh - var(--header-height));
}

#map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
}

/* Leaflet dark overrides */
.leaflet-container {
    background: var(--bg-primary) !important;
    font-family: var(--font-sans) !important;
}

.leaflet-control-zoom a {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-tertiary) !important;
}

.leaflet-draw-toolbar a {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border) !important;
}

.leaflet-bar {
    border: 1px solid var(--border) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4) !important;
}

.leaflet-bar a {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-bottom-color: var(--border) !important;
}

.leaflet-bar a:hover {
    background-color: var(--bg-tertiary) !important;
}

/* Map overlay instruction */
.map-overlay {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 26, 0.9);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 18px;
    font-size: 12px;
    color: var(--text-secondary);
    z-index: 800;
    pointer-events: none;
    backdrop-filter: blur(8px);
    white-space: nowrap;
}

/* Side Panel */
#panel {
    width: var(--panel-width);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.panel-section {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

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

.section-header h3 {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
}

/* Config */
.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.config-item label {
    display: block;
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 5px;
}

.config-item input {
    width: 100%;
    padding: 7px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.config-item input:focus {
    border-color: var(--accent-blue);
}

/* Buttons */
.button-group {
    display: flex;
    gap: 8px;
}

.btn {
    flex: 1;
    padding: 9px 14px;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s;
    letter-spacing: 0.3px;
}

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

.btn-primary {
    background: var(--accent-orange);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #e86000;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-elevated);
    border-color: var(--border-light);
}

.btn-danger {
    background: var(--accent-red);
    color: #fff;
    width: 100%;
    padding: 10px;
    margin-top: 10px;
}

.btn-danger:hover {
    background: #e03535;
}

.btn-large {
    padding: 14px 20px;
    font-size: 14px;
    letter-spacing: 0.5px;
    width: 100%;
}

.btn-icon {
    font-size: 14px;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
}

.stat-item {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 10px;
}

.stat-label {
    display: block;
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Flight Status */
.live-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--accent-green);
    background: var(--accent-green-dim);
    padding: 2px 8px;
    border-radius: 10px;
    animation: pulse 1.5s infinite;
}

.flight-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.flight-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flight-stat .stat-label {
    font-size: 11px;
    margin-bottom: 0;
    min-width: 80px;
}

.flight-stat .stat-value {
    font-size: 13px;
}

.mono {
    font-family: var(--font-mono);
}

.gps-ok { color: var(--accent-green); }
.gps-degraded { color: var(--accent-yellow); }
.gps-lost { color: var(--accent-red); }

.progress-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    margin: 0 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-orange);
    border-radius: 2px;
    transition: width 0.3s;
}

/* Detections */
.detection-count {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-orange);
    background: var(--accent-orange-dim);
    padding: 1px 8px;
    border-radius: 10px;
    min-width: 24px;
    text-align: center;
}

.detections-list {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.empty-state {
    text-align: center;
    padding: 20px;
    color: var(--text-dim);
    font-size: 12px;
}

.detection-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--accent-orange-dim);
    border-left: 3px solid var(--accent-orange);
    border-radius: var(--radius);
    padding: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.detection-card:hover {
    background: var(--bg-elevated);
}

.detection-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.detection-label {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-orange);
}

.detection-time {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
}

.detection-details {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
}

.detection-confidence {
    font-family: var(--font-mono);
    font-weight: 600;
}

.confidence-high { color: var(--accent-red); }
.confidence-med { color: var(--accent-orange); }

/* Thumbnail placeholder */
.detection-thumb {
    width: 100%;
    height: 60px;
    background: var(--bg-primary);
    border-radius: 4px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-dim);
    border: 1px solid var(--border);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 420px;
    max-width: 90vw;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.upload-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    font-size: 13px;
    color: var(--text-dim);
    transition: color 0.3s;
}

.upload-step.active {
    color: var(--text-primary);
}

.upload-step.done {
    color: var(--accent-green);
}

.upload-step.error {
    color: var(--accent-red);
}

.step-icon {
    font-size: 10px;
    width: 16px;
    text-align: center;
}

.upload-step.active .step-icon {
    animation: pulse 1s infinite;
    color: var(--accent-orange);
}

.upload-step.done .step-icon {
    color: var(--accent-green);
}

.upload-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Hide Leaflet Draw's default toolbar and actions — we use custom buttons */
.leaflet-draw,
.leaflet-draw-section,
.leaflet-draw-toolbar,
.leaflet-draw-actions {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Leaflet draw toolbar tooltip dark */
.leaflet-draw-tooltip {
    background: var(--bg-secondary) !important;
    border-color: var(--border) !important;
    color: var(--text-primary) !important;
}

.leaflet-draw-tooltip:before {
    border-right-color: var(--border) !important;
}

/* Custom map marker for detections */
.detection-marker {
    background: none;
    border: none;
}

.detection-marker-inner {
    width: 24px;
    height: 24px;
    background: var(--accent-orange);
    border: 2px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 2px 8px rgba(255, 107, 0, 0.5);
    animation: detection-ping 2s infinite;
}

@keyframes detection-ping {
    0% { box-shadow: 0 0 0 0 rgba(255, 107, 0, 0.5); }
    70% { box-shadow: 0 0 0 12px rgba(255, 107, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 107, 0, 0); }
}

/* Drone position marker */
.drone-marker {
    background: none;
    border: none;
}

.drone-marker-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.drone-marker-inner svg {
    width: 100%;
    height: 100%;
}

.drone-marker-inner.drone-returning {
    opacity: 0.5;
}

/* Dark tooltip for drone labels */
.dark-tooltip {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
    font-family: var(--font-mono) !important;
    font-size: 10px !important;
    font-weight: 500 !important;
    padding: 3px 8px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4) !important;
    white-space: nowrap !important;
}

.dark-tooltip::before {
    border-right-color: var(--border) !important;
}

/* Takeoff marker */
.takeoff-marker {
    background: none;
    border: none;
}

.takeoff-marker-inner {
    width: 12px;
    height: 12px;
    background: var(--accent-green);
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 200, 83, 0.4);
}

/* ========== MAP TOOLBAR (custom draw controls) ========== */

.map-toolbar {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 800;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 38px;
}

.map-toolbar-group {
    display: flex;
    flex-direction: column;
    width: 38px;
    background: rgba(13, 13, 13, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.map-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 34px;
    min-height: 34px;
    max-height: 34px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 1px solid var(--border);
    padding: 0;
    flex-shrink: 0;
}

.map-tool-btn:last-child {
    border-bottom: none;
}

.map-tool-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.map-tool-btn.active {
    background: var(--accent-orange);
    color: #fff;
}

.map-tool-btn svg {
    width: 18px;
    height: 18px;
}

/* Action bars — shown below toolbar contextually */
.map-actions {
    display: none;
    flex-direction: row;
    gap: 4px;
    width: 200px;
}

body.mode-draw #mapActionsDraw { display: flex; }
body.mode-edit #mapActionsEdit { display: flex; }

.map-action-btn {
    flex: 1;
    padding: 8px 4px;
    background: rgba(13, 13, 13, 0.9);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    backdrop-filter: blur(8px);
}

.map-action-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.map-action-btn.action-finish {
    color: var(--accent-orange);
    border-color: var(--accent-orange-dim);
}

.map-action-btn.action-finish:hover {
    background: var(--accent-orange);
    color: #fff;
}

.map-action-btn.action-cancel:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

/* ========== MODE VISIBILITY ========== */

body[data-product="core"] .orchestrator-only { display: none !important; }
body[data-product="orchestrator"] .core-only { display: none !important; }
body[data-mode="real"] .demo-only { display: none !important; }
body[data-mode="demo"] .real-only { display: none !important; }
.initially-hidden { display: none; }

/* ========== SEGMENTED TOGGLE ========== */

.segmented-toggle {
    display: flex;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2px;
    gap: 2px;
}

.seg-btn {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.8px;
    color: var(--text-dim);
    background: transparent;
    border: none;
    border-radius: 18px;
    padding: 4px 12px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.seg-btn:hover {
    color: var(--text-secondary);
}

.seg-btn.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.toggle-sm .seg-btn {
    font-size: 9px;
    padding: 3px 10px;
}

.demo-mode-btn {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.8px;
    color: var(--text-dim);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 4px 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.demo-mode-btn:hover {
    color: var(--text-secondary);
    border-color: var(--accent-orange);
}

.demo-mode-btn.active {
    color: var(--accent-orange);
    border-color: var(--accent-orange);
    background: var(--accent-orange-dim);
}

.header-center {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-right {
    gap: 12px;
}

/* ========== ALERT BADGE (header) ========== */

.alert-badge {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--text-dim);
    cursor: pointer;
}

.alert-badge .badge-count {
    position: absolute;
    top: -2px;
    right: -4px;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    background: var(--accent-red);
    border-radius: 8px;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.alert-badge .badge-count:empty,
.alert-badge .badge-count[data-count="0"] { display: none; }

/* ========== CONFIG EXTENSIONS ========== */

.config-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.config-select {
    width: 100%;
    padding: 7px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    outline: none;
    cursor: pointer;
    appearance: none;
}

.config-select:focus {
    border-color: var(--accent-blue);
}

.config-hint {
    font-size: 10px;
    color: var(--text-dim);
    margin-top: 4px;
    display: block;
}

.relay-battery-auto {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 10px;
}

.relay-battery-display {
    flex: 1;
}

.relay-battery-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.relay-battery-title {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.relay-battery-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-green);
}

.relay-battery-toggle {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--text-dim);
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    margin-left: 10px;
}

.relay-battery-toggle:hover {
    color: var(--text-primary);
    border-color: var(--accent-orange);
}

.relay-battery-advanced {
    margin-bottom: 10px;
}

.config-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    outline: none;
    border: none;
    margin-top: 4px;
}

.config-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-orange);
    cursor: pointer;
    border: 2px solid #fff;
}

.config-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-orange);
    cursor: pointer;
    border: 2px solid #fff;
}

/* ========== FLEET STATUS ========== */

.fleet-status-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
}

.fleet-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
}

.fleet-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.fleet-card-name {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.fleet-card-state {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.state-standby  { color: var(--text-dim);     background: var(--bg-elevated); }
.state-patrol   { color: var(--accent-green);  background: var(--accent-green-dim); }
.state-returning { color: var(--accent-yellow); background: rgba(255, 193, 7, 0.15); }
.state-charging { color: var(--accent-blue);   background: var(--accent-blue-dim); }
.state-maintenance { color: var(--accent-red); background: var(--accent-red-dim); }

.fleet-card-battery {
    display: flex;
    align-items: center;
    gap: 8px;
}

.battery-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.battery-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s, background-color 0.3s;
}

.battery-fill.high   { background: var(--accent-green); }
.battery-fill.medium { background: var(--accent-yellow); }
.battery-fill.low    { background: var(--accent-red); }

.battery-pct {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 32px;
    text-align: right;
}

/* ========== RELAY TIMELINE ========== */

.relay-timeline {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
}

.timeline-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeline-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 60px;
}

.timeline-track {
    flex: 1;
    height: 16px;
    background: var(--bg-primary);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

.timeline-bar {
    position: absolute;
    top: 2px;
    bottom: 2px;
    border-radius: 2px;
    opacity: 0.8;
}

/* ========== ALERTS ========== */

.alert-count-badge {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-red);
    background: var(--accent-red-dim);
    padding: 1px 8px;
    border-radius: 10px;
    min-width: 24px;
    text-align: center;
}

.alerts-list {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.alert-card:hover {
    background: var(--bg-elevated);
}

.alert-card.severity-critical { border-left: 3px solid var(--accent-red); }
.alert-card.severity-warning  { border-left: 3px solid var(--accent-orange); }
.alert-card.severity-info     { border-left: 3px solid var(--accent-blue); }

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

.alert-type {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
}

.alert-type.critical { color: var(--accent-red); }
.alert-type.warning  { color: var(--accent-orange); }
.alert-type.info     { color: var(--accent-blue); }

.alert-time {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
}

.alert-message {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.alert-drone {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    margin-top: 4px;
}

/* ========== DEMO OVERLAY ========== */

.demo-overlay {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    pointer-events: none;
}

.demo-overlay-inner {
    background: rgba(26, 26, 26, 0.9);
    border: 1px solid var(--accent-orange-dim);
    border-radius: var(--radius);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(8px);
}

.demo-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--accent-orange);
}

.demo-elapsed {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

.demo-progress-bar {
    width: 100px;
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    overflow: hidden;
}

.demo-progress-fill {
    height: 100%;
    background: var(--accent-orange);
    border-radius: 2px;
    transition: width 0.3s;
}

/* ========== WEATHER BAR ========== */

.weather-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
}

.weather-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.weather-label {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-dim);
}

.weather-value {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.weather-status {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
}

.weather-status.ok      { color: var(--accent-green); background: var(--accent-green-dim); }
.weather-status.warning  { color: var(--accent-yellow); background: rgba(255, 193, 7, 0.15); }
.weather-status.critical { color: var(--accent-red); background: var(--accent-red-dim); }

/* ========== BASE BUTTON SET STATE ========== */

.btn-base-set {
    background: var(--accent-green-dim);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

.btn-base-set:hover {
    background: var(--accent-green-dim);
    border-color: var(--accent-green);
}

/* ========== BASE MARKER ========== */

.base-marker {
    background: none;
    border: none;
}

.base-marker-inner {
    width: 20px;
    height: 20px;
    background: var(--accent-green);
    border: 2px solid #fff;
    transform: rotate(45deg);
    box-shadow: 0 2px 8px rgba(0, 200, 83, 0.5);
}

/* ========== CURACAO DEMO COASTLINE ========== */

/* Patrol schedule */
.config-input-dt {
    width: 100%;
    padding: 7px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    outline: none;
    color-scheme: dark;
}
.config-input-dt:focus { border-color: var(--accent-blue); }

.schedule-repeat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}
.schedule-repeat input[type="checkbox"] {
    accent-color: var(--accent-orange);
    width: 14px;
    height: 14px;
}

/* Coordinate waypoint table */
.coord-table {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}
.coord-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.coord-num {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    min-width: 18px;
    text-align: right;
}
.coord-input {
    flex: 1;
    padding: 5px 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 11px;
    outline: none;
    min-width: 0;
}
.coord-input:focus { border-color: var(--accent-blue); }
.coord-delete {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    line-height: 1;
}
.coord-delete:hover { color: var(--accent-red); }
.coord-actions {
    display: flex;
    gap: 6px;
}
.coord-csv-input {
    width: 100%;
    padding: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 11px;
    resize: vertical;
    outline: none;
}
.coord-csv-input:focus { border-color: var(--accent-blue); }
.coord-csv-input::placeholder { color: var(--text-dim); }

/* GPS status */
.weather-status.gps-fixed {
    color: var(--accent-green);
    background: var(--accent-green-dim);
}

/* ========== DETECTION NOTIFICATION OVERLAY ========== */
.detection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1500;
    pointer-events: none;
    padding: 8px 16px;
}
.detection-overlay-bar {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--accent-red);
    border-left: 4px solid var(--accent-red);
    border-radius: var(--radius);
    padding: 12px 16px;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 4px 24px rgba(255, 61, 61, 0.25);
    animation: slideDown 0.3s ease-out;
}
.detection-overlay-bar.severity-medium {
    border-color: var(--accent-orange);
    box-shadow: 0 4px 24px rgba(255, 107, 0, 0.2);
}
.detection-overlay-bar.severity-low {
    border-color: var(--accent-yellow);
    box-shadow: 0 4px 24px rgba(255, 193, 7, 0.15);
}
@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.detection-overlay-icon {
    color: var(--accent-red);
    flex-shrink: 0;
}
.detection-overlay-bar.severity-medium .detection-overlay-icon { color: var(--accent-orange); }
.detection-overlay-bar.severity-low .detection-overlay-icon { color: var(--accent-yellow); }
.detection-overlay-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.detection-overlay-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--accent-red);
}
.detection-overlay-bar.severity-medium .detection-overlay-label { color: var(--accent-orange); }
.detection-overlay-bar.severity-low .detection-overlay-label { color: var(--accent-yellow); }
.detection-overlay-message {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}
.detection-overlay-coords {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
}
.detection-overlay-confidence {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-red);
    min-width: 48px;
    text-align: center;
}
.detection-overlay-bar.severity-medium .detection-overlay-confidence { color: var(--accent-orange); }
.detection-overlay-bar.severity-low .detection-overlay-confidence { color: var(--accent-yellow); }
.detection-overlay-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Simulated target markers */
.target-marker {
    background: none !important;
    border: none !important;
}
.target-marker-inner {
    opacity: 0.35;
    transition: opacity 0.6s ease, filter 0.6s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.target-marker-inner.detected {
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(255, 107, 0, 0.8));
}

.curacao-coastline {
    fill: #1a1a1a;
    fill-opacity: 0.6;
    stroke: #3a3a3a;
    stroke-width: 1.5;
}

/* ========== AI ADVISOR ========== */

.ai-toggle {
    position: relative;
    width: 36px;
    height: 20px;
    display: inline-block;
}
.ai-toggle input { opacity: 0; width: 0; height: 0; }
.ai-toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-tertiary);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}
.ai-toggle-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    top: 3px;
    background: var(--text-dim);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}
.ai-toggle input:checked + .ai-toggle-slider {
    background: var(--accent-purple-dim);
}
.ai-toggle input:checked + .ai-toggle-slider::before {
    transform: translateX(16px);
    background: var(--accent-purple);
}

.ai-advisor-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
}
.ai-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ai-status-dot.disconnected { background: var(--text-dim); }
.ai-status-dot.connecting { background: var(--accent-yellow); animation: pulse 1s infinite; }
.ai-status-dot.connected { background: var(--accent-purple); animation: pulse 1.5s infinite; }
.ai-status-text {
    color: var(--text-secondary);
}
.ai-source-badge {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 2px 6px;
    border-radius: 3px;
}
.ai-source-local {
    color: var(--accent-green);
    background: var(--accent-green-dim);
}
.ai-source-cloud {
    color: var(--accent-purple);
    background: var(--accent-purple-dim);
}
.ai-decision-count {
    margin-left: auto;
    color: var(--text-dim);
}

.ai-decision-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent-purple);
    border-radius: var(--radius);
    padding: 10px;
}
.ai-decision-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.ai-urgency {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 10px;
}
.ai-urgency-routine { color: var(--text-secondary); background: var(--bg-elevated); }
.ai-urgency-elevated { color: var(--accent-yellow); background: rgba(255, 193, 7, 0.12); }
.ai-urgency-urgent { color: var(--accent-red); background: var(--accent-red-dim); }

.ai-confidence {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-purple);
}
.ai-reasoning {
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 8px;
}
.ai-params {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.ai-param-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 3px;
}
.ai-vetoed {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 11px;
}
.ai-veto-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--accent-yellow);
    margin-right: 4px;
}
.ai-veto-text {
    color: var(--text-secondary);
    font-size: 11px;
}
