:root {
  color-scheme: light;
  font-family: "DM Sans", system-ui, sans-serif;
  color: #18322a;
  background: #f8f9f5;
  --surface: #fff;
  --ink: #18322a;
  --muted: #53675f;
  --line: #e2e9e2;
  --green: #256348;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, a:focus-visible { outline: 3px solid #3a9971; outline-offset: 3px; }
[hidden] { display: none !important; }
a { color: var(--green); }
h1, h2, h3, p { margin: 0; }
.shell { width: min(100% - 28px, 1320px); margin-inline: auto; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner, .brand, .button { display: flex; align-items: center; }
.header-inner { justify-content: space-between; min-height: 70px; gap: 10px; }
.brand { gap: 11px; }
.brand img { flex: none; }
h1 { font-size: 1.17rem; letter-spacing: -.045em; }
.brand p { font-size: .77rem; color: var(--muted); }
.button, .map-button {
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid #d9e4da;
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface);
  font-size: .83rem;
  font-weight: 700;
}
.button:not(:disabled):hover, .map-button:not(:disabled):hover { background: #edf5ef; }
.button svg, .map-button svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.button.primary { background: var(--ink); color: white; border-color: var(--ink); }
.button.primary:not(:disabled):hover { background: var(--green); }
.dashboard { display: grid; gap: 14px; margin-block: 14px 22px; }
.map-panel, .traffic {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  overflow: hidden;
  min-width: 0;
}
.map-panel { position: relative; isolation: isolate; height: clamp(310px, 54svh, 630px); }
#map { height: 100%; background: #e5ede3; }
.leaflet-container { font-family: inherit; }
.map-label, .map-button, .location-panel { position: absolute; z-index: 500; }
.map-label {
  top: 12px; left: 12px; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1px solid #d9e4da; border-radius: 10px; background: white;
  font-family: var(--mono); font-size: .68rem; font-weight: 600;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #798680; }
.map-label[data-state="live"] .status-dot { background: #258458; box-shadow: 0 0 0 3px #d8f0df; }
.map-label[data-state="error"] .status-dot { background: #a85d32; }
.map-button { top: 12px; right: 12px; width: 44px; display: grid; padding: 0; place-items: center; }
.location-panel {
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(290px, 100% - 32px); padding: 19px; border: 1px solid #dbe6dc; border-radius: 16px;
  background: #fff; box-shadow: 0 12px 36px #18322a28;
}
.location-panel h2, .traffic-header h2 { font-size: 1.08rem; line-height: 1.25; letter-spacing: -.03em; }
.location-panel p { color: var(--muted); font-size: .83rem; margin: 7px 0 13px; }
.location-panel p[data-error] { color: #863c24; line-height: 1.45; }
.location-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.location-crosshair, .location-picker { position: absolute; z-index: 500; }
.location-crosshair {
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 24px; height: 24px; border: 2px solid #174a37; border-radius: 50%;
  box-shadow: 0 0 0 2px #fff; pointer-events: none;
  background: radial-gradient(circle, #174a37 0 2px, #fff 3px 4px, transparent 5px);
}
.location-picker {
  bottom: 26px; right: 12px; left: 52px; width: fit-content;
  padding: 10px; border: 1px solid #dbe6dc; border-radius: 12px; background: #fff;
}
.location-picker p { margin-bottom: 7px; font-size: .78rem; }
@media (any-pointer: coarse) {
  html, body { touch-action: pan-x pan-y; }
}
.traffic-header { display: flex; justify-content: space-between; align-items: center; padding: 17px 16px 12px; }
.traffic-header p { color: var(--muted); font-size: .76rem; margin-top: 4px; }
.count { min-width: 32px; padding: 6px; border-radius: 9px; background: #e9f4eb; font: 600 .79rem var(--mono); text-align: center; }
.notice { padding: 7px 16px 12px; color: var(--muted); font-size: .83rem; line-height: 1.5; }
.details { padding: 12px; margin: 0 12px 10px; background: #eef6ef; border: 1px solid #dbe8dc; border-radius: 13px; }
.detail-header { display: flex; align-items: start; gap: 10px; justify-content: space-between; }
.detail-header h3 { font: 600 1rem var(--mono); }
.detail-header p { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.close-detail {
  border: 0; border-radius: 8px; background: transparent; color: var(--ink);
  width: 44px; height: 44px; margin: -7px -6px 0 0; font-size: 1.35rem;
}
.close-detail:hover { background: #deebe0; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-block: 11px; }
.metrics dt { color: var(--muted); font-size: .72rem; }
.metrics dd { margin: 3px 0 0; font: 500 .79rem var(--mono); }
.route { border-top: 1px solid #d8e7db; padding-top: 9px; font-size: .79rem; overflow-wrap: anywhere; }
.route p + p { margin-top: 4px; }
.route small { color: var(--muted); }
.route-button { width: fit-content; margin-top: 9px; }
.flight-list { list-style: none; padding: 0 12px 8px; margin: 0; }
.flight-list li + li { border-top: 1px solid var(--line); }
.flight-row {
  width: 100%; min-height: 62px; padding: 8px; text-align: left; border: 0; border-radius: 9px;
  background: transparent; color: var(--ink); display: grid; align-items: center;
  grid-template-columns: 34px minmax(0, 1fr) auto; gap: 9px;
}
.flight-row:hover, .flight-row[aria-pressed="true"] { background: #edf6ee; }
.flight-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--green); background: #e7f1e8; }
.flight-icon svg { width: 17px; height: 17px; }
.flight-meta { display: grid; gap: 3px; min-width: 0; }
.flight-meta strong, .distance { font: 600 .84rem var(--mono); }
.flight-meta small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .75rem; }
.distance { font-size: .75rem; }
.sources { border-top: 1px solid var(--line); padding: 10px 16px; font-size: .72rem; }
.sources a { text-underline-offset: 2px; }
.plane-pin {
  display: grid; place-items: center;
  border-radius: 50%;
  color: #195742;
}
.plane-pin svg { width: 28px; height: 28px; filter: drop-shadow(0 1px 2px #18322a70); }
.plane-pin svg path { stroke: #fff; stroke-width: 2.6; stroke-linejoin: round; paint-order: stroke; }
.plane-pin.selected { background: #dcefe4; box-shadow: inset 0 0 0 1.5px #397b5d; }

@media (min-width: 850px) {
  .shell { width: min(100% - 48px, 1320px); }
  .header-inner { min-height: 76px; }
  .dashboard { grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; margin-block-start: 20px; }
  .map-panel, .traffic { height: clamp(470px, calc(100svh - 118px), 900px); }
  .traffic { overflow: auto; }
}
