/* Centurion SkyScan — dark, bronze accent. Mobile first. */
:root {
  --ink: #0E0F12; --panel: #16181D; --panel2: #1D2026; --line: #2A2E37;
  --text: #E8E6E1; --muted: #8A8F99; --dim: #5C616B;
  --bronze: #B08D57; --bronze-l: #D4B37A; --bronze-d: #8C6D3F; --glow: rgba(176,141,87,.22);
  --ground: #9AA0A8; --ok: #6FBF8A; --warn: #E0A458; --bad: #D96C6C;
  --tabs-h: 64px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -.01em; margin: 0; }
.h2 { font-size: 16px; font-weight: 600; margin: 0; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 13px; } .bronze { color: var(--bronze-l); }
.row { display: flex; align-items: center; } .between { justify-content: space-between; } .gap8 { gap: 8px; } .grow { flex: 1; min-width: 0; }
.pad-x { padding: 0 20px; } .mt16 { margin-top: 16px; } .mt12 { margin-top: 12px; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.err { color: var(--bad); font-size: 13px; margin: 8px 0 0; }

/* boot + auth */
.boot, .auth { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; }
.brand { font-size: 20px; font-weight: 600; letter-spacing: .04em; }
.brand-c { color: var(--bronze-l); }
.auth-card { width: 100%; max-width: 360px; display: grid; gap: 14px; }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .field select, textarea {
  height: 46px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 16px; outline: none; }
textarea { height: auto; min-height: 140px; padding: 12px 14px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.field input:focus, .field select:focus, textarea:focus { border-color: var(--bronze); }
.field.inline { grid-template-columns: auto 1fr; align-items: center; }
.field.inline input { height: 40px; width: 140px; }
#q-times { flex-wrap: wrap; }
.btn { height: 46px; padding: 0 18px; white-space: nowrap; border-radius: 14px; border: 1px solid var(--line); background: var(--panel2); font-weight: 600; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--bronze); border-color: var(--bronze); color: var(--ink); }
.btn-danger { background: transparent; border-color: rgba(217,108,108,.5); color: var(--bad); }
.pillbtn { border-radius: 999px; height: 44px; }
.linkbtn { background: none; border: 0; color: var(--bronze-l); padding: 0; }
.iconbtn { width: 44px; height: 44px; border-radius: 999px; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; }

/* app shell */
#app { position: fixed; inset: 0; }
.view { position: absolute; inset: 0 0 calc(var(--tabs-h) + var(--sab)) 0; }
/* Pages are one 760 px column, centred by the page's own side padding, so each
   block keeps its own side margins (cards, notes, the tail map) on any width. */
.page { overflow-y: auto; -webkit-overflow-scrolling: touch; padding-top: calc(var(--sat) + 12px); padding-bottom: 24px;
  padding-left: max(0px, calc(50% - 380px)); padding-right: max(0px, calc(50% - 380px)); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; padding: 0 20px 10px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabs-h) + var(--sab)); padding-bottom: var(--sab);
  background: rgba(22,24,29,.96); border-top: 1px solid var(--line); display: flex; justify-content: space-around; align-items: flex-start; padding-top: 6px; z-index: 20;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.tabs a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; max-width: 96px; padding: 4px 0; color: var(--muted); text-decoration: none; font-size: 11px; }
.tabs a[aria-current="page"] { color: var(--bronze-l); }
.tab-dot { position: absolute; top: 2px; left: calc(50% + 6px); width: 8px; height: 8px; border-radius: 999px; background: var(--bronze-l); }

/* live */
.map, .map-fallback { position: absolute; inset: 0; background: #0B0C10; }
.map-fallback { overflow-y: auto; padding: calc(var(--sat) + 150px) 12px 180px; }
.live-top { position: absolute; top: calc(var(--sat) + 10px); left: 12px; right: 12px; display: flex; gap: 8px; z-index: 5; max-width: 560px; }
.pill { height: 48px; border-radius: 999px; background: rgba(22,24,29,.95); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(0,0,0,.45); display: flex; align-items: center; }
.pill.search { flex: 1; gap: 8px; padding: 0 16px; }
.pill.search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; font-size: 16px; }
.pill.round { width: 48px; justify-content: center; }
.results { position: absolute; top: calc(var(--sat) + 64px); left: 12px; right: 12px; max-width: 560px; z-index: 6; background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: 0 12px 32px rgba(0,0,0,.45); padding: 6px; max-height: 50vh; overflow-y: auto; }
.results button { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; border: 0; border-radius: 14px; background: transparent; }
.results button:hover, .results button:focus-visible { background: var(--panel2); outline: none; }
.legend { position: absolute; top: calc(var(--sat) + 66px); left: 12px; right: 12px; max-width: 560px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 4; font-size: 11px; pointer-events: none; }
.legend > * { pointer-events: auto; }
.chip { padding: 4px 9px; border-radius: 999px; background: rgba(22,24,29,.92); border: 1px solid var(--line); display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.dot.air { background: var(--bronze-l); } .dot.gnd { background: var(--ground); } .dot.dim { background: var(--dim); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); }
.age-chip { font-size: 11px; padding: 4px 9px; border-radius: 999px; background: rgba(22,24,29,.92); border: 1px solid var(--line); color: var(--muted); }
.age-chip.stale { color: var(--warn); border-color: rgba(224,164,88,.5); }
.sheet { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 6; max-width: 560px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: 24px; box-shadow: 0 -12px 32px rgba(0,0,0,.45); padding: 14px 16px 16px; }
.sheet .grab { width: 40px; height: 4px; border-radius: 999px; background: var(--line); margin: 0 auto 10px; }
.sheet .reg { font-size: 22px; font-weight: 600; letter-spacing: .03em; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; text-align: center; }
.stats > div { background: var(--panel2); border-radius: 16px; padding: 8px 2px; }
.stats b { display: block; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats span { font-size: 11px; color: var(--muted); }
.state-pill { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.state-pill.airborne { background: var(--glow); color: var(--bronze-l); border-color: rgba(176,141,87,.4); }
.state-pill.ground { color: var(--ground); }
.badge { height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.badge.warn { border-color: rgba(224,164,88,.5); color: var(--warn); }
.note { margin: 10px 20px 0; padding: 12px; border-radius: 16px; background: var(--panel2); font-size: 12px; color: var(--muted); line-height: 1.45; }
.sheet .note { margin: 10px 0 0; }
/* Mapbox keeps its own logo and attribution styling (required, and readable on both base maps) */
.mapboxgl-ctrl-attrib { font-size: 10px; }
.pill.round[aria-pressed="true"] { border-color: rgba(176,141,87,.75); background: rgba(48,40,28,.96); }
.dot.traffic { background: #86A6CF; }
.chip.chiptoggle.stale { color: var(--warn); border-color: rgba(224,164,88,.5); }
.tag.traffic { color: #A9BCD3; border-color: rgba(134,166,207,.45); background: rgba(134,166,207,.1); }
.badge.bad { border-color: rgba(217,108,108,.6); color: var(--bad); }
.wnote { margin-top: 3px; color: var(--text); opacity: .85; font-style: italic; overflow-wrap: anywhere; }

/* lists + cards */
.list { padding: 4px 12px 0; display: grid; gap: 8px; }
.card { margin: 0 16px 10px; padding: 12px 16px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); }
.field-search { margin: 0 20px 12px; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.field-search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; font-size: 16px; }
.group { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 14px 16px; }
.group-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; background: none; border: 0; padding: 0; text-align: left; }
.group-name { font-weight: 600; font-size: 16px; }
.counts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; margin-top: 4px; }
.c-air { color: var(--bronze-l); } .c-gnd { color: var(--ground); } .c-nos { color: var(--dim); } .c-pend { color: var(--warn); }
.tag { padding: 2px 8px; border-radius: 999px; font-size: 11px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.warn { border-color: rgba(224,164,88,.5); color: var(--warn); }
.tag.on { background: var(--glow); border-color: rgba(176,141,87,.4); color: var(--bronze-l); }
.tails { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tailchip { padding: 5px 9px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); font-size: 12px; font-variant-numeric: tabular-nums; }
.tailchip.air { border-color: rgba(176,141,87,.5); color: var(--bronze-l); }
.tailchip.ladd { border-color: rgba(224,164,88,.45); }
.tailchip.unres { color: var(--muted); border-style: dashed; }
.group-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.group-actions .btn { height: 38px; padding: 0 12px; border-radius: 12px; font-size: 13px; }
.group-actions select { height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); padding: 0 10px; font-size: 13px; }
.menu { position: absolute; z-index: 10; left: 12px; right: 12px; max-width: 736px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 6px; box-shadow: 0 12px 32px rgba(0,0,0,.45); }
.menu button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; border: 0; background: transparent; text-align: left; }
.menu button:hover { background: var(--panel2); }
.menu small { display: block; color: var(--muted); font-size: 12px; }
.mi { width: 40px; height: 40px; border-radius: 12px; background: var(--panel2); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.mi-bronze { background: var(--glow); color: var(--bronze-l); }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); width: 100%; text-align: left; }
button.item:hover, a.item:hover { border-color: #3a3f4a; }
a.item, a.tailchip { color: inherit; text-decoration: none; }
.item .t { font-weight: 600; } .item .s { font-size: 12px; color: var(--muted); }
.datebox { width: 44px; text-align: center; flex: none; } .datebox small { display: block; font-size: 11px; color: var(--muted); } .datebox b { font-size: 18px; line-height: 1; }
.evicon { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.evicon.dep { background: var(--glow); color: var(--bronze-l); } .evicon.land { background: rgba(111,191,138,.15); color: var(--ok); }
.infer { margin-left: 4px; padding: 1px 6px; border-radius: 6px; font-size: 10px; background: rgba(224,164,88,.15); color: var(--warn); font-weight: 600; vertical-align: 1px; }
.section-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 8px 8px 0; }
.empty { text-align: center; color: var(--muted); padding: 32px 20px; font-size: 14px; }
.foot { text-align: center; font-size: 11px; padding: 10px 20px 0; }
.chips-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 12px; scrollbar-width: none; }
.chips-row::-webkit-scrollbar { display: none; }
.chiptog { flex: none; height: 38px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid var(--line); background: var(--panel); color: var(--muted); }
.chiptog[aria-pressed="true"] { border-color: rgba(176,141,87,.5); background: var(--glow); color: var(--bronze-l); }
.toggle { width: 50px; height: 30px; border-radius: 999px; border: 0; background: var(--line); position: relative; flex: none; transition: background .2s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 999px; background: #fff; transition: transform .2s; }
.toggle[aria-checked="true"] { background: var(--bronze); }
.toggle[aria-checked="true"]::after { transform: translateX(20px); }
.signout { text-align: center; padding: 20px; }

/* tail */
.tail-head { display: flex; align-items: center; gap: 6px; padding: 0 16px 0 8px; }
.tail-reg { font-size: 26px; letter-spacing: .03em; }
.tail-map-wrap { position: relative; margin: 14px 16px 0; height: 250px; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); background: #121419; }
.tail-map { position: absolute; inset: 0; }
.map-label { position: absolute; left: 10px; top: 10px; z-index: 2; font-size: 11px; padding: 4px 9px; border-radius: 999px; background: rgba(22,24,29,.92); border: 1px solid var(--line); max-width: calc(100% - 20px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-fit { position: absolute; right: 10px; top: 10px; z-index: 2; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(22,24,29,.92); border: 1px solid var(--line); color: var(--text); }
.tail-map-wrap:has(.map-fit:not([hidden])) .map-label { max-width: calc(100% - 130px); }
@media (min-width: 700px) { .tail-map-wrap { height: 380px; } }
/* Wide screens: the map fills the left, the details scroll in a 460 px panel on the right. */
@media (min-width: 1100px) {
  #v-tail { padding-left: calc(100% - 476px); padding-right: 16px; }
  #v-tail .tail-map-wrap { position: fixed; z-index: 1; margin: 0; height: auto;
    top: calc(var(--sat) + 12px); left: 12px; right: 488px; bottom: calc(var(--tabs-h) + var(--sab) + 12px); }
}

/* modal + toast */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; }
.modal-card { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 24px 24px 0 0;
  padding: 14px 16px calc(18px + var(--sab)); display: grid; gap: 12px; }
#modal-body { display: grid; gap: 12px; }
@media (min-width: 700px) { .modal { align-items: center; } .modal-card { border-radius: 24px; } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabs-h) + var(--sab) + 14px); z-index: 60; max-width: calc(100% - 32px);
  background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.toast.bad { border-color: rgba(217,108,108,.6); }
.oplist { display: grid; gap: 6px; max-height: 46vh; overflow-y: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { height: 36px; padding: 0 12px; border: 0; background: var(--panel2); font-size: 13px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--glow); color: var(--bronze-l); }
:focus-visible { outline: 2px solid var(--bronze-l); outline-offset: 2px; }
.group-actions p { margin: 0; align-self: center; flex: 1 1 180px; }
.trip { margin-top: 2px; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; color: inherit; }
.trip-card { display: block; padding: 14px 16px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); color: inherit; text-decoration: none; }
a.trip-card:hover { border-color: #3a3f4a; }
.trip-code { font-weight: 600; font-size: 16px; }
.legs { display: grid; gap: 4px; margin-top: 10px; font-size: 13px; font-variant-numeric: tabular-nums; }
.leg { display: flex; gap: 10px; align-items: baseline; }
.leg-when { color: var(--muted); flex: none; min-width: 104px; }
.leg.done { opacity: .45; }
.trip-live { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.chiptoggle { color: var(--text); font-size: 11px; cursor: pointer; }
.chiptoggle[aria-pressed="true"] { border-color: rgba(176,141,87,.7); background: var(--glow); color: var(--bronze-l); }
.dot.trip { background: transparent; box-shadow: inset 0 0 0 2px var(--bronze-l); }
.oprow { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--line); }
.oprow .t { font-weight: 600; font-size: 14px; } .oprow .s { font-size: 12px; color: var(--muted); }
.oplist2 { display: grid; gap: 6px; margin-top: 12px; }
.optails { padding: 2px 0 6px; }
.wrap { flex-wrap: wrap; }
.btn.sm { height: 34px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.grid12 { display: grid; gap: 12px; }
.watchbox .card { margin: 12px 16px 0; }
.wrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.field .row.between { width: 100%; }
