/* SANOU NAFA — interface d'enquête · made by IKOSMART v1.0 */

:root {
  --papier: #EFF2EE;
  --surface: #FFFFFF;
  --surface-2: #F7F9F6;
  --encre: #16211E;
  --encre-2: #5C6862;
  --encre-3: #8A948E;
  --or: #8A6A12;
  --or-vif: #C89A21;
  --or-clair: #F5EBD0;
  --teal: #1B5C57;
  --alerte: #A93E27;
  --alerte-clair: #FBEDE9;
  --valide: #2E6B34;
  --trait: #D5DBD6;
  --trait-fort: #B4BDB7;
  --r: 3px;
  --ombre: 0 1px 2px rgba(22, 33, 30, .06), 0 8px 24px -12px rgba(22, 33, 30, .18);
  --police: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--police);
  background: var(--papier);
  color: var(--encre);
  font-size: 15px;
  line-height: 1.45;
  overscroll-behavior-y: contain;
}

button, input, select, textarea { font: inherit; color: inherit; }

.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--encre-3);
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- Barre supérieure ---------- */
.barre {
  position: sticky; top: 0; z-index: 40;
  background: var(--encre); color: #EFF2EE;
  padding: 10px 16px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .2);
}
.barre .marque { display: flex; flex-direction: column; line-height: 1.15; margin-right: auto; min-width: 0; }
.barre .marque b { font-size: 14px; letter-spacing: .04em; font-weight: 700; }
.barre .marque span { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #96A099; }

.pastille {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  padding: 5px 10px; border-radius: 100px;
  background: rgba(255, 255, 255, .1); color: #DDE3DE; white-space: nowrap;
}
.pastille .point { width: 7px; height: 7px; border-radius: 50%; background: var(--or-vif); }
.pastille.hors .point { background: #C0785B; }
.pastille.attente .point { background: var(--or-vif); animation: pulse 1.4s infinite; }
.pastille.ok .point { background: #6FB07A; }
@keyframes pulse { 50% { opacity: .25; } }

/* ---------- Boutons ---------- */
.btn {
  appearance: none; border: 1px solid var(--trait-fort); background: var(--surface);
  color: var(--encre); padding: 11px 16px; border-radius: var(--r);
  font-size: 14px; font-weight: 600; cursor: pointer; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-2); border-color: var(--encre-3); }
.btn:active { transform: translateY(1px); }
.btn.principal { background: var(--encre); border-color: var(--encre); color: #F4F7F3; }
.btn.principal:hover { background: #22322D; }
.btn.or { background: var(--or); border-color: var(--or); color: #FFF9EC; }
.btn.or:hover { background: #9C7915; }
.btn.discret { background: transparent; border-color: transparent; color: var(--encre-2); padding: 8px 10px; }
.btn.discret:hover { background: rgba(22, 33, 30, .06); }
.btn.danger { color: var(--alerte); border-color: #E3C6BE; }
.btn.danger:hover { background: var(--alerte-clair); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.petit { padding: 7px 11px; min-height: 34px; font-size: 13px; }

:focus-visible { outline: 2px solid var(--or-vif); outline-offset: 2px; }

/* ---------- Écran de connexion ---------- */
.portail {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(120% 90% at 50% -10%, #24352F 0%, #16211E 55%, #0E1614 100%);
}
.portail .carte {
  width: 100%; max-width: 400px; background: var(--surface);
  border-radius: 4px; padding: 34px 30px 28px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .6);
}
.portail .sceau {
  width: 46px; height: 46px; border: 2px solid var(--or); border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
  color: var(--or); letter-spacing: .02em; margin-bottom: 18px;
}
.portail h1 { font-size: 21px; margin: 0 0 4px; letter-spacing: -.01em; }
.portail p.sous { margin: 0 0 24px; color: var(--encre-2); font-size: 13px; }
.portail .pied { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--trait); display: flex; justify-content: space-between; align-items: center; }

/* ---------- Mise en page principale ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 20px 16px 120px; }

.accueil-grille { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.tuile {
  background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r);
  padding: 22px; cursor: pointer; text-align: left; position: relative; overflow: hidden;
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.tuile::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--or);
  transform: scaleY(0); transform-origin: top; transition: transform .2s;
}
.tuile:hover { border-color: var(--encre-3); box-shadow: var(--ombre); transform: translateY(-1px); }
.tuile:hover::before { transform: scaleY(1); }
.tuile h3 { margin: 8px 0 6px; font-size: 17px; letter-spacing: -.01em; }
.tuile p { margin: 0; color: var(--encre-2); font-size: 13px; }

/* ---------- Rail de progression (log stratigraphique) ---------- */
.chantier { display: grid; grid-template-columns: 210px 1fr; gap: 26px; align-items: start; }

.rail { position: sticky; top: 74px; }
.rail .titre-rail { margin-bottom: 10px; }
.strate {
  display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: center;
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  padding: 7px 6px; border-radius: var(--r); color: var(--encre-2); font-size: 13px;
}
.strate:hover { background: rgba(22, 33, 30, .05); color: var(--encre); }
.strate .jauge {
  height: 26px; border-radius: 2px; background: var(--trait); position: relative; overflow: hidden;
}
.strate .jauge i {
  position: absolute; inset: auto 0 0 0; background: var(--or-vif);
  transition: height .35s cubic-bezier(.2, .7, .3, 1); height: 0;
}
.strate.active { color: var(--encre); font-weight: 650; }
.strate.active .jauge { box-shadow: inset 0 0 0 2px var(--encre); }
.strate .n { font-family: var(--mono); font-size: 10px; color: var(--encre-3); }

/* ---------- Sections du formulaire ---------- */
.bloc {
  background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r);
  margin-bottom: 14px; scroll-margin-top: 78px;
}
.bloc > header {
  padding: 14px 18px; border-bottom: 1px solid var(--trait);
  display: flex; align-items: baseline; gap: 12px;
}
.bloc > header .num {
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--or);
  border: 1px solid var(--or-clair); background: var(--or-clair); padding: 2px 7px; border-radius: 2px;
}
.bloc > header h2 { margin: 0; font-size: 15px; letter-spacing: -.005em; }
.bloc .note {
  padding: 10px 18px; font-size: 12.5px; color: var(--encre-2);
  background: var(--surface-2); border-bottom: 1px solid var(--trait);
}
.bloc .corps { padding: 16px 18px 20px; display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

.champ { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.champ.full { grid-column: 1 / -1; }
.champ > label { font-size: 12.5px; font-weight: 600; color: var(--encre-2); }
.champ > label .u { font-weight: 400; color: var(--encre-3); }
.champ > label .req { color: var(--alerte); }
.champ .aide { font-size: 11.5px; color: var(--encre-3); }

input[type=text], input[type=number], input[type=tel], input[type=date], input[type=time],
input[type=password], select, textarea {
  width: 100%; padding: 10px 11px; min-height: 44px;
  border: 1px solid var(--trait-fort); border-radius: var(--r);
  background: var(--surface); transition: border-color .12s, box-shadow .12s;
}
input[type=number], input[type=date], input[type=time] { font-family: var(--mono); font-variant-numeric: tabular-nums; }
textarea { min-height: 78px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--encre); box-shadow: 0 0 0 3px rgba(200, 154, 33, .22);
}
input::placeholder { color: var(--encre-3); }

.separateur {
  grid-column: 1 / -1; margin: 8px 0 0; padding-top: 12px; border-top: 1px solid var(--trait);
  font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--or);
}

/* Choix segmentés */
.choix { display: flex; flex-wrap: wrap; gap: 6px; }
.choix label {
  position: relative; display: inline-flex; align-items: center;
  padding: 9px 13px; min-height: 42px; border: 1px solid var(--trait-fort);
  border-radius: var(--r); background: var(--surface); cursor: pointer;
  font-size: 13.5px; user-select: none; transition: all .12s;
}
.choix input { position: absolute; opacity: 0; pointer-events: none; }
.choix label:hover { border-color: var(--encre-3); background: var(--surface-2); }
.choix input:checked + span { font-weight: 650; }
.choix label:has(input:checked) { background: var(--encre); border-color: var(--encre); color: #F4F7F3; }
.choix label:has(input:checked).danger { background: var(--alerte); border-color: var(--alerte); }
.choix input:focus-visible + span { outline: 2px solid var(--or-vif); outline-offset: 4px; }

/* Tableaux répétables */
.tableau { grid-column: 1 / -1; }
.tableau > .chapeau { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tableau > .chapeau h4 { margin: 0; font-size: 13px; font-weight: 700; color: var(--or); letter-spacing: .01em; }
.defile { overflow-x: auto; border: 1px solid var(--trait); border-radius: var(--r); }
table.grille { width: 100%; border-collapse: collapse; min-width: 620px; }
table.grille th {
  background: var(--surface-2); text-align: left; padding: 9px 10px;
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--encre-2); border-bottom: 1px solid var(--trait); white-space: nowrap;
}
table.grille td { padding: 5px 6px; border-bottom: 1px solid var(--trait); vertical-align: middle; }
table.grille tr:last-child td { border-bottom: 0; }
table.grille td.libelle { font-size: 13px; font-weight: 550; min-width: 190px; background: var(--surface-2); }
table.grille input[type=text], table.grille input[type=number] { min-height: 38px; padding: 7px 8px; border-color: var(--trait); }
table.grille .choix label { padding: 6px 10px; min-height: 34px; font-size: 12.5px; }
table.grille .num-ligne { font-family: var(--mono); font-size: 11px; color: var(--encre-3); width: 30px; text-align: center; }
.case-oui { width: 22px; height: 22px; accent-color: var(--or); cursor: pointer; }

/* Photos */
.photos { grid-column: 1 / -1; }
.vignettes { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.vignette { position: relative; width: 104px; }
.vignette img { width: 104px; height: 104px; object-fit: cover; border-radius: var(--r); border: 1px solid var(--trait); display: block; }
.vignette button {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: rgba(22, 33, 30, .82); color: #fff; cursor: pointer; font-size: 14px; line-height: 1;
}
.vignette input { margin-top: 5px; font-size: 11px; padding: 5px 6px; min-height: 30px; }

/* ---------- Barre d'actions fixe ---------- */
.actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(239, 242, 238, .94); backdrop-filter: blur(8px);
  border-top: 1px solid var(--trait-fort); padding: 10px 16px;
}
.actions .dedans { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.actions .info { margin-right: auto; font-size: 12.5px; color: var(--encre-2); min-width: 0; }

/* ---------- Listes, tables admin ---------- */
.panneau { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r); padding: 18px; }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r); padding: 16px; border-left: 3px solid var(--or); }
.stat .v { font-family: var(--mono); font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat.alerte { border-left-color: var(--alerte); }
.stat.alerte .v { color: var(--alerte); }

.barres { display: grid; gap: 7px; }
.barre-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.barre-item .piste { grid-column: 1 / -1; height: 6px; background: var(--surface-2); border-radius: 100px; overflow: hidden; }
.barre-item .piste i { display: block; height: 100%; background: var(--or-vif); border-radius: 100px; }
.barre-item .n { font-family: var(--mono); font-weight: 700; font-size: 13px; }

table.liste { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.liste th {
  text-align: left; padding: 10px; font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--encre-2); border-bottom: 1px solid var(--trait-fort); white-space: nowrap;
}
table.liste td { padding: 10px; border-bottom: 1px solid var(--trait); }
table.liste tr:hover td { background: var(--surface-2); }
.marque-etat { display: inline-block; padding: 2px 8px; border-radius: 100px; font-size: 11px; font-weight: 650; background: var(--surface-2); border: 1px solid var(--trait); }
.marque-etat.actif { background: #E9F2E9; border-color: #C2DCC4; color: var(--valide); }
.marque-etat.chaud { background: var(--alerte-clair); border-color: #E3C6BE; color: var(--alerte); }
.marque-etat.or { background: var(--or-clair); border-color: #E4D3A6; color: var(--or); }

.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--trait); margin-bottom: 18px; overflow-x: auto; }
.onglets button {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 11px 14px;
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--encre-2); white-space: nowrap;
}
.onglets button.actif { color: var(--encre); border-bottom-color: var(--or); }

.filtres { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filtres select, .filtres input { min-height: 40px; width: auto; min-width: 130px; }

/* ---------- Messages ---------- */
.message { padding: 11px 14px; border-radius: var(--r); font-size: 13.5px; margin-bottom: 14px; border: 1px solid; }
.message.erreur { background: var(--alerte-clair); border-color: #E3C6BE; color: #7E2D1B; }
.message.succes { background: #EAF3EA; border-color: #C2DCC4; color: #23532A; }
.message.info { background: var(--or-clair); border-color: #E4D3A6; color: #6B520C; }

.toast {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%);
  background: var(--encre); color: #F4F7F3; padding: 12px 18px; border-radius: 100px;
  font-size: 13.5px; z-index: 60; box-shadow: var(--ombre); max-width: 90vw; text-align: center;
}

.vide { text-align: center; padding: 52px 20px; color: var(--encre-2); }
.vide h3 { margin: 0 0 6px; color: var(--encre); font-size: 16px; }

.modale { position: fixed; inset: 0; background: rgba(14, 22, 20, .55); z-index: 70; display: grid; place-items: center; padding: 16px; }
.modale .boite { background: var(--surface); border-radius: 4px; max-width: 920px; width: 100%; max-height: 88dvh; overflow: auto; }
.modale .boite > header { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--trait); padding: 14px 18px; display: flex; align-items: center; gap: 12px; }
.modale .boite > header h3 { margin: 0; font-size: 16px; margin-right: auto; }

dl.detail { margin: 0; display: grid; grid-template-columns: minmax(160px, 34%) 1fr; }
dl.detail dt { padding: 8px 10px; font-size: 12.5px; color: var(--encre-2); border-bottom: 1px solid var(--trait); background: var(--surface-2); }
dl.detail dd { padding: 8px 10px; margin: 0; font-size: 13.5px; border-bottom: 1px solid var(--trait); }

.pied-marque { text-align: center; padding: 26px 16px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--encre-3); }

/* ---------- Adaptatif ---------- */
@media (max-width: 900px) {
  .chantier { grid-template-columns: 1fr; gap: 12px; }
  .rail { position: sticky; top: 58px; z-index: 20; background: var(--papier); padding: 8px 0; margin: 0 -16px; padding-inline: 16px; border-bottom: 1px solid var(--trait); }
  .rail .titre-rail { display: none; }
  .rail .strates { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .rail .strates::-webkit-scrollbar { display: none; }
  .strate { grid-template-columns: 1fr; gap: 4px; min-width: 76px; padding: 6px; text-align: center; }
  .strate .jauge { height: 5px; }
  .strate .lib { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bloc .corps { grid-template-columns: 1fr; }
  dl.detail { grid-template-columns: 1fr; }
  dl.detail dt { border-bottom: 0; padding-bottom: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media print {
  .barre, .actions, .rail, .onglets, .filtres { display: none !important; }
  body { background: #fff; }
  .bloc { border-color: #999; break-inside: avoid; }
}
