/* =====================================================================
   Radar V1 — feuille de style
   Mobile d'abord : rien ne dépasse, rien ne demande de zoom.
   Cibles tactiles à 44 px minimum, texte de base à 16 px.
   ===================================================================== */

:root {
  --fond: #0f1115;
  --fond-2: #171a21;
  --fond-3: #1f2430;
  --bord: #2a3040;
  --texte: #e7e9ee;
  --texte-2: #9aa3b2;
  --accent: #4f8cff;
  --ok: #3ecf8e;
  --attention: #ffb020;
  --alerte: #ff5c5c;
  --rayon: 12px;
}

@media (prefers-color-scheme: light) {
  :root {
    --fond: #f6f7f9; --fond-2: #ffffff; --fond-3: #eef0f4;
    --bord: #d8dce4; --texte: #12151c; --texte-2: #5a6376;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--fond); color: var(--texte);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}

/* ---------- ossature ---------- */
header {
  position: sticky; top: 0; z-index: 20;
  background: var(--fond); border-bottom: 1px solid var(--bord);
  padding: 12px 16px calc(12px + env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
header h1 { font-size: 17px; margin: 0; font-weight: 650; }
header .sous { font-size: 12px; color: var(--texte-2); font-weight: 400; }

main {
  padding: 16px 16px calc(96px + env(safe-area-inset-bottom));
  max-width: 760px; margin: 0 auto;
}

nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--fond-2); border-top: 1px solid var(--bord);
  padding-bottom: env(safe-area-inset-bottom);
}
nav button {
  background: none; border: 0; color: var(--texte-2);
  padding: 10px 1px 12px; min-height: 56px;
  font-size: 10px; letter-spacing: -.015em; line-height: 1.1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer; overflow: hidden; white-space: nowrap; min-width: 0;
}
nav button .ico { font-size: 19px; line-height: 1; }
nav button[aria-current="true"] { color: var(--accent); }
nav .pastille {
  position: absolute; transform: translate(14px, -6px);
  background: var(--alerte); color: #fff; border-radius: 10px;
  font-size: 10px; padding: 1px 5px; font-weight: 700;
}

/* ---------- blocs ---------- */
.carte {
  background: var(--fond-2); border: 1px solid var(--bord);
  border-radius: var(--rayon); padding: 14px; margin-bottom: 12px;
}
.carte h3 { margin: 0 0 6px; font-size: 15px; line-height: 1.35; }
.meta { color: var(--texte-2); font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px 10px; }
.section-titre { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--texte-2); margin: 20px 0 8px; }

.rang {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px; font-weight: 800; font-size: 14px; flex: 0 0 auto;
}
.rang.A { background: #1d4d38; color: #7ff0bb; }
.rang.B { background: #1d3a4d; color: #8fd4ff; }
.rang.C { background: #4d431d; color: #ffdf8f; }
.rang.D { background: #4d2f1d; color: #ffb894; }
.rang.E, .rang.\? { background: var(--fond-3); color: var(--texte-2); }

.etiquette {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; background: var(--fond-3); color: var(--texte-2); border: 1px solid var(--bord);
}
.etiquette.urgent { background: #4d1d1d; color: #ffb3b3; border-color: #6b2b2b; }
.etiquette.bientot { background: #4d3a1d; color: #ffd9a0; border-color: #6b522b; }
.etiquette.motif { font-family: ui-monospace, monospace; letter-spacing: .02em; }

/* ---------- boutons et formulaires ---------- */
button, .bouton {
  font: inherit; font-size: 15px; min-height: 44px;
  border-radius: 10px; border: 1px solid var(--bord);
  background: var(--fond-3); color: var(--texte);
  padding: 10px 14px; cursor: pointer;
}
button.principal { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.discret { background: none; border-color: transparent; color: var(--texte-2); min-height: 36px; padding: 6px 8px; }
button.danger { background: #3a1d1d; border-color: #6b2b2b; color: #ffb3b3; }
button:disabled { opacity: .5; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions > * { flex: 1 1 auto; }

label { display: block; font-size: 13px; color: var(--texte-2); margin: 12px 0 5px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; /* 16px : empêche le zoom auto sur iPhone */
  padding: 11px 12px; min-height: 44px;
  background: var(--fond); color: var(--texte);
  border: 1px solid var(--bord); border-radius: 10px;
}
textarea { min-height: 88px; resize: vertical; }

.filtres { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.filtres::-webkit-scrollbar { display: none; }
.filtres button { min-height: 38px; padding: 6px 13px; font-size: 13.5px; white-space: nowrap; flex: 0 0 auto; }
.filtres button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- explication du score ---------- */
details.pourquoi { margin-top: 10px; }
details.pourquoi > summary {
  cursor: pointer; font-size: 13px; color: var(--accent);
  list-style: none; padding: 6px 0; min-height: 32px;
}
details.pourquoi > summary::-webkit-details-marker { display: none; }
.calcul { border-top: 1px solid var(--bord); margin-top: 6px; padding-top: 8px; font-size: 13px; }
.calcul .ligne { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; align-items: flex-start; }
.calcul .ligne .txt { flex: 1; }
.calcul .pts { font-variant-numeric: tabular-nums; font-weight: 700; flex: 0 0 auto; }
.calcul .pts.plus { color: var(--ok); }
.calcul .pts.moins { color: var(--alerte); }
.calcul .raison { color: var(--texte-2); font-size: 12px; }
.calcul .total { border-top: 1px dashed var(--bord); margin-top: 6px; padding-top: 8px; font-weight: 700; }

/* ---------- bandeau proposition ---------- */
.proposition { border-left: 3px solid var(--accent); }
.proposition .expl { white-space: pre-line; font-size: 13.5px; color: var(--texte-2); margin-top: 6px; }

/* ---------- fenêtre modale ---------- */
dialog {
  border: 1px solid var(--bord); border-radius: 16px 16px 0 0;
  background: var(--fond-2); color: var(--texte);
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  width: 100%; max-width: 560px; margin: auto auto 0; position: fixed; inset: auto 0 0 0;
}
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog h3 { margin: 0 0 4px; font-size: 16px; }
dialog .rappel { font-size: 13px; color: var(--texte-2); }

.vide { text-align: center; color: var(--texte-2); padding: 40px 12px; font-size: 14px; }
.erreur { background: #3a1d1d; border: 1px solid #6b2b2b; color: #ffb3b3; padding: 11px 13px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }
.info { background: var(--fond-3); border: 1px solid var(--bord); padding: 11px 13px; border-radius: 10px; margin-bottom: 12px; font-size: 13.5px; color: var(--texte-2); }
pre { background: var(--fond); border: 1px solid var(--bord); border-radius: 10px; padding: 12px; overflow-x: auto; font-size: 12px; }

#connexion { max-width: 380px; margin: 14vh auto 0; padding: 0 16px; text-align: center; }
#connexion h1 { font-size: 26px; margin-bottom: 4px; }
#connexion p { color: var(--texte-2); font-size: 14px; }
.cache { display: none !important; }
