/* Stratos EFB — Flight Planner.
 *
 * The builder is a chart workspace with a step rail above it, not a form on a
 * page: the plan is edited against the chart the whole time. Every rule here is
 * sized for the 300 px panel and a tablet, and reads the tokens and the `e-*`
 * component kit defined once in efb.css. Nothing new is invented: a planner
 * surface is a card, a row is a row, and the accent is still the bag's.
 */

body.view-plan .efb-main { background: #07080b; }

.fp-shell { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ── route bar: DEP · route · ARR, then the plan's numbers ─────────── */

.fp-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--efb-line);
  background: rgba(12, 13, 16, .96);
  margin: 0;
}
.fp-bar label {
  display: flex;
  align-items: center;
  height: 34px;
  border: 1px solid var(--efb-line-strong);
  border-radius: 6px;
  background: #0b0c0f;
  min-width: 0;
}
.fp-bar label:focus-within { border-color: var(--efb-accent); box-shadow: 0 0 0 3px var(--efb-accent-soft); }
.fp-bar label > span {
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 0 9px;
  border-right: 1px solid var(--efb-line);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .14em;
  color: var(--efb-faint);
}
.fp-bar input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 10px;
  border: 0;
  outline: 0;
  background: none;
  color: var(--efb-text);
  font: 600 13px/1 ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.fp-bar input::placeholder { color: var(--efb-faint); font-weight: 400; letter-spacing: .02em; text-transform: none; font-family: inherit; }
.fp-bar-apt { flex: 0 0 116px; }
.fp-bar-apt input { color: #ff5cd6; }
.fp-bar-route { flex: 1 1 auto; }
.fp-bar-route input { color: #ff5cd6; }
.fp-bar-facts { display: flex; gap: 14px; padding: 0 6px; flex: none; }
.fp-bar-facts span { display: flex; flex-direction: column; gap: 2px; }
.fp-bar-facts em { font-style: normal; font-size: 8.5px; font-weight: 750; letter-spacing: .14em; color: var(--efb-faint); }
.fp-bar-facts b { font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── panel tabs ──────────────────────────────────────────────────────── */

.fp-steps { display: flex; gap: 2px; flex: 1; min-width: 0; }
.fp-step {
  flex: 1;
  padding: 6px 4px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--efb-muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.fp-step:hover { color: var(--efb-text); background: rgba(148, 163, 184, .08); }
.fp-step:focus-visible { outline: 2px solid var(--efb-accent); outline-offset: 1px; }
.fp-step.is-current { color: var(--efb-text); background: var(--efb-accent-soft); box-shadow: inset 0 -2px 0 var(--efb-accent); }
.fp-step.is-muted { opacity: .5; }

/* ── chart and panel ─────────────────────────────────────────────────── */

.fp-view { position: relative; flex: 1; min-height: 0; background: #08090c; overflow: hidden; }
.fp-map { position: absolute; inset: 0; }
.fp-map canvas { touch-action: none; cursor: grab; }
.fp-map canvas:active { cursor: grabbing; }

.fp-panel { top: 10px; bottom: 10px; max-height: none; width: 372px; }
.fp-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 9px 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
}
.fp-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px;
  border-top: 1px solid var(--efb-line);
  background: rgba(11, 12, 15, .62);
}

/* ── search ──────────────────────────────────────────────────────────── */

/* Inside the panel the results take their own space instead of covering the
   rows below: a dropdown over a 300 px list hides the thing being edited. */
.fp-search-block { position: relative; display: flex; flex-direction: column; gap: 5px; }
.fp-search-label { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--efb-faint); font-weight: 700; }
.fp-search { flex: none; min-width: 0; }
.fp-results { position: static; margin: 0; max-height: 232px; box-shadow: none; background: #131417; }
.fp-results:empty { display: none; }
.fp-result { display: flex !important; align-items: center; gap: 8px; }
.fp-result-id { font-size: 11px; font-weight: 750; letter-spacing: .04em; min-width: 42px; }
.fp-result-main { flex: 1; min-width: 0; margin: 0 !important; }
.fp-result-main b { display: block; font-size: 10.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-result-main small { display: block; font-size: 9px; color: var(--efb-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-result .e-badge { flex: 0 0 auto; margin-left: 0 !important; }

/* ── cards and rows ──────────────────────────────────────────────────── */

.fp-card { padding: 10px 11px; }
.fp-card h3 { margin-bottom: 8px; }
.fp-empty-small { padding: 12px 10px; }
.fp-empty-small b { font-size: 11.5px; }
.fp-empty-small p { margin: 4px 0 0; font-size: 10.5px; }

.fp-stop-head { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; margin-bottom: 7px; }
.fp-stop-head b { font-size: 14px; letter-spacing: .04em; }
.fp-tools { gap: 5px; }
.fp-tools .e-btn svg { vertical-align: -2px; margin-right: 3px; }

.fp-detail { padding: 8px 10px; border-radius: var(--efb-r-sm); border: 1px solid var(--efb-accent-line); background: var(--efb-accent-soft); }
.fp-detail-head { display: flex; align-items: baseline; gap: 7px; margin-bottom: 6px; min-width: 0; }
.fp-detail-head b { font-size: 12px; letter-spacing: .03em; }
.fp-detail-head span { font-size: 9.5px; color: var(--efb-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fp-route-list { flex: none; display: flex; flex-direction: column; border: 1px solid var(--efb-line); border-radius: 6px; overflow: hidden; }
.fp-route-row, .fp-route-head {
  display: grid;
  grid-template-columns: 11px minmax(0, 1fr) 44px 32px 30px 36px 56px;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
}
.fp-route-head {
  background: rgba(148, 163, 184, .06);
  border-bottom: 1px solid var(--efb-line);
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--efb-faint);
}
.fp-route-head span:nth-child(n+4) { text-align: right; }
.fp-route-row { cursor: pointer; border-top: 1px solid rgba(148, 163, 184, .06); }
.fp-route-row:first-of-type { border-top: 0; }
.fp-route-row:hover { background: rgba(148, 163, 184, .07); }
.fp-route-row.is-selected { background: var(--efb-accent-soft); box-shadow: inset 2px 0 0 var(--efb-accent); }
.fp-route-main { min-width: 0; }
.fp-route-main b { display: block; font: 600 11.5px/1.2 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; letter-spacing: .04em; }
.fp-route-main span { display: block; font-size: 9px; color: var(--efb-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-route-via { font: 600 9.5px/1 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; color: #ff5cd6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-route-num { text-align: right; font-size: 10.5px; font-variant-numeric: tabular-nums; color: var(--efb-text); }
.fp-route-num.is-dim { color: var(--efb-faint); }
.fp-route-actions { display: flex; gap: 1px; justify-content: flex-end; }
.fp-start { padding: 18px 14px; }
.fp-start p { line-height: 1.55; }
.fp-mini {
  width: 18px;
  height: 18px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  color: var(--efb-faint);
  font-size: 11px;
  line-height: 1;
}
.fp-mini:hover { color: var(--efb-text); background: rgba(148, 163, 184, .14); }
.fp-mini.danger:hover { color: #f7bdbd; background: rgba(248, 113, 113, .14); }
.fp-summary-row { display: flex; gap: 14px; flex-wrap: wrap; padding: 2px 0; }
.fp-summary-row > span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fp-summary-row em { font-style: normal; font-size: 8.5px; letter-spacing: .11em; text-transform: uppercase; color: var(--efb-faint); font-weight: 700; }
.fp-summary-row b { font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }

.fp-cruise { display: flex; gap: 7px; }
.fp-cruise .e-field { flex: 1 1 0; min-width: 0; }

/* ── procedures ──────────────────────────────────────────────────────── */

.fp-proc-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--efb-line);
  border-radius: var(--efb-r-sm);
  max-height: 190px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.fp-proc {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-bottom: 1px solid var(--efb-line);
  background: none;
  color: var(--efb-text);
  text-align: left;
}
.fp-proc:last-child { border-bottom: 0; }
.fp-proc:hover { background: rgba(148, 163, 184, .07); }
.fp-proc.is-selected { background: var(--efb-accent-soft); box-shadow: inset 2px 0 0 var(--efb-accent); }
.fp-proc-id { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; }
.fp-proc-meta { margin-left: auto; font-size: 9px; color: var(--efb-faint); }
.fp-proc-detail { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--efb-line); }
.fp-suggest { margin: 8px 0 0; color: #b6f4fd; }
.fp-link {
  margin-top: 7px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--efb-accent);
  font-size: 10px;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── fuel, alternate and weather ─────────────────────────────────────── */

.fp-fuel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.fp-fuel-head .e-seg { width: 100%; }
.fp-fuel-head .e-seg button { flex: 1 1 0; }
.fp-fuel-out .e-table { font-size: 10.5px; }
.fp-fuel-out .e-table th { font-size: 8.5px; }
.fp-notes { margin: 8px 0 0; padding-left: 16px; font-size: 10px; line-height: 1.5; color: var(--efb-muted); }

.fp-alt-tools { display: flex; gap: 7px; margin: 9px 0 7px; }
.fp-alt-tools .e-field { flex: 1 1 0; min-width: 0; }
.fp-alt-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.fp-alt { padding: 8px 9px; border: 1px solid var(--efb-line); border-radius: var(--efb-r-sm); background: rgba(148, 163, 184, .03); }
.fp-alt-head { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.fp-alt-head b { font-size: 12px; letter-spacing: .03em; }
.fp-alt-head span { font-size: 10px; color: var(--efb-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-alt-facts { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 5px 0 0; }
.fp-alt-facts span { font-size: 9.5px; color: var(--efb-faint); }
.fp-alt-why { margin-top: 5px; font-size: 9.5px; color: var(--efb-faint); }
.fp-alt-why summary { cursor: pointer; }
.fp-alt-why ul { margin: 4px 0 0; padding-left: 15px; line-height: 1.5; }
.fp-alt .e-row { margin-top: 7px; }

.fp-wx { padding: 8px 0; border-top: 1px solid var(--efb-line); }
.fp-wx:first-of-type { border-top: 0; padding-top: 0; }
.fp-wx-head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 6px; }
.fp-wx-head b { font-size: 12px; letter-spacing: .05em; }
.fp-wx-facts { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.fp-wx-facts > span { display: flex; flex-direction: column; gap: 1px; }
.fp-wx-facts em { font-style: normal; font-size: 8px; letter-spacing: .1em; text-transform: uppercase; color: var(--efb-faint); font-weight: 700; }
.fp-wx-facts b { font-size: 11px; font-variant-numeric: tabular-nums; }
.fp-raw {
  display: block;
  margin: 5px 0 0;
  padding: 6px 7px;
  border-radius: 5px;
  border: 1px solid var(--efb-line);
  background: rgba(11, 12, 15, .7);
  font-size: 9.5px;
  line-height: 1.5;
  color: var(--efb-muted);
  white-space: pre-wrap;
  word-break: break-word;
}
.fp-wx-mini { display: flex; align-items: baseline; gap: 7px; padding: 4px 0; border-top: 1px solid var(--efb-line); }
.fp-wx-mini:first-of-type { border-top: 0; }
.fp-wx-mini b { font-size: 11px; letter-spacing: .04em; }
.fp-wx-mini span { font-size: 10px; color: var(--efb-muted); }

/* ── review ──────────────────────────────────────────────────────────── */

.fp-check { margin: 6px 0 0; padding-left: 16px; font-size: 10.5px; line-height: 1.55; }
.fp-check.warn { color: #f3dfb4; }
.fp-check.bad { color: #f7cfcf; }

.fp-saved { display: flex; flex-direction: column; }
.fp-saved-row { display: flex; align-items: center; gap: 6px; padding: 5px 0; border-top: 1px solid var(--efb-line); }
.fp-saved-row:first-child { border-top: 0; }
.fp-saved-main { flex: 1; min-width: 0; }
.fp-saved-main b { display: block; font-size: 11px; }
.fp-saved-main span { display: block; font-size: 9px; color: var(--efb-faint); }

/* ── responsive ──────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .fp-panel { width: 340px; }
}

@media (max-width: 900px) {
  .fp-bar { flex-wrap: wrap; }
  .fp-bar-route { order: 5; flex-basis: 100%; }
  .fp-bar-facts { margin-left: auto; }
  .fp-panel { width: 330px; right: 48px; }
}

@media (max-width: 640px) {
  /* A phone gets the panel as a sheet over the lower half of the chart, the
     same behaviour as the Navigator's route list. */
  .fp-panel { top: auto; bottom: 10px; left: 10px; right: 10px; width: auto; max-height: 58%; }
  .fp-bar-facts, .fp-bar .map-chip { display: none; }
  .fp-bar-apt { flex: 1 1 0; }
  .fp-fuel-grid { grid-template-columns: 1fr; }
  .fp-summary-row { gap: 10px; }
}

/* ── the chart readout: centre, query radius, NM and altitude ─────────── */

.map-readout {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 3;
  width: 300px;
  max-width: calc(100% - 28px);
  max-height: 64%;
  overflow: auto;
  padding: 9px 11px 10px;
  border-radius: 10px;
  border: 1px solid var(--efb-line-strong);
  background: rgba(12, 13, 16, .86);
  box-shadow: 0 12px 26px rgba(0, 0, 0, .38);
}
.map-readout[hidden] { display: none; }
.map-readout-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--efb-line);
}
.map-readout-head > b {
  margin-right: auto;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--efb-faint);
}
.map-readout-field {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--efb-faint);
}
.map-readout-select {
  height: 24px;
  padding: 0 4px;
  border-radius: 5px;
  border: 1px solid var(--efb-line-strong);
  background: var(--efb-panel-2);
  color: var(--efb-text);
  font: inherit;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.map-readout-btn {
  height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  border: 1px solid var(--efb-line-strong);
  background: var(--efb-panel-2);
  color: var(--efb-muted);
  font: inherit;
  font-size: 10px;
  font-weight: 650;
}
.map-readout-btn[aria-pressed='true'] {
  border-color: var(--efb-accent);
  background: var(--efb-accent);
  color: #101114;
}
.map-readout-facts { display: flex; flex-direction: column; gap: 5px; padding-top: 7px; }
.map-readout-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  column-gap: 8px;
  row-gap: 1px;
  align-items: baseline;
}
.map-readout-row em {
  font-style: normal;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--efb-faint);
}
.map-readout-row b { font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.map-readout-row i { grid-column: 2; font-style: normal; font-size: 9px; color: var(--efb-faint); }
.map-readout-note { margin: 7px 0 0; font-size: 9px; line-height: 1.5; color: var(--efb-faint); }

/* ── the globe's surface controls ───────────────────────────────────────
   Shown only while the chart is a globe: what the sphere is drawn from, and
   how to bring the camera back to the route. A reset of the whole builder sits
   in the HUD instead, where it is reachable from every step. */

.map-hud-btn {
  height: 24px;
  padding: 0 9px;
  border-radius: 5px;
  border: 1px solid var(--efb-line-strong);
  background: rgba(12, 13, 16, .82);
  color: var(--efb-muted);
  font: inherit;
  font-size: 9.5px;
  font-weight: 650;
}
.map-hud-btn:hover { color: #f7d8d8; border-color: rgba(248, 113, 113, .4); background: rgba(46, 12, 14, .82); }
.map-hud-btn:focus-visible { outline: 2px solid var(--efb-accent); outline-offset: 1px; }

.map-readout-globe { padding-top: 7px; }
.map-readout-globe[hidden] { display: none; }
.map-readout-label {
  display: block;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--efb-faint);
}
.map-readout-seg { display: flex; gap: 3px; margin: 5px 0 6px; }
.map-readout-seg button {
  flex: 1 1 0;
  min-width: 0;
  height: 26px;
  padding: 0 4px;
  border-radius: 5px;
  border: 1px solid var(--efb-line-strong);
  background: var(--efb-panel-2);
  color: var(--efb-muted);
  font: inherit;
  font-size: 9.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-readout-seg button[aria-pressed='true'] { border-color: var(--efb-accent); background: var(--efb-accent); color: #101114; }
.map-readout-tools { display: flex; gap: 5px; }
.map-readout-tools .map-readout-btn { flex: 1 1 0; }
.map-readout-globe .map-readout-note { margin-top: 6px; }

/* ── the card a chart tap opens when the record is not unique ─────────── */

.map-pick {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 4;
  width: 336px;
  max-width: calc(100% - 28px);
  max-height: 64%;
  overflow: auto;
  padding: 8px;
  border-radius: 11px;
  border: 1px solid var(--efb-line-strong);
  background: rgba(14, 15, 18, .95);
  box-shadow: 0 16px 32px rgba(0, 0, 0, .45);
}
.map-pick[hidden] { display: none; }
.map-pick-head { padding: 3px 4px 7px; border-bottom: 1px solid var(--efb-line); }
.map-pick-head > b { display: block; font-size: 11.5px; }
.map-pick-head > span { display: block; margin-top: 2px; font-size: 9px; color: var(--efb-faint); }
.map-pick-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 6px;
  border: 0;
  border-top: 1px solid var(--efb-line);
  background: none;
  color: var(--efb-text);
  font: inherit;
  text-align: left;
}
.map-pick-row:hover { background: rgba(148, 163, 184, .07); }
.map-pick-id {
  min-width: 64px;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.map-pick-main { min-width: 0; }
.map-pick-main > b { display: block; font-size: 11px; font-weight: 600; }
.map-pick-main > small { display: block; font-size: 9px; color: var(--efb-faint); }
.map-pick-row.is-custom .map-pick-id { color: var(--efb-muted); }
.map-pick-row.is-ghost { justify-content: center; color: var(--efb-muted); font-size: 10.5px; }

@media (max-width: 700px) {
  /* On a phone the readout keeps only its controls: even trimmed, the fact rows
     covered half the chart they describe. */
  .map-readout { left: 8px; bottom: 8px; width: auto; max-width: calc(100% - 64px); padding: 7px 9px; }
  .map-readout-facts, .map-readout-note { display: none; }
}

/* The filed route under departure → arrival in the OFP app. */
.fp-ofp-route { margin: 12px 0 4px; padding: 9px 11px; border: 1px solid rgba(148, 163, 184, .18); border-radius: 8px; background: rgba(255, 255, 255, .03); font: 12px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; word-break: break-word; }
