/* ══════════════════════════════════════════════════════
   SKYPRO360 — Operations Console  ·  Design System v2
   ══════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg:         #06090f;
  --surface-0:  #0c1017;
  --surface-1:  #111621;
  --surface-2:  #181e2b;
  --surface-3:  #1f2737;

  /* Borders */
  --border:     #1e2636;
  --border-lt:  #2a3347;
  --border-focus: #3b82f6;

  /* Text */
  --fg:         #e8ecf4;
  --fg-2:       #94a3b8;
  --fg-3:       #64748b;
  --fg-4:       #475569;

  /* Brand */
  --accent:     #e30613;
  --accent-dim: rgba(227,6,19,.12);

  /* Semantic */
  --green:      #22c55e;
  --green-dim:  rgba(34,197,94,.12);
  --blue:       #3b82f6;
  --blue-dim:   rgba(59,130,246,.12);
  --amber:      #f59e0b;
  --amber-dim:  rgba(245,158,11,.10);
  --red:        #ef4444;
  --red-dim:    rgba(239,68,68,.10);

  /* Shape */
  --radius:     8px;
  --radius-sm:  5px;
  --radius-lg:  12px;

  /* Type */
  --font:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:       'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  /* Elevation */
  --shadow-sm:  0 1px 2px rgba(0,0,0,.3);
  --shadow-md:  0 2px 8px rgba(0,0,0,.35), 0 0 1px rgba(0,0,0,.2);
  --shadow-lg:  0 4px 24px rgba(0,0,0,.45);
}

/* ── Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── App shell ───────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ══ Top Bar ═════════════════════════════════════════ */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
  padding: 0 24px;
  background: var(--surface-0);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.logo-mark {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: #fff;
}

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

.logo-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--fg);
}

.logo-accent { color: var(--accent); }

.logo-divider {
  width: 1px;
  height: 18px;
  background: var(--border-lt);
}

.logo-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-3);
  letter-spacing: .01em;
}

/* Indicators */
.topbar-center {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg-3);
  transition: all .3s ease;
}

.ind-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fg-4);
  transition: all .3s ease;
}

/* Indicator states */
.indicator.on  { border-color: rgba(34,197,94,.35); color: var(--green); background: var(--green-dim); }
.indicator.on .ind-dot { background: var(--green); box-shadow: 0 0 8px rgba(34,197,94,.5); }

.indicator.warn  { border-color: rgba(245,158,11,.3); color: var(--amber); background: var(--amber-dim); }
.indicator.warn .ind-dot { background: var(--amber); box-shadow: 0 0 6px rgba(245,158,11,.4); }

.indicator.err { border-color: rgba(239,68,68,.3); color: var(--red); background: var(--red-dim); }
.indicator.err .ind-dot { background: var(--red); box-shadow: 0 0 6px rgba(239,68,68,.4); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

.indicator.on .ind-dot { animation: pulse-dot 2.5s ease-in-out infinite; }

/* Right side */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 12px;
  flex-shrink: 0;
}

.topbar-meta {
  display: flex;
  gap: 12px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--fg-3);
  font-weight: 500;
}

.meta-item svg { opacity: .6; }

/* Operation badge */
.op-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 4px 12px;
  border-radius: 100px;
  white-space: nowrap;
  transition: all .25s ease;
}

.badge-idle    { background: var(--surface-3); color: var(--fg-4); }
.badge-active  { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34,197,94,.25); }
.badge-done    { background: var(--blue-dim);  color: var(--blue);  border: 1px solid rgba(59,130,246,.25); }
.badge-aborted { background: var(--red-dim);   color: var(--red);   border: 1px solid rgba(239,68,68,.25); }

/* ══ Alert Bar ═══════════════════════════════════════ */
.alert-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 600;
}

.alert-danger {
  background: rgba(239,68,68,.08);
  border-bottom: 1px solid rgba(239,68,68,.2);
  color: var(--red);
}

/* ══ Dashboard Grid ══════════════════════════════════ */
.dashboard {
  display: grid;
  gap: 1px;
  background: var(--border);
  flex: 1;
}

/* ══ Panel ═══════════════════════════════════════════ */
.panel {
  background: var(--surface-0);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--fg-2);
}

.panel-title svg { color: var(--fg-3); }

.panel-actions {
  display: flex;
  gap: 4px;
}

/* ── Chips ────────────────────────────────────────────── */
.chip {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 8px;
  border-radius: 100px;
}

.chip-blue { background: var(--blue-dim); color: var(--blue); }

/* ══ Wizard Steps ════════════════════════════════════ */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 20px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-4);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all .2s ease;
}

.step:hover { border-color: var(--border-lt); color: var(--fg-3); }

.step.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.step.done {
  border-color: rgba(34,197,94,.3);
  color: var(--green);
  background: var(--green-dim);
}

.step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  transition: all .2s ease;
}

.step.active .step-num { background: var(--accent); color: #fff; }
.step.done .step-num   { background: var(--green); color: #fff; }

.step-label { white-space: nowrap; }

.step-line {
  width: 20px;
  height: 1px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Wizard panes ─────────────────────────────────── */
.wizard-body { flex: 1; display: flex; flex-direction: column; }
.wizard-pane { display: none; }
.wizard-pane.active { display: block; animation: fadeIn .15s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.wizard-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── Form ─────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--fg-3);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color .15s, box-shadow .15s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.input-with-hint { position: relative; }
.input-with-hint input { padding-right: 70px; }

.input-hint {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--fg-4);
  pointer-events: none;
}

/* ── Radius slider row ────────────────────────────── */
.radius-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-group .radius-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  width: auto;
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  border: 1px solid var(--border-lt);
  outline: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
}

.form-group .radius-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  cursor: grab;
}

.form-group .radius-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  cursor: grab;
}

.form-group .radius-number {
  width: 80px;
  flex-shrink: 0;
  text-align: center;
}

/* ── Map ─────────────────────────────────────────── */
#map {
  height: 55vh;
  min-height: 350px;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 1;
}

/* ── Flight mode — Cockpit overlay ─────────────────── */
#tabOperations.active.flight-active {
  grid-template-columns: 1fr 280px;
  position: relative;
  height: calc(100vh - 50px);
  overflow: hidden;
}
#tabOperations.flight-active .steps,
#tabOperations.flight-active .wizard-footer { display: none; }
#tabOperations.flight-active .panel-head .chip { display: none; }
#tabOperations.flight-active #wizardStep2 { display: block !important; }
#tabOperations.flight-active #wizardStep1,
#tabOperations.flight-active #wizardStep3 { display: none !important; }
#tabOperations.flight-active #wizardStep2 .form-row,
#tabOperations.flight-active #wizardStep2 > .form-group,
#tabOperations.flight-active #wizardStep2 .geocode-bar { display: none; }
#tabOperations.flight-active .panel-wizard {
  overflow: hidden;
}
#tabOperations.flight-active .panel-wizard > .panel-head {
  display: none;
}
#tabOperations.flight-active #map {
  height: calc(100vh - 50px);
  min-height: 400px;
}

/* Mission panel → cockpit HUD overlay (absolute over map) */
#tabOperations.flight-active .panel-mission {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 280px;
  background: linear-gradient(to bottom, rgba(10,15,25,0.45) 0%, rgba(10,15,25,0.82) 40%, rgba(10,15,25,0.92) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: none;
  padding: 14px 20px 12px;
  z-index: 10;
  border-radius: 0;
}
#tabOperations.flight-active .panel-mission .panel-title {
  display: none;
}
#tabOperations.flight-active .panel-mission .panel-head {
  justify-content: flex-end;
  margin-bottom: 8px;
}
#tabOperations.flight-active .panel-mission .mission-state {
  display: none;
}
#tabOperations.flight-active .panel-mission .btn.btn-big {
  height: 48px;
  font-size: 13px;
}
#tabOperations.flight-active .panel-mission #heartbeatBtn {
  display: none;
}
#tabOperations.flight-active .panel-mission .battery-bar {
  margin-bottom: 8px;
  padding-bottom: 8px;
}
#tabOperations.flight-active .panel-mission .mission-actions {
  gap: 6px;
}
#tabOperations.flight-active .panel-mission .mission-actions-row {
  gap: 6px;
}
#tabOperations.flight-active .panel-mission .toast {
  margin-top: 6px;
  padding: 6px 10px;
  font-size: 12px;
}

.map-gps-btn {
  width: 34px;
  height: 34px;
  background: var(--surface-0);
  border: 2px solid rgba(0,0,0,.2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--fg-3);
  transition: all .15s;
}

.map-gps-btn:hover { color: var(--accent); border-color: var(--accent); }
.map-gps-btn svg { width: 18px; height: 18px; }

.leaflet-container { font-family: var(--font); }
.leaflet-control-zoom a { background: var(--surface-0) !important; color: var(--fg) !important; border-color: var(--border) !important; }
.leaflet-control-zoom a:hover { background: var(--surface-2) !important; }

.leaflet-draw-toolbar a { background-color: var(--surface-0) !important; border-color: var(--border) !important; }
.leaflet-draw-toolbar a:hover { background-color: var(--surface-2) !important; }
.leaflet-draw-actions a { background: var(--surface-1); color: var(--fg); border-color: var(--border); }

[data-theme="light"] .map-gps-btn { background: #fff; }
[data-theme="light"] .leaflet-control-zoom a { background: #fff !important; color: #333 !important; }
[data-theme="light"] .leaflet-draw-toolbar a { background-color: #fff !important; }

/* ── Confirm card ─────────────────────────────────── */
.confirm-card {
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.confirm-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--fg-3);
  margin-bottom: 8px;
}

.confirm-header svg { color: var(--green); }

.confirm-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 12px;
}

.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}

.tag-ok {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(34,197,94,.2);
}

/* ── Geocoding bar ──────────────────────────────────── */
.geocode-bar {
  position: relative;
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.geocode-bar input {
  flex: 1;
  height: 40px;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color .15s, box-shadow .15s;
}

.geocode-bar input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.geocode-bar input::placeholder { color: var(--fg-4); }

.geocode-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  margin-top: 4px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  list-style: none;
}

.geocode-item {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--fg-2);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

.geocode-item:last-child { border-bottom: none; }
.geocode-item:hover { background: var(--surface-2); color: var(--fg); }

.geocode-empty {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--fg-4);
  font-style: italic;
  text-align: center;
}

/* ── Checklist groups ──────────────────────────────── */
.check-group { margin-bottom: 12px; }
.check-group:last-child { margin-bottom: 0; }

.check-group-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--fg-4);
  margin-bottom: 6px;
  padding-left: 4px;
}

/* ── Pre-flight checklist ────────────────────────────── */
.checklist { display: flex; flex-direction: column; gap: 8px; }

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .15s ease;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-2);
}
.check-item:hover { border-color: var(--accent); }
.check-item:has(input:checked) {
  background: var(--green-dim);
  border-color: var(--green);
  color: var(--green);
}
.check-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
  cursor: pointer;
  flex-shrink: 0;
}

/* ══ Mission Control ═════════════════════════════════ */
.mission-state {
  font-size: 14px;
  color: var(--fg-3);
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.mission-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mission-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ── Hold buttons ─────────────────────────────────── */
.hold-wrapper { display: flex; flex-direction: column; }

.hold-track {
  height: 3px;
  border-radius: 2px;
  background: var(--surface-3);
  margin-top: 3px;
  overflow: hidden;
}

.hold-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: var(--green);
  transition: width 0.05s linear;
}

.hold-track-end .hold-fill { background: #2563eb; }
.hold-track-danger .hold-fill { background: var(--red); }
.hold-track-fly .hold-fill { background: #16a34a; }

/* ── Fly button (INICIAR VUELO) ──────────────────── */
.btn-fly {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #fff;
  font-weight: 800;
  border: 2px solid rgba(255,255,255,.15);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-fly:hover { background: linear-gradient(135deg, #15803d 0%, #166534 100%); }
.btn-fly:disabled { opacity: 0.35; filter: grayscale(1); cursor: not-allowed; pointer-events: none; }
.btn-fly svg { flex-shrink: 0; }

/* ── Toast / microcopy ────────────────────────────── */
.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: auto;
  padding: 12px 14px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-2);
  line-height: 1.5;
}

.toast svg { flex-shrink: 0; margin-top: 1px; color: var(--fg-4); }

/* ══ Sidebar ═════════════════════════════════════════ */
.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--surface-0);
}

.sidebar .panel {
  border-bottom: 1px solid var(--border);
}

.sidebar .panel:last-child {
  border-bottom: none;
  flex: 1;
}

/* ── Code pane ────────────────────────────────────── */
.code-pane {
  min-height: 80px;
  max-height: 180px;
  overflow: auto;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-3);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Log ──────────────────────────────────────────── */
.panel-log { flex: 1; }

.log-scroll {
  flex: 1;
  min-height: 120px;
  max-height: 100%;
  overflow-y: auto;
  padding: 4px 0;
}

.log-scroll p {
  padding: 3px 10px;
  margin: 0;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--fg-4);
  border-radius: 3px;
  line-height: 1.7;
  transition: background .1s;
}

.log-scroll p:hover { background: var(--surface-2); }
.log-scroll p.log-ok { color: var(--green); }
.log-scroll p.log-error { color: var(--red); }

/* ══ Buttons ═════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s ease;
  white-space: nowrap;
}

.btn-sm { height: 34px; padding: 0 14px; font-size: 12px; }
.btn-block { width: 100%; }

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

.btn-accent { background: var(--accent); color: #fff; min-width: 180px; }
.btn-accent:hover { background: #c5050f; }

.btn-ghost {
  background: transparent;
  color: var(--fg-3);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--border-lt); color: var(--fg-2); }
.btn-ghost:disabled { opacity: .35; cursor: not-allowed; }

.btn-outline {
  background: transparent;
  color: var(--fg-3);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-success {
  background: var(--green);
  color: #052e16;
  font-weight: 700;
  border: none;
}
.btn-success:hover { background: #16a34a; }

.btn-end {
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  border: none;
}
.btn-end:hover { background: #1d4ed8; }

.btn-danger {
  background: var(--red);
  color: #fff;
  font-weight: 700;
  border: none;
}
.btn-danger:hover { background: #dc2626; }

.btn-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-3);
  cursor: pointer;
  transition: all .15s;
}

.btn-icon:hover { border-color: var(--accent); color: var(--accent); }

/* ── Big buttons (field / tablet use) ────────────── */
.btn.btn-big {
  height: 80px;
  padding: 0 20px;
  font-size: 16px;
  font-weight: 800;
  border-radius: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.btn.btn-big svg { width: 24px; height: 24px; flex-shrink: 0; }
.btn.btn-big:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  filter: grayscale(1);
}

/* Hold bar thicker for big buttons */
.hold-wrapper:has(.btn.btn-big) .hold-track {
  height: 5px;
  margin-top: 5px;
}

/* ══ Footer ══════════════════════════════════════════ */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 11px;
  color: var(--fg-4);
  border-top: 1px solid var(--border);
  background: var(--surface-0);
}

.footer-sep { color: var(--border-lt); }

/* ══ Utility ═════════════════════════════════════════ */
.hidden { display: none !important; }

/* ══ Responsive (base — overridden by new responsive at bottom) ══ */

/* ══ Light Theme ═════════════════════════════════════ */
[data-theme="light"] {
  --bg:         #f0f2f5;
  --surface-0:  #ffffff;
  --surface-1:  #f8f9fb;
  --surface-2:  #f0f2f5;
  --surface-3:  #e5e7ec;

  --border:     #d1d5db;
  --border-lt:  #e5e7eb;
  --border-focus: #3b82f6;

  --fg:         #111827;
  --fg-2:       #374151;
  --fg-3:       #6b7280;
  --fg-4:       #9ca3af;

  --accent-dim: rgba(227,6,19,.06);

  --green-dim:  rgba(34,197,94,.08);
  --blue-dim:   rgba(59,130,246,.08);
  --amber-dim:  rgba(245,158,11,.08);
  --red-dim:    rgba(239,68,68,.07);

  --shadow-sm:  0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 2px 8px rgba(0,0,0,.08), 0 0 1px rgba(0,0,0,.04);
  --shadow-lg:  0 4px 24px rgba(0,0,0,.1);
}

/* Light mode: cockpit overlay */
[data-theme="light"] #tabOperations.flight-active .panel-mission {
  background: linear-gradient(to bottom, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0.85) 40%, rgba(255,255,255,0.95) 100%);
  border-top: none;
}

[data-theme="light"] .logo-mark { box-shadow: 0 2px 8px rgba(227,6,19,.2); }
[data-theme="light"] .btn-success { color: #fff; }
[data-theme="light"] .code-pane { background: var(--surface-2); }
[data-theme="light"] .dashboard { background: var(--border); }

/* Light mode: big buttons disabled visible */
[data-theme="light"] .btn.btn-big:disabled {
  opacity: 0.45;
  filter: grayscale(0.8);
  background: var(--surface-3);
  color: var(--fg-4);
  border: 1px solid var(--border);
}

/* Light mode: hold track contrast */
[data-theme="light"] .hold-track {
  background: var(--border);
}

/* Light mode: geocode dropdown */
[data-theme="light"] .geocode-dropdown {
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
}

/* Light mode: fly button */
[data-theme="light"] .btn-fly {
  border-color: rgba(0,0,0,.08);
}

/* Light mode: checklist group title */
[data-theme="light"] .check-group-title {
  color: var(--fg-3);
}

/* Light mode: slider track visible */
[data-theme="light"] .form-group .radius-slider {
  background: #b0b8c8;
  border-color: #9aa3b3;
}
[data-theme="light"] .form-group .radius-slider::-webkit-slider-thumb {
  border-color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

/* ── Theme toggle button ──────────────────────────── */
.theme-toggle {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-3);
  cursor: pointer;
  transition: all .2s ease;
  flex-shrink: 0;
}

.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { width: 16px; height: 16px; }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ── Scrollbar ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-lt); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-4); }

/* ══════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.login-logo-img {
  width: 120px;
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.3));
}

.login-subtitle {
  font-size: 12px;
  color: var(--fg-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.login-partners {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.partner-item { display: flex; align-items: center; }
.partner-sep { color: var(--fg-3); font-size: 11px; font-weight: 600; opacity: 0.4; }
.v2x-badge {
  font-size: 11px;
  font-weight: 800;
  color: #3b82f6;
  background: rgba(59,130,246,.1);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
}

.login-form { display: flex; flex-direction: column; gap: 0; }
.login-form .form-group { margin-bottom: 16px; }

.login-error {
  padding: 10px 14px;
  background: var(--red-dim);
  border: 1px solid rgba(239,68,68,.25);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 12px;
}

.login-footer {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  font-size: 11px;
  color: var(--fg-4);
}

.login-demo {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.login-demo p {
  font-size: 11px;
  color: var(--fg-4);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}

.demo-btn {
  display: inline-block;
  padding: 4px 10px;
  margin: 3px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--fg-3);
  cursor: pointer;
  transition: all .15s;
}

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

/* ══════════════════════════════════════════════════════
   STATS BAR (Topbar)
   ══════════════════════════════════════════════════════ */
.topbar-stats {
  display: flex;
  gap: 6px;
  margin-left: 16px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg-3);
}

.stat-pill svg { opacity: .5; }
.stat-label { font-weight: 500; color: var(--fg-4); margin-left: 2px; }

.stat-active { border-color: rgba(34,197,94,.3); color: var(--green); background: var(--green-dim); }
.stat-active svg { opacity: .8; color: var(--green); }

/* ══════════════════════════════════════════════════════
   CONSOLE TABS
   ══════════════════════════════════════════════════════ */
.console-tabs {
  display: flex;
  gap: 0;
  background: var(--surface-0);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  overflow-x: auto;
}

.console-tabs .tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--fg-3);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.console-tabs .tab:hover { color: var(--fg); }
.console-tabs .tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.console-tabs .tab svg { opacity: .5; }
.console-tabs .tab.active svg { opacity: 1; color: var(--accent); }

/* Tab content visibility */
.tab-content { display: none; }
.tab-content.active { display: grid; }

/* Operations tab keeps the 3-column grid */
#tabOperations.active { grid-template-columns: 1fr 1fr 340px; gap: 1px; background: var(--border); flex: 1; }

/* Other tabs are full width */
#tabLivemap.active,
#tabHistory.active,
#tabFleet.active,
#tabPilots.active { display: block; flex: 1; }

.fullwidth-panel {
  background: var(--surface-0);
  padding: 20px 24px;
  min-height: calc(100vh - 180px);
}

/* ══════════════════════════════════════════════════════
   LIVE MAP
   ══════════════════════════════════════════════════════ */
.live-map {
  height: calc(100vh - 260px);
  min-height: 400px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 1;
}

.livemap-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-2);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════
   DRONE MARKER (pulsating)
   ══════════════════════════════════════════════════════ */
.drone-marker-wrapper {
  background: transparent !important;
  border: none !important;
  overflow: visible !important;
}

.drone-marker {
  width: 18px;
  height: 18px;
  background: #3b82f6;
  border: 2.5px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(59,130,246,.5);
  animation: drone-pulse 1.8s ease-in-out infinite;
  position: relative;
}

/* Radiating ring pulse */
.drone-marker::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(59,130,246,.6);
  transform: translate(-50%, -50%);
  animation: drone-ring 1.8s ease-out infinite;
  pointer-events: none;
}

@keyframes drone-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(59,130,246,.4); transform: scale(1); }
  50% { box-shadow: 0 0 24px rgba(59,130,246,.8); transform: scale(1.2); }
}

@keyframes drone-ring {
  0%   { width: 18px; height: 18px; opacity: .8; border-width: 2px; }
  100% { width: 50px; height: 50px; opacity: 0;  border-width: 1px; }
}

/* Battery tooltip */
.battery-tooltip {
  background: var(--surface-1) !important;
  border: 1px solid var(--border) !important;
  color: var(--bat-color, var(--green)) !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  padding: 2px 8px !important;
  border-radius: 100px !important;
  box-shadow: var(--shadow-sm) !important;
}

.battery-tooltip::before { border-top-color: var(--border) !important; }

/* ══════════════════════════════════════════════════════
   BATTERY BAR
   ══════════════════════════════════════════════════════ */
.battery-bar {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.battery-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-2);
  margin-bottom: 6px;
}

.battery-label svg { color: var(--fg-3); }

.battery-track {
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
}

.battery-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width .5s ease, background .3s;
}

.battery-fill.battery-warn { background: var(--amber); }
.battery-fill.battery-critical { background: var(--red); animation: bat-blink 1s ease infinite; }

@keyframes bat-blink { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

/* ══════════════════════════════════════════════════════
   FLIGHT TIMER
   ══════════════════════════════════════════════════════ */
.flight-timer {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--green);
  padding: 3px 10px;
  background: var(--green-dim);
  border: 1px solid rgba(34,197,94,.25);
  border-radius: 100px;
}

/* ══════════════════════════════════════════════════════
   DATA TABLES
   ══════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--fg-3);
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--fg-2);
}

.data-table tr:hover td { background: var(--surface-1); }

.table-empty {
  text-align: center;
  padding: 40px 20px !important;
  color: var(--fg-4);
  font-style: italic;
}

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  font-size: 12px;
  color: var(--fg-3);
}

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

/* Status dots */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.status-ok { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,.4); }
.status-active { background: var(--blue); box-shadow: 0 0 6px rgba(59,130,246,.4); animation: pulse-dot 2s ease infinite; }
.status-warn { background: var(--amber); box-shadow: 0 0 6px rgba(245,158,11,.4); }
.status-err { background: var(--red); box-shadow: 0 0 6px rgba(239,68,68,.4); }

/* ══════════════════════════════════════════════════════
   HISTORY FILTERS
   ══════════════════════════════════════════════════════ */
.history-filters {
  display: flex;
  gap: 4px;
}

.filter-btn {
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--fg-3);
  cursor: pointer;
  transition: all .15s;
}

.filter-btn:hover { border-color: var(--border-lt); color: var(--fg-2); }

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

/* ══════════════════════════════════════════════════════
   FLEET GRID
   ══════════════════════════════════════════════════════ */
.fleet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.fleet-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color .15s;
}

.fleet-card:hover { border-color: var(--border-lt); }

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

.fleet-reg {
  font-size: 15px;
  font-weight: 700;
  color: var(--fg);
  font-family: var(--mono);
}

.fleet-model {
  font-size: 13px;
  color: var(--fg-2);
  margin-bottom: 8px;
}

.fleet-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--fg-4);
  margin-bottom: 10px;
}

.fleet-status {
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-3);
}

/* ══════════════════════════════════════════════════════
   CHIP VARIANTS
   ══════════════════════════════════════════════════════ */
.chip-red { background: var(--red-dim); color: var(--red); }
.chip-amber { background: var(--amber-dim); color: var(--amber); }
.chip-green { background: var(--green-dim); color: var(--green); }

/* ══════════════════════════════════════════════════════
   NOTIFICATIONS STACK
   ══════════════════════════════════════════════════════ */
.notif-stack {
  position: fixed;
  top: 64px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.notif {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: notif-in .25s ease;
  transition: all .3s ease;
}

.notif-ok { background: #052e16; color: var(--green); border: 1px solid rgba(34,197,94,.3); }
.notif-error { background: #450a0a; color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.notif-warn { background: #451a03; color: var(--amber); border: 1px solid rgba(245,158,11,.3); }
.notif-info { background: var(--surface-2); color: var(--fg-2); border: 1px solid var(--border); }

[data-theme="light"] .notif-ok { background: #f0fdf4; }
[data-theme="light"] .notif-error { background: #fef2f2; }
[data-theme="light"] .notif-warn { background: #fffbeb; }
[data-theme="light"] .notif-info { background: #fff; }

.notif-close {
  background: transparent;
  border: none;
  color: inherit;
  opacity: .5;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}

.notif-close:hover { opacity: 1; }

.notif-exit { opacity: 0; transform: translateX(20px); }

@keyframes notif-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ══════════════════════════════════════════════════════
   RESPONSIVE UPDATES
   ══════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  #tabOperations.active { grid-template-columns: 1fr 1fr; }
  #tabOperations.active.flight-active { grid-template-columns: 1fr; }
  .sidebar { grid-column: 1 / -1; flex-direction: row; }
  .sidebar .panel { flex: 1; border-bottom: none; border-right: 1px solid var(--border); }
  .sidebar .panel:last-child { border-right: none; }
  .topbar-stats { display: none; }
}

@media (max-width: 768px) {
  #tabOperations.active { grid-template-columns: 1fr; }
  .topbar { height: auto; padding: 12px 16px; flex-wrap: wrap; }
  .topbar-center { order: 3; width: 100%; }
  .topbar-right { margin-left: auto; }
  .topbar-meta { display: none; }
  .topbar-stats { display: none; }
  .sidebar { flex-direction: column; }
  .sidebar .panel { border-right: none; border-bottom: 1px solid var(--border); }
  .steps { flex-wrap: wrap; gap: 4px; }
  .step-line { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .app-footer { flex-wrap: wrap; justify-content: center; }
  .console-tabs { padding: 0 12px; }
  .console-tabs .tab { padding: 8px 12px; font-size: 11px; }
  .fleet-grid { grid-template-columns: 1fr; }
  .history-filters { flex-wrap: wrap; }
  .mission-actions-row { grid-template-columns: 1fr; }
  .btn.btn-big { height: 64px; font-size: 14px; }
  #tabOperations.active.flight-active { grid-template-columns: 1fr; }
  #tabOperations.active.flight-active #map { min-height: 300px; }
}
