/* NAWDBA Terrain — palette HUMAPSY : bleu-vert #007481 / #00578a, accent ocre ; pensé pour l'iPad (cibles tactiles ≥ 44 px). */
:root {
  --teal: #007481; --bleu: #00578a; --encre: #14232f; --gris: #5d6b78; --ocre: #c47a2c; --terre: #a3412b;
  --sable: #f7f1e6; --ligne: rgba(20, 35, 47, .14); --fond: #fbf8f2; --carte: #ffffff;
  --arc: linear-gradient(to right, #7a1f12, #c47a2c, #e3b448, #2e7d4f, #007481, #00578a);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: linear-gradient(180deg, #fbf8f2 0%, #f3f6f7 100%) fixed; color: var(--encre);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding: env(safe-area-inset-top) max(14px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(14px, env(safe-area-inset-left));
}
#app { max-width: 1280px; margin: 0 auto; padding-bottom: 40px; }
.chargement { text-align: center; color: var(--gris); margin-top: 30vh; }
h2.entete { color: var(--teal); margin: 18px 0 6px; font-size: 1.55rem; border-bottom: 4px solid transparent; border-image: var(--arc) 1; padding-bottom: 6px; }
h3.titre { color: var(--bleu); margin: 22px 0 8px; font-size: 1.15rem; border-bottom: 3px solid transparent; border-image: var(--arc) 1; padding-bottom: 4px; }
h3, h4, h5, h6 { color: var(--teal); }
.arc { height: 4px; border-radius: 2px; margin: 10px 0; background: var(--arc); }
a { color: var(--bleu); }

/* ── Connexion ── */
.connexion { max-width: 760px; margin: 12px auto; }
.titre-app { text-align: center; background: var(--teal); color: #fff; border-radius: 15px; padding: 8px 16px; font-size: 1.35rem; font-weight: 800; }
.bonjour { text-align: center; color: var(--teal); font-size: 1.1rem; margin: 4px 0; }
.rouge { color: #cc0000; }
.carte-auth { background: #fff; border-radius: 14px; padding: 22px 24px; box-shadow: 0 2px 18px rgba(0, 87, 138, .10); display: grid; gap: 8px; }
.carte-auth .btn { margin-top: 10px; }

/* ── Bannière ── */
.banniere { position: relative; height: 200px; border-radius: 12px; overflow: hidden; background: var(--bleu); display: flex; align-items: center; justify-content: space-between; }
.pluie { position: absolute; inset: 0; width: 100%; height: 100%; }
.globe { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 120px; z-index: 1; animation: pulse 4s ease-in-out infinite; filter: drop-shadow(0 0 26px rgba(255, 255, 255, .45)); }
@keyframes pulse { 0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(0); } 50% { transform: translate(-50%, -50%) scale(1.1) rotate(-8deg); } }
.panneau { position: relative; z-index: 2; color: #fff; padding: 0 28px; pointer-events: none; }
.panneau h4 { margin: 0; font-size: 20px; font-weight: 900; color: #fff; }
.panneau h5 { margin: 0; font-size: 15px; font-weight: 900; color: #fff; line-height: 1.2; }
.panneau.droite { text-align: right; font-weight: 700; font-size: 14px; }
.barre-or { height: 2px; margin: 7px 0; background: linear-gradient(to right, #7a1f12, #c47a2c, #e3b448, #2e7d4f, #7fd1da); }
@media (max-width: 820px) { .panneau.droite { display: none; } .globe { font-size: 84px; } }
.date-bandeau { background: var(--teal); color: #fff; border-radius: 15px; padding: 9px 18px; text-align: center; margin: 10px 0 0; }

/* ── En-tête, onglets ── */
.haut { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.reseau.ok { color: #1e6b3a; } .reseau.ko { color: var(--terre); font-weight: 700; }
nav.onglets { position: sticky; top: env(safe-area-inset-top); z-index: 20; display: flex; gap: 6px; overflow-x: auto; padding: 8px 2px;
  background: rgba(251, 248, 242, .96); backdrop-filter: blur(6px); -webkit-overflow-scrolling: touch; scrollbar-width: none; }
nav.onglets::-webkit-scrollbar { display: none; }
nav.onglets button { flex: 0 0 auto; min-height: 44px; padding: 8px 14px; border: 1px solid var(--ligne); border-radius: 10px; background: #fff;
  font-weight: 800; color: var(--encre); font-size: .92rem; }
nav.onglets button.actif { background: var(--teal); color: #fff; border-color: var(--teal); }
.so-barre { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid var(--ligne); margin: 10px 0 12px; }
.so-barre button { min-height: 42px; padding: 7px 12px; border: 0; border-radius: 8px 8px 0 0; background: transparent; font-weight: 700; color: var(--gris); font-size: .92rem; }
.so-barre button.actif { background: rgba(0, 116, 129, .12); color: var(--teal); box-shadow: inset 0 -3px 0 var(--teal); }

/* ── Cartes, alertes, notes ── */
.carte { background: var(--carte); border: 1px solid var(--ligne); border-radius: 10px; padding: 12px 14px; margin: 8px 0; box-shadow: 0 10px 26px rgba(20, 35, 47, .05); }
.carte.accent { border-left: 4px solid var(--teal); }
.carte.ocre { border-left: 4px solid var(--ocre); }
.carte.alerte-carte { border-left: 4px solid var(--terre); background: #fff6f3; }
.carte ol, .carte ul { margin: 6px 0 4px 1.1rem; padding: 0; }
.citation { margin-top: 6px; padding-left: 10px; border-left: 2px solid rgba(20, 35, 47, .2); font-style: italic; white-space: pre-wrap; unicode-bidi: plaintext; }
.note { color: var(--gris); font-size: .9rem; margin: 6px 0; }
.alerte { display: flex; gap: 10px; align-items: flex-start; border-radius: 8px; padding: 10px 12px; margin: 8px 0; font-size: .95rem; }
.alerte .ic { flex: 0 0 auto; }
.alerte.success { background: #e6f4ea; color: #1e5a33; } .alerte.info { background: #e5f4fb; color: #0b4d66; }
.alerte.warning { background: #fff4dc; color: #6e4800; } .alerte.error { background: #fde2e1; color: #8a1b1b; }
.badge { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: .75rem; font-weight: 800; margin-left: 6px; }
.b-high { background: #fde2e1; color: #9b1c1c; } .b-mid { background: #fff1d6; color: #8a5a00; } .b-low { background: #e6f4ea; color: #1e6b3a; } .b-info { background: #e5f4fb; color: #0b5b78; }
.avertissement { border: 1px dashed rgba(20, 35, 47, .25); border-radius: 8px; padding: 10px 12px; margin-top: 18px; color: var(--gris); font-size: .84rem; }
.pre { white-space: pre-wrap; font: inherit; }
.apercu { background: #fff; border: 1px solid var(--ligne); border-radius: 8px; padding: 6px 14px; }

/* ── Formulaires (tactiles) ── */
.champ { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.lib { font-weight: 600; font-size: .9rem; color: var(--encre); }
.aide { color: var(--gris); font-size: .8rem; }
input[type=text], input[type=number], input[type=date], input[type=password], select, textarea {
  width: 100%; font: inherit; font-size: 16px; /* évite le zoom automatique de Safari */ color: var(--encre);
  border: 1px solid rgba(20, 35, 47, .22); border-radius: 8px; padding: 9px 10px; background: #fff; min-height: 44px; unicode-bidi: plaintext; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(0, 116, 129, .45); border-color: var(--teal); }
.case { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.case input { width: 22px; height: 22px; flex: 0 0 auto; margin-top: 1px; accent-color: var(--teal); }
.case.toggle input { width: 22px; height: 22px; }
.cases { display: flex; flex-direction: column; }
.cols.cases { display: grid; }
.radios { display: flex; flex-direction: column; } .radios.horiz { flex-direction: row; gap: 18px; flex-wrap: wrap; }
.puces { display: flex; flex-wrap: wrap; gap: 6px; }
.puce { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--ligne); border-radius: 999px; padding: 6px 12px; background: #fff; font-size: .88rem; cursor: pointer; }
.puce input { width: 18px; height: 18px; accent-color: var(--teal); }
.selecteur { font-weight: 700; }
.btn { min-height: 44px; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--ligne); background: #fff; font: inherit; font-weight: 700; color: var(--encre); cursor: pointer; margin: 4px 6px 4px 0; }
.btn.primaire { background: linear-gradient(90deg, var(--teal), var(--bleu)); color: #fff; border: 0; }
.btn.ia { border-color: rgba(196, 122, 44, .5); background: #fff8ef; }
.btn.petit { min-height: 38px; padding: 6px 12px; font-size: .88rem; }
.btn.danger { background: var(--terre); color: #fff; border: 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.rangee { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 6px 0; }
.rangee.col { flex-direction: column; align-items: stretch; }
.bloc-ia { margin: 6px 0; }
.cols { display: grid; gap: 14px; }
.cols.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) { .cols.c2, .cols.c3, .cols.c4 { grid-template-columns: 1fr; } }
.aligne-bas { display: flex; align-items: flex-end; padding-bottom: 8px; }
.guide-sec { margin: 10px 0; padding: 8px 12px; background: #fff; border: 1px solid var(--ligne); border-radius: 10px; }
.lg { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: center; border-bottom: 1px solid var(--ligne); }
@media (max-width: 760px) { .lg { grid-template-columns: 1fr; } }
.lettres { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; background: var(--sable); border-radius: 8px; padding: 6px 8px; margin: 6px 0; }
.lettre { min-width: 40px; min-height: 40px; font-size: 1.15rem; border: 1px solid var(--ligne); border-radius: 8px; background: #fff; cursor: pointer; }

/* ── Tableaux ── */
.table-zone { overflow: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--ligne); border-radius: 8px; background: #fff; margin: 6px 0; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th { position: sticky; top: 0; background: #eef5f6; color: var(--encre); text-align: left; padding: 7px 8px; font-weight: 700; white-space: nowrap; z-index: 1; }
td { border-top: 1px solid var(--ligne); padding: 4px 6px; vertical-align: top; }
table.edit td { min-width: 130px; }
table.edit td.large { min-width: 300px; } table.edit td.etroit { min-width: 64px; width: 64px; }
table.edit textarea, table.edit select, table.edit input[type=number] { min-height: 40px; padding: 6px 8px; font-size: 15px; }
table.edit input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--teal); margin: 9px auto; display: block; }
table.edit .ro { padding: 8px 4px; white-space: pre-wrap; }
table.lecture td { padding: 6px 8px; }
.suppr { border: 0; background: transparent; color: var(--terre); font-size: 1.1rem; min-width: 40px; min-height: 40px; cursor: pointer; }

/* ── Indicateurs, graphiques ── */
.metriques { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 10px 0; }
.metrique { background: #fff; border: 1px solid var(--ligne); border-radius: 10px; padding: 10px 12px; }
.metrique small { display: block; color: var(--gris); font-size: .8rem; } .metrique strong { font-size: 1.5rem; color: var(--encre); }
.progression { margin: 8px 0; } .progression small { color: var(--gris); }
.progression .barre { height: 10px; background: #e3eaec; border-radius: 6px; overflow: hidden; }
.progression .barre span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--bleu)); }
.barres { margin: 10px 0; display: grid; gap: 4px; }
.barre-l { display: grid; grid-template-columns: minmax(120px, 34%) 1fr 36px; gap: 8px; align-items: center; font-size: .86rem; }
.barre-l .b { height: 14px; background: #eef2f3; border-radius: 4px; overflow: hidden; } .barre-l .b i { display: block; height: 100%; background: var(--teal); }
.barre-l .v { text-align: right; font-weight: 700; }
.graphe-zone { overflow-x: auto; background: #fff; border: 1px solid var(--ligne); border-radius: 8px; padding: 6px; }
svg.graphe { min-width: 420px; width: 100%; height: auto; } svg.graphe .ax { font-size: 11px; fill: var(--gris); }
.legende { display: flex; flex-wrap: wrap; gap: 10px; font-size: .82rem; margin: 6px 0; } .legende i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* ── Divers ── */
details.deplier { background: #fff; border: 1px solid var(--ligne); border-radius: 10px; margin: 10px 0; padding: 4px 12px; }
details.deplier > summary { cursor: pointer; font-weight: 700; padding: 8px 0; min-height: 40px; }
details.detresse { border-color: rgba(163, 65, 43, .45); background: #fffaf8; }
.rec-pastille { background: #d1242f; color: #fff; border-radius: 999px; padding: 4px 12px; font-weight: 800; animation: clignote 1.2s infinite; }
@keyframes clignote { 50% { opacity: .45; } }
.chrono { font-variant-numeric: tabular-nums; font-weight: 700; margin: 0 10px; }
footer .pied { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(30px); opacity: 0;
  background: var(--encre); color: #fff; padding: 10px 16px; border-radius: 10px; transition: all .25s; z-index: 50; max-width: 90vw; pointer-events: none; }
#toast.vu { opacity: 1; transform: translateX(-50%); }
blockquote { color: var(--gris); font-style: italic; border-left: 3px solid var(--ligne); margin: 8px 0; padding-left: 10px; }
