/* ============================================================================
   app.css — application chrome (top bar, icon rail, Layer Manager, bottom bar).
   Reads exclusively from theme.css tokens. Layout is a single CSS grid so the
   map fills the remaining space and panels never overlap the timeline.
   ========================================================================== */

#app {
  display: grid;
  height: 100vh;
  grid-template-rows: var(--topbar-h) 1fr var(--bottombar-h);
  grid-template-columns: var(--rail-w) var(--left-w) 1fr;
  grid-template-areas:
    "top  top   top"
    "rail left  map"
    "bot  bot   bot";
}
.is-left-collapsed#app { grid-template-columns: var(--rail-w) 0 1fr; }

/* ---------------------------------------------------------------- top bar -- */
.topbar {
  grid-area: top; display: flex; align-items: center;
  background: var(--bg-chrome); border-bottom: 1px solid var(--line);
  padding: 0 8px 0 10px; gap: 6px; z-index: 40;
}
.wordmark { display: flex; align-items: center; gap: 9px; padding-right: 8px; }
.wordmark img { height: 30px; width: 30px; object-fit: contain; }   /* FalconEye mark: own roundel */
.wordmark .name {
  font-family: var(--font-head); font-weight: 700; font-size: 15px;
  letter-spacing: .13em; color: #fff; text-transform: uppercase; white-space: nowrap;
}
.wordmark .sub {
  font-family: var(--font-head); font-weight: 300; font-size: 15px;
  letter-spacing: .10em; color: var(--neutral-400); text-transform: uppercase;
  margin-left: 3px;
}
.topbar .spacer { flex: 1; }

/* scenario picker */
.scn-picker { position: relative; margin-left: 6px; }
.scn-btn { display: flex; align-items: center; gap: 7px; height: 26px; padding: 0 9px;
  background: var(--bg-panel-2); border: 1px solid var(--line); border-radius: 4px; color: var(--text-1);
  font-family: var(--font-head); font-size: 12px; letter-spacing: .04em; white-space: nowrap; }
.scn-btn:hover { background: var(--bg-hover); }
.scn-btn svg { width: 12px; height: 12px; color: var(--text-3); }
.scn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--active-green);
  box-shadow: 0 0 5px var(--active-green); flex: 0 0 auto; }
.scn-picker.threat .scn-dot { background: var(--accent-red); box-shadow: 0 0 6px var(--accent-red); }
.scn-menu { position: absolute; top: 30px; left: 0; min-width: 224px; background: var(--bg-panel);
  border: 1px solid var(--line); border-radius: 5px; box-shadow: var(--shadow-panel); padding: 4px; display: none; z-index: 60; }
.scn-picker.open .scn-menu { display: block; }
.scn-item { padding: 7px 10px; border-radius: 4px; cursor: pointer; }
.scn-item:hover { background: var(--bg-hover); }
.scn-item.on { background: #223049; }
.scn-item b { display: block; font-family: var(--font-head); font-size: 12.5px; color: var(--text-1);
  font-weight: 400; letter-spacing: .03em; }
.scn-item span { font-size: 10px; color: var(--text-3); }
.scn-item.threat b::before { content: "◆ "; color: var(--accent-red); }
.scn-item.live b::before { content: "● "; color: var(--active-green); font-size: 9px; }

.tbtn {
  width: 30px; height: 28px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: var(--radius);
  color: var(--neutral-300); transition: background var(--dur), color var(--dur);
}
.tbtn:hover { background: var(--bg-hover); color: #fff; }
.tbtn svg { width: 17px; height: 17px; }
.tsep { width: 1px; height: 20px; background: var(--line); margin: 0 3px; }

.search {
  display: flex; align-items: center; gap: 6px; height: 26px; width: 210px;
  background: var(--bg-panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0 8px; color: var(--text-3);
}
.search input {
  flex: 1; background: transparent; border: 0; outline: 0;
  color: var(--text-1); font-size: 12px; font-family: var(--font-body);
}
.search svg { width: 13px; height: 13px; color: var(--text-3); }

/* ------------------------------------------------------------- icon rail -- */
.rail {
  grid-area: rail; background: var(--bg-chrome);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding-top: 6px; z-index: 30;
}
.rbtn {
  width: 32px; height: 32px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: var(--radius);
  color: var(--neutral-400); transition: background var(--dur), color var(--dur);
}
.rbtn:hover { background: var(--bg-hover); color: var(--text-1); }
.rbtn.active { color: #fff; background: #2b2f36; }
.rbtn.active::before {
  content: ""; position: absolute; left: 0; width: 2px; height: 22px;
  background: var(--accent-blue); border-radius: 0 2px 2px 0; margin-left: -4px;
}
.rbtn { position: relative; }
.rbtn svg { width: 18px; height: 18px; }

/* --------------------------------------------------------- Layer Manager -- */
.leftpanel {
  grid-area: left; background: var(--bg-panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden; z-index: 30;
}
.lm-title {
  display: flex; align-items: center; gap: 8px; height: 30px;
  padding: 0 10px; background: var(--bg-panel-2);
  border-bottom: 1px solid var(--line);
}
.lm-title .t { font-family: var(--font-head); font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-2); }
.lm-title .grow { flex: 1; }
.lm-title .mini { color: var(--text-3); width: 22px; height: 20px;
  display: grid; place-items: center; border-radius: 3px; }
.lm-title .mini:hover { background: var(--bg-hover); color: var(--text-1); }
.lm-title .mini svg { width: 13px; height: 13px; }

.lm-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; }

.lm-section > .lm-sechead {
  display: flex; align-items: center; gap: 7px; height: 26px; padding: 0 8px;
  background: var(--bg-header); border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; z-index: 2;
}
.lm-sechead .chev { color: var(--text-3); transition: transform var(--dur); }
.lm-sechead .chev svg { width: 11px; height: 11px; display: block; }
.lm-section.collapsed .chev { transform: rotate(-90deg); }
.lm-sechead .title { font-family: var(--font-head); font-size: 11.5px;
  letter-spacing: .09em; text-transform: uppercase; color: var(--text-2); }
.lm-sechead .sec-grow { flex: 1; }
/* grey lightning = live-data indicator (Optix) */
.lm-sechead .bolt { color: var(--neutral-400); display: grid; place-items: center; }
.lm-sechead .bolt svg { width: 11px; height: 11px; display: block; }
/* teal add-circle, right after the section title (Optix) */
.lm-sechead .plus { width: 15px; height: 15px; display: grid; place-items: center;
  color: #fff; background: #26c6da; border-radius: 50%; }
.lm-sechead .plus svg { width: 11px; height: 11px; display: block; stroke-width: 3; }

.lm-section.collapsed > .lm-rows { display: none; }

.lm-row {
  display: flex; align-items: center; gap: 6px; min-height: 24px;
  padding: 0 8px 0 0; color: var(--text-2); position: relative;
}
.lm-row:hover { background: var(--bg-hover); }
.lm-row .indent { flex: 0 0 auto; }
.lm-row .chev { width: 14px; color: var(--text-3); display: grid; place-items: center; }
.lm-row .chev svg { width: 10px; height: 10px; }
.lm-row.no-children .chev { visibility: hidden; }
.lm-row.collapsed .chev { transform: rotate(-90deg); }

.lm-check {
  position: relative; width: 14px; height: 14px; flex: 0 0 auto;
  border: 1.5px solid var(--neutral-600); border-radius: 3px; background: transparent;
  padding: 0; transition: background var(--dur), border-color var(--dur);
}
.lm-check.on { background: var(--accent-blue); border-color: var(--accent-blue); }
/* Checkmark drawn from borders so it centres exactly (SVG ticks read right-heavy). */
.lm-check::after {
  content: ""; position: absolute; left: 50%; top: 48%;
  width: 3.5px; height: 7px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: translate(-50%, -55%) rotate(45deg); transform-origin: center;
  opacity: 0; transition: opacity var(--dur);
}
.lm-check.on::after { opacity: 1; }

.lm-swatch { width: 11px; height: 11px; border-radius: 2px; flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
/* color swatch on the RIGHT of the row + paint-drop color-mode trigger (Optix) */
.lm-color { display: flex; align-items: center; gap: 3px; flex: 0 0 auto; margin-left: 2px; }
.lm-paint { width: 16px; height: 17px; display: none; place-items: center; background: transparent;
  border: 0; color: var(--text-3); border-radius: 3px; }
.lm-row:hover .lm-paint { display: grid; }
.lm-paint:hover { color: var(--accent-blue); }
.lm-paint svg { width: 12px; height: 12px; }
.lm-swatch-r { width: 11px; height: 11px; border-radius: 2px; flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.color-menu .ctx-title { padding: 6px 12px 5px; font-size: 10px; letter-spacing: .06em; color: var(--text-3);
  text-transform: uppercase; border-bottom: 1px solid var(--line-soft); font-family: var(--font-head); }
.color-menu .ctx-item.on { color: var(--accent-blue); }
.color-menu .ctx-item.on::after { content: "\2713"; float: right; }
.lm-label { flex: 1; font-size: 12px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.lm-row.on .lm-label { color: var(--text-1); }

.lm-badge { font-size: 10px; color: var(--text-3); background: var(--bg-panel-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 0 6px; line-height: 15px; }
.lm-status { flex: 0 0 auto; display: grid; place-items: center; }
.lm-status svg { width: 12px; height: 12px; display: block; }
.lm-status.live { color: var(--neutral-400); }
.lm-status.warn { color: var(--accent-orange); }
.lm-status.planned { color: var(--text-dim); }
.lm-dots { color: var(--text-dim); width: 18px; height: 20px; display: none;
  place-items: center; background: transparent; border: 0; border-radius: 3px;
  opacity: .55; transition: color var(--dur), opacity var(--dur); }
.lm-dots svg { width: 12px; height: 12px; }
.lm-row:hover .lm-dots { display: grid; }
/* elegant: no box — the three bars just brighten to the accent on hover */
.lm-dots:hover { background: transparent; color: var(--accent-blue); opacity: 1; }
/* civilian/military filter funnel (ADS-B, AIS) */
.lm-filter { width: 16px; height: 18px; display: none; place-items: center; background: transparent;
  border: 0; color: var(--text-3); border-radius: 3px; }
.lm-row:hover .lm-filter { display: grid; }
.lm-filter:hover { color: var(--accent-blue); }
.lm-filter svg { width: 12px; height: 12px; }
.lm-filter.on { color: var(--accent-blue); }

/* ------------------------------------------------------------------- map -- */
#map { grid-area: map; position: relative; background: var(--bg-app); }
.maplibregl-ctrl-attrib { font-size: 9px !important; opacity: .5; }
.map-badges { position: absolute; left: 12px; bottom: 10px; z-index: 5;
  font-family: var(--font-head); font-size: 10px; letter-spacing: .1em;
  color: var(--text-3); text-transform: uppercase; pointer-events: none; }

/* ---------------------------------------------------------- bottom bar ---- */
.bottombar {
  grid-area: bot; background: var(--bg-chrome); border-top: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 35; position: relative;
}
.tl-grip {
  position: absolute; top: -4px; left: 0; right: 0; height: 8px; cursor: ns-resize; z-index: 2;
}
.tl-grip::after { content: ""; position: absolute; left: 50%; top: 3px;
  width: 40px; height: 2px; margin-left: -20px; background: var(--neutral-700);
  border-radius: 2px; transition: background var(--dur); }
.tl-grip:hover::after { background: var(--neutral-500); }
.tl-caret {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  width: 30px; height: 15px; padding: 0; display: grid; place-items: center;
  background: var(--bg-chrome); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 5px 5px 0 0; color: var(--neutral-300); z-index: 3;
}
.tl-caret:hover { color: #fff; }
.tl-caret svg { width: 13px; height: 13px; transition: transform var(--dur); }
.bottombar.tl-expanded .tl-caret svg { transform: rotate(180deg); }
/* Body stacks overview + focus (lanes+axis). */
.tl-body { flex: 1; position: relative; display: flex; flex-direction: column;
  overflow: hidden; }
.tl-focus { flex: 1; position: relative; display: flex; flex-direction: column;
  overflow: hidden; }

/* Selection band — the slice of time the map shows. Right edge = "now".
   Spans lanes + axis; draggable left bound, right bound, and whole-band body. */
.tl-band { position: absolute; top: 0; bottom: 0; z-index: 6; }
.tl-band-fill { position: absolute; inset: 0; background: rgba(90, 141, 255, 0.08);
  border-left: 1px solid rgba(255, 255, 255, 0.4);
  border-right: 2px solid #fff; cursor: grab;
  /* dims the timeline outside the band (clipped to .tl-focus) so the band pops */
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.32); }
.tl-band-h { position: absolute; top: 0; bottom: 0; width: 11px; cursor: ew-resize; z-index: 2; }
.tl-band-h.l { left: 0; }
.tl-band-h.r { right: 0; }
.tl-band-h::after { content: ""; position: absolute; top: 50%; left: 50%;
  width: 3px; height: 16px; margin: -8px 0 0 -1.5px; border-radius: 2px; }
.tl-band-h.l::after { background: rgba(255, 255, 255, 0.55); }
.tl-band-h.r::after { background: #fff; box-shadow: 0 0 5px rgba(255, 255, 255, 0.7); }

/* Lane area (expanded only). */
.tl-lanes { flex: 1; position: relative; overflow-y: auto; overflow-x: hidden;
  padding: 4px 0 2px; display: none; }
.bottombar.tl-expanded .tl-lanes { display: block; }
.tl-empty { color: var(--text-dim); font-size: 11px; padding: 10px 14px;
  font-family: var(--font-head); letter-spacing: .04em; }

.tl-lane { position: relative; height: 18px; margin: 2px 0; }
.tl-lane-lbl { position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  z-index: 2; font-size: 9.5px; font-family: var(--font-head); letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-2); pointer-events: none;
  text-shadow: 0 0 4px #000, 0 0 4px #000; }
.tl-seg { position: absolute; top: 3px; height: 12px; border-radius: 2px; opacity: .82;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.tl-etick { position: absolute; top: 1px; height: 16px; width: 2px; border-radius: 1px;
  transform: translateX(-1px); box-shadow: 0 0 5px currentColor; }
.tl-etick.launch { width: 3px; box-shadow: 0 0 7px #ee5f5b; }

.tl-axis { height: 22px; position: relative; border-top: 1px solid var(--line-soft);
  flex: 0 0 auto; }
.tl-end { position: absolute; top: 4px; font-size: 10px; color: var(--text-3);
  font-family: var(--font-body); }
.tl-end.l { left: 8px; } .tl-end.r { right: 8px; }
.tl-mark { position: absolute; top: 0; transform: translateX(-50%); text-align: center; }
.tl-mark i { display: block; width: 1px; height: 5px; background: var(--neutral-700); margin: 0 auto; }
.tl-mark b { display: block; font-size: 9.5px; font-weight: 400; color: var(--text-dim); margin-top: 1px; }

.tl-controls .tl-time { font-size: 11px; color: #6fc8db;
  font-family: var(--font-head); letter-spacing: .04em; min-width: 176px; }
.tl-controls .speed { font-size: 10px; color: var(--text-2); min-width: 34px; text-align: center;
  font-variant-numeric: tabular-nums; }
.tl-speed { display: flex; align-items: center; gap: 1px; margin: 0 4px; }
.tl-controls .cbtn.sm { width: 18px; height: 18px; }
.tl-controls .cbtn.sm svg { width: 11px; height: 11px; }
.tl-axis { height: 20px; position: relative; border-top: 1px solid var(--line-soft);
  color: var(--text-3); font-size: 10px; }
.tl-controls {
  position: relative;
  height: 30px; display: flex; align-items: center; gap: 4px; padding: 0 10px;
  border-top: 1px solid var(--line); color: var(--neutral-300);
}
.tl-controls .grow { flex: 1; }
/* transport dead-centered in the bar (like Optix), independent of side clusters */
.tl-controls .xport { position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 3px; }
.tl-coord { font-size: 10px; color: #8fb8c9; font-variant-numeric: tabular-nums; cursor: pointer;
  margin-left: 10px; white-space: nowrap; padding: 2px 5px; border-radius: 3px; min-width: 150px; }
.tl-coord:hover { background: var(--bg-hover); color: #cfe6ef; }
.tl-coord i { color: var(--text-3); font-style: normal; letter-spacing: .05em; margin-right: 4px; }
.tl-controls .cbtn { width: 26px; height: 22px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--neutral-300); border-radius: 3px; }
.tl-controls .cbtn:hover { background: var(--bg-hover); color: #fff; }
.tl-controls .cbtn.on { color: var(--accent-blue); }
.tl-controls .cbtn svg { width: 14px; height: 14px; }
.tl-controls .scale { font-size: 10px; color: var(--text-3); }
.tl-controls .scale .bar { display: inline-block; width: 42px; height: 6px;
  border: 1px solid var(--neutral-500); border-top: 0; vertical-align: middle;
  margin-left: 6px; }
.cbtn.play { color: #eef1f3; }
.tl-controls .mapmode { font-size: 10px; color: var(--text-3); margin-right: 8px; white-space: nowrap; }

/* ------------------------------------------------------- layer context menu */
.ctx-menu {
  position: fixed; z-index: 200; min-width: 168px; padding: 4px 0;
  background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-panel);
}
.ctx-item {
  padding: 6px 14px; font-size: 12px; color: var(--text-2); white-space: nowrap;
}
.ctx-item:hover { background: var(--bg-hover); color: var(--text-1); }
