:root {
  --bg: #0f172a;
  --panel-bg: #ffffff;
  --panel-border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --warn: #d97706;
  --zone: #2563eb;
  --zone-selected: #f97316;
  --zone-overlap: #dc2626;
  --flight: #16a34a;
  --header-h: 60px;
  --left-w: 340px;
  --right-w: 360px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  color: var(--text);
  background: #f1f5f9;
}

body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ---------- Header ---------- */
.app-header {
  height: var(--header-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--bg);
  color: #f8fafc;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  z-index: 1000;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { width: 36px; height: 36px; border-radius: 50%; display: block; filter: drop-shadow(0 0 8px rgba(52, 211, 153, 0.4)); }
.app-header h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: 0.2px; }
.subtitle { margin: 0; font-size: 12px; color: #94a3b8; }
.header-meta { display: flex; align-items: center; gap: 10px; }

.badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-loading { background: #334155; color: #cbd5e1; }
.badge-live { background: #14532d; color: #bbf7d0; }
.badge-cache { background: #1e3a5f; color: #bfdbfe; }
.badge-snapshot { background: #78350f; color: #fed7aa; }
.badge-error { background: #7f1d1d; color: #fecaca; }

/* Dataset provenance + "new zones" filter chip (header) */
.valid-from {
  font-size: 12px;
  color: #cbd5e1;
  background: #0d0d0d;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.chip {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #0891b2;
  background: rgba(8, 145, 178, 0.18);
  color: #67e8f9;
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { background: rgba(8, 145, 178, 0.32); }
.chip.active { background: #06b6d4; color: #06232b; border-color: #06b6d4; }

/* "NEW" / "CTR" / permanent / NOTAM pills on zones in the list */
.new-pill, .ctr-pill, .perm-pill, .notam-pill, .notam-active {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  padding: 1px 5px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 6px;
}
.new-pill { background: #0891b2; }
.ctr-pill { background: #7c3aed; }
.perm-pill { background: #db2777; }
.notam-pill { background: #b45309; }
.notam-active { background: #16a34a; margin-left: 4px; }
/* Category left-accents in the list (selection/overlap still take precedence). */
.zone-item.is-ctr { border-left-color: #7c3aed; }
.zone-item.is-permanent { border-left-color: #db2777; }
.zone-item.is-notam { border-left-color: #b45309; }
.overlap-card.oc-notam { border-left-color: #b45309; background: #fffbeb; border-color: #fde68a; }

/* ---------- Layout ---------- */
.layout { flex: 1 1 auto; display: flex; min-height: 0; }

.panel {
  background: var(--panel-bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel-left { width: var(--left-w); border-right: 1px solid var(--panel-border); }
.panel-right { width: var(--right-w); border-left: 1px solid var(--panel-border); }

.panel-header {
  flex: 0 0 auto;
  padding: 12px 14px;
  border-bottom: 1px solid var(--panel-border);
}
.panel-header h2 { margin: 0 0 2px; font-size: 15px; }
.panel-body { overflow-y: auto; padding: 14px; flex: 1 1 auto; }

.map-wrap { flex: 1 1 auto; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: #f1f5f9;
  color: var(--text);
  transition: background 0.12s, box-shadow 0.12s;
}
.btn:hover:not(:disabled) { background: #e2e8f0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: var(--panel-border); }
.btn-ghost:hover:not(:disabled) { background: #f1f5f9; }
/* Ghost buttons in the dark header need light text so their labels are always
   readable (previously dark-on-dark → visible only on hover). */
.app-header .btn-ghost {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
  white-space: nowrap;
}
.app-header .btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}
.btn-block { width: 100%; margin: 12px 0 4px; }
.btn-mini { padding: 2px 8px; font-size: 11px; font-weight: 600; }

/* ---------- Left panel: draw / flight summary ---------- */
.draw-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.draw-controls .btn { flex: 1 1 45%; }

.circle-radius-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.circle-radius-row label { font-size: 13px; font-weight: 600; color: var(--muted); }
.circle-radius-row input {
  flex: 1;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  font-size: 13px;
}
.circle-radius-row select {
  padding: 7px 8px;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  font-size: 13px;
}
.circle-radius-row input:focus, .circle-radius-row select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 12px 0 0; }

/* Weather card (flight panel) — wind-forward. Flyability colours are information. */
.wx { margin-top: 14px; border: 1px solid var(--panel-border); border-radius: 10px; padding: 12px; background: var(--surface-2); }
.wx-head { display: flex; justify-content: space-between; align-items: baseline; }
.wx-head h3 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.wx-updated { font-size: 10px; color: var(--muted); }
.wx-wind { display: flex; align-items: center; gap: 10px; margin: 8px 0 6px; }
.wx-arrow { font-size: 22px; line-height: 1; display: inline-block; color: var(--text); }
.wx-wind-main { font-size: 13px; color: var(--muted); }
.wx-wind-main b { font-size: 22px; font-weight: 800; color: var(--text); }
.wx-wind-main small { color: var(--muted); font-size: 12px; }
.wx-wind-dir { margin-left: auto; font-size: 12px; color: var(--muted); }
.wx-fly { font-size: 12.5px; font-weight: 700; border-radius: 7px; padding: 6px 9px; margin: 4px 0; }
.wx-fly-ok { background: rgba(22, 163, 74, 0.16); color: #86efac; }
.wx-fly-caution { background: rgba(217, 119, 6, 0.18); color: #fcd34d; }
.wx-fly-no { background: rgba(220, 38, 38, 0.18); color: #fca5a5; }
.wx-drone { display: block; font-size: 11.5px; color: var(--muted); margin: 6px 0; }
.wx-drone select { margin-left: 4px; background: var(--surface-3); color: var(--text); border: 1px solid var(--panel-border); border-radius: 6px; padding: 3px 6px; font-size: 11.5px; }
.wx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 8px 0; }
.wx-grid > div { display: flex; flex-direction: column; }
.wx-grid small { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
.wx-grid b { font-size: 13px; font-weight: 700; }
.wx-grid .muted { font-weight: 400; }
.wx-trend > small { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
.wx-trend-row { display: flex; gap: 5px; margin-top: 4px; }
.wx-trend-row span { flex: 1; text-align: center; background: var(--surface-3); border-radius: 6px; padding: 4px 2px; }
.wx-trend-row small { display: block; font-size: 9px; color: var(--muted); }
.wx-trend-row b { display: block; font-weight: 700; font-size: 13px; }
.wx-trend-row em { display: block; font-size: 10px; color: var(--muted); font-style: normal; }

/* Points of interest ("places to fly") list */
.poi-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.poi-row { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; padding: 12px; border: 1px solid var(--panel-border); border-radius: 10px; background: var(--surface-2); }
.poi-main { min-width: 0; }
.poi-name { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.poi-cat { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-top: 3px; }
.poi-note { font-size: 12.5px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.poi-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; white-space: nowrap; }
.poi-badge { font-size: 10px; font-weight: 700; border-radius: 999px; padding: 2px 8px; }
.poi-badge-ok { background: rgba(22, 163, 74, 0.16); color: #86efac; }
.poi-badge-warn { background: rgba(217, 119, 6, 0.18); color: #fcd34d; }
.flight-summary { margin-top: 14px; }
.stat-row { display: flex; gap: 8px; margin-bottom: 4px; }
.stat {
  flex: 1;
  background: #f8fafc;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
}
.stat-label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.stat-value { display: block; font-size: 15px; font-weight: 700; margin-top: 2px; }

.subsection { margin-top: 16px; }
.subsection h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.muted { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

.coords-list {
  margin: 0;
  padding-left: 22px;
  font-family: "SF Mono", ui-monospace, "Cascadia Code", Menlo, monospace;
  font-size: 11.5px;
  color: #334155;
  max-height: 180px;
  overflow-y: auto;
}
.coords-list li { padding: 1px 0; }

.overlap-list { display: flex; flex-direction: column; gap: 8px; }
.overlap-empty { font-size: 12px; color: var(--flight); font-weight: 600; }
.overlap-card {
  border: 1px solid #fecaca;
  background: #fef2f2;
  border-left: 4px solid var(--zone-overlap);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}
.overlap-card:hover { background: #fee2e2; }
.overlap-card .oc-title { font-weight: 700; font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.overlap-card .oc-row { font-size: 12px; color: #334155; margin-top: 3px; }
.overlap-card .oc-contact { font-size: 11px; color: var(--muted); margin-top: 4px; word-break: break-word; }

/* ---------- Right panel: zone list ---------- */
.count {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 999px;
}
.search {
  width: 100%;
  margin-top: 8px;
  padding: 7px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  font-size: 13px;
}
.search:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

.zone-list { overflow-y: auto; flex: 1 1 auto; }

/* Collapsible branch (RZ / NOTAMs / Permanent) */
.zgroup.hidden { display: none; }
.zgroup-head {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border: none; border-bottom: 1px solid var(--panel-border);
  background: #f8fafc; cursor: pointer; text-align: left;
  font-size: 12px; font-weight: 800; letter-spacing: 0.02em; color: #334155;
  position: sticky; top: 0; z-index: 1;
}
.zgroup-head:hover { background: #f1f5f9; }
.zg-caret { font-size: 10px; color: var(--muted); transition: transform 0.15s; }
.zgroup.collapsed .zg-caret { transform: rotate(-90deg); }
.zg-name { flex: 1 1 auto; }
.zg-count { background: #e2e8f0; color: #475569; border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 700; }
.zgroup.collapsed .zgroup-body { display: none; }
.zsub.hidden { display: none; }
.zsub-head {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 14px 5px 26px; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); background: #fcfdff; border-bottom: 1px solid #f1f5f9;
}
.zsub-name { flex: 1 1 auto; }
.zsub-count { color: #94a3b8; }

/* Category show/hide switch (visibility only) sitting beside each list title. */
.zg-toggle { flex-shrink: 0; display: inline-flex; align-items: center; cursor: pointer; }
.zg-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.zg-sw { position: relative; width: 28px; height: 15px; border-radius: 999px; background: #cbd5e1; transition: background 0.15s; }
.zg-sw::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px;
  border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.zg-toggle input:checked + .zg-sw { background: #e0e0e0; }
.zg-toggle input:checked + .zg-sw::after { transform: translateX(13px); background: #111111; }
.zg-toggle input:indeterminate + .zg-sw { background: #8a8a8a; }
.zg-toggle input:indeterminate + .zg-sw::after { transform: translateX(7px); }
.zg-toggle input:focus-visible + .zg-sw { outline: 2px solid #c4c4c4; outline-offset: 2px; }

.zone-item {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  border-left: 4px solid transparent;
}
.zone-item.hidden { display: none; }
.zone-item:hover { background: #f8fafc; }
/* Branch accents in the list (mirror the map colours). Declared BEFORE
   .selected/.overlap so an active selection/overlap colour always wins. */
.zone-item.is-rz { border-left-color: var(--zone); }
.zone-item.is-new { border-left-color: #0891b2; }
.zone-item.selected { background: #fff7ed; border-left-color: var(--zone-selected); }
.zone-item.overlap { background: #fef2f2; border-left-color: var(--zone-overlap); }
.zi-title { font-weight: 700; font-size: 13px; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.zi-alt { font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.zi-contact { font-size: 11px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Expandable detail (revealed on click) */
.zi-detail { display: none; margin-top: 8px; }
.zone-item.expanded .zi-detail { display: block; }
.zd-row { display: flex; gap: 8px; font-size: 12px; margin-top: 3px; }
.zd-label { flex: 0 0 74px; color: var(--muted); font-weight: 700; }
.zd-val { flex: 1 1 auto; color: #334155; word-break: break-word; }
.zd-raw {
  margin-top: 6px; padding: 7px 9px; background: #f8fafc; border: 1px solid var(--panel-border);
  border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; line-height: 1.5; color: #475569; white-space: pre-wrap; word-break: break-word;
}
.zi-zoom {
  margin-top: 8px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
  background: #eff6ff; color: var(--primary-dark); border: 1px solid #bfdbfe; border-radius: 6px;
}
.zi-zoom:hover { background: #dbeafe; }

.zone-list-empty { padding: 20px 14px; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- Auth + history (Phase 2) ---------- */
.header-divider { width: 1px; height: 24px; background: #334155; margin: 0 2px; }
.user-email { font-size: 12px; color: #cbd5e1; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-danger { background: transparent; border: 1px solid #fecaca; color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #fef2f2; }

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}
.modal {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 22px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.modal-wide { max-width: 560px; }
.modal h2 { margin: 0 0 6px; font-size: 18px; }
.modal .search { margin: 10px 0; }
.modal-close {
  position: absolute;
  top: 10px; right: 12px;
  border: none; background: transparent;
  font-size: 22px; line-height: 1;
  color: var(--muted); cursor: pointer;
}
.modal-close:hover { color: var(--text); }

/* History list */
.history-list { max-height: 60vh; overflow-y: auto; margin-top: 8px; }
.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--panel-border);
}
.hr-name { font-weight: 700; font-size: 14px; }
.hr-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hr-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Toast */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #171717;
  color: #f8fafc;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 2100;
}

/* ---------- Billing (Phase 3) ---------- */
.billing-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
}
.billing-banner.locked {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

/* Individual / Business account-type selector in the subscribe modal */
.acct-type { display: flex; gap: 8px; margin: 12px 0 6px; }
.acct-opt {
  flex: 1; display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--panel-border); border-radius: 10px; padding: 10px 12px;
  cursor: pointer; font-size: 13px; font-weight: 600;
}
.acct-opt small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.acct-opt:has(input:checked) { border-color: #8a8a8a; background: rgba(255, 255, 255, 0.06); }
.acct-opt input { accent-color: var(--primary); }

/* ---------- Left-panel mode switch + Volume Planner ---------- */
.mode-switch { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--panel-border); border-radius: 9px; padding: 3px; }
.mode-btn { flex: 1; border: none; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 700; padding: 6px 8px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.mode-btn:hover { color: var(--text); }
.mode-btn.active { background: var(--primary); color: #fff; }

.vp { position: relative; }
.vp-lockbadge { display: none; }
.vp.vp-locked { cursor: pointer; }
.vp.vp-locked .vp-lockbadge {
  display: block; margin-bottom: 10px; padding: 7px 10px; border-radius: 8px;
  background: rgba(34, 211, 238, 0.12); border: 1px solid rgba(34, 211, 238, 0.4);
  color: #67e8f9; font-size: 12px; font-weight: 700; text-align: center;
}
.vp.vp-locked > *:not(.vp-lockbadge) { opacity: 0.5; }

.vp-group { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 800; margin: 14px 0 8px; }
.vp-seg { display: flex; gap: 6px; margin-bottom: 8px; }
.vp-seg label { flex: 1; display: flex; align-items: center; gap: 6px; border: 1px solid var(--panel-border); border-radius: 8px; padding: 8px 10px; font-size: 13px; font-weight: 600; cursor: pointer; }
.vp-seg label:has(input:checked) { border-color: #8a8a8a; background: rgba(255, 255, 255, 0.06); }
.vp-seg input { accent-color: var(--primary); }
.vp-seg small { display: block; font-size: 10px; font-weight: 400; color: var(--muted); margin-top: 1px; }

.vp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vp-grid-1 { grid-template-columns: 1fr; }
.vp-f { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); }
.vp-f > span { font-weight: 600; }
.vp-f input, .vp-f select { padding: 7px 8px; border: 1px solid var(--panel-border); border-radius: 7px; font-size: 13px; background: var(--surface-2); color: var(--text); }
.vp-f input:focus, .vp-f select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.vp-f.hidden { display: none; }

.vp-adv { margin: 12px 0; }
.vp-adv summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.vp-adv[open] summary { margin-bottom: 8px; }

.vp-results:empty { display: none; }
.vp-results { margin-top: 12px; }
.vp-headline { display: flex; gap: 6px; margin-bottom: 10px; }
.vp-hcard { flex: 1; background: var(--surface-2); border: 1px solid var(--panel-border); border-radius: 8px; padding: 8px; text-align: center; }
.vp-hcard small { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.vp-hcard b { display: block; font-size: 15px; margin: 3px 0 1px; }
.vp-hcard > span { font-size: 10px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
.vp-hcard-red b { color: #f87171; }
.vp-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.vp-table td { padding: 4px 2px; border-bottom: 1px solid rgba(148, 163, 184, 0.08); color: #c6d3e8; }
.vp-table td:last-child { text-align: right; font-weight: 600; white-space: nowrap; }
.vp-th td { color: var(--muted); font-weight: 800; text-transform: uppercase; font-size: 10px; letter-spacing: 0.04em; padding-top: 10px; border-bottom: none; }
.vp-sub { color: var(--muted); font-family: ui-monospace, Menlo, monospace; font-size: 10px; }
.vp-shape { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.vp-shape .btn { flex: 0 0 auto; white-space: nowrap; }
.vp-plans-hint { flex: 1 1 140px; }
.vp-load { margin-bottom: 8px; }
.vp-adj-toggle { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin: 8px 0 2px; cursor: pointer; }
.vp-adj-toggle input { accent-color: var(--accent); }
.vp-plans-list { margin: 6px 0 4px; }
.vp-plans-list.hidden { display: none; }
.vp-plan-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(148, 163, 184, 0.08); font-size: 13px; }
.vp-plan-row > span:first-child { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp-plan-acts { display: flex; gap: 4px; flex-shrink: 0; }
.vp-foot { margin-top: 12px; }
.vp-areas { display: flex; gap: 6px; margin-bottom: 8px; }
.vp-areas span { flex: 1; text-align: center; font-size: 11px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--panel-border); border-radius: 6px; padding: 5px 4px; color: #c6d3e8; }
.vp-warn { font-size: 12px; font-weight: 700; color: #fca5a5; margin-bottom: 6px; }
.vp-ok { font-size: 12px; font-weight: 700; color: #34d399; }
.vp-ovl { list-style: none; margin: 0; padding: 0; max-height: 180px; overflow-y: auto; }
.vp-ovl li { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 4px 0; border-bottom: 1px solid rgba(148, 163, 184, 0.08); color: #c6d3e8; }
.vp-ovl li span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.vp-schem { display: flex; gap: 8px; margin: 4px 0 12px; }
.vp-schem figure { flex: 1; margin: 0; }
.vp-schem figcaption { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; text-align: center; margin-bottom: 2px; }
.vp-svg { width: 100%; height: auto; background: var(--surface-2); border: 1px solid var(--panel-border); border-radius: 8px; }
.vp-svg-t { fill: var(--text); font-size: 11px; font-weight: 800; font-family: -apple-system, "Segoe UI", sans-serif; }
.vp-svg-d { fill: var(--muted); font-size: 8.5px; font-family: ui-monospace, Menlo, monospace; }
.vp-ground { stroke: #64748b; stroke-width: 1.5; }
.vp-vlos { font-size: 12px; font-weight: 800; padding: 7px 10px; border-radius: 8px; margin-bottom: 8px; }
.vp-isvlos { background: rgba(52, 211, 153, 0.14); border: 1px solid rgba(52, 211, 153, 0.4); color: #34d399; }
.vp-bvlos { background: rgba(245, 158, 11, 0.14); border: 1px solid rgba(245, 158, 11, 0.45); color: #fbbf24; }
.leaflet-tooltip.vp-mk { background: #171717; color: #e6eefb; border: 1px solid #38bdf8; font-size: 11px; font-weight: 700; }
.leaflet-tooltip.vp-mk::before { border-top-color: #38bdf8; }

.plan-grid { display: flex; gap: 10px; margin: 14px 0 6px; }
.plan-card {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 16px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.plan-card:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(37, 99, 235, 0.15); }
.plan-card-featured { border-color: var(--primary); }
.plan-price { font-size: 20px; font-weight: 800; }
.plan-per { font-size: 11px; color: var(--muted); }
.plan-badge {
  position: absolute;
  top: -9px;
  background: var(--flight);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
}

/* ---------- Profile & equipment library ---------- */
.lib-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--panel-border); margin: 12px 0; }
.lib-tab {
  border: none;
  background: transparent;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.lib-tab:hover { color: var(--text); }
.lib-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.lib-pane { max-height: 62vh; overflow-y: auto; }
.lib-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.lib-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.lib-field span { font-weight: 600; }
.lib-field input, .lib-field select, .lib-field textarea {
  padding: 7px 9px;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}
.lib-field textarea { resize: vertical; }
.lib-field input:focus, .lib-field select:focus, .lib-field textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.lib-formtitle { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin: 14px 0 2px; }

.lib-list { display: flex; flex-direction: column; }
.lib-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--panel-border); }
.lr-main { font-size: 13px; }
.lr-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.lr-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Pilot Flight Record editor (inline in the Pilots pane) */
.fr-section { margin: 16px 0 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.fr-table-wrap { overflow-x: auto; }
.fr-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; }
.fr-table th, .fr-table td { border: 1px solid var(--panel-border); padding: 3px 5px; text-align: left; vertical-align: middle; }
.fr-table thead th { font-size: 11px; font-weight: 600; color: var(--muted); }
.fr-table input, .fr-table select { width: 100%; box-sizing: border-box; background: transparent; border: 0; color: inherit; font: inherit; padding: 3px 4px; }
.fr-table input:focus, .fr-table select:focus { outline: 1px solid var(--accent, #4a9eff); border-radius: 3px; }
.fr-table td:last-child, .fr-table th:last-child { width: 30px; text-align: center; }
.fr-table .fr-del { padding: 2px 7px; }
.fr-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

@media (max-width: 560px) { .lib-form { grid-template-columns: 1fr; } }

/* ---------- Footer + cookie notice + terms (Phase 4) ---------- */
.app-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 16px;
  background: #171717;
  color: #94a3b8;
  font-size: 12px;
  flex-wrap: wrap;
}
.app-footer strong { color: #e2e8f0; font-weight: 700; }
.app-footer nav a { color: #cbd5e1; text-decoration: none; margin: 0 8px; }
.app-footer nav a:hover { text-decoration: underline; }
.app-footer .footer-note { color: #64748b; }

.cookie-banner {
  position: fixed;
  left: 16px; right: 16px; bottom: 16px;
  max-width: 640px;
  margin: 0 auto;
  background: #171717;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  z-index: 2200;
}
.cookie-banner a { color: #93c5fd; }
.cookie-banner .btn { flex-shrink: 0; }

.terms-agree {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0 4px;
}
.terms-agree input { margin-top: 2px; }
.terms-agree a { color: var(--primary); }

.plan-card:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.plan-card:disabled:hover { border-color: var(--panel-border); box-shadow: none; }

.rq-warn { color: var(--danger); font-weight: 600; }

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

/* Popup */
.leaflet-popup-content { font-size: 12.5px; line-height: 1.5; }
.leaflet-popup-content b { color: var(--primary-dark); }

/* Combined "restrictions at this point" popup */
.pt-pop-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding-bottom: 5px; margin-bottom: 5px; border-bottom: 1px solid var(--panel-border); }
.pt-pop-coord { font-size: 11px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.pt-pop-list { display: flex; flex-direction: column; gap: 7px; max-height: 220px; overflow-y: auto; }
.pt-row { border-left: 3px solid var(--panel-border); padding-left: 7px; }
.pt-row-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; font-weight: 700; }
.pt-row-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Live cursor coordinate readout (bottom-left of the map) */
.coord-readout {
  background: rgba(23, 23, 23, 0.85);
  color: #e2e8f0;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  white-space: nowrap;
}
.coord-readout .cr-label { color: #94a3b8; margin-right: 6px; font-weight: 600; }

/* Floating clock — Romanian local + Zulu (UTC) time, bottom-right of the map */
.map-clock {
  background: rgba(23, 23, 23, 0.9);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 7px 12px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  line-height: 1.25;
  user-select: none;
}
.map-clock .mc-row { display: flex; align-items: baseline; gap: 9px; }
.map-clock .mc-label { font-size: 9px; letter-spacing: 1.5px; color: var(--muted); width: 36px; }
.map-clock .mc-time { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.map-clock .mc-z { font-size: 11px; color: var(--muted); margin-left: 3px; }

/* Ruler / distance tool — floating control at the map's top-left, below the zoom */
.measure-ctrl { display: flex; align-items: stretch; background: rgba(23, 23, 23, 0.9); border: 1px solid var(--panel-border); border-radius: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5); overflow: hidden; backdrop-filter: blur(6px); }
.measure-toggle { border: 0; background: transparent; color: var(--text); font-size: 15px; width: 34px; height: 34px; line-height: 1; cursor: pointer; }
.measure-toggle:hover { background: var(--surface-3); }
.measure-toggle.active { background: #333333; color: #fff; }
.measure-ext { display: flex; align-items: center; gap: 8px; padding: 0 10px; border-left: 1px solid var(--panel-border); }
.measure-ext.hidden { display: none; }
.measure-out { font-size: 12px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.measure-clear { border: 0; background: var(--surface-3); color: var(--text); font-size: 11px; padding: 3px 8px; border-radius: 5px; cursor: pointer; }
.measure-clear:hover { background: #3a3a3a; }
.leaflet-tooltip.measure-tip { background: #171717; color: var(--text); border: 1px solid var(--panel-border); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 700; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  :root { --left-w: 280px; --right-w: 280px; }
}
@media (max-width: 780px) {
  body { overflow: auto; }
  .layout { flex-direction: column; height: auto; }
  .panel-left, .panel-right { width: 100%; border: none; border-bottom: 1px solid var(--panel-border); }
  .map-wrap { height: 55vh; min-height: 360px; }
  .panel-body, .zone-list { max-height: 40vh; }
}

/* ================================================================= *
 *  DARK / FUTURISTIC THEME
 *  Purely visual: overrides colours/surfaces on top of the existing
 *  rules. No layout, structure or behaviour is changed. The map tiles
 *  stay as-is; everything around them goes dark.
 * ================================================================= */
:root {
  color-scheme: dark;
  --bg: #000000;            /* header / footer / deepest — true black */
  --panel-bg: #000000;      /* side panels, modals */
  --panel-border: #2a2a2a;  /* neutral borders, visible on black */
  --text: #e6eefb;
  --muted: #93a4be;
  --primary: #5a5a5a;
  --primary-dark: #6e6e6e;
  --surface-2: #1a1a1a;     /* dark-grey UI elements: inputs, headers, default buttons */
  --surface-3: #2a2a2a;     /* hover */
  --accent: #8a8a8a;        /* neutral grey accent */
}

html, body {
  background: var(--bg); /* full black — no decorative glow */
}

/* Header + footer: flat black with a neutral edge */
.app-header {
  background: #000000;
  border-bottom: 1px solid var(--panel-border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.app-footer { background: #000000; border-top: 1px solid var(--panel-border); }
.header-divider { background: var(--panel-border); }

/* Buttons */
.btn { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn-primary {
  background: #333333;
  color: #f5f5f5;
  box-shadow: none;
}
.btn-primary:hover:not(:disabled) { background: #404040; box-shadow: none; }
.btn-ghost { background: rgba(148, 163, 184, 0.06); border-color: var(--panel-border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: rgba(148, 163, 184, 0.14); }

/* Insets / surfaces that were light */
.stat { background: var(--surface-2); }
.count { background: var(--surface-2); }
.coords-list { color: #c6d3e8; }
.zgroup-head { background: var(--surface-2); color: #cdd9ee; border-bottom-color: var(--panel-border); }
.zgroup-head:hover { background: var(--surface-3); }
.zg-count { background: var(--surface-3); color: #b9c6dc; }
.zsub-head { background: #080808; color: var(--muted); border-bottom-color: var(--panel-border); }
.zg-sw { background: #333333; }
.zone-item { border-bottom-color: rgba(148, 163, 184, 0.08); }
.zone-item:hover { background: var(--surface-2); }
.zone-item.selected { background: rgba(249, 115, 22, 0.14); }
.zone-item.overlap { background: rgba(220, 38, 38, 0.16); }
.zd-val { color: #c6d3e8; }
.zd-raw { background: var(--surface-2); color: #b9c6dc; border-color: var(--panel-border); }
.zi-zoom { background: rgba(255, 255, 255, 0.08); color: var(--text); border-color: var(--panel-border); }
.zi-zoom:hover { background: rgba(255, 255, 255, 0.16); }

/* Inputs / search / selects */
.search, .circle-radius-row input, .circle-radius-row select,
.lib-field input, .lib-field select, .lib-field textarea {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--panel-border);
}
.search::placeholder, .lib-field input::placeholder, .lib-field textarea::placeholder { color: #62748e; }

/* Overlap cards (danger-tinted, now dark) */
.overlap-card { background: rgba(220, 38, 38, 0.12); border-color: rgba(220, 38, 38, 0.34); }
.overlap-card:hover { background: rgba(220, 38, 38, 0.2); }
.overlap-card .oc-row { color: #cbd6e8; }
.overlap-card.oc-notam { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.34); }

/* Modals */
.modal { background: #171717; border: 1px solid var(--panel-border); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6); }
.modal-overlay { background: rgba(0, 0, 0, 0.72); }

/* Billing banner + plan cards */
.billing-banner { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.2); color: #d4d4d4; }
.billing-banner.locked { background: rgba(220, 38, 38, 0.14); border-color: rgba(220, 38, 38, 0.4); color: #fecaca; }
.plan-card { background: var(--surface-2); }
.plan-card:hover { border-color: var(--accent); box-shadow: 0 2px 16px rgba(34, 211, 238, 0.22); }
.plan-card-featured { border-color: var(--accent); }
.plan-card:disabled:hover { border-color: var(--panel-border); }

/* Danger button */
.btn-danger { border-color: rgba(220, 38, 38, 0.45); }
.btn-danger:hover:not(:disabled) { background: rgba(220, 38, 38, 0.16); }

/* Leaflet: dark popups + controls (map tiles themselves unchanged) */
.leaflet-container { background: #000000; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #171717; color: var(--text); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55); }
.leaflet-popup-content b { color: #93c5fd; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-container a.leaflet-popup-close-button:hover { color: var(--text); }
.leaflet-bar a, .leaflet-bar a:hover {
  background: #171717; color: var(--text); border-bottom-color: var(--panel-border);
}
.leaflet-bar a:hover { background: var(--surface-3); }
.leaflet-control-attribution { background: rgba(0, 0, 0, 0.82) !important; color: #8ba0bd !important; }
.leaflet-control-attribution a { color: #93c5fd !important; }
/* Basemap gallery (layers control) */
.leaflet-control-layers {
  background: #171717; color: var(--text);
  border: 1px solid var(--panel-border); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.leaflet-control-layers-toggle { filter: invert(1) hue-rotate(180deg) brightness(1.1); }
.leaflet-control-layers-expanded { padding: 8px 12px 8px 10px; }
.leaflet-control-layers label { font-size: 13px; font-weight: 600; margin: 3px 0; }
.leaflet-control-layers-selector { accent-color: #c4c4c4; margin-right: 6px; }
.pt-row { border-left-color: var(--panel-border); }

/* Focus rings → cyan */
.search:focus, .circle-radius-row input:focus, .circle-radius-row select:focus,
.lib-field input:focus, .lib-field select:focus, .lib-field textarea:focus {
  outline-color: var(--accent);
}

/* Active hub tab — light so it reads on black */
.lib-tab.active { color: #f5f5f5; border-bottom-color: #c4c4c4; }
