/* Côté client : reprise fidèle de la maquette « Mon carnet maison ». */
/* Charte Bougeard : fond blanc, marine dominante, touches de jaune. Polices hébergées ici (pas d'appel à Google). */
@font-face { font-family: "Lora"; font-weight: 500; font-display: swap; src: url(/fonts/lora-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 400; font-display: swap; src: url(/fonts/poppins-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 500; font-display: swap; src: url(/fonts/poppins-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-display: swap; src: url(/fonts/poppins-latin-600-normal.woff2) format("woff2"); }


/* Layout : une colonne de téléphone centrée, un écran visible à la fois, charte Bougeard (fond blanc, marine, touches de jaune) */
:root {
  --navy: #251B64;
  --navy-2: #3B2F96;
  --yellow: #FDCC03;
  --tint: #FFF6CC;
  --paper: #FBFAF4;
  --soft: #F6F5FA;
  --rule: #E7E5EF;
  --line: #D6D3E3;
  --muted: #5E5C78;
  --white: #FFFFFF;
  --on-navy-muted: #D9D6EC;
  --display: "Lora", Georgia, "Times New Roman", serif;
  --body: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light dark;
}
html, body { background: var(--white); color: var(--navy); }
body { font-family: var(--body); font-size: 15px; line-height: 1.45; }
* { box-sizing: border-box; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
a { color: var(--navy); }

.app { max-width: 480px; margin: 0 auto; min-height: 100%; }
.screen { padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); padding-block: 20px 36px; display: flex; flex-direction: column; gap: 22px; }
.bleed { margin-left: calc(-1 * max(20px, env(safe-area-inset-left, 0px))); margin-right: calc(-1 * max(20px, env(safe-area-inset-right, 0px))); }

h1 { margin: 0; font-family: var(--display); font-weight: 500; font-size: 26px; line-height: 1.2; text-wrap: balance; }
h2.label { margin: 0; font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sub { margin: 0; font-size: 14px; color: var(--muted); }
.tick { width: 32px; height: 3px; background: var(--yellow); }

.head { display: flex; align-items: center; gap: 12px; }
.round { width: 44px; height: 44px; flex-shrink: 0; border: 1px solid var(--rule); border-radius: 22px; background: var(--white); display: flex; align-items: center; justify-content: center; }
.round svg { width: 20px; height: 20px; }

.btn { height: 52px; width: 100%; border: none; border-radius: 6px; background: var(--navy); color: var(--white); font-size: 16px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn:hover { background: var(--navy-2); }
.btn svg { width: 20px; height: 20px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; }
.input { height: 50px; padding: 0 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); font-size: 15px; }

/* Connexion */
.login { min-height: 100%; padding-block: 56px 32px; gap: 36px; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.brand img { width: min(300px, 80%); height: auto; }
.help { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--rule); text-align: center; display: flex; flex-direction: column; gap: 2px; }
.help span:first-child { font-size: 13px; color: var(--muted); }
.help strong { font-weight: 500; user-select: all; }

/* Accueil */
.topbar { display: flex; align-items: center; justify-content: space-between; }
.topbar img { width: 140px; height: auto; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { min-height: 132px; padding: 18px 16px; border: 1px solid var(--rule); border-radius: 8px; background: var(--white); text-align: left; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; }
.tile svg { width: 30px; height: 30px; }
.tile b { display: block; font-size: 16px; font-weight: 500; }
.tile small { font-size: 12px; color: var(--muted); }
.tile.strong { background: var(--navy); border-color: var(--navy); color: var(--white); }
.tile.strong small { color: var(--on-navy-muted); }
.tile:hover { border-color: var(--navy); }
.callout { padding: 16px; border-radius: 8px; background: var(--soft); display: flex; align-items: center; gap: 14px; }
.callout .ico { width: 44px; height: 44px; flex-shrink: 0; border-radius: 22px; background: var(--tint); display: flex; align-items: center; justify-content: center; }
.callout .ico svg { width: 22px; height: 22px; }
.callout .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.linkbtn { border: none; background: none; padding: 8px 0; font-size: 13px; font-weight: 500; text-decoration: underline; white-space: nowrap; }
.install { padding: 14px 16px; border: 1px dashed var(--line); border-radius: 8px; font-size: 13px; color: var(--muted); display: flex; gap: 12px; align-items: flex-start; }
.install b { color: var(--navy); font-weight: 500; }
.foot { padding-top: 16px; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }

/* Plan du toit */
.plan { background: var(--paper); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding-block: 14px 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.roof { position: relative; width: 100%; max-width: 420px; aspect-ratio: 390 / 250; }
.roof svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.roof .lbl { font-family: var(--body); font-size: 11px; fill: var(--muted); }
.zone { position: absolute; transform: translate(-50%, -50%); min-height: 32px; padding: 0 10px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255,255,255,.94); font-size: 11px; font-weight: 500; white-space: nowrap; }
.zone[aria-pressed="true"] { background: var(--yellow); border: 1.5px solid var(--navy); box-shadow: 0 0 0 4px rgba(253,204,3,.35); }
.hint { font-size: 12px; color: var(--muted); }
.zone.pin { width: 26px; min-height: 0; height: 26px; padding: 0; border-radius: 13px; border: 1.5px solid var(--navy); font-size: 12px; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.legend { padding: 0 16px; justify-content: center; }
.legend .chip { min-height: 34px; font-size: 12px; padding: 0 10px; }

/* Listes */
.rows { display: flex; flex-direction: column; }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.row span:first-child { color: var(--muted); }
.row span:last-child { font-weight: 500; text-align: right; }
.cards { display: flex; flex-direction: column; gap: 10px; }
.card { border: 1px solid var(--rule); border-radius: 8px; background: var(--white); }
.card.open { border-color: var(--navy); }
.card-h { width: 100%; padding: 14px; border: none; background: none; text-align: left; display: flex; gap: 12px; align-items: center; }
.card-h .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.card-h b { font-size: 14px; font-weight: 500; }
.card-h small { font-size: 12px; color: var(--muted); }
.kind { width: 40px; height: 40px; flex-shrink: 0; border-radius: 20px; display: flex; align-items: center; justify-content: center; background: var(--soft); }
.kind svg { width: 20px; height: 20px; }
.kind.sav { background: var(--tint); }
.kind.chantier { background: var(--navy); }
.badge { padding: 3px 8px; border-radius: 10px; background: var(--yellow); font-size: 11px; font-weight: 500; }
.chev { width: 18px; height: 18px; transition: transform .2s; }
.card.open .chev { transform: rotate(180deg); }
.card-b { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 12px; }
.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.ph { aspect-ratio: 4 / 3; border-radius: 4px; background: var(--rule); display: flex; align-items: flex-end; padding: 6px; font-size: 11px; max-width: 100%; }
.doc { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; border-top: 1px solid var(--rule); font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--white); font-size: 13px; }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--white); }
.step { display: flex; flex-direction: column; gap: 10px; }
.step > span { font-size: 13px; color: var(--muted); }
.addphoto { aspect-ratio: 4 / 3; border: 1.5px dashed var(--navy); border-radius: 6px; background: var(--white); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; overflow: hidden; position: relative; }
.addphoto input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.thumb { aspect-ratio: 4 / 3; border-radius: 6px; background: var(--soft) center / cover no-repeat; }
.track { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.track .on { color: var(--navy); font-weight: 600; }
.notice { padding: 12px 14px; border-radius: 8px; background: var(--tint); font-size: 14px; }

/* Signalements suivis sur l'accueil */
.report { width: 100%; padding: 14px; border: 1.5px solid var(--navy); border-radius: 8px; background: var(--white); text-align: left; display: flex; flex-direction: column; gap: 8px; }
.report-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.report-top b { font-size: 15px; font-weight: 500; }
.report small, .report .desc { font-size: 13px; color: var(--muted); }
.report .desc { font-style: italic; overflow-wrap: anywhere; }
.proposal { padding: 12px; border-radius: 8px; background: var(--tint); display: flex; flex-direction: column; gap: 10px; }
.proposal b { font-weight: 600; }
.twobtn { display: flex; flex-wrap: wrap; gap: 8px; }
.twobtn .btn { height: 44px; flex: 1 1 140px; font-size: 14px; }
.btn.ghost { background: var(--white); color: var(--navy); border: 1px solid var(--line); }
.bell-dot { position: absolute; top: 6px; right: 7px; width: 10px; height: 10px; border-radius: 5px; background: var(--yellow); border: 2px solid var(--white); }
.notif { padding: 12px 14px; border-radius: 8px; background: var(--navy); color: var(--white); font-size: 14px; display: flex; gap: 10px; align-items: center; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { padding: 4px 10px; border-radius: 12px; font-size: 12px; background: var(--soft); color: var(--muted); }
.pill.done { background: var(--navy); color: var(--white); }
.pill.now { background: var(--yellow); color: var(--navy); font-weight: 600; }
textarea.input { height: auto; padding: 12px 14px; line-height: 1.45; resize: vertical; }

/* Messagerie */
.chat { flex: 1; padding: 18px max(20px, env(safe-area-inset-right, 0px)) 18px max(20px, env(safe-area-inset-left, 0px)); background: var(--paper); display: flex; flex-direction: column; gap: 14px; min-height: 340px; }
.msg { max-width: 80%; display: flex; flex-direction: column; gap: 4px; }
.msg.me { align-self: flex-end; }
.msg .who { font-size: 12px; color: var(--muted); }
.bubble { padding: 12px 14px; font-size: 14px; border-radius: 14px; }
.me .bubble { background: var(--navy); color: var(--white); border-bottom-right-radius: 4px; }
.them .bubble { background: var(--white); border: 1px solid var(--rule); border-bottom-left-radius: 4px; }
.composer { display: flex; gap: 10px; align-items: center; padding-block: 14px; }
.composer .input { flex: 1; min-width: 0; height: 46px; border-radius: 23px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (prefers-reduced-motion: no-preference) {
  .screen { animation: in .22s ease-out; }
  @keyframes in { from { opacity: .4; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

/* --- Ajouts pour l'appli en ligne --- */
.screen { min-height: 100vh; }
a.tile, a.round, a.btn, a.linkbtn { text-decoration: none; color: inherit; }
a.tile.strong { color: var(--white); }
a.btn { color: var(--white); }
a.btn.ghost { color: var(--navy); }
.linkbtn { color: var(--navy); }
form { margin: 0; }
.plan .roof { aspect-ratio: auto; max-width: 480px; }
.plan .roof img { display: block; width: 100%; height: auto; }
.roof.clickable { cursor: crosshair; touch-action: manipulation; }
.roof .zone.pin { pointer-events: none; display: flex; align-items: center; justify-content: center; background: var(--white); color: var(--navy); }
.roof .zone.pin.traite { background: var(--navy); color: var(--white); }
.roof .zone.pin.new { background: var(--yellow); width: 32px; height: 32px; border-radius: 16px; font-size: 18px; }
.view3d { position: relative; width: 100%; aspect-ratio: 4 / 3; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--soft); }
.view3d iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.flash { padding: 12px 14px; border-radius: 8px; background: var(--tint); font-size: 14px; }
.flash.error { background: #FDECEC; color: #9B1C1C; }
.empty { padding: 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; font-size: 14px; }
details.card > summary { list-style: none; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
details.card[open] { border-color: var(--navy); }
details.card[open] .chev { transform: rotate(180deg); }
.ph { background: var(--rule) center / cover no-repeat; text-decoration: none; color: var(--navy); }
.ph img { display: none; }
a.chip { display: inline-flex; align-items: center; text-decoration: none; color: var(--navy); }
a.chip.on { background: var(--navy); border-color: var(--navy); color: var(--white); }
label.chip { display: inline-flex; align-items: center; cursor: pointer; font-weight: 400; }
label.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
label.chip:has(input:checked) { background: var(--navy); border-color: var(--navy); color: var(--white); }
label.chip:has(input:focus-visible) { outline: 2px solid var(--navy); outline-offset: 2px; }
.addphoto span { pointer-events: none; text-align: center; padding: 0 6px; }
.photorow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.chat .day { align-self: center; font-size: 12px; color: var(--muted); }
.ecrire { padding-bottom: 0; gap: 0; }
.ecrire > * + * { margin-top: 16px; }
.ecrire .chat { margin-top: 16px; }
.closed { padding: 12px 20px; background: var(--tint); font-size: 13px; }
.closed b { font-weight: 600; display: block; }
.composer .send { width: 46px; height: 46px; flex-shrink: 0; border: none; border-radius: 23px; background: var(--navy); color: var(--yellow); display: flex; align-items: center; justify-content: center; }
.composer .send svg { width: 20px; height: 20px; }
.preview { padding: 10px 14px; border-radius: 8px; background: var(--tint); font-size: 13px; }
.small { font-size: 12px; color: var(--muted); }
.login form { display: flex; flex-direction: column; gap: 16px; }
.login .input.code { font-size: 24px; letter-spacing: 8px; text-align: center; }
.textpage p { margin: 0; font-size: 14px; }
[hidden] { display: none !important; }
.notif svg { width: 20px; height: 20px; flex-shrink: 0; }
.addphoto svg { width: 26px; height: 26px; }
textarea, input { font: inherit; }
.round svg { color: var(--navy); }
.kind.divers { background: var(--soft); }

/* Téléphone en mode sombre : on déclare gérer le sombre pour que le navigateur n'assombrisse pas
   l'appli tout seul (logo grisé, couleurs inversées). La charte reste claire : fond blanc, marine. */
@media (prefers-color-scheme: dark) {
  html, body { background: #FFFFFF; color: #251B64; }
  input, select, textarea { background: #FFFFFF; color: #251B64; }
}
