/* Interface mobile de Jarvis : anthracite dominant, accents or. Lisible en plein soleil :
   texte presque blanc sur fond très sombre, gros caractères, boutons d'au moins 52 px. */

:root {
  --fond: #17181b;
  --fond-2: #1f2125;
  --fond-3: #292c31;
  --trait: #383c43;
  --texte: #f3f0e8;
  --doux: #b9b4a7;
  --or: #d4af37;
  --or-clair: #ecd078;
  --or-fonce: #b38d2b;
  --vert: #7fd6a2;
  --rouge: #f08b78;
  --ambre: #f2b04a;
  --bleu: #9dbbe0;
  --rayon: 16px;
  --ombre: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--fond);
  background-image: radial-gradient(120% 60% at 50% -10%, #23252a 0%, var(--fond) 60%);
  background-attachment: fixed;
  color: var(--texte);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
.cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ en-tête */

.entete {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) 18px 12px;
  background: rgba(23, 24, 27, .86);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(212, 175, 55, .16);
}
.marque {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; letter-spacing: .32em; font-size: 15px; color: var(--or-clair);
}
.anneau {
  display: inline-block; width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--or);
  box-shadow: 0 0 10px rgba(212, 175, 55, .35), inset 0 0 6px rgba(212, 175, 55, .3);
}
.anneau.grand { width: 64px; height: 64px; border-width: 4px; margin-bottom: 18px; }
.entete-droite { display: flex; align-items: center; gap: 12px; }
.puce-essai {
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ambre); border: 1px solid rgba(242, 176, 74, .55); border-radius: 999px; padding: 3px 10px;
}
.liaison { width: 10px; height: 10px; border-radius: 50%; background: var(--trait); }
.liaison.ok { background: var(--vert); box-shadow: 0 0 8px rgba(127, 214, 162, .6); }
.liaison.ko { background: var(--rouge); }

.bandeau {
  margin: 12px 16px 0; padding: 12px 16px; border-radius: 12px;
  background: rgba(240, 139, 120, .12); border: 1px solid rgba(240, 139, 120, .45);
  color: #ffd2c8; font-weight: 600;
}

/* ------------------------------------------------------------------ mise en page */

main {
  max-width: 560px; margin: 0 auto;
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 104px);
}
.vue { animation: entree .22s ease-out; }
@keyframes entree { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1 { font-size: 26px; line-height: 1.2; margin: 0 0 8px; font-weight: 700; }
h2 {
  margin: 30px 2px 12px; font-size: 13px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--or);
}
h3 { margin: 26px 2px 10px; font-size: 15px; color: var(--doux); font-weight: 600; }
.titre-ligne { display: flex; align-items: baseline; justify-content: space-between; }
.doux { color: var(--doux); }
.petit { font-size: 14px; }
.centre { text-align: center; }

.carte {
  background: var(--fond-2); border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: 18px; margin-bottom: 12px;
}

/* ------------------------------------------------------------------ boutons */

.bouton {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 20px; border-radius: 14px; border: 1.5px solid transparent;
  font: inherit; font-weight: 700; font-size: 17px; text-decoration: none; cursor: pointer;
  transition: transform .08s ease, opacity .15s ease, background .15s ease;
  user-select: none; -webkit-user-select: none;
}
.bouton:active { transform: scale(.97); }
.bouton:disabled { opacity: .45; cursor: default; transform: none; }
.bouton.plein { display: flex; width: 100%; }
.bouton.grand { min-height: 62px; font-size: 19px; }
.bouton.or {
  background: linear-gradient(180deg, var(--or-clair) 0%, var(--or) 55%, var(--or-fonce) 100%);
  color: #18160f; box-shadow: 0 6px 18px rgba(212, 175, 55, .22);
}
.bouton.contour { background: transparent; color: var(--or-clair); border-color: rgba(212, 175, 55, .7); }
.bouton.discret { background: var(--fond-3); color: var(--texte); border-color: var(--trait); }
.bouton.en-cours { position: relative; color: transparent !important; }
.bouton.en-cours::after {
  content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid rgba(24, 22, 15, .35); border-top-color: #18160f; animation: tourne .8s linear infinite;
}
.bouton.contour.en-cours::after, .bouton.discret.en-cours::after {
  border-color: rgba(236, 208, 120, .25); border-top-color: var(--or-clair);
}
@keyframes tourne { to { transform: rotate(360deg); } }
:focus-visible { outline: 3px solid var(--or-clair); outline-offset: 2px; }

.lien {
  -webkit-appearance: none; appearance: none; background: none; border: 0; padding: 10px 4px;
  font: inherit; font-size: 15px; font-weight: 600; color: var(--or-clair); cursor: pointer;
}
.lien.discret { display: block; margin: 34px auto 0; color: var(--doux); font-weight: 500; }

.retour { min-height: 1.5em; margin: 10px 2px 0; font-weight: 600; }
.retour.ok { color: var(--vert); }
.retour.erreur { color: var(--rouge); }
.retour.essai { color: var(--ambre); }
.retour.encours { color: var(--doux); font-weight: 400; }

/* ------------------------------------------------------------------ connexion */

.vue-connexion { display: grid; place-items: center; min-height: calc(100vh - 180px); }
.carte-connexion { width: 100%; text-align: center; padding: 34px 22px 26px; box-shadow: var(--ombre); }
.carte-connexion .doux { margin: 0 0 22px; }
#champ-code {
  width: 100%; margin-bottom: 14px; padding: 14px; border-radius: 14px;
  border: 1.5px solid var(--trait); background: var(--fond); color: var(--texte);
  font: inherit; font-size: 22px; letter-spacing: .14em; text-align: center; text-transform: uppercase;
}
#champ-code:focus { border-color: var(--or); outline: none; box-shadow: 0 0 0 3px rgba(212, 175, 55, .2); }

/* ------------------------------------------------------------------ pupitre */

.resume { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chiffre {
  flex: 1 1 calc(50% - 8px); min-width: 140px;
  background: var(--fond-2); border: 1px solid var(--trait); border-radius: 14px; padding: 12px 14px;
}
.chiffre b { display: block; font-size: 26px; line-height: 1.1; color: var(--or-clair); }
.chiffre span { font-size: 14px; color: var(--doux); }
.chiffre.alerte b { color: var(--ambre); }

.question { border-color: rgba(212, 175, 55, .45); box-shadow: var(--ombre); }
.question h3 { margin: 0 0 8px; color: var(--texte); font-size: 18px; line-height: 1.35; }
.question .contexte { color: var(--doux); margin: 0 0 12px; font-size: 15px; }
.reco {
  border-left: 3px solid var(--or); background: rgba(212, 175, 55, .07);
  border-radius: 0 10px 10px 0; padding: 10px 12px; margin: 10px 0;
}
.reco .etiquette, .pourquoi .etiquette {
  display: block; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--or); margin-bottom: 2px;
}
.pourquoi { margin: 10px 0; font-size: 15px; color: #dcd8cd; }
.pourquoi .etiquette { color: var(--doux); }
.cout { display: inline-block; margin: 2px 0 12px; font-size: 14px; color: var(--doux); }
.cout::before { content: "Coût : "; font-weight: 700; color: var(--doux); }
textarea {
  width: 100%; min-height: 64px; padding: 12px 14px; border-radius: 12px; resize: vertical;
  border: 1.5px solid var(--trait); background: var(--fond); color: var(--texte);
  font: inherit; font-size: 16px; line-height: 1.45;
}
textarea:focus { border-color: var(--or); outline: none; box-shadow: 0 0 0 3px rgba(212, 175, 55, .18); }
.choix { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 10px; }
.choix .bouton { padding: 10px 6px; font-size: 16px; }
.repondu { margin: 6px 0 0; font-weight: 700; color: var(--vert); }
.repondu small { display: block; font-weight: 500; color: var(--doux); }
.vide { color: var(--doux); font-style: italic; margin: 4px 2px 0; }

.pli { margin-top: 10px; }
.pli summary {
  cursor: pointer; padding: 12px 2px; color: var(--doux); font-weight: 600; list-style: none;
}
.pli summary::-webkit-details-marker { display: none; }
.pli summary::before { content: "›"; display: inline-block; width: 1em; color: var(--or); transition: transform .15s; }
.pli[open] > summary::before { transform: rotate(90deg); }
.compte { color: var(--or); font-weight: 700; }
.liste-reglees { list-style: none; margin: 0; padding: 0; }
.liste-reglees li { padding: 10px 2px; border-top: 1px solid var(--trait); font-size: 15px; }
.liste-reglees li small { display: block; color: var(--doux); }

.echeances { list-style: none; margin: 0; padding: 0; }
.echeances li {
  display: flex; gap: 14px; align-items: center;
  background: var(--fond-2); border: 1px solid var(--trait); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px;
}
.date {
  flex: 0 0 auto; min-width: 58px; text-align: center; border-radius: 10px; padding: 6px 4px;
  background: var(--fond-3); border: 1px solid rgba(212, 175, 55, .35);
}
.date b { display: block; font-size: 20px; line-height: 1; color: var(--or-clair); }
.date span { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--doux); }
.echeances .quand { display: block; font-size: 13px; color: var(--doux); }
.echeances .retard .quand { color: var(--rouge); font-weight: 700; }
.echeances .proche .quand { color: var(--ambre); font-weight: 700; }

.projet {
  background: var(--fond-2); border: 1px solid var(--trait); border-radius: var(--rayon);
  margin-bottom: 10px; overflow: hidden;
}
.projet > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; cursor: pointer; list-style: none; font-weight: 700; font-size: 17px;
}
.projet > summary::-webkit-details-marker { display: none; }
.projet > summary .comptes { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.projet ul { list-style: none; margin: 0; padding: 0 16px 8px; }
.projet li { padding: 10px 0; border-top: 1px solid var(--trait); }
.projet li .titre { display: block; font-weight: 600; }
.projet li .prochaine { display: block; font-size: 14px; color: var(--doux); margin-top: 2px; }
.projet li.fait .titre { color: var(--doux); text-decoration: line-through; text-decoration-color: rgba(185, 180, 167, .5); }
.etat {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .04em; white-space: nowrap;
  border-radius: 999px; padding: 2px 9px; margin-bottom: 4px; border: 1px solid currentColor;
}
.etat.ambre { color: var(--ambre); background: rgba(242, 176, 74, .1); }
.etat.or { color: var(--or-clair); background: rgba(212, 175, 55, .1); }
.etat.bleu { color: var(--bleu); }
.etat.neutre { color: #d6d2c6; border-color: var(--trait); }
.etat.discret { color: var(--doux); border-color: var(--trait); }
.etat.vert { color: var(--vert); }
.etat.rouge { color: var(--rouge); background: rgba(240, 139, 120, .1); }

/* suivis : ce que Jarvis a lancé et surveille ; la barre de gauche dit l'état d'un coup d'œil */
.resume-suivis { margin: 0 2px 10px; color: var(--doux); font-size: 15px; }
.resume-suivis b { color: var(--or-clair); }
.resume-suivis .alerte { color: var(--ambre); font-weight: 700; }
.suivis { list-style: none; margin: 0; padding: 0; }
.suivis li {
  background: var(--fond-2); border: 1px solid var(--trait); border-left: 4px solid var(--trait);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 8px;
}
.suivis li.en_cours { border-left-color: var(--or); }
.suivis li.en_retard { border-left-color: var(--ambre); }
.suivis li.fini { border-left-color: var(--vert); }
.suivis li.echec { border-left-color: var(--rouge); }
.suivis .quoi { display: block; font-weight: 600; overflow-wrap: anywhere; }
.suivis .detail { display: block; font-size: 14px; color: var(--doux); margin-top: 2px; overflow-wrap: anywhere; }
.suivis li.en_retard .detail.delai { color: var(--ambre); font-weight: 700; }
.suivis li.echec .detail.delai { color: var(--rouge); font-weight: 700; }
.guetteur { margin: 10px 2px 0; font-size: 13px; color: var(--doux); }
.guetteur.arrete { color: var(--ambre); font-weight: 700; }
.maj { margin-top: 26px; font-size: 13px; color: var(--doux); text-align: center; }

/* ------------------------------------------------------------------ lumières */

.note-essai {
  margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 600;
  color: var(--ambre); background: rgba(242, 176, 74, .08); border: 1px dashed rgba(242, 176, 74, .5);
}
#tout-eteindre { margin-top: 16px; }
.lampes { display: grid; gap: 10px; }
.lampe {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px;
  background: var(--fond-2); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 14px;
}
.lampe .globe {
  width: 40px; height: 40px; border-radius: 50%; background: var(--fond-3); border: 2px solid var(--trait);
  transition: background .3s, box-shadow .3s;
}
.lampe.allumee .globe { border-color: transparent; }
.lampe.injoignable .globe { border-style: dashed; border-color: rgba(240, 139, 120, .6); }
.lampe .nom { display: block; font-weight: 700; font-size: 17px; }
.lampe .etat-lampe { display: block; font-size: 14px; color: var(--doux); }
.lampe.injoignable .etat-lampe { color: var(--rouge); }
.lampe .retour-lampe { display: block; font-size: 14px; font-weight: 700; min-height: 0; }
.lampe .retour-lampe.ok { color: var(--vert); }
.lampe .retour-lampe.erreur { color: var(--rouge); }
.lampe .retour-lampe.essai { color: var(--ambre); }
.lampe .bouton { min-width: 112px; min-height: 48px; padding: 8px 14px; font-size: 16px; }

.note-ambiance { margin: 0 0 10px; color: var(--or-clair); font-weight: 600; }
.ambiances { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.ambiance {
  -webkit-appearance: none; appearance: none; text-align: left; cursor: pointer;
  background: var(--fond-2); color: var(--texte); border: 1.5px solid var(--trait); border-radius: var(--rayon);
  padding: 14px; min-height: 92px; font: inherit; transition: transform .08s, border-color .15s;
}
.ambiance:active { transform: scale(.97); }
.ambiance:disabled { opacity: .45; }
.ambiance b { display: block; font-size: 17px; text-transform: capitalize; color: var(--or-clair); }
.ambiance span { display: block; font-size: 13px; line-height: 1.35; color: var(--doux); margin-top: 4px; }
.ambiance.active { border-color: var(--or); box-shadow: 0 0 0 1px var(--or), 0 6px 18px rgba(212, 175, 55, .18); }
.ambiance.en-cours-geste { border-color: var(--or-clair); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(212, 175, 55, .25); } }

/* ------------------------------------------------------------------ parler */

#ouvrir-session { margin-top: 18px; }
#form-message .bouton { margin-top: 10px; }
.messages { list-style: none; margin: 0; padding: 0; }
.messages li {
  background: var(--fond-2); border: 1px solid var(--trait); border-radius: 14px 14px 14px 4px;
  padding: 10px 14px; margin-bottom: 8px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.messages li small { display: block; color: var(--doux); font-size: 12px; margin-bottom: 2px; }

/* ------------------------------------------------------------------ onglets */

.onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
  background: rgba(23, 24, 27, .92);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid rgba(212, 175, 55, .18);
}
.onglets a {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 6px; color: var(--doux); text-decoration: none; font-size: 12px; font-weight: 600;
  letter-spacing: .03em; border-radius: 12px;
}
.onglets svg {
  width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.onglets a.actif { color: var(--or-clair); }
.onglets a.actif svg { filter: drop-shadow(0 0 6px rgba(212, 175, 55, .45)); }
.pastille {
  position: absolute; top: 4px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--ambre); color: #1b1608; font-size: 11px; line-height: 18px; text-align: center;
}

@media (min-width: 700px) {
  main { padding-top: 18px; }
  .onglets { left: 50%; right: auto; width: 560px; transform: translateX(-50%); border-radius: 18px 18px 0 0;
             border-left: 1px solid rgba(212, 175, 55, .18); border-right: 1px solid rgba(212, 175, 55, .18); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
