/* Structura Projets — même allure que Structura Pro : beige béton, encre noire, accent ocre de chantier. */
:root {
  --bg: #f2efea; --card: #ffffff; --sunk: #e9e5de; --ink: #14181f; --muted: #6b6760; --line: rgba(20, 24, 31, .1);
  --accent: #14181f; --accent-ink: #f2efea; --ocre: #c8791d; --ocre-bg: #f6e6d0;
  --vert: #2f7d4a; --vert-bg: #dcefe0; --rouge: #b5443b; --rouge-bg: #f7dcd8; --bleu: #3a6ea5; --bleu-bg: #dde8f4;
  --titre: Futura, "Futura PT", "Century Gothic", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --corps: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --ombre: 0 1px 2px rgba(0, 0, 0, .05), 0 6px 20px rgba(0, 0, 0, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b111b; --card: #151c28; --sunk: #1d2533; --ink: #eef0f3; --muted: #98a0ad; --line: rgba(255, 255, 255, .09);
    --accent: #eef0f3; --accent-ink: #0b111b; --ocre: #f0a75c; --ocre-bg: #3a2c1a;
    --vert: #6cc28a; --vert-bg: #1f3a27; --rouge: #f08c80; --rouge-bg: #3d2421; --bleu: #8fb7e6; --bleu-bg: #1d2c40;
    --ombre: 0 0 0 .5px rgba(255, 255, 255, .07);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 var(--corps); }
main { max-width: 680px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px calc(40px + env(safe-area-inset-bottom)); }
h1 { font-family: var(--titre); font-size: 32px; font-weight: 700; margin: 4px 0; letter-spacing: -.01em; overflow-wrap: anywhere; }
h2 { font-family: var(--titre); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 26px 2px 10px; }
a { color: inherit; }
.chargement { color: var(--muted); text-align: center; margin-top: 30vh; }
.marque { font-family: var(--titre); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .16em; margin: 10px 2px 0; color: var(--muted); }
.sous-titre { color: var(--muted); margin: 0 0 14px; }
.muted { color: var(--muted); }
.petit { font-size: 13.5px; }
.vert { color: var(--vert); } .rouge { color: var(--rouge); }
.vide { color: var(--muted); text-align: center; padding: 18px 10px; margin: 0; }
.aide { color: var(--muted); font-size: 14px; margin: 8px 2px; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; font-size: 17px; color: var(--ink); background: var(--sunk); border: 1px solid transparent; border-radius: 12px; padding: 12px; width: 100%; min-height: 46px; }
input[type=range] { padding: 0; background: none; accent-color: var(--ocre); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--ocre); outline-offset: 2px; }
.btn { display: block; width: 100%; border: 0; border-radius: 14px; padding: 15px; background: var(--accent); color: var(--accent-ink); font-family: var(--titre); font-weight: 700; font-size: 17px; text-align: center; letter-spacing: .02em; }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .6; }
.btn.second { background: var(--card); color: var(--ink); box-shadow: var(--ombre); }
.btn.danger { background: transparent; color: var(--rouge); }
.btn.ia { background: var(--ocre); color: #fff; margin-top: 10px; }
.lien { border: 0; background: none; color: var(--ocre); font-weight: 600; padding: 8px 2px; font-size: 16px; }
.lien.rouge { color: var(--rouge); }
.petit-btn { border: 0; background: var(--ocre-bg); color: var(--ocre); font-weight: 700; border-radius: 10px; padding: 8px 13px; font-size: 14px; }
.rond { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--card); box-shadow: var(--ombre); font-size: 20px; }
.carte { display: block; width: 100%; text-align: left; border: 0; background: var(--card); border-radius: 18px; box-shadow: var(--ombre); padding: 14px 16px; text-decoration: none; color: inherit; }
.pile { display: flex; flex-direction: column; gap: 10px; }
.ligne { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tete2 { display: flex; align-items: center; justify-content: space-between; }
.tete2 h2 { margin-bottom: 10px; }
.retour { color: var(--ocre); text-decoration: none; font-weight: 600; padding: 8px 0; }

/* Connexion */
.login { max-width: 340px; margin: 14vh auto 0; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login .icone { width: 96px; height: 96px; border-radius: 22px; margin: 0 auto 8px; box-shadow: 0 10px 28px rgba(0, 0, 0, .2); }
.login h1 { margin: 0; text-transform: uppercase; letter-spacing: .06em; font-size: 28px; }
.login h1 .fin { color: var(--ocre); }
.login input { text-align: center; }
.err { color: var(--rouge); font-weight: 600; min-height: 1.2em; margin: 0; }

/* Projets */
.projet { display: flex; flex-direction: column; gap: 4px; }
.projet .nom { font-family: var(--titre); font-size: 21px; }
.type { display: inline-block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 3px 8px; border-radius: 6px; background: var(--bleu-bg); color: var(--bleu); }
.type.auto { background: var(--ocre-bg); color: var(--ocre); }
.pastille-txt { font-size: 12px; font-weight: 700; color: var(--vert); }
.avance { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.avance span { flex: none; min-width: 42px; }
.barre { flex: 1; height: 8px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.barre i { display: block; height: 100%; background: var(--vert); border-radius: 99px; }
.barre.jaune i { background: var(--ocre); } .barre.rouge i { background: var(--rouge); }
.chiffres { display: flex; gap: 18px; font-size: 14px; color: var(--muted); margin-top: 4px; }
.chiffres b { color: var(--ink); font-variant-numeric: tabular-nums; }
.alertes { display: flex; gap: 6px; flex-wrap: wrap; }
.alertes:empty { display: none; }
.alerte { font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--rouge-bg); color: var(--rouge); }
.alerte.jaune { background: var(--ocre-bg); color: var(--ocre); }

/* Un projet */
.titre-projet { margin-top: 8px; }
.onglets { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 16px; padding: 2px 16px 4px; scrollbar-width: none; position: sticky; top: 0; z-index: 5; background: var(--bg); }
.onglets::-webkit-scrollbar { display: none; }
.onglets a { flex: none; text-decoration: none; padding: 9px 14px; border-radius: 99px; background: var(--card); box-shadow: var(--ombre); font-weight: 600; font-size: 15px; color: var(--muted); }
.onglets a.on { background: var(--accent); color: var(--accent-ink); }
.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.stat span { font-size: 13px; color: var(--muted); }
.stat b { display: block; font-family: var(--titre); font-size: 30px; margin: 2px 0 8px; font-variant-numeric: tabular-nums; }
.stat.mauvais b { color: var(--rouge); }
.pile-serre .rang { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 15px; }
.pile-serre .rang:first-child { border-top: 0; }
.pile-serre .rang span { color: var(--muted); }
.pile-serre .rang b { font-variant-numeric: tabular-nums; text-align: right; }
.alerte-carte { margin-top: 10px; background: var(--rouge-bg); color: var(--rouge); font-weight: 600; box-shadow: none; }
.etape b, .st b { font-weight: 650; }
.etape .petit, .st .petit { display: block; margin-top: 2px; }
.puce { flex: none; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--sunk); color: var(--muted); }
.puce.fait, .puce.termine, .puce.retenu { background: var(--vert-bg); color: var(--vert); }
.puce.retard { background: var(--rouge-bg); color: var(--rouge); }
.puce.cours, .puce.en_cours { background: var(--ocre-bg); color: var(--ocre); }
.puce.j-inspection { background: var(--bleu-bg); color: var(--bleu); }
.puce.j-deficience { background: var(--rouge-bg); color: var(--rouge); }
.journal.fait .puce.j-deficience { background: var(--vert-bg); color: var(--vert); }
.journal p { margin: 8px 0 0; white-space: pre-wrap; }
.journal img { display: block; width: 100%; max-height: 320px; object-fit: cover; border-radius: 12px; margin-top: 10px; }
.rangee { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rangee > div { min-width: 0; }
.rangee > div b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rangee > b { flex: none; font-variant-numeric: tabular-nums; }
.tableau { padding: 6px 12px; }
.t-tete, .t-rang { display: grid; grid-template-columns: minmax(0, 1fr) 72px 72px 72px; gap: 6px; align-items: center; width: 100%; border: 0; background: none; text-align: left; padding: 9px 0; font-size: 14px; border-top: 1px solid var(--line); }
.t-tete { border-top: 0; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.t-tete span:not(:first-child), .t-rang span:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.t-rang span:first-child { overflow-wrap: break-word; hyphens: auto; line-height: 1.25; }
.t-rang.total { font-size: 12.5px; }
.t-rang.total { font-weight: 700; border-top: 2px solid var(--ink); }
.seg { display: flex; background: var(--sunk); border-radius: 12px; padding: 3px; gap: 3px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: none; padding: 9px 6px; border-radius: 9px; font-weight: 600; font-size: 14.5px; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.petit-seg button { font-size: 13.5px; padding: 8px 4px; }

/* Rapport de l'agent IA */
.rapport { margin-top: 10px; border-left: 4px solid var(--ocre); }
.rapport .resume { font-size: 16px; margin: 6px 0 12px; }
.rapport .reco { background: var(--ocre-bg); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.rapport .reco p { margin: 4px 0 0; }
.rapport ul { margin: 4px 0 10px; padding-left: 20px; }
.rapport li { margin: 3px 0; font-size: 14.5px; }
.rapport details { border-top: 1px solid var(--line); padding: 10px 0; }
.rapport summary { display: flex; justify-content: space-between; gap: 10px; cursor: pointer; list-style: none; }
.rapport summary::-webkit-details-marker { display: none; }
.rapport summary::before { content: "›"; color: var(--muted); margin-right: 6px; transition: transform .15s; display: inline-block; }
.rapport details[open] summary::before { transform: rotate(90deg); }
.rapport summary b { flex: 1; }
.rapport summary span { font-variant-numeric: tabular-nums; font-weight: 600; }
.roue { display: inline-block; width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -2px; animation: tourne .8s linear infinite; margin-right: 6px; }
@keyframes tourne { to { transform: rotate(360deg); } }

/* Feuilles (formulaires) */
#sheet:empty { display: none; }
.fond { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .35); display: flex; align-items: flex-end; justify-content: center; }
.feuille { width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; animation: monte .2s ease-out; }
@keyframes monte { from { transform: translateY(40px); opacity: 0; } }
.f-tete { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; position: sticky; top: -10px; background: var(--bg); z-index: 2; padding: 4px 0; }
.f-tete b { font-family: var(--titre); font-size: 17px; text-align: center; }
.f-tete > :last-child { justify-self: end; }
.f-tete > :first-child { justify-self: start; }
.feuille h2 { margin: 14px 2px 0; }
.champ { display: flex; flex-direction: column; gap: 5px; }
.champ > span { font-size: 13.5px; font-weight: 600; color: var(--muted); padding-left: 2px; }
.deux { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.deux input { min-width: 0; }
input[type=date] { -webkit-appearance: none; appearance: none; }
.coche { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.coche input { width: 22px; height: 22px; min-height: 0; flex: none; accent-color: var(--ocre); margin: 0; }
.rapides { display: flex; gap: 6px; }
.rapides button { flex: 1; border: 0; background: var(--sunk); border-radius: 10px; padding: 8px 0; font-weight: 600; font-size: 14px; }
.depot { display: block; border: 2px dashed var(--line); border-radius: 14px; padding: 16px; text-align: center; font-weight: 600; color: var(--muted); cursor: pointer; background: var(--card); }
.lien-doc { color: var(--ocre); font-weight: 600; text-align: center; }
.apercu { width: 100%; max-height: 240px; object-fit: cover; border-radius: 12px; }

#toast { position: fixed; left: 50%; bottom: calc(30px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 99px; font-weight: 600; font-size: 15px; max-width: 90vw; text-align: center; }

/* Comptes (administrateur) */
.compte { display: flex; flex-direction: column; gap: 3px; }
.compte.inactif { opacity: .6; }
.actions-c { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.rouge-btn { background: var(--rouge-bg); color: var(--rouge); }
.code-gros { font-family: ui-monospace, Menlo, monospace; font-size: 26px; letter-spacing: .08em; }
a.btn { text-decoration: none; }
