/* Recherche immo : design plat, léger et aéré. Pierre claire, encre, terre cuite pour les actions importantes.
   Règles : jamais de barre ni d'accent coloré sur le côté gauche d'un bloc ; boutons de même taille ; pas de blanc sur
   blanc (champs et boutons se détachent toujours de leur fond). */

:root {
  --fond: #F6F3EE;
  --carte: #FFFFFF;
  --sable: #EDE7DD;
  --trait: #DDD5C8;
  --encre: #22201C;
  --doux: #6B655C;
  --accent: #A4532F;
  --accent-fonce: #873F20;
  --accent-clair: #F5E6DD;
  --ok: #2F6B45;
  --ok-fond: #E3EFE6;
  --attention: #8A5A00;
  --attention-fond: #F8EDD3;
  --ko: #9B2C2C;
  --ko-fond: #F6E1E0;
  --rayon: 18px;
  --rayon-petit: 12px;
  --police: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --hauteur-bouton: 42px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--encre); font: 15px/1.55 var(--police); }
a { color: var(--accent-fonce); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 650; }
h1 { font-size: 1.7rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75em; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }

/* ---------- En-tête ---------- */
.topbar { display: flex; align-items: center; gap: 24px; padding: 14px 28px; background: var(--carte); border-bottom: 1px solid var(--trait); position: sticky; top: 0; z-index: 10; }
.brand, .brand-auth { display: inline-flex; align-items: center; gap: 10px; color: var(--encre); text-decoration: none; font-weight: 650; }
.brand-auth { margin-bottom: 18px; color: var(--accent-fonce); }
.nav { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.nav a { padding: 8px 14px; border-radius: 999px; color: var(--doux); text-decoration: none; white-space: nowrap; }
.nav a:hover { background: var(--sable); color: var(--encre); }
.nav a.active { background: var(--sable); color: var(--encre); font-weight: 600; }
.who { display: flex; align-items: center; gap: 8px; }
.who form { margin: 0; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: var(--hauteur-bouton); height: var(--hauteur-bouton); border-radius: 999px; border: 1px solid var(--trait); background: var(--fond); color: var(--encre); cursor: pointer; text-decoration: none; }
.btn-icon:hover, .btn-icon.active { background: var(--sable); }

main { max-width: 1240px; margin: 0 auto; padding: 32px 28px 64px; }
main.narrow { max-width: 620px; }

/* ---------- Blocs ---------- */
.page-head { margin-bottom: 22px; }
.page-head-actions { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.card { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 22px 24px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.card-link { display: block; color: inherit; text-decoration: none; }
.card-link:hover { border-color: var(--accent); }
.grid { display: grid; gap: 20px; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.stack > * + * { margin-top: 14px; }
.stack > .stack, .stack { display: block; }
.mt { margin-top: 20px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 180px; }
.muted { color: var(--doux); }
.small { font-size: .88rem; }
.prewrap { white-space: pre-wrap; }

/* ---------- Tuiles ---------- */
.tiles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.tile { display: flex; flex-direction: column; gap: 2px; background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 18px 20px; color: inherit; text-decoration: none; }
.tile:hover { border-color: var(--accent); }
.tile-value { font-size: 2rem; font-weight: 650; line-height: 1.1; }
.tile-label { color: var(--doux); }
.tile-hint { font-size: .85rem; color: var(--doux); }

/* ---------- Listes ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--sable); }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; color: inherit; text-decoration: none; }
.list-main { flex: 1; display: flex; flex-direction: column; }
.list-plain { margin: 0; padding-left: 18px; }
.list-plain li + li { margin-top: 6px; }
.list-plain li.alert { color: var(--ko); }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 12px; padding: 10px 0; }
.checklist li + li { border-top: 1px solid var(--sable); }
.checklist li > span:last-child { display: flex; flex-direction: column; }
.check { flex: none; width: 24px; height: 24px; border-radius: 999px; border: 1px solid var(--trait); display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; }
.checklist li.done .check { background: var(--ok-fond); border-color: var(--ok-fond); color: var(--ok); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.facts dt { color: var(--doux); }
.facts dd { margin: 0; }

/* ---------- Biens ---------- */
.property h3 { margin: 10px 0 2px; }
.property-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.property-price { font-size: 1.1rem; font-weight: 600; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.score { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 32px; padding: 0 8px; border-radius: 999px; font-weight: 650; }
.score-high { background: var(--ok-fond); color: var(--ok); }
.score-mid { background: var(--attention-fond); color: var(--attention); }
.score-low { background: var(--ko-fond); color: var(--ko); }
.score-none { background: var(--sable); color: var(--doux); }

/* ---------- Étiquettes ---------- */
.tag { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: .82rem; font-weight: 550; white-space: nowrap; }
.tag-ok { background: var(--ok-fond); color: var(--ok); }
.tag-warn { background: var(--attention-fond); color: var(--attention); }
.tag-ko { background: var(--ko-fond); color: var(--ko); }
.tag-neutral { background: var(--sable); color: var(--encre); }
.tag-soft { background: var(--fond); color: var(--doux); border: 1px solid var(--trait); }
.tag-accent { background: var(--accent-clair); color: var(--accent-fonce); }

/* ---------- Onglets et filtres ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--trait); background: var(--carte); color: var(--doux); text-decoration: none; font-size: .92rem; }
.tabs a.active { background: var(--encre); border-color: var(--encre); color: #fff; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.filters input[type="search"] { flex: 1; min-width: 200px; }

/* ---------- Tableaux ---------- */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--sable); vertical-align: top; }
.table th { color: var(--doux); font-weight: 550; font-size: .88rem; background: var(--fond); }
.table tr:last-child td { border-bottom: 0; }
.row-error td { color: var(--ko); }

/* ---------- Formulaires ---------- */
label { display: flex; flex-direction: column; gap: 6px; }
label > span:first-child { font-weight: 550; font-size: .92rem; }
label.inline { flex-direction: row; align-items: center; gap: 10px; }
input, select, textarea { font: inherit; color: var(--encre); background: var(--fond); border: 1px solid var(--trait); border-radius: var(--rayon-petit); padding: 10px 12px; min-height: var(--hauteur-bouton); width: 100%; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; background: #fff; }
textarea { resize: vertical; }
.help { font-size: .85rem; color: var(--doux); }
.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.choice { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { flex-direction: row; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--trait); background: var(--fond); cursor: pointer; font-weight: 500 !important; }
.pill input:checked + span { background: var(--encre); border-color: var(--encre); color: #fff; }
.pill input:focus-visible + span { outline: 2px solid var(--accent); }

/* ---------- Boutons (une seule hauteur partout) ---------- */
.btn, .btn-secondary { display: inline-flex; align-items: center; justify-content: center; height: var(--hauteur-bouton); padding: 0 20px; border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn { background: var(--accent); border: 1px solid var(--accent); color: #fff; }
.btn:hover { background: var(--accent-fonce); border-color: var(--accent-fonce); }
.btn-secondary { background: var(--sable); border: 1px solid var(--trait); color: var(--encre); }
.btn-secondary:hover { background: var(--trait); }
.btn-sm { height: 36px; padding: 0 14px; font-size: .9rem; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-fonce); text-decoration: underline; cursor: pointer; }

/* ---------- Messages ---------- */
.flash { border-radius: var(--rayon-petit); padding: 12px 16px; margin-bottom: 18px; }
.flash-success { background: var(--ok-fond); color: var(--ok); }
.flash-error { background: var(--ko-fond); color: var(--ko); }
.flash-info { background: var(--sable); }

/* ---------- Connexion ---------- */
.auth { min-height: 80vh; display: flex; align-items: center; justify-content: center; }
.auth .card { width: 100%; max-width: 440px; padding: 32px; }
.qr svg { width: 200px; height: 200px; }

/* ---------- Téléphone ---------- */
@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .brand span { display: none; }
  .who { gap: 6px; }
  .btn-icon { width: 38px; height: 38px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .who { margin-left: auto; }
  main { padding: 20px 16px 48px; }
  .grid-2 { grid-template-columns: 1fr; }
  .card { padding: 18px; }
}
