:root {
  --bg: #f2f4f8; --panel: #ffffff; --ink: #1f2a44; --muted: #66708a; --line: #dde2ec;
  --brand: #f26b1d; --brand-ink: #ffffff; --danger: #d6363b; --ok: #1f9d55; --warn: #c98a00;
  --header: #0f2a52; --header-ink: #ffffff; --chip: #e8ebf2;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11151f; --panel: #1b2130; --ink: #e8ecf4; --muted: #9aa3b8; --line: #2c3446; --header: #0b0e15; --chip: #262e40; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column; height: 100dvh;
}
header {
  background: var(--header); color: var(--header-ink);
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
}
header h1 { font-size: 22px; margin: 0; font-weight: 900; letter-spacing: .5px; display: flex; align-items: center; gap: 8px; }
header h1 img { width: 34px; height: 34px; border-radius: 50%; background: #fff; }
#b-logo { display: block; width: min(320px, 80%); height: auto; margin: 8px auto 0; border-radius: 16px; }
.brand .b-fox { background: linear-gradient(180deg, #ffa31a, #e5431b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pill { font: inherit; font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 999px; background: #ffffff22; color: inherit; border: 0; }
.pill.ok { background: var(--ok); color: #fff; }
.pill.warn { background: var(--warn); color: #fff; }
.pill.bad { background: var(--danger); color: #fff; }

main { flex: 1; overflow: hidden; position: relative; }
.tab { position: absolute; inset: 0; overflow-y: auto; padding: 12px; display: none; }
.tab.active { display: block; }
#tab-fly, #tab-map { padding: 0; }
#tab-fly.active, #tab-map.active { display: flex; flex-direction: column; }
h2 { margin: 0 0 8px; font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.hidden { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; min-width: 180px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.headline { font-size: 18px; font-weight: 700; border-width: 2px; }
.headline.GO { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--panel)); }
.headline.CAUTION { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, var(--panel)); }
.headline.NO-GO { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--panel)); }
.headline .tag { display: inline-block; padding: 2px 10px; border-radius: 6px; color: #fff; margin-right: 8px; }
.headline.GO .tag { background: var(--ok); } .headline.CAUTION .tag { background: var(--warn); } .headline.NO-GO .tag { background: var(--danger); }
.summary { margin: 0; padding-left: 18px; display: grid; gap: 6px; }

button {
  font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 10px 14px; cursor: pointer;
  background: var(--chip); color: var(--ink);
}
button.primary { background: var(--brand); color: var(--brand-ink); }
button.danger { background: var(--danger); color: #fff; }
button.ghost { background: transparent; border: 1px solid var(--line); }
button:disabled { opacity: .6; }
input, select, textarea {
  font: inherit; font-size: 16px;   /* under 16px, iPhone zooms the whole app in when the field is tapped, and it stays zoomed */ color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px;
}
#b-q { flex: 1; min-width: 0; }
.seg { display: inline-flex; background: var(--chip); border-radius: 10px; padding: 3px; gap: 2px; margin-top: 10px; flex-wrap: wrap; }
.seg button { background: none; padding: 7px 10px; font-size: 14px; border-radius: 8px; }
.seg button.on { background: var(--panel); box-shadow: 0 1px 3px #0002; }
.picks { list-style: none; padding: 0; margin: 6px 0 0; }
.review { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.review input, .review textarea, .review select { width: 100%; min-width: 0; max-width: 100%; }
.review .label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.review .seg { margin-top: 0; }
.seg.wide { display: flex; }
.seg.wide button { flex: 1; }
#b-q { width: 100%; }
.when-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.when-row select, .when-row input { width: 100%; min-width: 0; font-size: 16px; }
.when-row .ghost { padding: 9px 12px; }
.run { font-size: 19px; padding: 15px; margin-top: 8px; border-radius: 12px; }
.steps { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 4px; font-size: 14px; }
.steps li::before { content: "○"; display: inline-block; width: 22px; color: var(--muted); }
.steps li.busy::before { content: "◌"; color: var(--brand); }
.steps li.ok::before { content: "✓"; color: var(--ok); font-weight: 700; }
.steps li.bad::before { content: "✗"; color: var(--danger); font-weight: 700; }
.picks li button { width: 100%; text-align: left; background: none; border-bottom: 1px solid var(--line); border-radius: 0; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; }
.chips button { padding: 6px 10px; font-size: 14px; white-space: nowrap; }
.chips button.on { background: var(--brand); color: #fff; }
table { border-collapse: collapse; width: 100%; }
.winds th, .small-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px; }
.winds td { padding: 8px 4px; border-top: 1px solid var(--line); vertical-align: middle; }
.winds tr.lvl { cursor: pointer; }
.winds tr.models td { padding: 0 4px 8px 4px; border-top: 0; font-size: 13px; color: var(--muted); }
.winds .ht { font-weight: 700; font-variant-numeric: tabular-nums; }
.arrow { display: inline-block; width: 26px; height: 26px; border-radius: 50%; background: var(--chip); text-align: center; line-height: 26px; }
.arrow i { display: inline-block; font-style: normal; font-weight: 900; }
.agree { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.bar { width: 50px; height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; }
.bar span { display: block; height: 100%; }
.conf-high { background: var(--ok); } .conf-moderate { background: var(--warn); } .conf-low { background: var(--danger); }
.outlier { color: var(--danger); font-weight: 600; }
.small-table td { padding: 4px; border-top: 1px solid var(--line); font-size: 13px; }
.sources { padding-left: 0; list-style: none; margin: 0; display: grid; gap: 4px; font-size: 14px; }
.sources .x { color: var(--danger); } .sources .y { color: var(--ok); }

#s-map { height: 320px; border-radius: 10px; margin: 10px 0; }
.sites { padding-left: 0; list-style: none; display: grid; gap: 10px; margin: 0; }
.sites > li { border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.sites .top { display: flex; gap: 8px; align-items: baseline; }
.sites .num { background: var(--brand); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: inline-grid; place-items: center; font-weight: 700; flex: none; }
.sites .num.land { background: #1f9d55; }
.sites .why { margin: 4px 0; font-size: 14px; color: var(--muted); }
.sites .lands { list-style: none; padding: 0; margin: 6px 0; font-size: 14px; display: grid; gap: 4px; }
.sites a { color: var(--brand); font-weight: 600; text-decoration: none; }
.map-num { background: var(--brand); color: #fff; border: 2px solid #fff; border-radius: 50%; font: 700 13px system-ui; display: grid; place-items: center; box-shadow: 0 1px 4px #0006; }
.map-num.land { background: #1f9d55; font-size: 11px; }
.map-num.me { background: #1e6bff; }

/* ---- Fly ---- */
#gauges { display: grid; grid-template-columns: repeat(4, 1fr); background: #000; color: #fff; text-align: center; padding: 6px 0; }
#gauges b { display: block; font-size: 30px; font-variant-numeric: tabular-nums; line-height: 1.1; }
#gauges small { font-size: 12px; color: #ddd; }
.c1 { color: #4cff6a; } .c2 { color: #3fe0ff; } .c3 { color: #ff4fd8; } .c4 { color: #ffe34c; }
#fly-wrap { flex: 1; position: relative; }
#map, #all-map { position: absolute; inset: 0; }
#wind-panel { position: absolute; left: 0; top: 10px; z-index: 500; display: flex; align-items: center; }
#wind-body { background: #000c; color: #fff; padding: 8px; border-radius: 0 10px 10px 0; width: 196px; }
#wind-panel.closed #wind-body { display: none; }
#wind-toggle { writing-mode: vertical-rl; background: #000c; color: #fff; border-radius: 0 10px 10px 0; padding: 14px 6px; font-size: 14px; }
.wp-head { display: flex; justify-content: space-between; font-size: 11px; color: #ffb35c; margin-bottom: 4px; }
.band { display: grid; grid-template-columns: 52px 40px 1fr; gap: 6px; align-items: center; border-top: 1px solid #ffffff22; padding: 4px 0; }
.band .h { color: #ffb35c; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.band .dial { width: 36px; height: 36px; border: 1.5px dashed #ffffff88; border-radius: 50%; position: relative; }
.band .dial i { position: absolute; left: 50%; top: 50%; width: 3px; height: 30px; margin: -15px 0 0 -1.5px; border-radius: 2px; }
.band .dial i.obs { background: #ff4fd8; }
.band .dial i.fc { background: #ffffff66; width: 2px; margin-left: -1px; }
.band .dial i::before { content: ""; position: absolute; top: -4px; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-bottom-color: inherit; border-bottom: 6px solid; color: inherit; }
.band .dial i.obs::before { border-bottom-color: #ff4fd8; }
.band .dial i.fc::before { border-bottom-color: #ffffff66; }
.band .v { font-size: 14px; color: #ff4fd8; font-weight: 700; }
.band .v small { display: block; color: #bbb; font-weight: 400; font-size: 11px; }
.band.here { background: #ffffff14; }
.wp-foot { display: flex; justify-content: space-between; align-items: center; font-size: 11px; margin-top: 6px; gap: 6px; }
.wp-foot select { padding: 2px 4px; font-size: 16px; background: #222; color: #fff; border-color: #444; }
#fly-info { position: absolute; right: 8px; bottom: 26px; z-index: 500; display: flex; gap: 10px; align-items: center; background: #000b; color: #fff; padding: 6px 10px; border-radius: 10px; font-size: 13px; }
.fly-buttons { display: flex; gap: 8px; padding: 8px 12px; background: var(--panel); }
.fly-buttons button:not(.ghost) { flex: 1; }

/* ---- Map of flights ---- */
#tab-map .floating { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 500; margin: 0; box-shadow: 0 2px 8px #0003; background: #ffffffdd; }
#tab-map .floating button { color: #1f2a44; }
.floating-bottom { position: absolute; right: 10px; bottom: 26px; z-index: 500; background: #000a; color: #fff; }

/* ---- Log ---- */
#log-summary .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
#log-summary .stats b { display: block; font-size: 22px; }
#log-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
#log-list li { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
#log-list .top { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
#log-list .stats { color: var(--muted); font-size: 14px; margin: 4px 0 8px; }
#log-list .actions { display: flex; gap: 6px; flex-wrap: wrap; }
#log-list .actions button { padding: 6px 12px; font-size: 14px; }

nav {
  display: flex; background: var(--panel); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav button {
  flex: 1; background: none; border-radius: 0; padding: 8px 0 6px; font-size: 20px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
nav button span { font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
nav button { min-width: 0; }
nav button.active { color: var(--brand); }

dialog { border: 0; border-radius: 14px; padding: 0; width: min(480px, calc(100vw - 24px)); max-height: 90dvh; background: var(--panel); color: var(--ink); }
dialog::backdrop { background: #0008; }
#flight-form, .dlg-body { padding: 16px; display: grid; gap: 10px; }
#flight-form label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
#b-air p, #b-air li { font-size: 15px; font-weight: 400; }
#b-air h2 { font-size: 17px; }
.nw { white-space: nowrap; }
.winds .outlier { font-size: 12px; }

.pl-note { background: #000a; color: #fff; font-size: 11px; padding: 3px 7px; border-radius: 6px; max-width: 150px; text-align: right; }
.pl-note:empty { display: none; }

.zone-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.zone-list li { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: grid; gap: 6px; }
.zone-list .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.zone-list .sw { display: flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
.zone-list .sw input { width: 20px; height: 20px; }
.zone-list .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.zone-list .actions button { padding: 6px 12px; font-size: 14px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 3px; vertical-align: -1px; }
.dot.r { background: #e3242b; } .dot.g { background: #1fbf3a; }

.fb-kinds { display: grid; grid-template-columns: 1fr 1fr; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.check input { width: 20px; height: 20px; flex: none; }
.fb-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.fb-list li { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: grid; gap: 6px; }
.fb-list .top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.fb-list .msg { white-space: pre-wrap; }
.fb-list .reply { background: color-mix(in srgb, var(--brand) 10%, var(--panel)); border-radius: 8px; padding: 8px; font-size: 14px; }
.st { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff; }
.st.new { background: var(--muted); } .st.planned { background: var(--warn); } .st.done { background: var(--ok); }
.fb-admin-row { display: grid; gap: 6px; }
.fb-admin-row .row button { padding: 6px 10px; font-size: 13px; }

.tbl { overflow-x: auto; }
.admin-table { font-size: 13px; min-width: 640px; }
.admin-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table td.n { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table a { color: var(--brand); font-weight: 600; }
.admin-table button { padding: 4px 10px; font-size: 13px; }

/* ---- sign up / install ---- */
.gate { position: fixed; inset: 0; z-index: 2000; background: var(--bg); overflow-y: auto; padding: calc(env(safe-area-inset-top) + 16px) 16px 24px; }
.gate-box { max-width: 420px; margin: 0 auto; display: grid; gap: 12px; }
.gate-logo { width: min(220px, 60%); height: auto; margin: 0 auto; border-radius: 16px; }
.gate-icon { width: 88px; height: 88px; border-radius: 20px; margin: 8px auto 0; box-shadow: 0 4px 14px #0003; }
.gate-lead { text-align: center; margin: 0; color: var(--muted); }
.gate h2 { text-align: center; margin: 0; }
.gate-form { display: grid; gap: 10px; }
.gate-form label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.err { color: var(--danger); margin: 0; min-height: 1em; font-size: 14px; }
.howto { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.howto ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.kbd { display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; background: var(--chip); }
.avatar { min-width: 30px; text-transform: uppercase; }
#dlg-acct .dlg-body button.ghost { width: 100%; }
.brief-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.brief-list button { width: 100%; text-align: left; background: var(--bg); font-weight: 400; display: grid; gap: 2px; }
.brief-list b.GO { color: var(--ok); } .brief-list b.CAUTION { color: var(--warn); } .brief-list b.NO-GO { color: var(--danger); }
#tab-map .leaflet-top { top: 66px; }      /* clear the 1 mo / 6 mo / year bar */
.greenz { color: var(--ok); font-weight: 700; }
.beta { font: 700 10px/1 ui-monospace, Menlo, monospace; letter-spacing: .1em; text-transform: uppercase; color: #0f2a52;
  background: #ffd166; border-radius: 5px; padding: 4px 5px; margin-left: 2px; }

/* ask about this briefing */
.ask-thread { display: grid; gap: 8px; margin: 4px 0 10px; }
.ask-thread:empty { display: none; }
.ask-thread .q { justify-self: end; max-width: 85%; background: var(--brand); color: var(--brand-ink); padding: 8px 12px; border-radius: 14px 14px 4px 14px; }
.ask-thread .a { justify-self: start; max-width: 92%; background: var(--chip); padding: 8px 12px; border-radius: 14px 14px 14px 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ask-thread .a.busy { color: var(--muted); font-style: italic; }
.ask-form { display: flex; gap: 8px; }
#ask-q { flex: 1; min-width: 0; }
