/* Mise en page : bandeau d'instruments en haut, carte plein écran, panneau d'onglets
   en bas sur téléphone et à gauche sur tablette paysage. */
@font-face { font-family: "B612"; src: url(fonts/b612-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "B612"; src: url(fonts/b612-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #e9edf1;
  --surface: #ffffff;
  --surface-2: #dfe5ec;
  --fg: #0f1720;
  --muted: #566476;
  --line: #c5ced8;
  --accent: #1d5bb8;
  --accent-fg: #ffffff;
  --route: #b5137f;
  --ok: #17803f;
  --warn: #a86400;
  --alert: #c0262a;
  --carte-filtre: none;

  /* Écran d'instruments : volontairement sombre dans les deux thèmes, comme un afficheur de bord. */
  /* Bandeau d'instruments : clair avec le thème clair, noir de cockpit avec le thème sombre */
  --ecran: #dfe5ec;
  --ecran-2: #ffffff;
  --ecran-fg: #0f1720;
  --ecran-lbl: #566476;
  --ecran-cyan: #00898a;
  --ecran-magenta: #b5137f;
  --ecran-vert: #17803f;
  --ecran-ambre: #a86400;
  --ecran-rouge: #c0262a;
  --ecran-bord: #c5ced8;

  --f-ui: "B612", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --f-num: "B612", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="ciel"]) {
    --bg: #0b1016; --surface: #131a22; --surface-2: #1b242e; --fg: #e5ecf3; --muted: #8d9cad;
    --line: #2a3644; --accent: #6ea8ff; --accent-fg: #06101d; --route: #ff5fcf;
    --ok: #4fd683; --warn: #ffbf47; --alert: #ff6b6b;
    --ecran: #0a1016; --ecran-2: #121b24; --ecran-fg: #e9f1f8; --ecran-lbl: #8094a9; --ecran-cyan: #00898a;
    --ecran-magenta: #ff62d4; --ecran-vert: #52e083; --ecran-ambre: #ffc04a; --ecran-rouge: #ff5a5a; --ecran-bord: transparent;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1016; --surface: #131a22; --surface-2: #1b242e; --fg: #e5ecf3; --muted: #8d9cad;
  --line: #2a3644; --accent: #6ea8ff; --accent-fg: #06101d; --route: #ff5fcf;
  --ok: #4fd683; --warn: #ffbf47; --alert: #ff6b6b;
  --ecran: #0a1016; --ecran-2: #121b24; --ecran-fg: #e9f1f8; --ecran-lbl: #8094a9; --ecran-cyan: #00898a;
  --ecran-magenta: #ff62d4; --ecran-vert: #52e083; --ecran-ambre: #ffc04a; --ecran-rouge: #ff5a5a; --ecran-bord: transparent;
  color-scheme: dark;
}
:root[data-theme="ciel"] {
  --bg: #d4eafb; --surface: #f3faff; --surface-2: #c2e1f7; --fg: #0b2540; --muted: #3f5f7d;
  --line: #9cc6e6; --accent: #0a66b8; --accent-fg: #ffffff; --route: #b5137f;
  --ecran: #9fd3f5; --ecran-2: #eaf6ff; --ecran-fg: #08233d; --ecran-lbl: #3a5c7c;
  --ecran-ambre: #a05f00; --ecran-bord: #7fb9e3;
  color-scheme: light;
}
:root.nuit { --carte-filtre: brightness(.55) contrast(1.1) saturate(.8); }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
/* Clavier ouvert : l'appli est collée à la zone visible au-dessus du clavier (iOS fait défiler la page) */
#app.saisie { position: fixed; left: 0; right: 0; top: var(--haut-visible, 0px); height: var(--hauteur-visible, 100%); }
body {
  background: var(--bg); color: var(--fg); font: 15px/1.4 var(--f-ui);
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.num { font-family: var(--f-num); font-variant-numeric: tabular-nums; }

#app {
  height: 100%; display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "bandeau" "carte" "panneau" "onglets";
}

/* ---------- Bandeau d'instruments ---------- */
.bandeau {
  grid-area: bandeau; background: var(--ecran); color: var(--ecran-fg); border-bottom: 1px solid var(--ecran-bord, transparent);
  padding: calc(env(safe-area-inset-top, 0px) + 6px) max(10px, env(safe-area-inset-right, 0px)) 6px max(10px, env(safe-area-inset-left, 0px));
  display: grid; gap: 4px; z-index: 1000; position: relative;
}
.ligne { display: flex; gap: 4px; align-items: stretch; min-width: 0; }
.instr {
  flex: 1 1 0; min-width: 0; background: var(--ecran-2); border-radius: 6px;
  padding: 3px 8px 4px; display: grid; grid-template-columns: 1fr auto; align-items: baseline;
}
.instr .lbl { grid-column: 1 / -1; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ecran-lbl); white-space: nowrap; }
.instr .val { font: 700 26px/1.05 var(--f-num); font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; }
.instr .u { font-size: 11px; color: var(--ecran-lbl); padding-left: 3px; }
.instr.wp { flex: 1.35 1 0; }
/* Logo CAPVFR en filigrane dans la case Vs */
.instr.vs { background: var(--ecran-2) url(icons/filigrane-bandeau.svg) no-repeat center 62% / auto 58%; }
.instr.wp.en-direct { flex: 2 1 0; }
.instr.wp .val { color: var(--ecran-magenta); font-family: var(--f-ui); font-size: 22px; text-overflow: ellipsis; }
.nav .val { color: var(--ecran-magenta); font-size: 21px; }
.nav .instr { padding-block: 2px 3px; }
.instr.ecart .val { color: var(--ecran-cyan); }
.instr.ecart.loin .val { color: var(--ecran-loin, var(--ecran-ambre)); }
.gps {
  flex: 0 0 auto; border: 0; border-radius: 6px; background: var(--ecran-2); color: var(--ecran-lbl);
  padding: 2px 8px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; min-width: 64px;
  display: grid; place-items: center; text-align: center; line-height: 1.15; cursor: pointer;
}
.gps b { display: block; font: 700 13px var(--f-num); text-transform: none; font-variant-numeric: tabular-nums; }
.gps.ok b { color: var(--ecran-vert); }
.gps.moyen b { color: var(--ecran-ambre); }
.gps.perdu b, .gps.refus b { color: var(--ecran-rouge); }
.gps.simu b { color: var(--ecran-cyan); }
.direct-tag { color: var(--ecran-ambre); font-size: 10px; letter-spacing: .08em; margin-left: 4px; }
/* Annuler le direct : à droite de la destination, assez grand pour un doigt */
.annuler-direct {
  align-self: center; width: 28px; height: 28px; margin-left: 4px; border-radius: 50%; padding: 0;
  border: 1.5px solid var(--ecran-ambre); background: transparent; color: var(--ecran-ambre);
  font: 700 15px/1 var(--f-ui); display: grid; place-items: center; cursor: pointer; position: relative;
}
.annuler-direct::after { content: ''; position: absolute; inset: -8px; }
/* Croix dessinée (le caractère ✕ change de taille et de place selon la police d'iOS) */
.croix { display: block; width: 12px; height: 12px; flex: none; }
.annuler-direct .croix { width: 13px; height: 13px; }

@media (max-width: 420px) {
  .instr .val { font-size: 22px; }
  .nav .val { font-size: 18px; }
  .instr.wp .val { font-size: 18px; }
  .instr { padding-inline: 6px; }
  .instr .lbl { font-size: 9.5px; }
}

/* ---------- Carte ---------- */
#carte { grid-area: carte; position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: var(--surface-2); }
.leaflet-tile-pane { filter: var(--carte-filtre); }
/* Évite les fines lignes claires entre tuiles dans Chrome. */
.leaflet-container img.leaflet-tile { mix-blend-mode: plus-lighter; }
.leaflet-container { font-family: var(--f-ui); }
/* Appui long sur la carte : pas de sélection de texte ni de menu « Copier / Rechercher » d'iOS,
   y compris dans la fiche du point qui s'ouvre sous le doigt */
#carte, #carte *, .alertes, .alertes * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.leaflet-control-attribution { font-size: 10px; }
.controles-carte { position: absolute; inset: 0; z-index: 700; pointer-events: none; background: transparent; overflow: visible; }
#map { transition: transform .6s linear; }
.etiquette > span, .pt-route svg { display: inline-block; rotate: var(--contre, 0deg); }
.etiquette > span { transform-origin: -9px 7px; }
.bc svg { transition: rotate .6s linear; }
.controles-carte .leaflet-control-attribution { display: none; } /* dans la fenêtre Légende */
.bouton-credits {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  font: italic 700 14px/1 Georgia, serif; display: grid; place-items: center; padding: 0; cursor: pointer; box-shadow: 0 1px 4px rgb(0 0 0 / .25);
}
.boutons-carte {
  position: absolute; z-index: 800; right: max(10px, env(safe-area-inset-right, 0px)); top: 10px;
  display: grid; gap: 8px;
}
.bc {
  width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--fg); display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 2px 8px rgb(0 0 0 / .18);
}
.bc svg { width: 24px; height: 24px; }
.bc.actif { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.bandeau-edition {
  position: absolute; z-index: 800; left: 50%; transform: translateX(-50%); bottom: 12px;
  background: var(--route); color: #fff; border-radius: 999px; padding: 6px 6px 6px 16px;
  display: flex; gap: 10px; align-items: center; box-shadow: 0 4px 14px rgb(0 0 0 / .25); white-space: nowrap;
  max-width: calc(100% - 24px);
}
.bandeau-edition span { overflow: hidden; text-overflow: ellipsis; }
.bandeau-edition button { border: 0; background: #fff; color: #7a0c56; border-radius: 999px; padding: 6px 14px; font-weight: 700; cursor: pointer; }
.toast {
  /* Hors de la carte : visible aussi dans les onglets et par-dessus les fenêtres */
  position: fixed; z-index: 7000; left: 50%; top: var(--haut-toast, 12px); transform: translateX(-50%);
  background: #0a1016; color: #e9f1f8; padding: 10px 16px; border-radius: 10px;
  box-shadow: 0 6px 20px rgb(0 0 0 / .3); max-width: calc(100% - 90px); text-align: center; font-size: 15px;
}
.avion { filter: drop-shadow(0 1px 2px rgb(0 0 0 / .6)); }
.avion svg { display: block; transition: transform .4s linear; }
@media (prefers-reduced-motion: reduce) { .avion svg { transition: none; } }
.etiquette {
  background: transparent; border: 0; box-shadow: none; padding: 0; color: #12202e;
  font: 700 11px var(--f-ui); text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff;
}
.etiquette::before { display: none; }
.etiquette.wp { color: #7a0c56; font-size: 12px; }
.etiquette.balise { color: #1c4f8f; font-weight: 400; }
/* Rm et longueur au milieu des branches de la route */
.etq-branche { background: none; border: 0; }
.etq-branche > span { display: inline-block; translate: -50% -50%; rotate: var(--contre, 0deg); white-space: nowrap; padding: 1px 5px; border-radius: 6px;
  background: rgb(255 255 255 / .85); border: 1px solid var(--route); color: #7a0c56; font: 400 10.5px var(--f-num); font-variant-numeric: tabular-nums; }
.etq-branche b { font-weight: 700; }
.fleche-branche { background: none; border: 0; }
.fleche-branche svg { display: block; opacity: .5; filter: drop-shadow(0 0 1.5px rgb(0 0 0 / .35)); }

.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--fg); }
.leaflet-popup-content { margin: 12px 14px; min-width: 220px; font-size: 14px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.pop h3 { margin: 0 0 2px; font-size: 16px; }
.pop .sous { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.pop .actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* ---------- Panneau ---------- */
.panneau {
  grid-area: panneau; border-top: 1px solid var(--line);
  /* logo en filigrane, fixe pendant le défilement du contenu */
  background: var(--surface) url(icons/filigrane.svg) no-repeat center 58% / min(88%, 520px) auto;
  max-height: 52vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-block: 14px 18px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
/* Téléphone : un onglet ouvert prend tout l'écran (ni carte ni bandeau), la carte revient avec « Carte » */
@media not all and (min-width: 900px) and (min-height: 500px) {
  #app:not(.ferme) { grid-template-rows: auto 0 minmax(0, 1fr) auto; }
  #app:not(.ferme) #carte { visibility: hidden; }
  #app:not(.ferme) .panneau { max-height: none; padding-top: calc(env(safe-area-inset-top, 0px) + 14px); }
  #app:not(.ferme) .bandeau { display: none; }
  /* ajout de points sur la carte : la carte prend la place du bandeau d'instruments */
  #app.ajout .bandeau { display: none; }
}
/* Peu de hauteur (clavier ouvert, paysage) : l'onglet ouvert prend tout l'espace */
#app.ecran-bas:not(.ferme) { display: flex; flex-direction: column; }
#app.ecran-bas:not(.ferme) > :not(.panneau):not(.onglets) { display: none; }
#app.ecran-bas:not(.ferme) .panneau { flex: 1 1 auto; min-height: 0; max-height: none; border: 0; padding-top: calc(env(safe-area-inset-top, 0px) + 12px); }
#app.ecran-bas.saisie:not(.ferme) .onglets { display: none; }
#app.ecran-bas:not(.ferme) .onglets { position: static; width: auto; margin: 0; border-radius: 0; box-shadow: none; }
.panneau section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.panneau h2 { margin: 0; font-size: 18px; text-wrap: balance; }
.panneau h3 { margin: 4px 0 0; font-size: 13px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.panneau p { margin: 0; }
.aide { color: var(--muted); font-size: 13.5px; max-width: 62ch; }
.onglets {
  grid-area: onglets; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface);
  border-top: 1px solid var(--line); z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.onglets button {
  border: 0; background: none; padding: 8px 2px 7px; display: grid; justify-items: center; gap: 2px;
  font-size: 11.5px; color: var(--muted); cursor: pointer; min-height: 54px;
}
.onglets svg { width: 22px; height: 22px; }
.onglets button[aria-selected="true"] { color: var(--accent); font-weight: 700; }

@media (min-width: 900px) and (min-height: 500px) {
  #app {
    grid-template-columns: 400px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "bandeau bandeau" "panneau carte" "onglets carte";
  }
  #app.ferme { grid-template-columns: 0 minmax(0, 1fr); }
  #app.ferme .panneau { padding: 0; border: 0; }
  .panneau { max-height: none; border-top: 0; border-right: 1px solid var(--line); }
  .instr .val { font-size: 32px; }
  .nav .val, .instr.wp .val { font-size: 26px; }
  .onglets { border-right: 1px solid var(--line); }
  #app.ferme .onglets { grid-area: carte; align-self: end; justify-self: start; z-index: 800; width: 400px; margin: 0 0 12px 12px; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 4px 16px rgb(0 0 0 / .2); }
}

/* ---------- Composants de formulaire ---------- */
.btn {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); border-radius: var(--r);
  padding: 9px 14px; cursor: pointer; font-weight: 700; font-size: 14px; min-height: 42px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
a.btn { text-decoration: none; }
.btn.prim { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.route { background: var(--route); border-color: var(--route); color: #fff; }
.btn.danger { color: var(--alert); }
.btn.petit { min-height: 34px; padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn:focus-visible, .onglets button:focus-visible, .bc:focus-visible, .ico:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.rangee { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.champs { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.champ { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.champ input, .champ select, .champ textarea, .recherche {
  width: 100%; border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  border-radius: 8px; padding: 9px 10px; font-size: 16px; min-height: 42px;
}
.champ input { font-family: var(--f-num); }
.champ input:focus, .recherche:focus, .champ select:focus, .champ textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.bascule { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.bascule span small { display: block; color: var(--muted); font-size: 12.5px; }
.bascule input { width: 22px; height: 22px; accent-color: var(--accent); flex: 0 0 auto; }
.choix { display: grid; gap: 6px; }
.choix label { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.choix input { accent-color: var(--accent); width: 18px; height: 18px; }
.ico {
  border: 0; background: none; color: var(--muted); width: 36px; height: 36px; border-radius: 8px;
  display: grid; place-items: center; cursor: pointer; flex: 0 0 auto;
}
.ico:hover { background: var(--surface-2); color: var(--fg); }
.ico svg { width: 18px; height: 18px; }
.ico:disabled { opacity: .3; cursor: default; }

/* ---------- Route ---------- */
.liste { list-style: none; margin: 0; padding: 0; display: grid; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.liste li { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; border-top: 1px solid var(--line); min-width: 0; }
.liste li:first-child { border-top: 0; }
.liste li.actif { background: color-mix(in srgb, var(--route) 12%, transparent); }
.liste .rang { font: 700 12px var(--f-num); color: var(--route); width: 22px; flex: 0 0 auto; }
.liste .nom { flex: 1 1 auto; min-width: 0; }
.liste .nom input { width: 100%; border: 0; background: none; padding: 4px 0; font-weight: 700; font-size: 15px; }
.liste .nom input:focus { outline: none; border-bottom: 2px solid var(--accent); }
.liste .nom small { display: block; color: var(--muted); font-size: 11.5px; font-family: var(--f-num); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vide { border: 1px dashed var(--line); border-radius: var(--r); padding: 16px; color: var(--muted); font-size: 14px; }

.log { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
.log table { border-collapse: collapse; width: 100%; font-size: 13px; min-width: 560px; }
.log th, .log td { padding: 7px 8px; text-align: right; white-space: nowrap; border-top: 1px solid var(--line); }
.log th { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; background: var(--surface-2); border-top: 0; }
.log th:first-child, .log td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
.log th:first-child { background: var(--surface-2); }
.log td { font-family: var(--f-num); }
.log td:first-child { font-family: var(--f-ui); font-weight: 700; }
.log td.cm { color: var(--route); font-weight: 700; }
.log tfoot td { font-weight: 700; background: var(--surface-2); }
.log tfoot td:first-child { background: var(--surface-2); }
.log tr.actif td { background: color-mix(in srgb, var(--route) 10%, var(--surface)); }
.repere { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.repere b { color: var(--fg); font-family: var(--f-num); }
.alerte { color: var(--alert); font-weight: 700; font-size: 13.5px; }

/* ---------- Terrains ---------- */
.terrains { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.terrain { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; }
.terrain .code { font: 700 17px var(--f-num); font-variant-numeric: tabular-nums; }
.terrain .code small { font: 400 13px var(--f-ui); color: var(--muted); margin-left: 6px; }
.terrain .det { grid-column: 1 / 2; color: var(--muted); font-size: 12.5px; }
.terrain .det .fq { color: var(--fg); font-family: var(--f-num); }
.terrain .vers { text-align: right; font: 700 16px var(--f-num); white-space: nowrap; }
.terrain .vers small { display: block; font: 400 12px var(--f-num); color: var(--muted); }
.terrain .actions { grid-column: 1 / -1; display: flex; gap: 6px; margin-top: 4px; }
.pastille { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; border-radius: 4px; padding: 1px 5px; border: 1px solid currentColor; vertical-align: 1px; }

/* ---------- Vol ---------- */
.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.chiffre { background: var(--surface-2); border-radius: var(--r); padding: 10px 12px; }
.chiffre span { display: block; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.chiffre b { font: 700 21px var(--f-num); }
.rec { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--alert); animation: clignote 1.4s infinite; }
@keyframes clignote { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .rec { animation: none; } }

/* ---------- Avertissement ---------- */
.modal {
  position: fixed; inset: 0; z-index: 5000; background: rgb(5 10 15 / .7); display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.modal > div { background: var(--surface); color: var(--fg); border-radius: 14px; max-width: 480px; padding: 22px; display: grid; gap: 12px; max-height: 100%; overflow-y: auto; }
.modal h2 { margin: 0; font-size: 20px; }
.modal ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14.5px; }

/* Fenêtre météo : panneau bleu de bulletin, même aspect dans les deux thèmes. */
.modal.meteo { place-items: start center; overflow-y: auto; }
.modal.meteo > div.mt {
  --mt-fond: #0d58a6; --mt-fond-2: #0a4a8d; --mt-ligne: #2f6cb5; --mt-fg: #ffffff; --mt-doux: #c3d8f1;
  --mt-bon: #2aa84a; --mt-moyen: #2f7fd6; --mt-mauvais: #d23b3b; --mt-critique: #b0279b; --mt-neutre: #0a4a8d;
  background: var(--mt-fond); color: var(--mt-fg); max-width: 960px; width: 100%; max-height: none; overflow: visible;
  position: relative; gap: 14px; padding: 18px 16px 20px; color-scheme: dark;
}
.mt h2 { font-size: 18px; margin: 0; padding-right: 40px; text-wrap: balance; }
.mt h3 { font-size: 16px; margin: 6px 0 4px; }
.mt p { margin: 0; line-height: 1.5; }
.mt a { color: #ffffff; }
.mt-fermer { position: absolute; top: 6px; right: 6px; z-index: 1; }
.mt-fermer:focus-visible, .mt-piste:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }
.mt-tete { display: grid; gap: 8px; }
.mt-quand { display: flex; flex-wrap: wrap; gap: 6px; font-family: var(--f-num); font-size: 13px; }
.mt-quand span { background: var(--mt-fond-2); border-radius: 6px; padding: 4px 8px; }
.mt-quand .vieux { background: var(--mt-mauvais); }
.mt-attente, .mt-proche { background: var(--mt-fond-2); border-radius: 8px; padding: 10px 12px; }
.mt-tuiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 720px) { .mt-tuiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.mt-tuile { border-radius: 8px; overflow: hidden; background: var(--mt-fond-2); text-align: center; }
.mt-haut { font: 700 22px/1.2 var(--f-num); padding: 8px 4px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.mt-haut small { font-size: 13px; margin-left: 2px; }
.mt-bas { font-size: 12.5px; padding: 6px 4px 8px; color: var(--mt-doux); }
.mt-tuile.bon .mt-haut { background: var(--mt-bon); }
.mt-tuile.moyen .mt-haut { background: var(--mt-moyen); }
.mt-tuile.mauvais .mt-haut { background: var(--mt-mauvais); }
.mt-tuile.critique .mt-haut { background: var(--mt-critique); }
.mt-ico { width: 30px; height: 22px; }
.mt-deux { display: grid; gap: 14px; }
@media (min-width: 720px) { .mt-deux { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.mt-bloc { display: grid; gap: 10px; align-content: start; min-width: 0; }
.mt-centre { justify-items: center; }
.mt-rose { width: 100%; max-width: 260px; }
.mt-rose text { font-family: var(--f-num); text-anchor: middle; dominant-baseline: middle; fill: #ffffff; }
.mt-rose .mt-card { font-size: 18px; }
.mt-rose .mt-gr { font-size: 13px; fill: #c3d8f1; }
.mt-rose .mt-qfu { font-size: 9px; font-weight: 700; }
.mt-compo { display: flex; gap: 16px; font-size: 14px; }
.mt-compo b { font-family: var(--f-num); }
.mt-pistes { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.mt-piste { font: 700 14px var(--f-num); min-width: 44px; min-height: 36px; border-radius: 8px; border: 1px solid var(--mt-ligne); background: transparent; color: var(--mt-doux); cursor: pointer; }
.mt-piste.actif { background: #ffffff; color: var(--mt-fond); border-color: #ffffff; }
.mt-nuages { width: 100%; }
.mt-nuages .mt-axe { font: 11px var(--f-num); fill: #c3d8f1; text-anchor: end; }
.mt-nuages .mt-couche { font: 700 10.5px var(--f-num); fill: #ffffff; text-anchor: end; }
.mt-nuages .mt-vide { font-size: 13px; fill: #c3d8f1; text-anchor: middle; }
.mt-brut { margin: 0; background: var(--mt-fond-2); border-radius: 8px; padding: 10px 12px; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
.mt-courbes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px) { .mt-courbes { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mt-courbe { margin: 0; background: var(--mt-fond-2); border-radius: 8px; padding: 8px; display: grid; gap: 4px; }
.mt-courbe svg { width: 100%; height: 60px; }
.mt-courbe figcaption { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--mt-doux); }
.mt-courbe small { font-family: var(--f-num); }
.mt-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mt-table th, .mt-table td { border: 1px solid var(--mt-ligne); padding: 7px 8px; text-align: left; }
.mt-table th { font-weight: 400; color: var(--mt-doux); }
.mt-table td:not(:last-child) { font-family: var(--f-num); white-space: nowrap; }
.mt-table tr.meilleure td { font-weight: 700; }
.mt-table td.alerte { color: #ffb4b4; }
.mt-badge { display: inline-block; background: #10161d; border-radius: 999px; padding: 2px 8px; font-size: 11.5px; font-weight: 700; }
.mt .mt-tend { margin: 0; padding-left: 18px; display: grid; gap: 6px; line-height: 1.5; }
.mt .mt-taf { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mt-taf li { background: var(--mt-fond-2); border-radius: 8px; padding: 8px 10px; display: grid; gap: 4px; }
.mt-per { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.mt-per span { font-weight: 700; }
.mt-per small { color: var(--mt-doux); font-family: var(--f-num); }
.mt-taf code { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-word; }
.mt-note { font-size: 12.5px; color: var(--mt-doux); }

/* Le bandeau a une hauteur fractionnaire : sur écran Retina, les rangées de tuiles tombent entre deux
   pixels et laissent un fin interstice clair. Chaque tuile déborde d'un demi-pixel sur sa voisine
   (et sans le mélange « plus-lighter » de Leaflet, qui éclaircirait ce recouvrement). */
.leaflet-container img.leaflet-tile { mix-blend-mode: normal; width: 256.5px !important; height: 256.5px !important; }

/* Visionneuse VAC : plein écran, pages empilées, défilement dans les deux sens une fois zoomé. */
.modal.vac-fen { padding: 0; place-items: stretch; }
.modal.vac-fen > .vac {
  background: var(--surface); color: var(--fg); border-radius: 0; max-width: none; max-height: none; height: 100%;
  padding: 0; gap: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden;
}
.vac-tete {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding: max(10px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 10px max(12px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.vac-tete h2 { margin: 0; font-size: 17px; }
.vac-tete small { color: var(--muted); font-size: 12.5px; }
.vac-outils { display: flex; gap: 6px; flex-wrap: wrap; }
.vac-outils .btn { min-width: 40px; min-height: 36px; }
.vac-etat { display: inline-block; margin-left: 4px; font-weight: 700; color: var(--muted); }
.vac-etat.ok { color: var(--ok); }
.vac-etat.perimee { color: var(--warn); }
.vac-pages {
  overflow: auto; -webkit-overflow-scrolling: touch; background: var(--surface-2); touch-action: pan-x pan-y;
  padding: 10px max(10px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
}
/* Plus large que l'écran une fois zoomé : défilement dans les deux sens ; sinon centré. */
.vac-contenu { display: flex; flex-direction: column; align-items: center; gap: 10px; width: max-content; min-width: 100%; will-change: transform; }
.vac-page { position: relative; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .25); }
.vac-page canvas { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }
.vac-page canvas.vac-detail { inset: auto; }
.vac-aide { padding: 16px; margin: 0; }
.btn.vac-ok { border-color: var(--ok); color: var(--ok); }
.vac-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.vac-liste li { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.vac-liste li > span:first-child { min-width: 0; }
.vac-liste small { display: block; color: var(--muted); }
.vac-liste small.ok { color: var(--ok); }
.vac-liste small.perimee { color: var(--warn); }
.vac-boutons { display: flex; gap: 6px; flex: 0 0 auto; }

/* VAC posée sur la carte */
.calque-vac { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; background: #fff; }
.leaflet-zoom-anim .calque-vac.leaflet-zoom-animated { transition: transform .25s cubic-bezier(0, 0, .25, 1); }
.vac-choix { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.btn.vac-cale::after { content: " ✈"; font-size: .8em; }
.vac-bandeau {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap; max-width: calc(100vw - 96px);
  background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 10px;
  padding: 5px 6px; box-shadow: 0 2px 8px rgb(0 0 0 / .2); font-size: 13px;
}
.vac-bandeau b { margin: 0 2px; white-space: nowrap; }
.vac-bandeau button {
  font: 700 12.5px var(--f-ui); min-width: 40px; min-height: 36px; padding: 0 6px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--fg);
}
.vac-bandeau button.actif { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.vac-bandeau button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Alertes d'espaces aériens : sous le bandeau d'instruments, au-dessus de la carte */
.alertes {
  position: fixed; z-index: 4000; left: 0; right: 0; top: calc(var(--haut-bandeau, 100px) + 8px);
  display: grid; gap: 8px; padding: 0 max(10px, env(safe-area-inset-right, 0px)) 0 max(10px, env(safe-area-inset-left, 0px));
  pointer-events: none;
}
.alerte {
  pointer-events: auto; position: relative; max-width: 520px; margin: 0 auto; width: 100%;
  border-radius: 12px; padding: 10px 44px 10px 14px; box-shadow: 0 4px 14px rgb(0 0 0 / .35);
  color: #fff; font-size: 14px; line-height: 1.35; display: grid; gap: 3px;
}
.al-radio { background: #1d4f9c; }
.al-interdite { background: #b3202a; }
.al-dangereuse { background: #b25c00; }
.al-ville { background: #f3c400; color: #1a1a1a; }
.al-ville-g { background: #f0901e; }
.al-quand { font-size: 12.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; opacity: .9; }
.al-nom { font-size: 17px; font-weight: 700; }
.al-nom small { font-size: 13px; font-weight: 400; }
.al-det { font-size: 13px; opacity: .92; }
.al-freq { font-size: 15px; margin-top: 2px; }
.al-freq b { font: 700 20px var(--f-num); letter-spacing: .02em; }
.al-fermer {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgb(255 255 255 / .5); background: rgb(255 255 255 / .15); color: #fff; font-size: 14px; cursor: pointer;
}
/* Bouton « ✕ Direct » d'une fiche : annule le direct en cours vers ce point */
.btn.dct-actif { background: transparent; color: #b26a00; border: 1.5px solid #e0a020; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }

/* Fenêtre « Couleurs et épaisseurs » */
.traits { display: grid; gap: 10px; }
.trait { display: grid; grid-template-columns: minmax(0, 1fr) 60px 44px; grid-template-areas: "nom apercu couleur" "ep ep ep" "op op op"; gap: 4px 10px; align-items: center;
  border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; }
.trait-nom { grid-area: nom; font-weight: 600; }
.trait-apercu { grid-area: apercu; width: 60px; height: 14px; }
.trait input[type=color] { grid-area: couleur; width: 44px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; }
.trait-ep { grid-area: ep; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.trait-ep input { flex: 1; accent-color: var(--accent); }
.trait-ep .num { width: 3ch; text-align: right; }
.trait-op { grid-area: op; }
.trait-lbl { width: 6.5em; flex: none; }

/* ---------- Carnet de vols ---------- */
.carnet { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.carnet button { width: 100%; text-align: left; display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); color: var(--fg); font: inherit; cursor: pointer; }
.cv-date { font-size: 12.5px; color: var(--muted); }
.cv-date::first-letter { text-transform: uppercase; }
.cv-titre { font-weight: 700; font-size: 16px; }
.cv-det { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal.carnet-fen { padding: 0; place-items: stretch; }
.modal > .cv-page { background: var(--surface); color: var(--fg); display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 0;
  height: 100%; max-height: none; width: 100%; max-width: 760px; margin: 0 auto; padding: 0; border-radius: 0; overflow: hidden; }
/* une seule zone qui défile : le contenu, sous l'en-tête */
.cv-corps { overscroll-behavior: contain; }
.cv-tete { display: flex; gap: 8px; align-items: center; padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px; border-bottom: 1px solid var(--line); }
.cv-titre-champ { flex: 1; min-width: 0; font: 700 19px var(--f-ui); color: var(--fg); background: transparent; border: 0; border-bottom: 1.5px dashed var(--line); border-radius: 0; padding: 6px 2px; }
.cv-titre-champ:focus { border-bottom: 2px solid var(--accent); outline: none; }
.cv-modifier { min-height: 48px; font-size: 16px; }
.cv-titre-lu { flex: 1; min-width: 0; margin: 0; padding: 6px 2px; font: 700 19px var(--f-ui); overflow-wrap: anywhere; }
.cv-date-lue { margin: 0; color: var(--muted); }
.cv-date-lue::first-letter { text-transform: uppercase; }
.cv-comm-lu { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.cv-actions { display: grid; gap: 10px; }
.cv-valider { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.cv-valider .btn { min-height: 48px; font-size: 16px; }
.cv-corps { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 16px calc(env(safe-area-inset-bottom, 0px) + 20px); display: grid; gap: 14px; align-content: start; }
.cv-corps h3 { margin: 4px 0 0; font-size: 13px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.cv-date-champ { max-width: 220px; }
.cv-carte { height: 300px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); }
.cv-carte.leaflet-container { touch-action: pan-x pan-y; cursor: default; }
.cv-corps textarea { font: inherit; resize: vertical; min-height: 90px; }
.cv-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.cv-photos figure { margin: 0; position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.cv-photos img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.cv-photo-suppr { position: absolute; top: 4px; right: 4px; min-width: 28px; height: 28px; border-radius: 999px; border: 0; background: rgb(0 0 0 / .55); color: #fff; font-size: 13px; padding: 0 8px; cursor: pointer; }
.cv-photo-suppr.confirme { background: #b42318; }
.cv-grande { position: fixed; inset: 0; z-index: 6000; background: rgb(0 0 0 / .92); display: grid; place-items: center; padding: 16px; }
.cv-grande img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cv-grande button { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); right: 12px; color: #fff; }
/* Profil des hauteurs (page d'un vol) : une série, trait fin, grille discrète */
.cv-profil { margin: 0; position: relative; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 8px 2px; }
.cv-profil figcaption { font-size: 13px; color: var(--muted); margin: 0 0 2px 4px; }
.cv-profil svg { display: block; touch-action: pan-y; }
.pf-grille { stroke: var(--line); stroke-width: 1; }
.pf-axe { fill: var(--muted); font: 11px var(--f-num); font-variant-numeric: tabular-nums; }
.pf-ligne { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pf-aire { fill: var(--accent); opacity: .12; }
.pf-repere { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.pf-point { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.pf-bulle { position: absolute; top: 30px; transform: translateX(-50%); background: var(--surface); color: var(--fg); border: 1px solid var(--line);
  border-radius: 8px; padding: 3px 8px; font-size: 13px; white-space: nowrap; box-shadow: 0 2px 8px rgb(0 0 0 / .15); pointer-events: none; }
.pf-bulle b { font-family: var(--f-num); }
.cv-photos > .aide { grid-column: 1 / -1; margin: 0; }
/* Couper la trace (modification d'un vol) */
.cv-coupe { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.cv-coupe h3 { margin: 0; }
.cv-curseur { display: grid; grid-template-columns: 4.5em 4.5em minmax(0, 1fr); align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.cv-curseur b { color: var(--fg); font-family: var(--f-num); }
.cv-curseur input { width: 100%; accent-color: var(--accent); min-height: 32px; }
.pf-hors { fill: var(--surface-2); opacity: .85; }

/* Enregistrement de la trace : bouton de magnétoscope (● enregistrer, ■ arrêter) */
.magneto { display: flex; align-items: center; gap: 14px; }
.magneto-bouton { flex: none; width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--line); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 2px 8px rgb(0 0 0 / .15); padding: 0; }
.magneto-signe { width: 26px; height: 26px; border-radius: 50%; background: #d92d20; transition: border-radius .15s, width .15s, height .15s; }
.magneto-bouton.en-cours { border-color: #d92d20; animation: rec-anneau 1.6s infinite; }
.magneto-bouton.en-cours .magneto-signe { width: 22px; height: 22px; border-radius: 4px; background: var(--fg); }
@keyframes rec-anneau { 50% { border-color: color-mix(in srgb, #d92d20 30%, var(--line)); } }
@media (prefers-reduced-motion: reduce) { .magneto-bouton.en-cours { animation: none; } }
.magneto-texte { display: grid; gap: 2px; min-width: 0; }
.magneto-texte b { font-size: 16px; }
.magneto-texte span { font-size: 13.5px; color: var(--muted); }

/* Fenêtre de confirmation */
#confirmer > div { max-width: 400px; }
#confirmer p { margin: 0; color: var(--muted); }
.cf-boutons { display: grid; gap: 8px; margin-top: 4px; }
.cf-boutons .btn { min-height: 46px; font-size: 15.5px; }

/* ---------- Log de nav à imprimer (lognav.js) : feuille A4 sur le modèle papier ---------- */
.lognav-fen { position: fixed; inset: 0; z-index: 5500; background: var(--surface-2); display: grid; grid-template-rows: auto minmax(0, 1fr); }
.ln-barre { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px; background: var(--surface); border-bottom: 1px solid var(--line); }
.ln-barre b { font-size: 17px; }
.ln-aide { flex: 1 1 220px; font-size: 13px; color: var(--muted); }
.ln-defile { overflow: auto; -webkit-overflow-scrolling: touch; padding: 8px; }
.ln-echelle { transform-origin: top left; width: max-content; }
.ln-feuille { width: 190mm; background: #fff; color: #000; font: 10.5pt/1.25 Calibri, Carlito, "Segoe UI", Arial, sans-serif; padding: 0; margin: 0 0 12px;
  border: 1px solid #000; box-shadow: 0 2px 10px rgb(0 0 0 / .2); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ln-feuille b { font-weight: 700; }
.ln-num { font-family: var(--f-num); font-weight: 700; color: #0b3a8a; }
.ln-haut { display: grid; grid-template-columns: 1fr 26mm 31mm 27mm; border-bottom: 1px solid #000; }
.ln-boite { padding: 2mm 2.5mm; }
.ln-haut .ln-boite + .ln-boite { border-left: 1px solid #000; }
.ln-boite > b { text-decoration: underline; display: block; margin-bottom: 1.5mm; }
.ln-boite ul { margin: 0; padding-left: 4mm; font-size: 9.5pt; }
.ln-boite p { margin: 0 0 2mm; font-size: 9.5pt; }
.ln-tirets { border-top: 1px dashed #000; margin-top: 1mm !important; padding-top: 1mm; }
.ln-dest { font-size: 9.5pt; color: #0b3a8a; font-weight: 700; margin: -0.5mm 0 1.5mm; }
.ln-notes { min-height: 40mm; border-bottom: 1px solid #000; }
.ln-notes p { color: #0b3a8a; font-weight: 600; }
.ln-grille { display: grid; grid-template-columns: 42mm 21mm 19mm 32mm 18mm 18mm 21mm 19mm; }
.ln-grille > * { box-sizing: border-box; }
.ln-t { grid-row: 1; border-right: 1px solid #000; border-bottom: 1px solid #000; display: grid; place-items: center; font-size: 13pt; position: relative; }
.ln-t:nth-child(1) { grid-column: 1; } .ln-t:nth-child(2) { grid-column: 2; } .ln-t:nth-child(3) { grid-column: 3; } .ln-t:nth-child(4) { grid-column: 4; }
.ln-t:nth-child(5) { grid-column: 5; } .ln-t:nth-child(6) { grid-column: 6; }
.ln-fuelt { grid-column: 7 / span 2; display: grid; grid-template-columns: 21mm 19mm; grid-template-rows: auto 1fr; border-right: 0; }
.ln-fuelt span:first-child { grid-column: 1 / -1; text-align: center; border-bottom: 1px solid #000; width: 100%; }
.ln-fuelt span:nth-child(2) { font-size: 9.5pt; text-align: center; border-right: 1px solid #000; height: 100%; display: grid; place-items: center; line-height: 1.05; }
.ln-fuelt span:nth-child(3) { font-size: 11pt; display: grid; place-items: center; height: 100%; }
.ln-c { border-right: 1px solid #000; border-bottom: 1px solid #000; display: flex; align-items: center; padding: 0 2mm; min-height: 0; }
.ln-wpt { grid-column: 1; font-weight: 700; font-size: 12pt; }

.ln-bleu { background: #c5d9f1; }
.ln-num.ln-c, .ln-c.ln-num { justify-content: center; }
.ln-branche { grid-column: 2 / span 3; display: grid; grid-template-columns: 21mm 19mm 32mm; }
.ln-diag { position: relative; padding: 0; display: block;
  background: linear-gradient(to bottom right, transparent calc(50% - .6px), #000 calc(50% - .6px), #000 calc(50% + .6px), transparent calc(50% + .6px)); }
.ln-diag .ln-h, .ln-diag .ln-b { position: absolute; font-size: 10.5pt; }
.ln-diag .ln-h { top: 1mm; left: 1.5mm; }
.ln-diag .ln-b { bottom: 1mm; right: 1.5mm; }
.ln-branche .ln-diag .ln-h, .ln-branche .ln-diag .ln-b { font-family: var(--f-num); font-weight: 700; color: #0b3a8a; font-size: 11pt; }
.ln-t.ln-diag { display: block; }
.ln-noir { grid-column: 2 / span 3; background: #000; }
.ln-pied { border-top: 1px solid #000; padding: 3mm 4mm 2mm; }
.ln-pinnule { text-align: center; font-weight: 700; font-size: 13pt; margin: 0 0 4mm; }
.ln-totaux { display: flex; justify-content: space-between; font-size: 10pt; }
@media print {
  @page { size: A4; margin: 10mm; }
  html, body { overflow: visible !important; height: auto !important; background: #fff !important; }
  body.impression-log > *:not(#lognav) { display: none !important; }
  body.impression-log #lognav { position: static; display: block; background: #fff; }
  .ln-barre { display: none !important; }
  .ln-defile { overflow: visible; padding: 0; }
  .ln-echelle { transform: none !important; height: auto !important; }
  .ln-feuille { box-shadow: none; margin: 0; break-after: page; }
  .ln-feuille:last-child { break-after: auto; }
}
.ln-depart { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.ln-depart input { font: 600 16px var(--f-num); padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }

/* Route : actions rares dans le menu ⋮ */
.kebab { position: relative; flex: none; }
.kebab-bouton { width: 46px; padding: 0; display: grid; place-items: center; }
.kebab-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 200px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 8px 24px rgb(0 0 0 / .18); padding: 6px; display: grid; }
.kebab-menu > button, .kebab-menu > label { font: inherit; font-size: 15.5px; text-align: left; background: none; border: 0; border-radius: 8px; padding: 12px 12px; color: var(--fg); cursor: pointer; }
.kebab-menu > :hover { background: var(--surface-2); }
.kebab-menu .danger { color: var(--alert); }

/* Log de la route : altitude prévue (saisie) et altitude de sécurité (calculée) */
.log td.alt { padding: 2px 4px; }
.log td.alt input { width: 5.2em; font: inherit; font-family: var(--f-num); padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); text-align: right; }
.log td.zs { color: var(--muted); font-family: var(--f-num); }

/* ---------- Recherche (recherche.js) : en haut de l'écran, pour laisser la place au clavier ---------- */
.modal.rc-fen { place-items: start center; height: var(--hauteur-visible, 100dvh); top: var(--haut-visible, 0px); bottom: auto; }
.modal > div.rc-panneau { width: min(560px, 100%); max-width: none; padding: 12px; gap: 10px; grid-template-rows: auto 1fr; max-height: 100%; overflow: hidden; }
.rc-barre { display: flex; gap: 8px; align-items: center; }
#rc-champ { flex: 1; min-width: 0; font: inherit; font-size: 18px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
.rc-fermer { width: 48px; height: 48px; display: grid; place-items: center; flex: none; }
.rc-liste { list-style: none; margin: 0; padding: 0 !important; display: grid; gap: 8px; overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; }
.rc-res { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; gap: 5px; }
.rc-tete { font-size: 15.5px; }
.rc-badge { display: inline-block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 2px 6px; border-radius: 6px; background: var(--accent); color: var(--accent-fg); margin-right: 6px; vertical-align: 1px; }
.rc-det { font-size: 14px; opacity: .85; }
.rc-det.rc-fort { font-size: 16.5px; opacity: 1; }
.rc-res .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.rc-aide { font-size: 14px; opacity: .8; padding: 4px 2px; }
.tr-sous { margin: 4px 0 0; font-size: 16px; }
.trait.ecriture { grid-template-areas: "nom apercu couleur"; }
.ecr-apercu { grid-area: apercu; background: var(--ecran); border-radius: 6px; padding: 3px 6px; font: 700 14px/1.2 var(--f-num); text-align: center; white-space: nowrap; overflow: hidden; }
.trait.ecriture .ecr-apercu { min-width: 0; }
.r-theme { flex: none; width: auto; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); }

/* ---------- Légende de la carte SIA (bouton i) ---------- */
.modal > div.lg-fen { width: min(640px, 100%); max-width: none; padding: 0; gap: 0; grid-template-rows: auto 1fr; overflow: hidden; height: 100%; }
.lg-tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--line); }
.lg-tete h2 { font-size: 18px; }
.lg-fermer { width: 48px; height: 48px; display: grid; place-items: center; }
.lg-corps { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 14px 20px; display: grid; grid-auto-rows: max-content; gap: 12px; align-content: start; min-height: 0; }
.lg-corps h3 { margin: 8px 0 0; font-size: 16px; }
.lg-panneau { background: #fff; border-radius: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; cursor: zoom-in; }
.lg-panneau img { display: block; width: 100%; height: auto; }
.lg-panneau.zoom { cursor: zoom-out; }
.lg-panneau.zoom img { width: 250%; max-width: none; }
.lg-sources a { color: inherit; }

/* Fenêtre Thème et couleurs : croix rouge de fermeture en haut à droite, toujours visible */
.tr-tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: -22px; z-index: 2;
  background: var(--surface); margin: -22px -22px 0; padding: 12px 10px 8px 22px; border-bottom: 1px solid var(--line); }
/* Bouton de fermeture des fenêtres : croix blanche dans un carré rouge aux coins arrondis */
.croix-rouge { width: 36px; height: 36px; margin: 4px; flex: none; display: grid; place-items: center; padding: 0; border: 0; cursor: pointer;
  color: #fff; background: #ec4a4f; border-radius: 9px; box-shadow: 0 1px 3px rgb(0 0 0 / .3); }
.croix-rouge:active { background: #c9343a; }
.croix-rouge svg { display: block; width: 18px; height: 18px; }

/* Logo CAPVFR (texte foncé) : sur une plaque blanche, lisible dans tous les thèmes */
.logo-app { display: block; width: 216px; max-width: 70%; height: auto; background: #fff; border-radius: 12px; padding: 4px 8px; }
#avertissement .logo-app { margin: 0 auto 4px; }
