/* Aerobove admin: dark chrome, brand green #34d399, a darkened map so the white plane icons read. */
:root {
  --bg: #0c1317;
  --panel: #131d23;
  --line: #243139;
  --fg: #e8eff2;
  --muted: #90a2ac;
  --green: #34d399;
  --warn: #f5b83d;
  --bad: #f06a6a;
  --blue: #4aa3ff;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Wordmark rule (CLAUDE.md): "Aero" white, "bove" brand green, mixed case. */
.wordmark { margin: 0; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: baseline; gap: 0; }
.w-aero { color: #fff; }
.w-bove { color: var(--green); }
.wordmark .tag { margin-left: 0.7rem; font-size: 0.8rem; font-weight: 500; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }

button, select, input[type="search"], input[type="password"] {
  font: inherit; color: var(--fg); background: var(--panel);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.4rem 0.65rem;
}
button { cursor: pointer; }
button:hover, select:hover { border-color: #3a4d58; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
button.quiet { background: transparent; color: var(--muted); }

/* ---- map page ---- */
body.app { display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1.2rem; padding: 0.6rem 1rem; background: var(--bg); border-bottom: 1px solid var(--line); }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.9rem; }
.field { display: flex; align-items: center; gap: 0.45rem; color: var(--muted); font-size: 0.85rem; }
.field input[type="search"] { width: 12rem; }
.check { display: flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 0.85rem; }
.logout { margin: 0; }
.stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; }
#map { flex: 1 1 auto; min-height: 0; background: #0a0f12; }

/* Layer toggle: Both / Aerobove fleet / Data sources */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 0.4rem 0.7rem; color: var(--muted); cursor: pointer; font-size: 0.85rem; border-right: 1px solid var(--line); }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--green); color: #04201a; font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--green); outline-offset: -2px; }
button[aria-expanded="true"] { border-color: var(--green); color: var(--green); }

/* Fleet panel */
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(24rem, 100%); z-index: 1100; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 0.8rem 0.9rem 1.2rem; }
.drawer[hidden] { display: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
.drawer-head h2 { margin: 0; font-size: 1.05rem; }
.drawer-head button { font-size: 1.3rem; line-height: 1; padding: 0.1rem 0.5rem; }
.problems { background: rgba(245, 184, 61, 0.1); border: 1px solid var(--warn); color: var(--warn); border-radius: 6px; padding: 0.5rem 0.7rem; margin-bottom: 0.7rem; font-size: 0.85rem; }
.hint { color: var(--muted); font-size: 0.8rem; margin: 0.9rem 0 0; }
.hint code { color: var(--fg); }
.subhead { margin: 1.1rem 0 0.5rem; font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.region-item { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.75rem; background: #101a20; }
.region-name { font-weight: 600; }
.fleet-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.fleet-item { border: 1px solid var(--line); border-radius: 8px; padding: 0.65rem 0.75rem; background: #101a20; }
.fleet-item.off { opacity: 0.65; }
.fleet-top { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.fleet-name { font-weight: 600; }
.fleet-desc { color: var(--muted); font-size: 0.82rem; margin: 0.25rem 0 0.45rem; }
.fleet-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.pill { display: inline-block; border-radius: 99px; padding: 0.1rem 0.6rem; font-size: 0.78rem; border: 1px solid var(--line); color: var(--muted); }
.pill.flying { background: rgba(52, 211, 153, 0.15); border-color: var(--green); color: var(--green); }
.pill.scheduled { border-color: var(--warn); color: var(--warn); }
.fleet-meta { color: var(--muted); font-size: 0.8rem; margin-top: 0.3rem; }
.btn-small { font-size: 0.8rem; padding: 0.25rem 0.55rem; }
/* on/off switch */
.switch { position: relative; display: inline-block; width: 2.4rem; height: 1.35rem; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: #2b3a43; transition: background 0.15s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 0.17rem; left: 0.17rem; width: 1.01rem; height: 1.01rem; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(1.05rem); }
.switch input:focus-visible + i { outline: 2px solid var(--green); outline-offset: 2px; }
/* flight plan */
.back { margin-bottom: 0.5rem; padding-left: 0; }
.flight-title { margin: 0 0 0.2rem; font-size: 1.05rem; }
.progress { height: 0.4rem; background: #2b3a43; border-radius: 99px; overflow: hidden; margin: 0.5rem 0 0.2rem; }
.progress b { display: block; height: 100%; background: var(--green); }
.plan { width: 100%; border-collapse: collapse; margin-top: 0.5rem; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.plan th { text-align: left; color: var(--muted); font-weight: 500; padding: 0.2rem 0.3rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.plan td { padding: 0.18rem 0.3rem; border-bottom: 1px solid #18242b; }
.plan tr.done td { color: var(--muted); }
.plan tr.here td { color: var(--green); font-weight: 600; }
.flight-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.7rem 0 0.2rem; }
.flight-actions a { color: var(--green); font-size: 0.8rem; align-self: center; }
@media (max-width: 620px) { .drawer { width: 100%; } }
.status { padding: 0.4rem 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; min-height: 2rem; }
.status.warn { color: var(--warn); }
.status.bad { color: var(--bad); }

/* Darken OpenStreetMap's light tiles (a display filter only; the tiles are unchanged). */
.leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.82) contrast(0.92) saturate(0.55); }
.leaflet-container { background: #0a0f12; font: inherit; }
.leaflet-control-attribution { background: rgba(12, 19, 23, 0.85) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--green) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--fg); }
.leaflet-popup-content { margin: 0.7rem 0.9rem; min-width: 11rem; }

/* Aircraft: white plane icons like the game, rotated to their track. */
.plane { background: none; border: 0; }
.plane svg { width: 24px; height: 24px; display: block; filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.9)); transition: opacity 0.15s; }
.plane.dim svg { opacity: 0.18; }
/* An Aerobove fleet aircraft: in the game it is an ordinary white plane; here it gets a green glow so you can tell. */
.plane.synthetic svg { filter: drop-shadow(0 0 4px var(--green)) drop-shadow(0 0 2px #000); }
.plane.hit svg { filter: drop-shadow(0 0 5px var(--green)) drop-shadow(0 0 2px #000); }
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--blue); border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(74, 163, 255, 0.28); }
.popup h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.popup dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.8rem; }
.popup dt { color: var(--muted); }
.popup dd { margin: 0; font-variant-numeric: tabular-nums; }

/* ---- login ---- */
body.login { display: grid; place-items: center; padding: 1rem; }
body.login main { width: min(22rem, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1.6rem; }
body.login .wordmark { font-size: 2rem; }
body.login .sub { margin: 0.2rem 0 1.2rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; }
body.login form { display: grid; gap: 0.6rem; }
body.login label { color: var(--muted); font-size: 0.85rem; }
body.login input { width: 100%; }
body.login button { background: var(--green); color: #04201a; border: 0; font-weight: 600; padding: 0.6rem; }
body.login .err { margin: 0 0 0.8rem; color: var(--bad); }

@media (max-width: 620px) {
  .field input[type="search"] { width: 8.5rem; }
  .wordmark .tag { display: none; }
}
@media (prefers-reduced-motion: reduce) { .plane svg { transition: none; } }

/* Rest settings form of a route plane */
.sortie-box { margin: 0.8rem 0; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: 8px; background: #101a20; }
.sortie-box .subhead { margin-top: 0; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin: 0.3rem 0; font-size: 0.85rem; color: var(--muted); }
.time-pick { display: flex; align-items: center; gap: 0.35rem; }
.time-pick select { padding: 0.2rem 0.35rem; }
.field-row input { width: 8.5rem; font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 0.25rem 0.45rem; }
