/* Inthuiss Cockpit sur téléphone : feuille unique, aucun style en ligne (CSP style-src 'self') */
:root {
  --bleu: #126336;
  --bleu-clair: #e6f3eb;
  --texte: #1d2733;
  --gris: #6b7785;
  --trait: #dde3ea;
  --fond: #f5f7fa;
  --vert: #1f8f4e;
  --rouge: #b3261e;
  --haut: env(safe-area-inset-top, 0px);
  --bas: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --texte: #e7ecf2; --gris: #9aa6b4; --trait: #2c3642; --fond: #12171d; --bleu-clair: #1b2a38; }
  body { background: #0d1116; }
  .carte, #entete, #onglets, .saisie, input, textarea, select { background: #161d25; color: var(--texte); }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--texte); background: var(--fond);
  display: flex; flex-direction: column; -webkit-text-size-adjust: 100%;
}
.cache { display: none !important; }
button { font: inherit; cursor: pointer; }

#entete {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px;
  padding: calc(10px + var(--haut)) 12px 10px; background: #fff; border-bottom: 1px solid var(--trait);
}
#entete h1 { font-size: 18px; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#etat-reseau { font-size: 12px; color: #fff; background: var(--rouge); border-radius: 10px; padding: 2px 8px; }
.icone { border: 0; background: none; font-size: 28px; line-height: 1; padding: 0 6px; color: var(--bleu); }

#vue { flex: 1; overflow-y: auto; padding: 12px 12px calc(80px + var(--bas)); }
.attente, .vide { color: var(--gris); text-align: center; margin-top: 32px; }

#onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; background: #fff;
  border-top: 1px solid var(--trait); padding-bottom: var(--bas);
}
#onglets button {
  flex: 1; border: 0; background: none; padding: 6px 0 8px; font-size: 11px; color: var(--gris);
  display: flex; flex-direction: column; align-items: center; position: relative;
}
#onglets button.actif { color: var(--bleu); font-weight: 600; }
.pictogramme { font-size: 20px; line-height: 24px; }
.pastille {
  position: absolute; top: 2px; left: 55%; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  background: var(--rouge); color: #fff; font-size: 11px; line-height: 18px; font-weight: 600;
}

.carte { background: #fff; border: 1px solid var(--trait); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.ligne { display: flex; align-items: center; gap: 10px; }
.ligne > .grandit { flex: 1; min-width: 0; }
.discret { color: var(--gris); font-size: 13px; }
.titre-carte { font-weight: 600; margin: 0 0 2px; }
.coupe { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bouton {
  display: inline-block; border: 0; border-radius: 10px; padding: 10px 16px; background: var(--bleu); color: #fff; font-weight: 600;
}
.bouton.secondaire { background: var(--bleu-clair); color: var(--bleu); }
.bouton.danger { background: var(--rouge); }
.bouton.large { display: block; width: 100%; margin-top: 10px; }
.bouton:disabled { opacity: .5; }
.barre { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.barre h2 { flex: 1; font-size: 17px; margin: 0; text-align: center; }
label { display: block; margin: 10px 0 4px; font-size: 14px; color: var(--gris); }
label.case { display: flex; gap: 8px; align-items: center; color: var(--texte); }
input[type=text], input[type=date], input[type=time], textarea, select {
  width: 100%; font: inherit; padding: 10px; border: 1px solid var(--trait); border-radius: 10px; background: #fff; color: var(--texte);
}
textarea { resize: none; }

/* Accueil (connexion, inscription) */
.accueil { max-width: 420px; margin: 8vh auto 0; text-align: center; }
.accueil img { width: 96px; height: 96px; border-radius: 22px; }
.accueil h2 { margin: 16px 0 6px; }
.accueil p { color: var(--gris); }
.erreur { color: var(--rouge); }

/* Journée */
.rdv { border-left: 5px solid var(--bleu); }
.rdv .heure { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 92px; }
.rdv.masque { opacity: .7; font-style: italic; }
.agendas-filtre { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; }
.puce { border: 1px solid var(--trait); border-radius: 16px; padding: 4px 10px; background: #fff; font-size: 13px; white-space: nowrap; color: var(--texte); }
.puce.active { background: var(--bleu-clair); border-color: var(--bleu); color: var(--bleu); }

/* Discussions */
.conversation { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; }
.bulle { max-width: 82%; padding: 8px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--trait); align-self: flex-start; word-wrap: break-word; white-space: pre-wrap; }
.bulle.moi { align-self: flex-end; background: var(--bleu-clair); border-color: transparent; }
.bulle .auteur { font-size: 12px; font-weight: 600; color: var(--bleu); }
.bulle .quand { font-size: 11px; color: var(--gris); text-align: right; }
.photo { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; margin-top: 6px; }
.empreinte { font-size: 11px; color: var(--vert); }
.empreinte.mauvaise { color: var(--rouge); font-weight: 600; }
.saisie {
  position: fixed; left: 0; right: 0; bottom: calc(56px + var(--bas)); z-index: 2; display: flex; gap: 6px; align-items: flex-end;
  padding: 8px; background: #fff; border-top: 1px solid var(--trait);
}
.saisie textarea { flex: 1; max-height: 120px; }
.saisie .icone { font-size: 24px; padding: 8px; }
.avec-saisie { padding-bottom: calc(140px + var(--bas)) !important; }

/* Fil */
.publication .texte { white-space: pre-wrap; word-wrap: break-word; margin: 6px 0; }
.publication.annonce { border-color: var(--bleu); }
.reactions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.reactions button { border: 1px solid var(--trait); background: none; border-radius: 14px; padding: 2px 10px; color: var(--texte); }
.reactions button.mien { background: var(--bleu-clair); border-color: var(--bleu); }
.commentaire { border-top: 1px solid var(--trait); padding-top: 6px; margin-top: 6px; font-size: 14px; white-space: pre-wrap; }

/* Tâches */
.tache .fait { border: 2px solid var(--vert); color: var(--vert); background: none; border-radius: 50%; width: 34px; height: 34px; font-size: 18px; }
.en-retard { color: var(--rouge); font-weight: 600; }

#message {
  position: fixed; left: 12px; right: 12px; bottom: calc(70px + var(--bas)); z-index: 3; padding: 12px; border-radius: 10px;
  background: #222b35; color: #fff; text-align: center;
}
#message.erreur { background: var(--rouge); }
