:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c232c;
  --line: #2a333f;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #4ea3ff;
  --accent-2: #ffb347;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- barre supérieure ------------------------------------------------ */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1000;
}
.brand { font-weight: 700; font-size: 17px; color: var(--text); letter-spacing: .3px; }
.brand-mark { color: var(--accent); }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
  padding: 6px 11px; border-radius: 8px; color: var(--muted); font-size: 14px;
}
.topbar nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.topbar nav a.on { background: var(--panel-2); color: var(--text); }
.spacer { flex: 1; }

/* Menu déroulant de la barre : ouvert au survol comme au clavier, pour rester
   accessible sans JavaScript. */
.menu { position: relative; }
.menu > a::after { content: " ▾"; opacity: .6; font-size: 11px; }
.menu-panel {
  display: none; position: absolute; top: 34px; left: 0; min-width: 230px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.5);
  padding: 6px; z-index: 1200;
}
.menu:hover .menu-panel, .menu:focus-within .menu-panel { display: block; }
.menu-panel a {
  display: flex; align-items: baseline; gap: 8px; padding: 7px 10px;
  border-radius: 7px; color: var(--text); font-size: 14px;
}
.menu-panel a:hover { background: var(--panel); text-decoration: none; }
.menu-panel a .n { margin-left: auto; color: var(--muted); font-size: 11.5px;
                   font-variant-numeric: tabular-nums; }
.menu-panel .sep { height: 1px; background: var(--line); margin: 5px 2px; }

.quicksearch { position: relative; }
.quicksearch input {
  width: 300px; padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font-size: 14px;
}
.quicksearch input:focus { outline: none; border-color: var(--accent); }
.qs-results {
  position: absolute; top: 40px; right: 0; width: 380px; max-height: 60vh;
  overflow: auto; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.5); z-index: 1200;
}
.qs-results a {
  display: flex; gap: 10px; align-items: baseline; padding: 9px 12px;
  border-bottom: 1px solid var(--line); color: var(--text);
}
.qs-results a:hover { background: var(--panel); text-decoration: none; }
.qs-results .code { font-weight: 700; color: var(--accent); min-width: 56px; }
.qs-results .kind { margin-left: auto; font-size: 11px; color: var(--muted); }

.pill {
  padding: 6px 12px; border-radius: 999px; font-size: 13px;
  background: var(--accent); color: #06121f; font-weight: 600; border: none;
  cursor: pointer;
}
.pill.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.pill:hover { text-decoration: none; filter: brightness(1.1); }

/* --- mise en page ---------------------------------------------------- */
main { padding: 20px; max-width: 1180px; margin: 0 auto; }
body.fullmap main { padding: 0; max-width: none; }


h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 26px 0 10px; color: var(--muted);
     text-transform: uppercase; letter-spacing: .08em; }
.sub { color: var(--muted); margin: 0 0 18px; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

.stat { background: var(--panel); border: 1px solid var(--line);
        border-radius: var(--radius); padding: 14px; }
.stat b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px;
     text-transform: uppercase; letter-spacing: .05em; }
tbody tr:hover { background: var(--panel-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.tag.ok { color: var(--ok); border-color: #23502f; }
.tag.warn { color: var(--warn); border-color: #5a4515; }
.tag.err { color: var(--err); border-color: #5e2626; }
.tag.mand { color: var(--accent-2); border-color: #5a4515; }

input, select, textarea, button { font-family: inherit; font-size: 14px; }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px;
              text-transform: uppercase; letter-spacing: .05em; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.hint { color: var(--muted); font-size: 12.5px; }

/* Liste de cases à cocher avec libellé et explication. Hors de `.field`, dont
   la règle sur `span` met tout en capitales et en bloc. */
.checks { margin-bottom: 12px; }
.checks > .label { display: block; font-size: 12px; color: var(--muted);
                   margin-bottom: 6px; text-transform: uppercase;
                   letter-spacing: .05em; }
.checks label { display: flex; gap: 9px; align-items: baseline;
                padding: 5px 0; cursor: pointer; }
.checks label b { flex: 0 0 150px; font-weight: 600; }
.checks label .hint { flex: 1; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
      padding: 12px; overflow-x: auto; }

/* --- carte ------------------------------------------------------------ */
#map { position: absolute; inset: 56px 0 0 0; }
.leaflet-container { background: #0b0f14; }
.map-panel {
  position: absolute; top: 72px; left: 16px; z-index: 900; width: 268px;
  background: rgba(22,27,34,.95); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; backdrop-filter: blur(8px);
}
.map-panel h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase;
                letter-spacing: .06em; color: var(--muted); }
.map-panel label { display: flex; align-items: center; gap: 8px; padding: 4px 0;
                   font-size: 14px; cursor: pointer; }
.map-panel .range { width: 100%; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.marker-ad { background: var(--accent); }
.marker-vfr { background: var(--accent-2); }
.marker-nav { background: #b57fff; }
.marker-heli { background: #3fb950; }
.marker-obs { background: #f85149; }

/* --- symbologie aéronautique ---------------------------------------- */
.ff-icon { background: none; border: none; }
.ff-icon svg { display: block; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.35)); }

/* Étiquettes façon carte aéronautique : texte sombre cerné de blanc, sans
   cartouche, pour rester lisible sur un fond IGN clair. */
.ff-label {
  background: none; border: none; box-shadow: none; padding: 0;
  font: 700 11px/1.1 Helvetica, Arial, sans-serif;
  color: #12212f; white-space: nowrap;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff;
}
.ff-label::before { display: none; }
.ff-label-aerodrome { font-size: 12.5px; }
.ff-label-vfr_point { font-size: 10.5px; color: #123a6b; }
.ff-label-navaid { font-size: 10.5px; color: #2b3947; }

.as-hatch { fill: url(#ff-hatch); }

.ff-select {
  width: 100%; padding: 7px 9px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}

.map-legend {
  position: absolute; top: 72px; right: 16px; z-index: 900; width: 290px;
  max-height: calc(100vh - 110px); overflow: auto;
  background: rgba(22,27,34,.96); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; backdrop-filter: blur(8px);
}
.map-legend h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase;
                 letter-spacing: .06em; color: var(--muted); }
.legend-row { display: flex; align-items: center; gap: 10px; padding: 3px 0;
              font-size: 13px; }
.legend-sym { width: 26px; display: flex; justify-content: center; flex: 0 0 26px; }
.legend-sym svg { filter: none; }
.legend-line { width: 26px; flex: 0 0 26px; border-top-width: 3px;
               border-top-style: solid; }
.legend-sep { height: 1px; background: var(--line); margin: 10px 0; }

@media (max-width: 780px) {
  .map-legend { right: 8px; left: 8px; width: auto; top: auto; bottom: 8px;
                max-height: 45vh; }
}

/* --- page d'accueil --------------------------------------------------- */
.hero {
  padding: 56px 20px 44px; text-align: center;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(900px 380px at 50% -12%, rgba(78,163,255,.16), transparent 70%),
    var(--panel);
}
.hero h1 { font-size: 40px; letter-spacing: -.4px; margin-bottom: 12px; }
.hero p { color: var(--muted); max-width: 640px; margin: 0 auto 22px;
          font-size: 16px; line-height: 1.6; }
.hero .row { justify-content: center; }
.hero .pill { padding: 10px 20px; font-size: 15px; }
.airac-chip {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px;
  padding: 5px 13px; border-radius: 999px; font-size: 12.5px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
}
.airac-chip b { color: var(--text); font-weight: 600; }
.dot-live { width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
            box-shadow: 0 0 0 3px rgba(63,185,80,.18); }

.pillar { display: block; color: inherit; }
.pillar:hover { text-decoration: none; border-color: var(--accent); }
.pillar .ico { font-size: 26px; line-height: 1; margin-bottom: 10px; }
.pillar b { display: block; font-size: 16px; margin-bottom: 6px; }
.pillar p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; }

.counter { display: flex; flex-wrap: wrap; gap: 26px; justify-content: center;
           padding: 6px 0 2px; }
.counter div { text-align: center; }
.counter b { display: block; font-size: 28px; font-variant-numeric: tabular-nums; }
.counter span { color: var(--muted); font-size: 12.5px; }

/* --- fiche d'un objet -------------------------------------------------- */
.kv { display: grid; grid-template-columns: 190px 1fr; gap: 2px 16px; }
.kv dt { color: var(--muted); font-size: 13px; padding: 6px 0;
         border-bottom: 1px solid var(--line); }
.kv dd { margin: 0; padding: 6px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 620px) { .kv { grid-template-columns: 1fr; }
                            .kv dt { border: none; padding-bottom: 0; } }
.detail-map { height: 300px; border-radius: var(--radius); overflow: hidden; }

.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }

/* --- pied de page ------------------------------------------------------ */
.footer {
  border-top: 1px solid var(--line); margin-top: 42px; padding: 26px 20px 34px;
  color: var(--muted); font-size: 13px; background: var(--panel);
}
.footer-inner { max-width: 1180px; margin: 0 auto;
                display: grid; gap: 22px;
                grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.footer b { display: block; color: var(--text); font-size: 12px;
            text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.footer a { display: block; padding: 3px 0; color: var(--muted); }
.footer a:hover { color: var(--text); }
.footer .legal { grid-column: 1 / -1; border-top: 1px solid var(--line);
                 padding-top: 16px; line-height: 1.6; }
body.fullmap .footer { display: none; }

/* --- modal de calage -------------------------------------------------- */
.cal-modal {
  position: fixed; inset: 0; z-index: 2000; background: rgba(5,8,12,.82);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.cal-box {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
  width: min(1400px, 96vw); height: min(880px, 92vh);
  display: flex; flex-direction: column;
}
.cal-body { display: flex; gap: 14px; flex: 1; min-height: 0; }
.cal-imgwrap {
  flex: 1; overflow: auto; background: #05080c; border: 1px solid var(--line);
  border-radius: 8px; cursor: crosshair;
}
.cal-imgwrap img { width: 100%; display: block; }
.cal-side { width: 320px; overflow: auto; }

/* --- visionneuse VAC -------------------------------------------------- */
.vac-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.vac-tabs button {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 13px;
}
.vac-tabs button.on { background: var(--accent); color: #06121f; font-weight: 600; }
.vac-frame {
  width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: 8px;
  background: #fff;
}
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 2px; }

.dot-icon { border-radius: 50%; border: 2px solid rgba(0,0,0,.6);
            box-shadow: 0 0 0 1px rgba(255,255,255,.25); }

.popup-title { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.popup-sub { color: #555; font-size: 12px; }

/* --- espace dev ------------------------------------------------------- */
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 28px; text-align: center; color: var(--muted); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone.hot { border-color: var(--accent); background: rgba(78,163,255,.07);
                color: var(--text); }
.joblog {
  background: #05080c; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; max-height: 320px; overflow: auto; white-space: pre-wrap;
  font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: #b9c6d3;
}
.progress { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }

@media (max-width: 780px) {
  .topbar { flex-wrap: wrap; }
  .quicksearch input { width: 190px; }
  .map-panel { left: 8px; right: 8px; width: auto; }
}

/* --- météo dans la fiche d'aérodrome ------------------------------------
   Le message brut est mis en avant, en chasse fixe : un METAR se lit groupe
   par groupe, et une police proportionnelle en désaligne la lecture. Les
   valeurs décodées sont volontairement plus discrètes — elles aident, elles
   ne font pas foi. */
.meteo-bloc { margin-bottom: 18px; }
.meteo-bloc:last-of-type { margin-bottom: 0; }

.meteo-raw {
  margin: 8px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--bg-soft, #11161d);
  border: 1px solid var(--line, #232c38);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;      /* un TAF est long : il doit se replier */
  word-break: break-word;
}

.meteo-champs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 10px;
}
.meteo-champs > div { display: flex; flex-direction: column; gap: 1px; }
.meteo-champs .hint { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }

/* Catégorie de vol : la couleur reprend la convention aéronautique
   habituelle, mais le sigle reste écrit — une pastille seule serait
   illisible pour qui ne connaît pas le code. */
.cat {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor;
}
.cat-vfr  { color: #46c46a; }
.cat-mvfr { color: #4a9df0; }
.cat-ifr  { color: #e8574a; }
.cat-lifr { color: #d15fe0; }

/* --- cycle AIRAC en trois étapes ---------------------------------------
   Le numéro à gauche n'est pas décoratif : l'ordre est imposé — le XML BD SIA
   prime sur l'eAIP là où les deux se recouvrent — et une interface qui
   présenterait trois boutons côte à côte suggérerait le contraire. */
.etape {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 0;
  border-top: 1px solid var(--line, #232c38);
}
.etape:first-child { border-top: 0; padding-top: 4px; }

.etape-num {
  flex: 0 0 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: var(--bg-soft, #11161d);
  border: 1px solid var(--line, #232c38);
  font-size: 13px; font-weight: 700;
}
