/* Chantiers · Murat Arzu : charte du cabinet (Geist et Geist Mono, angles droits, couleurs Flux), pensée pour le
   téléphone en plein jour : fond clair, gros contrastes, boutons de 52 px au pouce, actions en bas de l'écran.
   Aucun attribut style dans le HTML : la CSP (public/_headers) l'interdit. */
@font-face {
  font-family: "Geist";
  font-weight: 400 600;
  font-display: swap;
  src: url(/fonts/geist-latin.woff2) format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist";
  font-weight: 400 600;
  font-display: swap;
  src: url(/fonts/geist-latin-ext.woff2) format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
    U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Geist Mono";
  font-weight: 400 500;
  font-display: swap;
  src: url(/fonts/geist-mono-latin.woff2) format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
    U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist Mono";
  font-weight: 400 500;
  font-display: swap;
  src: url(/fonts/geist-mono-fleches.woff2) format("woff2");
  unicode-range: U+2190, U+2192;
}

:root {
  --lin: #f6f5f1;
  --encre: #0a2233;
  --gris: #52606b;
  --filet: #dde3e3;
  --surface: #ecf1ef;
  --blanc: #ffffff;
  --profondeur: #0a3d62;
  --sarcelle: #1b9aaa;
  --sarcelle-texte: #11727e;
  --menthe: #a8e6cf;
  --erreur: #b42318;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --bas: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100dvh;
  font-family:
    Geist,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  font-size: 17px;
  line-height: 1.45;
  color: var(--encre);
  background: var(--lin);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a {
  color: var(--encre);
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  font-weight: 500;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--sarcelle);
  outline-offset: 2px;
}
.mono {
  font-family: var(--mono);
}
.chargement {
  padding: 32px 16px;
  color: var(--gris);
  font-family: var(--mono);
  font-size: 13px;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: calc(96px + var(--bas));
}

/* --- Barre du haut ------------------------------------------------------------------------------ */
.barre {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 16px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--lin);
  border-bottom: 1px solid var(--filet);
}
.barre .titre {
  flex: 1;
  min-width: 0;
}
.barre .titre strong {
  display: block;
  font-weight: 500;
  font-size: 18px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.barre .titre small {
  display: block;
  color: var(--gris);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.retour,
.lien-barre {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  margin: -4px;
  font-family: var(--mono);
  font-size: 20px;
  text-decoration: none;
  color: var(--encre);
}
.lien-barre {
  font-size: 13px;
  padding: 0 8px;
  border: 1px solid var(--filet);
  height: 36px;
  margin: 0;
}
.marque {
  display: flex;
  align-items: center;
  gap: 10px;
}
.marque svg {
  width: 28px;
  height: 28px;
  flex: none;
}
.marque span {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

main {
  padding: 16px;
  display: grid;
  gap: 16px;
}
.sur-titre {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gris);
}
.vide {
  padding: 28px 16px;
  border: 1px dashed var(--filet);
  color: var(--gris);
  text-align: center;
}

/* --- Boutons ------------------------------------------------------------------------------------ */
.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 20px;
  border: 1px solid var(--encre);
  border-radius: 0;
  background: var(--blanc);
  color: var(--encre);
  font-size: 17px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}
.bouton.principal {
  background: var(--encre);
  color: var(--blanc);
}
.bouton.sarcelle {
  background: var(--sarcelle-texte);
  border-color: var(--sarcelle-texte);
  color: var(--blanc);
}
.bouton.discret {
  border-color: var(--filet);
}
.bouton.danger {
  border-color: var(--erreur);
  color: var(--erreur);
}
.bouton.danger.arme {
  background: var(--erreur);
  color: var(--blanc);
}
.bouton.large {
  width: 100%;
}
.bouton:disabled {
  opacity: 0.45;
  cursor: default;
}
.bouton:active:not(:disabled) {
  transform: translateY(1px);
}

.actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  padding: 12px 16px calc(12px + var(--bas));
  background: linear-gradient(to top, var(--lin) 75%, rgba(246, 245, 241, 0));
}
.actions-dedans {
  max-width: 688px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
}
.actions-dedans .bouton {
  flex: 1;
}
.pile {
  display: grid;
  gap: 10px;
}

/* --- Listes ------------------------------------------------------------------------------------- */
.liste {
  display: grid;
  gap: 1px;
  background: var(--filet);
  border: 1px solid var(--filet);
}
.carte-chantier {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  background: var(--blanc);
  text-decoration: none;
}
.carte-chantier .nom {
  font-weight: 500;
  font-size: 18px;
}
.carte-chantier .adresse {
  color: var(--gris);
  font-size: 15px;
}
.carte-chantier .meta {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gris);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.en-cours {
  color: var(--sarcelle-texte);
}
details.archives > summary {
  cursor: pointer;
  padding: 12px 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--gris);
}

/* --- Bandeau de visite -------------------------------------------------------------------------- */
.bandeau {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border-left: 4px solid var(--filet);
  text-decoration: none;
}
.bandeau.ouverte {
  background: var(--encre);
  color: var(--blanc);
  border-left-color: var(--sarcelle);
}
.bandeau .texte {
  flex: 1;
}
.bandeau strong {
  display: block;
  font-weight: 500;
}
.bandeau small {
  font-family: var(--mono);
  font-size: 12px;
  opacity: 0.8;
}
.bandeau .fleche {
  font-family: var(--mono);
  font-size: 20px;
}

/* --- Onglets et puces --------------------------------------------------------------------------- */
.onglets {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--filet);
}
.onglets button {
  flex: 1 0 auto;
  padding: 0 8px;
  white-space: nowrap;
  min-height: 48px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--gris);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.onglets button.actif {
  color: var(--encre);
  border-bottom-color: var(--sarcelle);
  font-weight: 500;
}
.onglets .nb {
  font-family: var(--mono);
  font-size: 12px;
  margin-left: 4px;
}
.puces {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.puce {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--filet);
  background: var(--blanc);
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
}
.puce.active {
  background: var(--encre);
  border-color: var(--encre);
  color: var(--blanc);
}

/* --- Points ------------------------------------------------------------------------------------- */
.groupe {
  display: grid;
  gap: 8px;
}
.groupe h2 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 15px;
}
.groupe h2 .lot {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gris);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.groupe h2 .compte {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gris);
}
.ligne-point {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px;
  background: var(--blanc);
  text-decoration: none;
}
.ligne-point.leve {
  opacity: 0.6;
}
.vignette {
  width: 64px;
  height: 64px;
  object-fit: cover;
  background: var(--surface);
  display: block;
}
.vignette.sans {
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--gris);
}
.ligne-point .haut {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}
.numero {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--sarcelle-texte);
}
.zone {
  color: var(--gris);
}
.ligne-point p {
  margin-top: 2px;
  font-size: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.etiquette {
  display: inline-block;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--surface);
  color: var(--gris);
}
.etiquette.nouveau {
  background: var(--menthe);
  color: var(--encre);
}
.etiquette.leve {
  background: var(--encre);
  color: var(--blanc);
}

/* --- Formulaires -------------------------------------------------------------------------------- */
form {
  display: grid;
  gap: 14px;
}
label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--gris);
}
input,
select,
textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--filet);
  border-radius: 0;
  background: var(--blanc);
  font-size: 17px;
  color: var(--encre);
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--gris) 50%),
    linear-gradient(135deg, var(--gris) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 50%,
    calc(100% - 15px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}
textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.4;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--sarcelle);
}
.aide {
  font-size: 13px;
  color: var(--gris);
}
.erreur-texte {
  color: var(--erreur);
  font-size: 14px;
}
.cadre {
  padding: 14px;
  background: var(--blanc);
  border: 1px solid var(--filet);
  display: grid;
  gap: 12px;
}
details.cadre > summary {
  cursor: pointer;
  font-size: 15px;
  list-style: none;
}
details.cadre > summary::before {
  content: "+ ";
  font-family: var(--mono);
  color: var(--sarcelle-texte);
}
details.cadre[open] > summary::before {
  content: "− ";
}

/* --- Photos ------------------------------------------------------------------------------------- */
.saisie-photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.saisie-photos figure {
  position: relative;
  margin: 0;
  aspect-ratio: 1;
  background: var(--surface);
}
.saisie-photos img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.saisie-photos .retirer {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 32px;
  height: 32px;
  border: 0;
  background: var(--encre);
  color: var(--blanc);
  font-family: var(--mono);
  cursor: pointer;
}
.prise {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  aspect-ratio: 1;
  border: 1px dashed var(--gris);
  background: var(--blanc);
  color: var(--encre);
  font-size: 13px;
  text-align: center;
  cursor: pointer;
}
.prise .signe {
  font-family: var(--mono);
  font-size: 26px;
  line-height: 1;
  color: var(--sarcelle-texte);
}
.prise input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.galerie {
  display: grid;
  gap: 8px;
}
.galerie img {
  width: 100%;
  display: block;
  background: var(--surface);
}
.galerie figure {
  margin: 0;
  position: relative;
}

/* --- Fiche d'un point --------------------------------------------------------------------------- */
.infos {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-size: 15px;
}
.infos dt {
  color: var(--gris);
  font-size: 13px;
  padding-top: 2px;
}
.infos dd {
  margin: 0;
}
.texte-point {
  font-size: 18px;
  white-space: pre-wrap;
}

/* --- Récapitulatif de visite -------------------------------------------------------------------- */
.chiffres {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--filet);
  border: 1px solid var(--filet);
}
.chiffres div {
  background: var(--blanc);
  padding: 12px;
  display: grid;
  gap: 2px;
}
.chiffres strong {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 500;
}
.chiffres span {
  font-size: 12px;
  color: var(--gris);
}
.progression {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--gris);
}
.adresses {
  font-family: var(--mono);
  font-size: 13px;
  word-break: break-all;
  padding: 10px;
  background: var(--surface);
}

/* --- Connexion ---------------------------------------------------------------------------------- */
.connexion {
  min-height: 100dvh;
  display: grid;
  align-content: center;
  gap: 28px;
  padding: 24px;
  max-width: 420px;
  margin: 0 auto;
}
.connexion svg {
  width: 56px;
  height: 56px;
}
.connexion h1 {
  font-size: 26px;
  line-height: 1.2;
}

/* --- Message ------------------------------------------------------------------------------------ */
#message {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(88px + var(--bas));
  z-index: 10;
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 16px;
  background: var(--encre);
  color: var(--blanc);
  font-size: 15px;
}
#message.erreur {
  background: var(--erreur);
}

/* Champ fichier caché dans un bouton (ajout de photo sur la fiche d'un point) */
.prise-ligne {
  position: relative;
}
input.cache {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.saisie-photos.occupe {
  opacity: 0.5;
  pointer-events: none;
}

.lien-discret {
  justify-self: start;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--gris);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --- Plans ------------------------------------------------------------------------------------- */
/* L'écran du plan occupe toute la hauteur : barre du haut, plan, barre d'actions (fixe, 76 px). */
#app.mode-plan { display: flex; flex-direction: column; height: 100dvh; padding-bottom: calc(76px + var(--bas)); }
.plan-cadre {
  position: relative; overflow: hidden; background: var(--surface);
  flex: 1; min-height: 0;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.plan-toile { position: absolute; left: 0; top: 0; background: var(--blanc); box-shadow: 0 0 0 1px var(--filet); }
.plan-toile img { display: block; width: 100%; height: 100%; pointer-events: none; }
.repere {
  position: absolute; transform: translate(-50%, -50%); z-index: 1;
  min-width: 28px; height: 28px; padding: 0 5px; display: grid; place-items: center;
  background: var(--encre); color: var(--blanc); border: 2px solid var(--blanc);
  box-shadow: 0 1px 4px rgba(10, 34, 51, 0.4);
  font-family: var(--mono); font-size: 12px; font-weight: 500; line-height: 1; text-decoration: none;
}
.repere.nouveau { background: var(--menthe); color: var(--encre); }
.repere.leve { background: var(--gris); opacity: 0.8; }
.repere.focus { outline: 3px solid var(--sarcelle); outline-offset: 2px; z-index: 2; }
.repere.choix { background: var(--sarcelle-texte); color: var(--blanc); z-index: 3; }
.plan-commandes { position: absolute; right: 12px; top: 12px; z-index: 4; display: grid; gap: 8px; justify-items: end; }
.plan-commandes button {
  width: 44px; height: 44px; border: 1px solid var(--filet); background: var(--blanc); color: var(--encre);
  font-family: var(--mono); font-size: 20px; cursor: pointer;
}
.plan-commandes .filtre-plan { width: auto; min-width: 44px; padding: 0 8px; font-size: 11px; }
.indication {
  flex: 1; display: grid; place-items: center; min-height: 52px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--filet); font-size: 15px; text-align: center;
}
.ligne-plan {
  display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center;
  padding: 10px; background: var(--blanc); text-decoration: none;
}
.ligne-plan .nom { display: block; font-weight: 500; }
.ligne-plan .meta { display: block; font-family: var(--mono); font-size: 12px; color: var(--gris); }
.vignette-plan { display: block; width: 96px; height: 72px; object-fit: contain; background: var(--blanc); border: 1px solid var(--filet); }
.extrait { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface); border: 1px solid var(--filet); }
.extrait img { position: absolute; max-width: none; pointer-events: none; }
.extrait .repere { left: 50%; top: 50%; }
.emplacement { display: grid; gap: 8px; }
.emplacement > a { display: block; }
.ligne-boutons { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.lieu { display: grid; grid-template-columns: 132px 1fr; gap: 12px; align-items: center; }
.apercu-plan { background: var(--blanc); border: 1px solid var(--filet); min-height: 120px; }
.apercu-plan img { display: block; width: 100%; }

/* --- Réunion de chantier ------------------------------------------------------------------------ */
.titre-cadre { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.titre-cadre h2 { font-size: 15px; }
.presences { gap: 14px; }
.presence { display: grid; gap: 6px; }
.nom-presence { font-size: 15px; color: var(--encre); }
.segments { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--filet); border: 1px solid var(--filet); }
.segment {
  min-height: 44px; border: 0; background: var(--blanc); color: var(--gris); cursor: pointer;
  font-size: 14px;
}
.segment.present.actif { background: var(--sarcelle-texte); color: var(--blanc); }
.segment.absent.actif { background: var(--erreur); color: var(--blanc); }
.segment.excuse.actif { background: var(--gris); color: var(--blanc); }
fieldset.deux { margin: 0; padding: 0; border: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
fieldset.deux legend { padding: 0; margin-bottom: 6px; font-size: 14px; color: var(--gris); }
