/* =====================================================================
   synapsus connect - console web
   Mêmes couleurs que le site synapsus.fr ; codes d'état de l'accueil de la
   tablette : vert en marche, rouge alarme, gris hors ligne / désactivé.
   ===================================================================== */

:root{
  --bg:#f5f7fa; --surface:#ffffff; --surface-2:#eef2f6;
  --ink:#132033; --ink-soft:#4a586c; --muted:#7d8899; --line:#dfe5ec;
  --brand:#15839d; --brand-deep:#0c4f5f; --brand-soft:#e2f2f5;
  --ok:#1e9e5a; --ok-soft:#e1f5ea; --alarme:#d42a20; --alarme-soft:#fde7e5;
  --veille:#c98a06; --veille-soft:#fdf2d8; --off:#8a96a6; --off-soft:#eceff3;
  --c1:#15839d; --c2:#e2231a; --c3:#c98a06; --c4:#6b4fd8; --c5:#1e9e5a; --c6:#d1478f;
  --shadow:0 1px 2px rgba(19,32,51,.06),0 10px 28px -16px rgba(19,32,51,.25);
  --font:"Plus Jakarta Sans",-apple-system,"Segoe UI",Roboto,sans-serif;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0d131b; --surface:#141c26; --surface-2:#1b2633;
    --ink:#e9eef4; --ink-soft:#b4c0cf; --muted:#8392a5; --line:#243243;
    --brand:#4cbfd6; --brand-deep:#a6e3ef; --brand-soft:#123039;
    --ok:#3ccf82; --ok-soft:#123326; --alarme:#ff6b61; --alarme-soft:#3a1a19;
    --veille:#f0b43c; --veille-soft:#3a2d12; --off:#7d8899; --off-soft:#1f2834;
    --c1:#4cbfd6; --c2:#ff6b61; --c3:#f0b43c; --c4:#a28cff; --c5:#3ccf82; --c6:#ff8cc6;
    --shadow:0 1px 2px rgba(0,0,0,.4),0 12px 30px -16px rgba(0,0,0,.7);
    color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --bg:#0d131b; --surface:#141c26; --surface-2:#1b2633;
  --ink:#e9eef4; --ink-soft:#b4c0cf; --muted:#8392a5; --line:#243243;
  --brand:#4cbfd6; --brand-deep:#a6e3ef; --brand-soft:#123039;
  --ok:#3ccf82; --ok-soft:#123326; --alarme:#ff6b61; --alarme-soft:#3a1a19;
  --veille:#f0b43c; --veille-soft:#3a2d12; --off:#7d8899; --off-soft:#1f2834;
  --c1:#4cbfd6; --c2:#ff6b61; --c3:#f0b43c; --c4:#a28cff; --c5:#3ccf82; --c6:#ff8cc6;
  --shadow:0 1px 2px rgba(0,0,0,.4),0 12px 30px -16px rgba(0,0,0,.7);
  color-scheme:dark;
}

*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.5 var(--font);min-height:100vh}
a{color:var(--brand)}
button,input,select{font:inherit;color:inherit}
:focus-visible{outline:3px solid var(--brand);outline-offset:2px;border-radius:6px}
[hidden]{display:none!important}
.wrap{max-width:1080px;margin:0 auto;padding-inline:16px}

/* ---------- barre du haut ---------- */
.barre{position:sticky;top:0;z-index:5;background:var(--surface);border-bottom:1px solid var(--line)}
.barre .wrap{display:flex;align-items:center;gap:14px;min-height:58px}
.barre .marque{display:flex;align-items:center;gap:10px;text-decoration:none;color:var(--ink);font-weight:800;letter-spacing:-.01em}
.barre .marque img{height:26px;width:auto}
.barre .marque span{color:var(--brand);font-weight:700}
.barre .menu{display:flex;gap:4px;margin-left:12px}
.barre .menu a{text-decoration:none;color:var(--ink-soft);font-weight:600;font-size:14px;padding:6px 10px;border-radius:8px}
.barre .menu a[aria-current="page"]{background:var(--brand-soft);color:var(--brand)}
.invitations{display:flex;flex-direction:column;gap:10px;margin-bottom:18px}
.invitation{background:var(--brand-soft);border:1px solid var(--line);border-radius:12px;padding:12px 14px;display:flex;flex-wrap:wrap;gap:10px;align-items:center;justify-content:space-between}
.invitation > div{min-width:0;overflow-wrap:anywhere}
.societe .membres{list-style:none;margin:10px 0;padding:0;display:flex;flex-direction:column;gap:8px}
.societe .membres li{display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:space-between}
.societe .membres li span{overflow-wrap:anywhere;min-width:0}
.barre .compte{margin-left:auto;display:flex;align-items:center;gap:10px;font-size:13.5px;color:var(--muted);min-width:0}
.barre .compte b{color:var(--ink-soft);font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:28ch}
.logo-sombre{display:none}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]) .logo-clair{display:none} :root:not([data-theme="light"]) .logo-sombre{display:block}}
:root[data-theme="dark"] .logo-clair{display:none} :root[data-theme="dark"] .logo-sombre{display:block}

main{padding-block:24px 60px}
h1{font-size:clamp(22px,3.4vw,28px);line-height:1.2;margin:0 0 4px;letter-spacing:-.015em;text-wrap:balance}
h2{font-size:17px;margin:0 0 12px;letter-spacing:-.005em}
.sous-titre{color:var(--muted);margin:0 0 20px}

/* ---------- boutons et champs ---------- */
.bouton{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:0;border-radius:10px;
  background:var(--brand);color:#fff;font-weight:700;padding:10px 18px;cursor:pointer;text-decoration:none;min-height:42px}
:root .bouton{color:#fff}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]) .bouton{color:#08202a}}
:root[data-theme="dark"] .bouton{color:#08202a}
.bouton:disabled{opacity:.55;cursor:default}
.bouton.second{background:var(--surface-2);color:var(--ink)}
.bouton.danger{background:var(--alarme-soft);color:var(--alarme)}
.bouton.petit{min-height:34px;padding:6px 12px;font-size:13.5px;border-radius:8px}
.lien{background:none;border:0;padding:0;color:var(--brand);cursor:pointer;font-weight:600}
label.champ{display:flex;flex-direction:column;gap:6px;font-weight:600;font-size:14px}
input[type=text],input[type=email],input[type=number],select{background:var(--surface);border:1px solid var(--line);
  border-radius:10px;padding:10px 12px;min-height:44px;width:100%;color:var(--ink)}
input:focus{border-color:var(--brand);outline:none;box-shadow:0 0 0 3px var(--brand-soft)}
.code-saisie{font-size:26px;letter-spacing:.35em;text-align:center;font-variant-numeric:tabular-nums}
.aide{font-size:13.5px;color:var(--muted);margin:0}
.erreur{color:var(--alarme);font-weight:600;margin:0}

/* ---------- connexion ---------- */
.carte-connexion{max-width:420px;margin:6vh auto 0;background:var(--surface);border:1px solid var(--line);
  border-radius:16px;box-shadow:var(--shadow);padding:28px 24px;display:flex;flex-direction:column;gap:16px}
.carte-connexion img{height:40px;width:auto;align-self:flex-start}

/* ---------- tableau de bord ---------- */
.outils{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-bottom:16px}
.outils input{flex:1 1 220px;width:auto}
.compteurs-parc{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}
.pastille{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:600;padding:4px 10px;border-radius:999px;
  background:var(--surface-2);color:var(--ink-soft);white-space:nowrap}
.pastille::before{content:"";width:8px;height:8px;border-radius:50%;background:currentColor}
.pastille.ok{background:var(--ok-soft);color:var(--ok)}
.pastille.alarme{background:var(--alarme-soft);color:var(--alarme)}
.pastille.veille{background:var(--brand-soft);color:var(--brand)}
.pastille.off{background:var(--off-soft);color:var(--off)}
.pastille.attention{background:var(--veille-soft);color:var(--veille)}

.liste{display:flex;flex-direction:column;gap:8px}
.ligne{display:grid;grid-template-columns:auto 1fr auto;gap:14px;align-items:center;background:var(--surface);
  border:1px solid var(--line);border-left:5px solid var(--off);border-radius:12px;padding:12px 16px;
  text-decoration:none;color:inherit}
.ligne:hover{border-color:var(--brand)}
.ligne.ok{border-left-color:var(--ok)} .ligne.alarme{border-left-color:var(--alarme)}
.ligne.veille{border-left-color:var(--brand)} .ligne.off{border-left-color:var(--off)}
.ligne .nom{font-weight:700;min-width:0;overflow-wrap:anywhere}
.ligne .details{font-size:13.5px;color:var(--muted)}
.ligne .sn{font-variant-numeric:tabular-nums;color:var(--muted);font-size:13px}
.ligne > div{min-width:0}
.vide{background:var(--surface);border:1px dashed var(--line);border-radius:14px;padding:28px;text-align:center;color:var(--ink-soft)}

/* ---------- fiche ---------- */
.entete-fiche{display:flex;flex-wrap:wrap;gap:12px 20px;align-items:flex-start;justify-content:space-between;margin-bottom:18px}
.entete-fiche > div{min-width:0}
.retour{display:inline-block;margin-bottom:8px;font-weight:600;text-decoration:none}
.grille{display:grid;grid-template-columns:repeat(12,1fr);gap:14px}
.grille > *{min-width:0}
.bloc{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:16px 18px;box-shadow:var(--shadow)}
.l12{grid-column:span 12} .l8{grid-column:span 8} .l6{grid-column:span 6} .l4{grid-column:span 4}
.phase{font-size:19px;font-weight:800;margin:0 0 12px}
.mesures{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:10px}
.mesure{background:var(--surface-2);border-radius:10px;padding:8px 10px}
.mesure span{display:block;font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}
.mesure b{font-size:19px;font-variant-numeric:tabular-nums}
.mesure small{font-size:13px;color:var(--muted);font-weight:600}
.actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px;align-items:center}
.alarmes{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.alarmes li{background:var(--alarme-soft);color:var(--alarme);border-radius:8px;padding:8px 10px;font-weight:600}
.ras{color:var(--ok);font-weight:600;margin:0}

.fonctions{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:12px}
.fonction{border:1px solid var(--line);border-top:4px solid var(--off);border-radius:12px;padding:12px 14px;background:var(--surface);
  display:flex;flex-direction:column;gap:10px}
.fonction.ok{border-top-color:var(--ok)} .fonction.veille{border-top-color:var(--brand)}
.fonction .tete{display:flex;justify-content:space-between;gap:8px;align-items:baseline}
.fonction .tete b{overflow-wrap:anywhere}
.fonction .type{font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.05em;white-space:nowrap}
.fonction .temp{font-size:26px;font-weight:800;font-variant-numeric:tabular-nums}
.fonction .temp small{font-size:14px;color:var(--muted);font-weight:600}
.consignes{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}
.consignes label{font-size:12px;color:var(--muted);display:flex;flex-direction:column;gap:3px}
.consignes input{min-height:38px;padding:6px 8px;text-align:center}
.bascule{display:inline-flex;align-items:center;gap:8px;cursor:pointer;font-weight:600;font-size:14px;user-select:none}
.bascule input{appearance:none;width:42px;height:24px;border-radius:999px;background:var(--off);position:relative;cursor:pointer;margin:0;flex:none;transition:background .15s}
.bascule input::after{content:"";position:absolute;top:3px;left:3px;width:18px;height:18px;border-radius:50%;background:#fff;transition:transform .15s}
.bascule input:checked{background:var(--ok)}
.bascule input:checked::after{transform:translateX(18px)}
.bascule input:disabled{opacity:.5;cursor:default}

.choix-duree{display:inline-flex;background:var(--surface-2);border-radius:10px;padding:3px;gap:2px}
.choix-duree button{border:0;background:none;padding:5px 12px;border-radius:8px;cursor:pointer;font-weight:600;font-size:13.5px;color:var(--ink-soft)}
.choix-duree button[aria-pressed="true"]{background:var(--surface);color:var(--ink);box-shadow:var(--shadow)}
.graphe{width:100%;overflow-x:auto}
.graphe svg{display:block;width:100%;height:auto;min-width:520px}
.graphe .axe{stroke:var(--line);stroke-width:1}
.graphe text{fill:var(--muted);font-size:11px;font-family:var(--font)}
.graphe path{fill:none;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.legende{display:flex;flex-wrap:wrap;gap:6px 16px;font-size:13px;color:var(--ink-soft);margin-top:8px}
.legende span{display:inline-flex;align-items:center;gap:6px}
.legende i{width:14px;height:3px;border-radius:2px;display:inline-block}
.s1{stroke:var(--c1);background:var(--c1)} .s2{stroke:var(--c2);background:var(--c2)} .s3{stroke:var(--c3);background:var(--c3)}
.s4{stroke:var(--c4);background:var(--c4)} .s5{stroke:var(--c5);background:var(--c5)} .s6{stroke:var(--c6);background:var(--c6)}
.pointille{stroke-dasharray:5 4}

.acces{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}
.acces li{display:flex;align-items:center;gap:10px;justify-content:space-between;flex-wrap:wrap}
.acces li span{overflow-wrap:anywhere;min-width:0}

.formulaire{display:flex;flex-direction:column;gap:16px;max-width:460px}
.radios{display:flex;flex-direction:column;gap:8px}
.radios label{display:flex;gap:10px;align-items:flex-start;background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:10px 12px;cursor:pointer;font-weight:400}
.radios label b{display:block}
.radios input{margin-top:4px}

/* ---------- accueil façon tablette ----------
   Mêmes proportions que accueil.bas : 2 colonnes de tuiles carrées séparées
   de 6 % de la largeur, petites tuiles d'accès par 4 (écart 2 %) ; textes
   placés et dimensionnés en % de la tuile (unités cqw). */
.accueil{background:#000;border-radius:18px;padding:14px;max-width:470px;margin:0 auto;color:#000;
  font-family:Roboto,"Segoe UI",Arial,sans-serif;container-type:inline-size}
.accueil .tuiles{display:grid;grid-template-columns:1fr 1fr;gap:6cqw;margin-bottom:6cqw}
.accueil .acces-tuiles{display:grid;grid-template-columns:repeat(4,1fr);gap:2cqw}
.tuile{position:relative;aspect-ratio:1;background:center/100% 100% no-repeat;container-type:inline-size;border-radius:11%;
  cursor:pointer;border:0;padding:0;font:inherit;color:inherit;text-align:left;overflow:hidden;display:block;width:100%}
.tuile:focus-visible{outline:3px solid #4cbfd6;outline-offset:2px}
.tuile span{position:absolute;font-weight:700;line-height:1.12;white-space:nowrap}
.tuile .t-nom{left:7.1%;top:1%;width:90%;font-size:10cqw;white-space:normal;max-height:24%;overflow:hidden}
.tuile .t-temp{left:7.7%;top:53%;font-size:22.2cqw}
.tuile .t-cons{left:10%;top:82%;font-size:12.5cqw}
.tuile .t-mode{left:57%;top:86%;font-size:8.3cqw;max-width:36%;overflow:hidden}
.tuile .t-mode.eau{left:auto;right:7%;max-width:50%}
.tuile .t-panneau{right:5%;top:6%;font-size:16.7cqw}
.tuile .t-bas{left:5%;right:5%;top:82%;font-size:11.8cqw;text-align:center;overflow:hidden;text-overflow:ellipsis}
.tuile .t-cnom{left:5%;right:5%;top:6%;font-size:11.8cqw;text-align:center;overflow:hidden;text-overflow:ellipsis}
.tuile .t-cval{left:5%;right:5%;top:68%;font-size:18.2cqw;text-align:center;overflow:hidden;text-overflow:ellipsis}
.tuile .t-cval.petit{font-size:11.1cqw;top:72%}
.tuile .t-etatpac{left:0;right:0;top:82%;font-size:12.5cqw;text-align:center}
.tuile.marche::after{content:"";position:absolute;inset:0;border-radius:11%;box-shadow:inset 0 0 0 4cqw rgb(60,235,70)}
.tuile.marche.sombre::after{box-shadow:inset 0 0 0 4cqw rgb(30,160,45)}
.tuile.lointaine{opacity:.55}
.etats{display:grid;grid-template-columns:1fr 1fr;gap:4.3%;aspect-ratio:1}
.etats .tuile{border-radius:8%}
.logo-tuile .t-sn{left:0;right:0;top:40%;font-size:12.5cqw;text-align:center;font-weight:400}
.logo-tuile .t-date{left:0;right:0;top:60.6%;font-size:8.3cqw;text-align:center;color:#fff;font-weight:400}
.logo-tuile .t-heure{left:0;right:0;top:68%;font-size:17.2cqw;text-align:center;color:#fff;font-weight:400}
.logo-tuile .t-version{left:72%;top:29%;font-size:6.7cqw;color:#e2231a;font-weight:400}
.tuile .t-ext{left:37%;top:42%;font-size:29.8cqw;color:#e2231a}
.accueil-legende{text-align:center;font-size:13px;color:var(--muted);margin:10px 0 0}

/* ---------- prise en main à distance ---------- */
.miroir-fond{position:fixed;inset:0;z-index:15;background:rgba(5,10,16,.86);display:flex;align-items:center;justify-content:center;
  padding:calc(12px + env(safe-area-inset-top,0px)) 12px calc(12px + env(safe-area-inset-bottom,0px))}
.miroir{background:var(--surface);border-radius:16px;box-shadow:var(--shadow);display:flex;flex-direction:column;gap:10px;
  padding:14px;max-height:100%;width:min(460px,100%)}
.miroir .tete{display:flex;justify-content:space-between;align-items:center;gap:10px}
.miroir .tete h2{margin:0;font-size:16px}
.miroir .cadre{background:#000;border-radius:14px;padding:8px;display:flex;justify-content:center;min-height:200px;flex:1 1 auto;overflow:hidden}
.miroir .cadre img{max-width:100%;max-height:calc(100vh - 260px);object-fit:contain;cursor:pointer;touch-action:none;user-select:none;-webkit-user-drag:none;border-radius:6px}
.miroir .attente{color:#c5cbe8;align-self:center;text-align:center;padding:30px 10px}
.miroir .outils{margin:0;gap:8px}
.miroir .outils input{flex:1 1 140px;min-height:38px}

.toast{position:fixed;left:50%;bottom:calc(20px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);
  background:var(--ink);color:var(--bg);padding:10px 16px;border-radius:10px;font-weight:600;box-shadow:var(--shadow);
  max-width:calc(100vw - 32px);z-index:20}
.toast.erreur{background:var(--alarme);color:#fff}

@media (max-width:860px){ .l8,.l6,.l4{grid-column:span 12} }
@media (max-width:700px){ .barre .compte b{display:none} }
@media (max-width:560px){
  .barre .menu a{padding:6px 6px;font-size:13px}
  .ligne{grid-template-columns:1fr;gap:6px}
  .barre .compte b{display:none}
}
