/* UpPlex — mobile-first, simple, en français. */
:root {
  /* Thème noir et or (choisi par Ulrick le 27 nov. 2026).
     --vert garde son nom historique mais porte l'or de marque. */
  --vert: #d4af37;
  --vert-clair: #2b2513;
  --fond: #0f0f11;
  --carte: #1a1a1e;
  --texte: #f2efe9;
  --texte-doux: #a8a29e;
  --bordure: #37332a;
  --accent: #e3b341;
  --danger: #e5484d;
  --rayon: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--fond); color: var(--texte); line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
/* Typographie plus légère et claire (demande d'Ulrick, 4 déc. 2026) :
   les graisses vivent dans la plage 400-600, jamais 700/800. */
strong, b { font-weight: 600; }
h1, h2, h3, h4 { font-weight: 600; }
.conteneur { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* Barre du haut */
.barre-haut { background: #000; color: var(--vert); border-bottom: 1px solid var(--bordure); position: sticky; top: 0; z-index: 10; }
.barre-haut-contenu { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; }
.logo { font-weight: 600; font-size: 1.1rem; display: inline-flex; align-items: center; gap: 9px; }
.logo-img { width: 30px; height: 30px; display: block; }
.zone-utilisateur { font-size: .85rem; display: flex; gap: 8px; align-items: center; }
.zone-utilisateur button {
  background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.3);
  border-radius: 8px; padding: 6px 10px; font-size: .8rem; cursor: pointer;
}

/* Fil d'Ariane */
.fil-ariane { padding: 12px 0 0; display: flex; gap: 8px; flex-wrap: wrap; }
.fil-ariane button {
  background: none; border: none; color: var(--vert); font-size: .9rem; cursor: pointer; padding: 4px 0;
  text-decoration: underline;
}

/* Messages */
.message { margin: 12px 0; padding: 12px 14px; border-radius: var(--rayon); font-size: .95rem; }
.message.succes { background: var(--vert-clair); border: 1px solid #57491c; }
.message.erreur { background: #33191b; border: 1px solid #6e2b2e; color: var(--danger); }

/* Cartes */
.carte { background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 16px; margin: 12px 0; }
.carte h2, .carte h3 { margin: 0 0 10px; }
.carte h2 { font-size: 1.25rem; }
.carte h3 { font-size: 1.05rem; color: var(--vert); }
.cliquable { cursor: pointer; }
.cliquable:active { transform: scale(.99); }

/* Formulaires */
label { display: block; font-size: .9rem; font-weight: 500; margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; padding: 12px; font-size: 1rem; border: 1px solid var(--bordure);
  border-radius: 10px; background: #232327; color: var(--texte); font-family: inherit;
}
input[type="file"] { padding: 8px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--vert); border-color: var(--vert); }
.rang { display: flex; gap: 10px; }
.rang > * { flex: 1; }
.aide { font-size: .8rem; color: var(--texte-doux); margin-top: 2px; }

/* Boutons */
.btn {
  display: inline-block; width: 100%; padding: 14px; margin-top: 12px; font-size: 1rem; font-weight: 600;
  border: none; border-radius: 10px; background: var(--vert); color: #171410; cursor: pointer;
}
.btn:active { opacity: .9; }
.btn-secondaire { background: transparent; color: var(--vert); border: 2px solid var(--vert); }
.btn-danger { background: transparent; color: var(--danger); border: 2px solid var(--danger); }
.btn-petit { width: auto; padding: 8px 14px; font-size: .85rem; margin-top: 8px; }

/* Listes */
.liste { list-style: none; padding: 0; margin: 0; }
.liste li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 4px; border-bottom: 1px solid var(--bordure);
}
.liste li:last-child { border-bottom: none; }
.puce {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600;
}
.puce.loue { background: var(--vert-clair); color: var(--vert); }
.puce.vacant { background: #3a2f10; color: var(--accent); }
.puce.inc { background: #232946; color: #a5b4fc; }
.puce.particulier { background: #2e1a47; color: #d8b4fe; }

/* Stats */
.grille-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.stat { background: var(--vert-clair); border-radius: 10px; padding: 12px; text-align: center; }
.stat .valeur { font-size: 1.3rem; font-weight: 600; color: var(--vert); }
.stat .etiquette { font-size: .75rem; color: var(--texte-doux); }

/* Photo */
.photo-immeuble { width: 100%; max-height: 240px; object-fit: cover; border-radius: 10px; margin-bottom: 8px; }

/* Onglets */
.onglets { display: flex; gap: 8px; margin: 12px 0; overflow-x: auto; }
.onglets button {
  flex: 1; white-space: nowrap; padding: 10px; border-radius: 10px; border: 1px solid var(--bordure);
  background: var(--carte); color: var(--texte); font-size: .9rem; cursor: pointer;
}
.onglets button.actif { background: var(--vert); color: #171410; border-color: var(--vert); font-weight: 600; }

/* Divers */
.chargement { text-align: center; color: var(--texte-doux); padding: 40px 0; }
.vide { text-align: center; color: var(--texte-doux); padding: 20px 0; font-size: .95rem; }
.code-invitation {
  font-family: ui-monospace, monospace; font-size: 1.4rem; font-weight: 600; letter-spacing: 2px;
  background: #241d08; border: 2px dashed var(--accent); border-radius: 10px;
  padding: 12px; text-align: center; margin: 8px 0; color: var(--accent);
}
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--vert); font-weight: 500; }
.pied { text-align: center; color: var(--texte-doux); padding: 24px 0 40px; }
.montant { font-variant-numeric: tabular-nums; }
.danger-zone { border-color: #6e2b2e; }

/* Phase 2 : tableaux du bilan annuel */
.tableau { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .95rem; }
.tableau th, .tableau td { padding: 8px 6px; border-bottom: 1px solid var(--bordure, #e5e7eb); text-align: left; }
.tableau th { color: var(--texte-doux); font-weight: 500; font-size: .85rem; }
.tableau td.montant, .tableau th.montant { text-align: right; }

/* Phase 3 : tâches & calendrier */
.tache-ligne { display: flex; gap: 10px; align-items: flex-start; }
.coche { width: 22px; height: 22px; margin-top: 2px; flex-shrink: 0; cursor: pointer; }
.tache-faite { opacity: .65; }
.tache-faite strong { text-decoration: line-through; }
.retard { color: var(--danger); }
.puce.auto { background: #0c2d3f; color: #7dd3fc; }
.puce.recurrente { background: #3a2f10; color: var(--accent); }
.jour-cal { font-weight: 600; color: var(--vert); margin: 14px 0 4px; }

/* Phase 4 : suivi des loyers */
.puce.paye { background: var(--vert-clair); color: var(--vert); }
.puce.partiel { background: #3a2f10; color: var(--accent); }
.puce.en_retard { background: #3a1d1f; color: var(--danger); }
.puce.en_attente { background: #2c2c30; color: var(--texte-doux); }
.nav-mois { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.nav-mois .btn-petit { margin-top: 0; }
.message-genere {
  white-space: pre-wrap; font-size: .88rem; background: var(--fond);
  border: 1px solid var(--bordure); border-radius: 10px; padding: 10px;
}

/* Phase 7 : carte des immeubles (Leaflet + tuiles OpenStreetMap) */
#carte-immeubles {
  height: 60vh; min-height: 300px; width: 100%;
  border-radius: 10px; position: relative; z-index: 0; /* contexte d'empilement : les panneaux Leaflet ne dépassent pas sur la barre du haut */
}
#carte-immeubles .leaflet-popup-content { font-size: .95rem; line-height: 1.5; }
#carte-immeubles .leaflet-popup-content .btn { margin-top: 8px; }

/* Barre de navigation du bas (style appli mobile, demande d'Ulrick 4 déc. 2026).
   Fixe, mobile d'abord ; sur grand écran elle reste centrée sur la largeur
   du conteneur de l'appli (720 px, comme .conteneur). */
body.avec-barre-bas { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.barre-bas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: #000; border-top: 1px solid var(--bordure);
  padding-bottom: env(safe-area-inset-bottom);
}
.barre-bas-contenu { max-width: 720px; margin: 0 auto; display: flex; }
.barre-bas button {
  flex: 1; background: none; border: none; cursor: pointer; font-family: inherit;
  color: var(--texte-doux); display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 8px 2px 7px; font-size: .68rem; font-weight: 500; line-height: 1.2;
}
.barre-bas button svg { width: 23px; height: 23px; display: block; }
.barre-bas button.actif { color: var(--vert); }
.barre-bas button:active { opacity: .75; }

/* Panneau « Plus » : les sections secondaires, au-dessus de la barre du bas. */
.panneau-plus {
  position: fixed; left: 0; right: 0; z-index: 39;
  bottom: calc(62px + env(safe-area-inset-bottom));
}
.panneau-plus-contenu {
  max-width: 720px; margin: 0 auto; padding: 0 12px;
}
.panneau-plus-carte {
  background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--rayon);
  box-shadow: 0 -6px 28px rgba(0, 0, 0, .55); padding: 8px; display: grid;
  grid-template-columns: 1fr 1fr; gap: 4px;
}
.panneau-plus-carte button {
  background: none; border: none; cursor: pointer; font-family: inherit; text-align: left;
  color: var(--texte); font-size: .95rem; padding: 12px; border-radius: 8px;
  display: flex; align-items: center; gap: 10px;
}
.panneau-plus-carte button svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--vert); }
.panneau-plus-carte button:active { background: var(--vert-clair); }

/* Autocomplétion d'adresse (Nominatim / OpenStreetMap) dans les formulaires
   d'immeuble : liste déroulante tactile sous le champ adresse. */
.champ-adresse-bloc { position: relative; }
.suggestions-adresse {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin-top: 4px;
  background: #232327; border: 1px solid var(--bordure); border-radius: 10px;
  overflow: hidden; box-shadow: 0 10px 28px rgba(0, 0, 0, .55);
}
.suggestion-adresse {
  display: block; width: 100%; text-align: left; background: none; border: none;
  border-bottom: 1px solid var(--bordure); padding: 11px 12px; cursor: pointer;
  color: var(--texte); font-family: inherit;
}
.suggestion-adresse:last-child { border-bottom: none; }
.suggestion-adresse:hover, .suggestion-adresse:active { background: var(--vert-clair); }
.suggestion-l1 { display: block; font-size: .95rem; }
.suggestion-l2 { display: block; font-size: .8rem; color: var(--texte-doux); margin-top: 1px; }
