/* SLS TWO — interface web. Design system repris de la maquette Codex :
   sidebar sombre à accents rouges, panneaux blancs arrondis, topbar translucide,
   Century Gothic, rouge SLS réservé aux accents (jamais en aplat de texte courant). */
:root {
  --encre: #000000;
  --encre-douce: #3f3f3f;
  --nuit: #111111;
  --nuit-relief: #242424;
  --rouge: #c00000;
  --rouge-sombre: #9f0c0e;
  --rouge-voile: #fbeaea;
  --papier: #f2f2f2;
  --surface: #ffffff;
  --filet: rgba(0, 0, 0, 0.15);
  --filet-sombre: rgba(0, 0, 0, 0.28);
  --sourdine: #6b6b6b;
  --ombre: 0 8px 24px rgba(0, 0, 0, 0.06);
  --ombre-forte: 0 18px 48px rgba(0, 0, 0, 0.10);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font-family: "Century Gothic", Futura, "Trebuchet MS", Arial, sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(192, 0, 0, 0.3);
  outline-offset: 2px;
}
a { color: inherit; }

/* ================= coquille ================= */
.coquille {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  background:
    linear-gradient(90deg, transparent 99%, rgba(0, 0, 0, 0.04) 100%) 0 0 / 54px 54px,
    var(--papier);
}
body.mode-connexion .coquille { grid-template-columns: minmax(0, 1fr); }
body.mode-connexion #sidebar, body.mode-connexion #topbar { display: none; }

/* ---------- sidebar ---------- */
#sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 5;
  display: flex;
  flex-direction: column;
  padding: 24px 16px 16px;
  overflow-y: auto;
  color: #e9eded;
  background:
    linear-gradient(145deg, rgba(192, 0, 0, 0.16), transparent 30%),
    var(--nuit);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.marque {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: white;
  margin-bottom: 22px;
}
.marque img { width: 100%; display: block; object-fit: cover; }
.marque .produit {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 8px;
  color: white;
  border-radius: 6px;
  background: var(--rouge);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.nav-groupe { margin-bottom: 18px; }
.nav-titre {
  margin: 0 0 6px;
  padding: 0 10px;
  color: #8a8a8a;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.nav-item {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  color: #ababab;
  text-decoration: none;
  border-radius: 9px;
  font-size: 12px;
  transition: color 150ms ease, background 150ms ease;
}
.nav-item:hover { color: white; background: rgba(255, 255, 255, 0.05); }
.nav-item.actif {
  color: white;
  background: linear-gradient(90deg, rgba(192, 0, 0, 0.34), rgba(192, 0, 0, 0.08));
}
.nav-item.actif::before {
  content: "";
  position: absolute;
  left: -16px;
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--rouge);
}
.nav-marque {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 10px;
  font-weight: 700;
}
.nav-item.actif .nav-marque {
  color: #f7c8c9;
  border-color: rgba(192, 0, 0, 0.55);
  background: rgba(192, 0, 0, 0.2);
}
.sidebar-pied {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.carte-utilisateur {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 6px 12px;
}
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: white;
  background: linear-gradient(135deg, var(--rouge), var(--rouge-sombre));
  font-size: 12px;
  font-weight: 700;
}
.carte-utilisateur b { display: block; color: white; font-size: 12px; }
.carte-utilisateur span { color: #9a9a9a; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.sidebar-pied .actions { display: grid; gap: 6px; }
.sidebar-pied .actions button {
  width: 100%;
  padding: 7px 10px;
  color: #cfcfcf;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 11px;
}
.sidebar-pied .actions button:hover { color: white; border-color: rgba(255, 255, 255, 0.3); }

/* ---------- zone principale ---------- */
.zone-principale { display: flex; flex-direction: column; min-width: 0; }
#topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 30px;
  border-bottom: 1px solid var(--filet);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
}
#fil-ariane { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--sourdine); min-width: 0; }
#fil-ariane b { color: var(--encre); }
#fil-ariane .separateur { color: #c4c4c4; }
#topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--sourdine); }
main#app { padding: 16px 22px 44px; width: 100%; }

/* ================= typographie de page ================= */
.sur-titre, #app h1 + .note { color: var(--rouge-sombre); }
#app h1 {
  margin: 0 0 3px;
  font-size: 19px;
  letter-spacing: -0.02em;
}
#app h2 {
  margin: 16px 0 8px;
  color: var(--encre);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
#app h2::before { content: "— "; color: var(--rouge); }
.chargement { color: var(--sourdine); }
.note { font-size: 11px; color: var(--sourdine); margin: 3px 0 8px; line-height: 1.45; }
p { line-height: 1.5; }

/* ================= composants ================= */
button, .btn {
  min-height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 650;
  color: #555555;
  border: 1px solid var(--filet-sombre);
  background: white;
  transition: background 120ms ease, border-color 120ms ease;
}
button:hover, .btn:hover { border-color: #8f8f8f; }
button.principal {
  color: white;
  border: 1px solid var(--nuit);
  background: var(--nuit);
  box-shadow: 0 7px 15px rgba(0, 0, 0, 0.14);
}
button.principal:hover { background: var(--nuit-relief); }
button.discret { min-height: 28px; padding: 0 10px; font-size: 10.5px; color: #666; border-color: var(--filet); box-shadow: none; }
button.discret:hover { border-color: var(--rouge); color: var(--rouge-sombre); }
button:disabled { opacity: 0.45; cursor: default; }

/* tableaux : panneaux blancs, en-tête clair en majuscules (le rouge charte reste
   réservé aux documents Word — à l'écran, il accentue sans dominer) */
table {
  width: 100%;
  margin: 6px 0 12px;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--filet);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--ombre);
}
th {
  padding: 7px 10px;
  color: #8b8b8b;
  text-align: left;
  background: #f7f8f7;
  border-bottom: 1px solid var(--filet);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
td {
  padding: 6px 10px;
  border-bottom: 1px solid #eef0ee;
  font-size: 12px;
  background: var(--surface);
}
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fbf9f9; }
td.actions { white-space: nowrap; width: 1%; }
tr.inactif td { color: #999; }
td a { color: var(--rouge-sombre); text-decoration: none; border-bottom: 1px dotted rgba(159, 12, 14, 0.5); }
td a:hover { border-bottom-style: solid; }

/* formulaires */
form.ligne {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: flex-end;
  margin: 8px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--filet);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--ombre);
}
form.ligne label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #7d7d7d;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
input, select, textarea {
  min-height: 30px;
  padding: 5px 9px;
  color: var(--encre);
  border: 1px solid #cfcfcf;
  border-radius: 8px;
  background: #fbfbfb;
  font-size: 12.5px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}
textarea { line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(192, 0, 0, 0.55);
  background: white;
}

/* badges et pastilles */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--filet-sombre);
  color: #555;
  background: white;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
  margin-left: 8px;
}
.badge.plein {
  color: white;
  border-color: var(--rouge);
  background: var(--rouge);
}

/* cartes */
.carte {
  padding: 10px 14px;
  margin: 8px 0;
  border: 1px solid var(--filet);
  border-left: 4px solid var(--rouge);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--ombre);
  line-height: 1.55;
}

/* barre d'avancement du registre */
.avancement {
  display: flex;
  height: 10px;
  min-width: 140px;
  border-radius: 999px;
  overflow: hidden;
  background: #e7e7e7;
  border: 1px solid var(--filet);
}
.avancement div { height: 100%; }

.erreur-msg {
  padding: 10px 14px;
  margin: 10px 0;
  color: var(--rouge-sombre);
  border: 1px solid rgba(192, 0, 0, 0.35);
  border-radius: 10px;
  background: var(--rouge-voile);
  font-size: 12px;
}

/* ---------- écran de connexion ---------- */
#connexion {
  max-width: 380px;
  margin: 14vh auto 0;
  padding: 28px 30px 26px;
  border-left: none;
  box-shadow: var(--ombre-forte);
}
#connexion::before {
  content: "";
  display: block;
  height: 3px;
  margin: -28px -30px 24px;
  background: var(--rouge);
  border-radius: 12px 12px 0 0;
}
#connexion h1 { margin: 0 0 18px; font-size: 19px; }
#connexion form { display: flex; flex-direction: column; gap: 12px; }
#connexion label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #7d7d7d;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.connexion-logo { display: block; max-width: 210px; margin: 6vh auto 0; }

/* ---------- fiche projet : grille des paramètres ---------- */
.grille-fiche {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 6px 12px;
  padding: 12px 14px;
  border: 1px solid var(--filet);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--ombre);
}
.grille-fiche label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: #7d7d7d;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- géométrie (arbre) ---------- */
.arbre-batiment { padding: 10px 14px; }
.arbre-batiment > .entete-bat { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.arbre-batiment .entete-bat h2 { margin: 0; }
.arbre-batiment .entete-bat h2::before { content: none; }
.niveau-bloc { margin: 10px 0 10px 18px; border-left: 2px solid var(--filet); padding-left: 14px; }
.niveau-bloc > b { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--encre-douce); }

/* onglets (héritage — plus utilisés, la navigation est dans la sidebar) */
.onglets { display: none; }

/* liens de retour */
#app > p:first-child a { color: var(--sourdine); text-decoration: none; font-size: 11.5px; }
#app > p:first-child a:hover { color: var(--rouge-sombre); }

/* ---------- sélecteur de projet (sidebar) ---------- */
.selecteur-projet {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  margin-bottom: 16px;
  color: white;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
}
.selecteur-projet:hover { border-color: rgba(192, 0, 0, 0.6); }
.monogramme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  color: white;
  background: var(--rouge);
  font-size: 11px;
  font-weight: 700;
}
.selecteur-projet b { display: block; font-size: 12px; letter-spacing: 0.02em; }
.selecteur-projet span { color: #9a9a9a; font-size: 10px; }
.socle-carte {
  margin: 14px 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(192, 0, 0, 0.14);
  border: 1px solid rgba(192, 0, 0, 0.3);
}
.socle-carte b { display: block; color: #f0caca; font-size: 11px; }
.socle-carte span { color: #b08a8a; font-size: 9.5px; }
.nav-compte {
  justify-self: end;
  min-width: 18px;
  padding: 1px 6px;
  text-align: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 9px;
  font-weight: 700;
}
.nav-item { grid-template-columns: 26px 1fr auto; }

/* ---------- carte héros « préparation de l'étude » ---------- */
.heros {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  margin: 10px 0 12px;
  padding: 18px 22px;
  border-radius: 16px;
  overflow: hidden;
  color: #f3e9e9;
  background:
    radial-gradient(120% 160% at 90% -20%, rgba(192, 0, 0, 0.55), transparent 55%),
    linear-gradient(120deg, #2a0505, #101010 55%);
  box-shadow: var(--ombre-forte);
}
.heros .sur-titre {
  margin: 0 0 8px;
  color: #e79a9b;
  font-size: 9.5px;
  font-weight: 760;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
#app .heros h2 { margin: 0 0 6px; color: white; font-size: 21px; letter-spacing: -0.02em; text-transform: none; }
#app .heros h2::before { content: none; }
.heros h2 em { font-style: normal; color: #f2a9aa; }
.heros p { margin: 0 0 8px; color: #c9baba; font-size: 12px; max-width: 60ch; }
.heros a { color: #f2a9aa; font-size: 11.5px; font-weight: 700; text-decoration: none; }
.heros a:hover { color: white; }
.anneau { position: relative; width: 92px; height: 92px; }
.anneau svg { transform: rotate(-90deg); }
.anneau .fond { stroke: rgba(255, 255, 255, 0.14); }
.anneau .valeur { stroke: var(--rouge); stroke-linecap: round; transition: stroke-dashoffset 600ms ease; }
.anneau b {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
}
.anneau b small { color: #9c8d8d; font-size: 8.5px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.1em; }

/* ---------- cartes métriques ---------- */
.grille-metriques {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}
.metrique {
  position: relative;
  min-height: 78px;
  padding: 10px 13px;
  border: 1px solid var(--filet);
  border-radius: 13px;
  overflow: hidden;
  background: white;
  box-shadow: var(--ombre);
}
.metrique::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 36px;
  height: 4px;
  background: var(--rouge);
}
.metrique p {
  margin: 0 0 8px;
  color: #7d7d7d;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.metrique strong { font-size: 24px; letter-spacing: -0.04em; }
.metrique span { color: #686868; font-size: 10px; margin-left: 6px; }
.metrique small { display: block; margin-top: 4px; color: #9d9d9d; font-size: 9px; }

/* ---------- panneau priorités ---------- */
.priorites { padding: 0; overflow: hidden; border-left: 1px solid var(--filet); }
.priorites .entete-panneau { padding: 14px 18px 8px; }
.entete-panneau .sur-titre {
  margin: 0 0 4px;
  color: var(--rouge-sombre);
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.entete-panneau h3 { margin: 0; font-size: 15px; }
.priorite-item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 7px 14px;
  border-top: 1px solid #eef0ee;
  text-decoration: none;
  color: inherit;
}
.priorite-item:hover { background: #fbf9f9; }
.priorite-item .puce {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--filet);
  background: #f7f4f4;
  color: var(--rouge-sombre);
  font-size: 10px;
  font-weight: 700;
}
.priorite-item b { display: block; font-size: 12px; }
.priorite-item span { color: #8b8b8b; font-size: 10.5px; }
.priorite-item .fleche { color: var(--rouge-sombre); font-weight: 700; }

/* ---------- état vide ---------- */
.etat-vide { text-align: center; padding: 20px 10px; color: #8b8b8b; font-size: 12px; }
.etat-vide::before {
  content: "⌀";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-bottom: 10px;
  border-radius: 11px;
  color: white;
  background: var(--nuit);
  font-size: 15px;
}
.etat-vide span { display: block; }

@media (max-width: 900px) {
  .coquille { grid-template-columns: minmax(0, 1fr); }
  #sidebar { position: fixed; inset: auto 0 0 0; height: auto; flex-direction: row; align-items: center; gap: 8px; padding: 8px; overflow-x: auto; }
  .marque, .sidebar-pied, .nav-titre { display: none; }
  .nav-groupe { display: flex; margin: 0; }
  main#app { padding: 18px 14px 90px; }
}
