/* Gestion des loyers — mobile d'abord, gros boutons, contraste élevé */
:root {
  --fond: #f6f8f7;
  --carte: #ffffff;
  --encre: #182222;
  --discret: #5b6b6b;
  --filet: #dfe5e3;
  --accent: #0f6e56;
  --accent-fonce: #0a5241;
  --accent-clair: #e3f1ec;
  --rouge: #b42318;
  --rouge-clair: #fdecea;
  --orange: #b54708;
  --orange-clair: #fef3e2;
  --vert: #087443;
  --vert-clair: #e5f5ec;
  --gris-clair: #eef1f0;
  --rayon: 14px;
  --ombre: 0 1px 2px rgba(16, 24, 24, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; overflow-x: hidden; background: var(--fond); color: var(--encre);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 88px;
}
a { color: var(--accent); }
h1 { font-size: 1.45rem; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 28px 0 10px; }
.discret { color: var(--discret); font-size: .92rem; }
.conteneur { max-width: 760px; margin: 0 auto; padding: 16px; }

/* barre du haut */
.entete { background: var(--accent); color: #fff; }
.entete .conteneur { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; padding-bottom: 12px; }
.entete a { color: #fff; text-decoration: none; font-weight: 600; }
.entete .marque { font-size: 1.05rem; }
.entete form button { background: none; border: 0; color: #d6ece4; font: inherit; font-size: .9rem; cursor: pointer; }

/* navigation du bas */
.nav-bas {
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--carte); border-top: 1px solid var(--filet);
  display: flex; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 10;
}
.nav-bas a {
  flex: 1; text-align: center; text-decoration: none; color: var(--discret); font-size: .78rem; padding: 6px 2px;
  border-radius: 10px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.nav-bas a svg { width: 24px; height: 24px; }
.nav-bas a.actif { color: var(--accent); font-weight: 600; }
.nav-bas a.encaisser { color: #fff; background: var(--accent); margin: 0 4px; }

/* cartes et chiffres */
.carte { background: var(--carte); border: 1px solid var(--filet); border-radius: var(--rayon); padding: 16px; box-shadow: var(--ombre); }
.carte + .carte { margin-top: 12px; }
.grille-chiffres { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.chiffre { background: var(--carte); border: 1px solid var(--filet); border-radius: var(--rayon); padding: 14px; }
.chiffre .valeur { font-size: clamp(1.05rem, 4.6vw, 1.35rem); overflow-wrap: anywhere; font-weight: 700; font-variant-numeric: tabular-nums; }
.chiffre .libelle { color: var(--discret); font-size: .85rem; }
.chiffre.alerte { background: var(--rouge-clair); border-color: #f5c2bd; }
.chiffre.alerte .valeur { color: var(--rouge); }
.chiffre.ok .valeur { color: var(--vert); }

/* boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px;
  border-radius: 12px; border: 1px solid var(--filet); background: var(--carte); color: var(--encre);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn-principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-principal:active { background: var(--accent-fonce); }
.btn-whatsapp { background: #1f8f4e; border-color: #1f8f4e; color: #fff; }
.btn-danger { color: var(--rouge); border-color: #f5c2bd; }
.btn-large { width: 100%; font-size: 1.1rem; min-height: 60px; }
.btn-petit { min-height: 40px; padding: 0 14px; font-size: .92rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions .btn { flex: 1 1 auto; }

/* listes */
.liste { list-style: none; margin: 0; padding: 0; background: var(--carte); border: 1px solid var(--filet); border-radius: var(--rayon); overflow: hidden; }
.liste li { padding: 14px 16px; border-top: 1px solid var(--filet); }
.liste li:first-child { border-top: 0; }
.liste a.ligne { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.ligne .titre { font-weight: 600; }
.ligne .montant { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.montant.rouge { color: var(--rouge); }
.montant.barre { text-decoration: line-through; color: var(--discret); }

/* pastilles de statut */
.pastille { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.pastille.payee { background: var(--vert-clair); color: var(--vert); }
.pastille.partielle { background: var(--orange-clair); color: var(--orange); }
.pastille.en_retard { background: var(--rouge-clair); color: var(--rouge); }
.pastille.due, .pastille.a_venir { background: var(--gris-clair); color: var(--discret); }
.pastille.annule { background: var(--gris-clair); color: var(--discret); }

/* calendrier 12 mois */
.calendrier { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mois { border-radius: 10px; padding: 10px 8px; text-align: center; font-size: .82rem; border: 1px solid var(--filet); background: var(--gris-clair); color: var(--discret); }
.mois strong { display: block; font-size: .95rem; }
.mois.payee { background: var(--vert-clair); color: var(--vert); border-color: #b7e3c9; }
.mois.partielle { background: var(--orange-clair); color: var(--orange); border-color: #f8d9a8; }
.mois.en_retard { background: var(--rouge-clair); color: var(--rouge); border-color: #f5c2bd; }

/* formulaires */
label { display: block; font-weight: 600; margin: 16px 0 6px; }
input[type=text], input[type=number], input[type=date], input[type=tel], input[type=password], select, textarea {
  width: 100%; min-height: 52px; padding: 12px 14px; font: inherit; border: 1px solid #c9d2cf; border-radius: 12px; background: #fff; color: var(--encre);
}
input:focus, select:focus { outline: 3px solid var(--accent-clair); border-color: var(--accent); }
.aide { color: var(--discret); font-size: .85rem; margin-top: 4px; }
.erreur, .errorlist { color: var(--rouge); font-size: .9rem; margin: 6px 0 0; padding: 0; list-style: none; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.modes label { margin: 0; font-weight: 500; border: 1px solid #c9d2cf; border-radius: 12px; padding: 14px; display: flex; align-items: center; gap: 10px; background: #fff; cursor: pointer; }
.modes input { width: 20px; height: 20px; accent-color: var(--accent); }
.modes label:has(input:checked) { border-color: var(--accent); background: var(--accent-clair); font-weight: 700; }
.resume-solde { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: var(--accent-clair); font-size: .95rem; display: none; }

/* messages */
.messages { list-style: none; padding: 0; margin: 0 0 12px; }
.messages li { padding: 12px 14px; border-radius: 12px; margin-bottom: 8px; background: var(--vert-clair); color: var(--vert); font-weight: 600; }
.messages li.error { background: var(--rouge-clair); color: var(--rouge); }
.bandeau-hors-ligne { display: none; background: var(--orange-clair); color: var(--orange); text-align: center; padding: 10px; font-weight: 600; font-size: .92rem; }
body.hors-ligne .bandeau-hors-ligne { display: block; }

/* tableaux simples */
table.simple { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.simple th, table.simple td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--filet); }
table.simple td.n, table.simple th.n { text-align: right; font-variant-numeric: tabular-nums; }

details.zone { margin-top: 16px; background: var(--carte); border: 1px solid var(--filet); border-radius: var(--rayon); padding: 4px 16px; }
details.zone summary { cursor: pointer; font-weight: 600; padding: 12px 0; }

.connexion { max-width: 420px; margin: 8vh auto 0; }
.vide { text-align: center; padding: 28px 16px; color: var(--discret); }

/* formulaires de gestion */
.retour { display: inline-block; margin: 4px 0 10px; text-decoration: none; font-weight: 600; font-size: .95rem; }
.titre-section { margin: 0 0 4px; font-size: 1.05rem; }
form .carte { margin-top: 16px; }
.champ { margin-top: 14px; }
.champ label { margin: 0 0 6px; }
.champ .facultatif { font-weight: 400; color: var(--discret); font-size: .82rem; margin-left: 4px; }
.champ.en-erreur input, .champ.en-erreur select, .champ.en-erreur textarea { border-color: var(--rouge); }
textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
input[type=file] { font: inherit; font-size: .95rem; width: 100%; padding: 10px; border: 1px dashed #b9c4c0; border-radius: 12px; background: var(--fond); }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 8px 14px; margin-right: 10px; background: var(--accent-clair); color: var(--accent-fonce); cursor: pointer; }
.champ a { word-break: break-all; }
label.case { display: flex; align-items: center; gap: 10px; font-weight: 500; margin: 0; cursor: pointer; }
label.case input { width: 22px; height: 22px; accent-color: var(--accent); }
.deux-colonnes { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 560px) { .deux-colonnes { grid-template-columns: 1fr 1fr; } }

.lot-ligne { border: 1px solid var(--filet); border-radius: 12px; padding: 4px 14px 14px; margin-top: 12px; background: var(--fond); }
.lot-champs { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 560px) { .lot-champs { grid-template-columns: 1.1fr 1fr 1fr; } }
.lot-ligne .supprimer { margin-top: 12px; color: var(--rouge); font-size: .92rem; }
.btn-lien { background: none; border: 0; color: var(--discret); min-height: 36px; padding: 0; margin-top: 10px; text-decoration: underline; }
.btn-ajout { width: 100%; margin-top: 12px; border-style: dashed; color: var(--accent); background: transparent; }

.barre-actions {
  position: sticky; bottom: 76px; z-index: 5; display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 16px; padding: 12px; background: rgba(246, 248, 247, .94); backdrop-filter: blur(6px);
  border: 1px solid var(--filet); border-radius: var(--rayon);
}
.barre-actions .btn { flex: 1; }
@media (min-width: 560px) { .barre-actions .btn { flex: 0 0 auto; min-width: 150px; } }
.alerte-carte { background: var(--rouge-clair); color: var(--rouge); border-color: #f5c2bd; font-weight: 600; }
.entete-section { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 10px; }
.entete-section h2 { margin: 0; }

@media (min-width: 760px) {
  .nav-bas { justify-content: center; gap: 8px; }
  .nav-bas a { flex: 0 0 120px; }
}
