:root {
  --navy: #0a2144; --sky: #1a73d9; --ok: #1f9e57; --warn: #ed8c14; --bad: #db3333;
  --crew: #6b5cf5; --pax: #b35cee; --bag: #10a39e; --fuel: #fa8514; --balance: #219e66; --takeoff: #059ecc;
  --landing: #6654eb; --speeds: #ed4577;
  --bg: #eef2f8; --card: #fff; --text: #14213a; --muted: #62708a; --line: #dde4ef; --field: #f3f6fb;
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #060d1c; --card: #101a30; --text: #eaf0fb; --muted: #94a3bd; --line: #1f2d4a; --field: #17233e; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; padding-bottom: env(safe-area-inset-bottom); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--sky); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.hero { background: linear-gradient(135deg, var(--navy), var(--sky)); color: #fff; border-radius: 24px; padding: 22px; box-shadow: 0 12px 30px #1a73d933; }
.hero small { opacity: .85; font-weight: 600; letter-spacing: .02em; }
.hero h1 { margin: 4px 0 6px; font-size: 2rem; line-height: 1.1; }
.hero p { margin: 0; opacity: .9; }
.hero .club { margin-top: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .9rem; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: #ffffff26; border: 0; border-radius: 99px; padding: 4px 12px; color: #fff; font-weight: 600; font-size: .85rem; }
h2.group { margin: 26px 4px 10px; font-size: 1.15rem; display: flex; align-items: center; gap: 8px; }
.count { background: var(--sky); color: #fff; border-radius: 99px; padding: 1px 9px; font-size: .75rem; font-weight: 700; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.ac { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--accent, var(--sky)); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: inherit; }
.ac:hover { box-shadow: 0 6px 20px #0a21441a; }
.ac .reg { font-size: 1.35rem; font-weight: 800; }
.ac .meta { color: var(--muted); font-size: .9rem; }
.ac .chips { display: flex; gap: 12px; margin-top: 4px; font-weight: 600; font-size: .9rem; }
.ac .chips .m { color: var(--crew); } .ac .chips .f { color: var(--fuel); }
.ac .go { margin-left: auto; color: var(--muted); font-size: 1.4rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 14px; }
.card h3 { margin: 0 0 10px; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.top { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
.back { background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 8px 14px; text-decoration: none; color: var(--text); font-weight: 600; }
.title { font-size: 1.5rem; font-weight: 800; line-height: 1.1; } .title small { display: block; font-size: .85rem; font-weight: 500; color: var(--muted); }
.tabs { position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; padding: 6px; background: var(--card); border: 1.5px solid var(--fuel); border-radius: 21px; margin: 6px 0 4px; box-shadow: 0 6px 16px #0a214414; }
.tab { flex: 1; text-align: center; text-decoration: none; color: var(--text); border-radius: 16px; padding: 9px 4px; font-weight: 700; font-size: .95rem; }
.tab small { display: block; font-weight: 500; font-size: .72rem; color: var(--muted); }
.tab.on { background: var(--c); color: #fff; } .tab.on small { color: #ffffffe6; }
.status { border-radius: var(--radius); padding: 16px; color: #fff; display: flex; gap: 14px; align-items: center; }
.status.ok { background: var(--ok); } .status.warning { background: var(--warn); } .status.outOfLimits { background: var(--bad); }
.status .big { font-size: 1.5rem; font-weight: 800; line-height: 1.15; }
.status .sub { opacity: .92; font-size: .92rem; }
.issues { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.issues li { border-radius: 12px; padding: 10px 12px; background: #db333314; border: 1px solid #db333344; }
.issues li.warning { background: #ed8c1414; border-color: #ed8c1455; }
.issues b { display: block; } .issues span { color: var(--muted); font-size: .9rem; }
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.field label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field .in { display: flex; align-items: center; background: var(--field); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.field input, .field select { flex: 1; min-width: 0; background: transparent; border: 0; padding: 10px 12px; font-size: 1.1rem; font-weight: 700; outline: none; }
.field .u { padding-right: 12px; color: var(--muted); font-weight: 600; }
.field .in:focus-within { border-color: var(--sky); box-shadow: 0 0 0 3px #1a73d933; }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: 3px; }
.field.bad .in { border-color: var(--bad); }
.tag { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 6px; text-align: right; border-bottom: 1px solid var(--line); } th:first-child, td:first-child { text-align: left; }
th { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
tr.total td { font-weight: 800; border-bottom: 0; }
.two { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.chart { width: 100%; height: auto; background: var(--field); border-radius: 14px; }
.chart .grid { stroke: var(--line); stroke-width: 1; } .chart .tick { fill: var(--muted); font-size: 15px; } .chart .axis { fill: var(--muted); font-size: 16px; font-weight: 600; }
.chart .env { stroke-width: 2.5; } .chart .env.ok { fill: #1f9e5726; stroke: var(--ok); } .chart .env.bad { fill: #db333322; stroke: var(--bad); }
.chart .path { stroke: var(--sky); stroke-width: 2; fill: none; } .chart .path.arr { stroke: var(--fuel); stroke-dasharray: 5 4; }
.legend { list-style: none; margin: 10px 0 0; padding: 0; display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: .88rem; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.metric { background: var(--field); border-radius: 14px; padding: 12px; }
.metric .v { font-size: 1.6rem; font-weight: 800; line-height: 1.1; } .metric .l { font-size: .82rem; color: var(--muted); font-weight: 600; }
.metrics { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.seg { display: inline-flex; background: var(--field); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 9px 16px; font-weight: 700; } .seg button.on { background: var(--sky); color: #fff; }
.note { color: var(--muted); font-size: .88rem; margin: 8px 0 0; } .note.warn { color: var(--warn); font-weight: 600; }
.disclaimer { display: flex; gap: 10px; color: var(--muted); font-size: .85rem; margin: 22px 4px 8px; }
.speeds td.v { font-weight: 800; font-size: 1.15rem; } tr.crit td { background: #ed45771a; } .speeds td.l small { display: block; color: var(--muted); }
button.primary { background: var(--sky); color: #fff; border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 700; }
button.link { background: none; border: 0; color: var(--sky); font-weight: 600; padding: 4px; }
.picker { display: grid; gap: 10px; margin-top: 14px; }
.picker button { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.picker b { font-size: 1.1rem; } .picker span { display: block; color: var(--muted); font-size: .88rem; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.toast { background: #1f9e5718; border: 1px solid #1f9e5755; border-radius: 12px; padding: 8px 12px; margin-top: 12px; font-size: .88rem; }
/* Petits écrans : rien ne doit dépasser */
.two > *, .grid > *, .fields > *, .status > div { min-width: 0; }
.two { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.card { overflow-x: auto; }
@media (max-width: 520px) { th, td { padding: 7px 3px; font-size: .86rem; } .wrap { padding: 12px; } .hero h1 { font-size: 1.7rem; } }
.fields { grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); }
td { white-space: nowrap; } td:first-child { white-space: normal; }
/* Aérodromes et météo */
.apt { display: flex; align-items: center; gap: 8px; background: var(--field); border: 1px solid var(--line); border-radius: 14px; padding: 6px 8px 6px 12px; margin-bottom: 10px; width: 100%; }
.apt.pickbtn { padding: 14px; color: var(--sky); font-weight: 700; border-style: dashed; }
.aptmain { flex: 1; min-width: 0; background: none; border: 0; text-align: left; padding: 4px 0; display: flex; flex-direction: column; }
.icao { font-size: 1.35rem; font-weight: 800; line-height: 1.1; } .aname { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x { background: none; border: 0; color: var(--muted); font-size: 1.1rem; padding: 6px 8px; }
.wx { background: var(--field); border-radius: 14px; padding: 12px; margin: 10px 0; }
.wxhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.wx .metric { background: var(--card); } .wx .metric .v { font-size: 1.3rem; }
code.raw { display: block; margin-top: 8px; font: .78rem/1.35 ui-monospace, Menlo, monospace; color: var(--muted); word-break: break-word; }
label.check { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: .92rem; } label.check input { width: 18px; height: 18px; }
.modal { position: fixed; inset: 0; background: #0008; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 85vh; border-radius: 22px 22px 0 0; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.sheethead { display: flex; justify-content: space-between; align-items: center; font-size: 1.1rem; }
.sheet input[type=search] { width: 100%; background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 1.05rem; outline: none; }
.results { list-style: none; margin: 0; padding: 0; overflow: auto; }
.results button { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 11px 4px; }
.results small { display: block; color: var(--muted); } .results li.note { padding: 12px 4px; }
@media (min-width: 700px) { .modal { align-items: center; } .sheet { border-radius: 22px; } }
.seg { max-width: 100%; } .seg button { padding: 9px 10px; font-size: .9rem; white-space: nowrap; }
/* Durée du vol */
.dur { flex: 1; text-align: center; background: var(--field); border-radius: 14px; padding: 8px; }
.dur span { display: block; font-size: .78rem; color: var(--muted); font-weight: 600; } .dur b { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.seg button:disabled { opacity: .4; }

/* ───── Rapport PDF (impression) ───── */
#print-root { display: none; }
.pdfbtn { margin-left: auto; background: var(--sky); color: #fff; border: 0; border-radius: 99px; padding: 9px 16px; font-weight: 800; letter-spacing: .02em; }
@media print {
  @page { size: A4; margin: 11mm; }
  #app, .modal { display: none !important; }
  #print-root { display: block; }
  :root { --bg: #fff; --card: #fff; --text: #111; --muted: #555; --line: #d5dbe6; --field: #f4f6fa; }
  body { background: #fff; color: #111; font-size: 10pt; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.rpt { font-size: 9.5pt; color: #111; } .rpt h1 { margin: 0; font-size: 19pt; } .rpt .rsub { font-weight: 700; font-size: 12pt; }
.rpt .mut { color: #666; } .rpt .small { font-size: 8pt; } .rpt .warn { color: #c46a00; } .rpt .bad { color: #c62828; } .rpt .okc { color: #1f9e57; }
.rhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.badge { color: #fff; font-weight: 800; font-size: 9pt; padding: 5px 12px; border-radius: 99px; white-space: nowrap; } .badge.ok { background: #1f9e57; } .badge.bad { background: #db3333; }
.rissues { margin: 6px 0; padding-left: 16px; } .rissues li.critical { color: #c62828; } .rissues li.warning { color: #c46a00; }
.rtable { width: 100%; border-collapse: collapse; margin: 8px 0; font-variant-numeric: tabular-nums; break-inside: avoid; }
.rtable th, .rtable td { padding: 3px 6px; text-align: right; border-bottom: 1px solid #dde3ee; } .rtable th:first-child, .rtable td:first-child { text-align: left; }
.rtable th { color: #666; font-size: 8pt; } .rtable tr.tot td { font-weight: 800; } .rspeeds tr.crit td { background: #ed45771a; }
.rchart { max-width: 520px; margin: 6px auto; break-inside: avoid; } .rchart .legend { justify-content: center; font-size: 8pt; }
.rfuel { margin: 6px 0; }
.rboxes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0; break-inside: avoid; }
.rbox { border: 1px solid #cfd6e4; border-top: 4px solid var(--c); border-radius: 8px; padding: 8px 10px; display: grid; gap: 3px; align-content: start; }
.rbox h4 { margin: 0 0 2px; color: var(--c); font-size: 11pt; } .rb-dist { display: flex; gap: 14px; font-size: 10pt; margin: 3px 0; } .rb-dist b { font-size: 13pt; }
.rbox code { font: 7pt/1.3 ui-monospace, Menlo, monospace; color: #555; word-break: break-word; }
.rdisc { color: #c62828; font-size: 7.5pt; margin-top: 10px; }
/* Zone de rendu du PDF : hors écran, toujours en thème clair, largeur A4 (794 px à 96 dpi) */
.pdf-stage { position: fixed; left: -10000px; top: 0; width: 794px; padding: 38px; background: #fff; color: #111;
  --bg: #fff; --card: #fff; --text: #111; --muted: #555; --line: #d5dbe6; --field: #f4f6fa; font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; }
.pdf-stage .rpt { font-size: 12px; } .pdf-stage .rpt h1 { font-size: 24px; } .pdf-stage .rsub { font-size: 15px; }

/* ───────── iPhone : présentation compacte (≤ 600 px) ─────────
   Moins de marges, titres et cartes plus serrés, champs sur deux colonnes. Les champs de saisie restent à 16 px :
   en dessous, Safari zoome sur la page à chaque saisie. */
@media (max-width: 600px) {
  body { font-size: 14.5px; line-height: 1.3; }
  .wrap { padding: 8px 10px 14px; }
  .hero { padding: 12px 14px; border-radius: 18px; box-shadow: 0 6px 16px #1a73d933; }
  .hero small { font-size: .74rem; } .hero h1 { margin: 1px 0 3px; font-size: 1.45rem; } .hero p { font-size: .84rem; line-height: 1.25; }
  .hero .club { margin-top: 8px; gap: 6px; font-size: .78rem; } .pill { padding: 3px 10px; font-size: .78rem; }
  h2.group { margin: 14px 2px 6px; font-size: 1rem; } .count { font-size: .68rem; padding: 0 7px; }
  .grid { gap: 7px; grid-template-columns: 1fr; }
  .ac { padding: 8px 12px; gap: 10px; border-left-width: 5px; border-radius: 14px; }
  .ac .reg { font-size: 1.1rem; } .ac .meta { font-size: .8rem; display: inline; margin-left: 6px; } .ac .chips { gap: 10px; margin-top: 1px; font-size: .8rem; } .ac .go { font-size: 1.1rem; }
  .top { gap: 8px; margin: 0 0 6px; } .back { padding: 6px 11px; font-size: .88rem; }
  .title { font-size: 1.15rem; } .title small { font-size: .74rem; }
  .pdfbtn { padding: 7px 13px; font-size: .85rem; }
  .tabs { padding: 4px; gap: 4px; border-radius: 16px; margin: 4px 0 2px; }
  .tab { padding: 5px 2px; border-radius: 12px; font-size: .86rem; line-height: 1.15; } .tab small { font-size: .64rem; }
  .card { padding: 10px 12px; margin-top: 8px; border-radius: 14px; }
  .card h3 { margin: 0 0 7px; font-size: .95rem; gap: 6px; }
  .two { gap: 0; }
  .fields { gap: 7px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field label { font-size: .74rem; margin-bottom: 2px; line-height: 1.15; }
  .field .in { border-radius: 10px; } .field input, .field select { padding: 6px 9px; font-size: 16px; } .field .u { padding-right: 9px; font-size: .85rem; }
  .field .hint { font-size: .68rem; margin-top: 1px; }
  .status { padding: 10px 12px; gap: 10px; border-radius: 14px; } .status .big { font-size: 1.15rem; } .status .sub { font-size: .8rem; line-height: 1.25; } .status > div:first-child { font-size: 1.5rem !important; }
  .issues { gap: 5px; margin-top: 6px; } .issues li { padding: 7px 9px; font-size: .85rem; } .issues span { font-size: .78rem; }
  .metrics { gap: 6px; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
  .metric { padding: 7px 9px; border-radius: 11px; } .metric .v { font-size: 1.15rem; } .metric .l { font-size: .7rem; }
  .wx { padding: 8px; margin: 7px 0; border-radius: 11px; } .wx .metric .v { font-size: 1.05rem; } .wxhead { margin-bottom: 5px; font-size: .85rem; }
  .apt { padding: 3px 4px 3px 10px; margin-bottom: 7px; border-radius: 11px; } .apt.pickbtn { padding: 10px; } .icao { font-size: 1.15rem; } .aname { font-size: .78rem; }
  code.raw { font-size: .68rem; margin-top: 5px; }
  th, td { padding: 4px 3px; font-size: .78rem; } th { font-size: .64rem; }
  .chart { border-radius: 10px; } .legend { margin-top: 6px; gap: 3px 12px; font-size: .75rem; } .dot { width: 9px; height: 9px; margin-right: 4px; }
  .seg button { padding: 7px 9px; font-size: .82rem; }
  .dur { padding: 5px; border-radius: 11px; } .dur b { font-size: 1.25rem; } .dur span { font-size: .7rem; }
  .note { font-size: .78rem; margin: 5px 0 0; line-height: 1.25; }
  label.check { margin-top: 8px; font-size: .82rem; }
  .disclaimer { font-size: .74rem; margin: 14px 2px 4px; gap: 7px; }
  .toast { padding: 6px 10px; font-size: .8rem; margin-top: 8px; }
  .sheet { padding: 12px; max-height: 88vh; } .results button { padding: 9px 4px; }
}
.fields.f3 { margin-top: 12px; }
@media (max-width: 600px) {
  .fields.f3 { margin-top: 8px; grid-template-columns: 1.15fr 1fr .95fr; }       /* altitude · température · revêtement sur une ligne */
  .fields.f3 .field .hint { grid-column: auto; }
  .field.wide { grid-column: 1 / -1; }
  .seg { display: flex; width: 100%; } .seg button { flex: 1; }
}

/* Boutons − et + (cases grises) de part et d'autre d'un champ (carburant, masses, durée du vol) */
:root { --sbfill: #dfe4ec; --sbpress: #c3cad8; }
@media (prefers-color-scheme: dark) { :root { --sbfill: #27344f; --sbpress: #3a4a6b; } }
.stepin { padding: 0; }
.stepin input { text-align: center; padding-left: 4px; padding-right: 2px; -moz-appearance: textfield; }
.stepin input::-webkit-outer-spin-button, .stepin input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepin .u { padding: 0 6px 0 0; }
.sb { flex: 0 0 44px; align-self: stretch; min-height: 44px; border: 0; padding: 0; font-size: 1.7rem; font-weight: 800; line-height: 1; touch-action: manipulation; }
.sb.minus, .sb.plus { background: var(--sbfill); color: var(--text); }
.stepin .sb:first-child { border-right: 1px solid var(--line); } .stepin .sb:last-child { border-left: 1px solid var(--line); }
.sb.minus:active, .sb.plus:active { background: var(--sbpress); }
/* Durée du vol : même boîte que les champs — « − », valeur, « + » */
.durbox { display: flex; align-items: stretch; margin: 12px 0 6px; overflow: hidden; background: var(--field); border: 1px solid var(--line); border-radius: 12px; }
.durbox .dur { flex: 1; min-width: 0; text-align: center; background: transparent; padding: 5px 4px; }
@media (max-width: 600px) { .durbox { border-radius: 10px; margin: 8px 0 4px; } .sb { flex-basis: 38px; min-height: 40px; font-size: 1.5rem; } .stepin .u { padding-right: 3px; font-size: .78rem; } .stepin input { padding-left: 2px; } }

/* Pas de zoom au double appui (le zoom par pincement reste possible) ; pas de sélection de texte sur les boutons */
html, body, button, a, input, select, label, .tab { touch-action: manipulation; }
button, .tab, .seg { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }

/* Alertes de longueur de piste */
.metric.bad { background: #db333326; box-shadow: inset 0 0 0 2px var(--bad); } .metric.bad .v { color: var(--bad); }
.metric.warn { background: #ed8c1426; box-shadow: inset 0 0 0 2px var(--warn); } .metric.warn .v { color: var(--warn); }
.card.bad { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); } .card.warn { border-color: var(--warn); }
.alert { border-radius: 12px; padding: 9px 11px; margin-top: 8px; font-size: .92rem; line-height: 1.3; }
.alert.bad { background: #db333320; border: 1px solid var(--bad); color: var(--bad); } .alert.warn { background: #ed8c1420; border: 1px solid var(--warn); color: #b86a00; }
@media (prefers-color-scheme: dark) { .alert.warn { color: #ffb04d; } .alert.bad { color: #ff7a7a; } }
@media (max-width: 600px) { .alert { padding: 7px 9px; font-size: .82rem; margin-top: 6px; } }
