/* Style Classical : voir design.md. Une page de livre : fond papier, encre chaude, filets fins, un seul accent or posé en trait.
   Titres en Cormorant Garamond, texte en Lora (polices locales, OFL). Statut des locataires en vert / orange. */
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 400; font-display: swap; src: url("vendor/fonts/cormorant-garamond-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 600; font-display: swap; src: url("vendor/fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 400; font-display: swap; src: url("vendor/fonts/cormorant-garamond-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 600; font-display: swap; src: url("vendor/fonts/cormorant-garamond-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Lora"; font-style: normal; font-weight: 400; font-display: swap; src: url("vendor/fonts/lora-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Lora"; font-style: normal; font-weight: 600; font-display: swap; src: url("vendor/fonts/lora-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Lora"; font-style: italic; font-weight: 400; font-display: swap; src: url("vendor/fonts/lora-latin-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Lora"; font-style: normal; font-weight: 400; font-display: swap; src: url("vendor/fonts/lora-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Lora"; font-style: normal; font-weight: 600; font-display: swap; src: url("vendor/fonts/lora-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Lora"; font-style: italic; font-weight: 400; font-display: swap; src: url("vendor/fonts/lora-latin-ext-400-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
  --ink:#201f1d; --white:#FFFFFF; --bg:#f3f2f2; --surface:#eae9e9;
  --line:rgba(32,31,29,.16); --card-hover:rgba(32,31,29,.07); --field-line:rgba(32,31,29,.22);
  --text:#201f1d; --muted:#605d5d; /* l'encre à 55 % du design.md n'atteint que 3,7:1 : #605d5d donne 6:1 */
  --accent:#b68235; --accent-100:#fff3e4; --accent-700:#7d5411; --accent-teinte:rgba(182,130,53,.07); /* or : trait seulement ; texte en 700 */
  --vert:#1E7A3C; --vert-doux:#E7F6EC; --orange:#B54708; --orange-doux:#FFF1E6; --rouge:#B42318; /* statut des locataires, dépenses, suppression */
  --font:"Lora", Georgia, "Times New Roman", serif;
  --titre:"Cormorant Garamond", Garamond, Georgia, serif;
  --ease:cubic-bezier(.44, 0, .56, 1);
  --shadow-sm:0 1px 2px rgba(45,43,43,.14); --shadow-md:0 3px 10px rgba(45,43,43,.16);
  --r-badge:2px; --r-btn:4px; --r-field:4px; --r-card:7px; --pill:99px;
  --sidebar:232px;
  --s1:4.6px; --s2:9.2px; --s3:13.8px; --s4:18.4px; --s5:23px; --s6:27.6px; --s7:36.8px; --s8:46px;
  /* Noms encore utilisés par des styles en ligne d'app.js. */
  --border:var(--line); --border-input:var(--field-line); --radius-md:var(--r-field);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
::selection { background: rgba(182,130,53,.3); }
h1, h2, h3, th, label, legend { font-weight: 600; }
b, strong { font-weight: 600; color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: var(--s2); background: var(--ink); color: var(--bg); padding: var(--s2) var(--s4); border-radius: var(--r-btn); z-index: 10; }
.skip:focus { left: var(--s2); }
/* Surtitres et fil d'Ariane : petites capitales espacées, chiffres tabulaires */
.surtitre, .ariane { display: block; margin: 0; font-size: 11.5px; line-height: 18px; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; font-feature-settings: "tnum"; }
.ariane a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--accent); transition: text-decoration-color .3s var(--ease); }
.ariane a:hover { text-decoration-color: var(--ink); }

/* ---------- Menu latéral : texte seul, séparé par un filet ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); flex: none; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; align-self: flex-start; overflow-y: auto;
  background: var(--bg); box-shadow: inset -1px 0 0 var(--line); padding: var(--s7) var(--s4) var(--s5) var(--s7); }
.brand { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 0 0 var(--s5); }
.sidebar a.wordmark { display: flex; align-items: center; gap: var(--s2); min-height: 0; padding: 0; background: none; color: var(--ink); text-decoration: none; font: 600 26px/1 var(--titre); letter-spacing: -.01em; }
.wordmark .mark { display: none; }
.sidebar a.wordmark::before { content: ""; width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--accent); }
#fermer-menu { display: none !important; }
.sidebar ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.groupe-titre { margin: var(--s5) 0 var(--s1); font-size: 11px; line-height: 18px; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; font-weight: 400; }
.sidebar li a { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 34px; padding: 0;
  color: var(--muted); text-decoration: none; font: 400 15px/20px var(--font); transition: color .3s var(--ease); }
.sidebar li a:hover { color: var(--ink); }
.sidebar li a[aria-current="page"] { color: var(--accent-700); font-weight: 600; }
.sidebar li a[aria-current="page"] .libelle { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 5px; }
.pastille { min-width: 18px; font: 400 12px/18px var(--font); color: var(--muted); text-align: right; font-feature-settings: "tnum"; }
.reglages { margin-top: auto; padding-top: var(--s4); display: grid; gap: 0; }

/* ---------- Barre du haut ---------- */
.content { flex: 1; min-width: 0; padding: 0 var(--s7); }
.topbar { position: sticky; top: 0; z-index: 4; min-height: 76px; display: flex; align-items: center; gap: var(--s3); padding: var(--s4) 0 var(--s3); margin-bottom: var(--s3); background: var(--bg); box-shadow: 0 1px 0 var(--line); }
.recherche { flex: 1; min-width: 0; max-width: 420px; }
.recherche input { width: 100%; min-height: 44px; padding: 0 var(--s4); border: 0; border-radius: var(--r-field); background: transparent; box-shadow: inset 0 0 0 1px var(--field-line); color: var(--ink); font: 400 15px/1 var(--font); }
.recherche input::placeholder { color: var(--muted); }
.recherche input:focus { outline: none; box-shadow: inset 0 0 0 1px var(--accent); }
.raccourci { white-space: nowrap; font-size: 13px; color: var(--muted); font-style: italic; }
.btn.burger { display: none; }
body.auth .sidebar, body.auth .btn.burger, body.auth .topbar { display: none !important; }
/* Connexion (mode en ligne) : colonne étroite centrée, nom de l'appli au-dessus, formulaire en carte bordée. */
body.auth .shell { justify-content: center; }
body.auth .content { padding: 0; }
body.auth main { max-width: 440px; margin: 0 auto; padding: 12vh var(--s4) var(--s8); gap: var(--s4); }
body.auth main::before { content: "Gestio"; font: 600 26px/1 var(--titre); color: var(--ink); margin-bottom: var(--s6); }
body.auth main form.card { max-width: none; padding: var(--s6); }
body.auth main form.card .toolbar { margin-top: var(--s2); }
#signout { margin-left: auto; }

/* ---------- Mise en page et texte ---------- */
main { max-width: 1160px; padding: var(--s3) 0 var(--s8); display: flex; flex-direction: column; gap: var(--s6); animation: fondu .45s var(--ease); }
@keyframes fondu { from { opacity: .001; } to { opacity: 1; } }
main:focus { outline: none; }
/* Plus le titre est grand, plus il est léger : h1 en 400, le reste en 600. */
h1 { font: 400 42px/1.12 var(--titre); letter-spacing: -.015em; color: var(--ink); margin: 0; text-wrap: balance; }
h2 { font: 600 28px/1.12 var(--titre); letter-spacing: -.015em; color: var(--ink); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.sub { color: var(--text); margin: 0; font-size: 17px; line-height: 1.55; max-width: 64ch; }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.toolbar .spacer { flex: 1; }
.toolbar label, .contexte label { font-size: 14px; color: var(--muted); font-weight: 400; }

/* ---------- Boutons : police des titres, au trait ; le principal au contour or, jamais rempli ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 40px; padding: 0 18px; border: 0; border-radius: var(--r-btn);
  background: transparent; box-shadow: inset 0 0 0 1px var(--field-line); color: var(--ink); font: 600 16px/20px var(--titre); letter-spacing: .01em; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color .3s var(--ease), color .3s var(--ease); }
.btn:hover { background: var(--card-hover); }
.btn:active:not([disabled]) { background: rgba(32,31,29,.12); }
.btn.primary { color: var(--accent-700); box-shadow: inset 0 0 0 1px var(--accent); }
.btn.primary:hover { background: rgba(182,130,53,.11); }
.btn.primary:active:not([disabled]) { background: rgba(182,130,53,.2); }
.btn.ghost { box-shadow: none; padding: 0 var(--s2); }
.btn.danger { color: var(--rouge); box-shadow: inset 0 0 0 1px var(--rouge); }
.btn.danger:hover { background: rgba(180,35,24,.07); }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 15px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

/* ---------- Cartes bordées, non remplies ; listes ---------- */
.card { background: transparent; box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-card); padding: var(--s6); min-width: 0; display: flex; flex-direction: column; gap: var(--s4); }
.grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid > .card { gap: var(--s3); }
.card h3 { font: 600 22px/1.12 var(--titre); letter-spacing: -.01em; color: var(--ink); margin: 0; overflow-wrap: anywhere; }
.card .meta { color: var(--text); font-size: 15px; margin: 0; overflow-wrap: anywhere; }
.card .actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: auto; padding-top: var(--s2); }
.specs { display: flex; flex-direction: column; margin: 0; }
.spec { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); padding: 10px 0; box-shadow: inset 0 -1px 0 var(--line); font-size: 15px; }
.spec:last-child { box-shadow: none; }
.spec dt { flex: 0 0 40%; color: var(--muted); }
.spec dd { margin: 0; color: var(--ink); text-align: right; overflow-wrap: anywhere; font-feature-settings: "tnum"; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); }
.count { font-weight: 600; font-size: 15px; color: var(--muted); font-feature-settings: "tnum"; }
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rows li { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: center; padding: 14px 0; box-shadow: inset 0 -1px 0 var(--line); color: var(--ink); }
.rows li:last-child { box-shadow: none; }
.rows li.fait { opacity: .6; }
.rows.calendrier li { flex-wrap: nowrap; align-items: flex-start; }
.rows.calendrier input[type="checkbox"] { flex: none; margin-top: 4px; }
.rows.calendrier li > .small { white-space: nowrap; }
.rows .grow { flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; }
.rows .small.muted { color: var(--muted); }
.amount { font-feature-settings: "tnum"; white-space: nowrap; font-weight: 600; color: var(--ink); }
.sections { display: grid; gap: var(--s4); grid-template-columns: repeat(2, 1fr); }
.good, .bad, .warn { color: var(--ink); }
/* Statuts : point plein (réglé), point creux (partiel), étiquette à l'encre (non réglé) */
.badge, .statut { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 2px 9px; border-radius: var(--r-badge); background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); font: 400 13px/18px var(--font); white-space: nowrap; vertical-align: 1px; }
.badge.solde::before, .badge.actif::before, .statut.ok::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.badge.partiel::before, .badge.en_attente::before, .statut.partiel::before { content: ""; width: 7px; height: 7px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--ink); }
.badge.impaye, .statut.retard { background: var(--ink); color: var(--bg); box-shadow: none; }
/* Exception voulue : le statut d'un locataire se lit d'un coup d'œil, en couleur (vert actif, orange inactif), toujours avec le mot. */
.badge.locataire-actif { background: var(--vert-doux); color: var(--vert); box-shadow: none; font-weight: 600; }
.badge.locataire-inactif { background: var(--orange-doux); color: var(--orange); box-shadow: none; font-weight: 600; }
.badge.locataire-actif::before, .badge.locataire-inactif::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
/* Statut de paiement (Quittances) : réglée en vert, à régler en orange ; le texte reste, la couleur ne fait que le souligner. */
.badge.statut-solde { background: var(--vert-doux); color: var(--vert); box-shadow: none; font-weight: 600; }
.badge.statut-en_attente { background: var(--orange-doux); color: var(--orange); box-shadow: none; font-weight: 600; }
.badge.statut-solde::before, .badge.statut-en_attente::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: none; }
.card.locataire-actif { box-shadow: inset 4px 0 0 var(--vert), inset 0 0 0 1px var(--line); }
.card.locataire-inactif { box-shadow: inset 4px 0 0 var(--orange), inset 0 0 0 1px var(--line); }
.rows li.locataire-actif, .rows li.locataire-inactif { padding-left: 14px; }
.rows li.locataire-actif { box-shadow: inset 4px 0 0 var(--vert), inset 0 -1px 0 var(--line); }
.rows li.locataire-inactif { box-shadow: inset 4px 0 0 var(--orange), inset 0 -1px 0 var(--line); }
h1 .badge { font-size: 14px; vertical-align: 8px; }
/* L'accent : étiquette or (fond 100, texte 700) sur la prochaine étape. */
.prochaine { display: inline-flex; padding: 1px 8px; border-radius: var(--r-badge); background: var(--accent-100); box-shadow: inset 0 0 0 1px rgba(182,130,53,.35); color: var(--accent-700); font: italic 400 13px/18px var(--font); margin-left: 6px; vertical-align: 1px; white-space: nowrap; }
.empty { text-align: center; padding: var(--s8) var(--s5); color: var(--text); align-items: center; }
.empty p { margin: 0; }

/* ---------- Tableau de bord ---------- */
.entete { display: flex; flex-direction: column; gap: var(--s4); }
.accueil { display: grid; grid-template-columns: 1.15fr 1fr; gap: var(--s4); align-items: stretch; }
.phrase { max-width: 30ch; }
.phrase .suite { color: var(--muted); }
/* Mise en avant : un filet or sur une teinte à peine dorée (jamais un aplat d'accent). */
.carte-cas { background: var(--accent-teinte); box-shadow: inset 0 0 0 1px var(--accent); color: var(--ink); border-radius: var(--r-card); padding: var(--s6); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.carte-cas .tag { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; font-feature-settings: "tnum"; }
.carte-cas h2 { font-size: 24px; line-height: 1.12; }
.carte-cas .montant { margin: 0; font: 400 clamp(48px, 5vw, 64px)/1 var(--titre); letter-spacing: -.015em; white-space: nowrap; font-feature-settings: "lnum", "tnum"; }
.carte-cas ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; color: var(--text); }
.lien-cas { margin-top: auto; font-weight: 600; color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; align-self: flex-start; }
.loyers { display: flex; flex-direction: column; gap: var(--s4); padding-top: var(--s2); }
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s4); }
.tuile-loyer { background: transparent; box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-card); padding: var(--s5); display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--text); transition: background-color .3s var(--ease); }
.tuile-loyer:hover { background: var(--card-hover); }
.tuile-loyer .lieu { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tuile-loyer .nom { font: 600 22px/1.12 var(--titre); letter-spacing: -.01em; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tuile-loyer .val { font: 400 34px/1 var(--titre); letter-spacing: -.01em; color: var(--ink); white-space: nowrap; font-feature-settings: "lnum", "tnum"; margin: 2px 0; }

/* ---------- Formulaires : champs transparents au filet, focus or ---------- */
form.card { max-width: 720px; }
.field { display: grid; gap: 6px; margin-bottom: var(--s4); align-content: start; }
.field label { font: 600 14px/20px var(--font); color: var(--ink); }
.field input, .field select, .field textarea, main select, main input:not([type="checkbox"]):not([type="radio"]):not([type="file"]) {
  min-height: 40px; padding: 0 14px; border: 0; border-radius: var(--r-field); background: transparent; box-shadow: inset 0 0 0 1px var(--field-line); color: var(--ink); font: 400 15px/1.2 var(--font); }
.field textarea { padding: var(--s3) 14px; }
main textarea[style*="border"] { box-shadow: none; } /* app.js leur pose déjà une bordure en ligne de la même couleur */
.field input, .field select, .field textarea { width: 100%; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, main select:focus-visible, main input:focus-visible { box-shadow: inset 0 0 0 1px var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent-700); }
.field .hint { font-size: 13px; color: var(--muted); font-style: italic; }
.row2 { display: grid; gap: 0 var(--s4); grid-template-columns: 1fr 1fr; }
fieldset { border-color: var(--line) !important; border-radius: var(--r-field) !important; }
fieldset.cases { border: 0; padding: 0; margin: 0 0 var(--s4); min-width: 0; }
fieldset.cases legend { padding: 0; margin-bottom: var(--s2); font: 600 14px/20px var(--font); color: var(--ink); }
.cases-liste { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); }
.case { display: inline-flex; align-items: center; gap: var(--s2); min-height: 32px; color: var(--ink); font-size: 15px; cursor: pointer; }
.case input { width: 18px; height: 18px; margin: 0; flex: none; }
/* Fiche bailleur : options impossibles pour la forme, tableau des détentions (lignes empilées sous 600 px) */
.field select option:disabled { display: none; }
.field + .info { margin: calc(-1 * var(--s2)) 0 var(--s4); }
fieldset.detentions { padding: var(--s3) var(--s4); margin: 0 0 var(--s4); min-width: 0; }
fieldset.detentions legend { padding: 0 var(--s1); font: 600 14px/20px var(--font); color: var(--ink); }
/* Chaque ligne est une grille : les cellules passent à la ligne quand la place manque, jamais de défilement horizontal. */
table.detentions, table.detentions tbody { display: block; }
table.detentions tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s2) var(--s3); align-items: start; padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
table.detentions td { min-width: 0; padding: 0; border: 0; }
table.detentions td:first-child { grid-column: span 2; }
table.detentions td.det-retirer { align-self: end; }
table.detentions label { display: block; margin-bottom: 4px; font-size: 13px; color: var(--muted); }
table.detentions input, table.detentions select { width: 100%; min-width: 0; }
.det-nouvelle { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: var(--s2); margin-top: var(--s2); }
.det-total { margin: var(--s3) 0 0; font-weight: 600; }
.det-total:empty { display: none; }
@media (max-width: 599px) {
  table.detentions tr, .det-nouvelle { grid-template-columns: minmax(0, 1fr); }
  table.detentions td:first-child { grid-column: auto; }
  /* Tableaux du foyer : une ligne devient un bloc, chaque montant précédé de son en-tête (data-l). */
  table.empile thead { display: none; }
  table.empile, table.empile tbody, table.empile tr { display: block; }
  table.empile tr { padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
  table.empile td, table.empile th { display: flex; justify-content: space-between; gap: var(--s3); padding: 2px 0; border: 0; text-align: left; }
  table.empile :is(td, th):empty { display: none; }
  table.empile [data-l]::before { content: attr(data-l); color: var(--muted); font-size: 13px; text-transform: none; letter-spacing: 0; }
  table.an-biens td:first-child { display: block; white-space: normal; } /* nom du bien et sa barre, l'un sous l'autre */
}
fieldset.cases .hint { display: block; margin-top: var(--s2); font-size: 13px; color: var(--muted); font-style: italic; }
.error { color: var(--bg); background: var(--ink); border-radius: var(--r-field); padding: var(--s3) var(--s4); margin: 0; }
.brouillon, .info { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: center; padding: var(--s3) var(--s4); border-radius: var(--r-field); background: var(--accent-teinte); box-shadow: inset 0 0 0 1px var(--accent); color: var(--ink); }

/* ---------- Tableaux : en-têtes en capitales espacées, filets entre lignes ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: var(--s3); border-bottom: 1px solid var(--line); font-size: 15px; }
th { font-size: 11.5px; color: var(--muted); font-weight: 400; text-transform: uppercase; letter-spacing: .09em; }
td { color: var(--ink); font-feature-settings: "tnum"; }
td.num, th.num { text-align: right; }
table.empile tbody th { font-size: 15px; color: var(--ink); font-weight: 600; text-transform: none; letter-spacing: 0; } /* total du foyer, lisible */

/* ---------- Alerte et messages ---------- */
.alerte { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin: 0 0 var(--s2); padding: var(--s3) var(--s4); border-radius: var(--r-card); background: var(--ink); color: var(--bg); }
.alerte .btn { background: var(--bg); color: var(--ink); box-shadow: none; }
.toast { position: fixed; right: var(--s5); bottom: var(--s5); max-width: 380px; padding: var(--s3) var(--s4); border-radius: var(--r-card); background: var(--ink); color: var(--bg); box-shadow: var(--shadow-md); opacity: 0; transition: opacity .3s var(--ease); pointer-events: none; z-index: 6; }
.toast.show { opacity: 1; }
.toast.err { background: var(--ink); }
.toast.ok { background: var(--bg); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-md); }

/* ---------- Photos ---------- */
.vignettes { display: inline-flex; flex-wrap: wrap; gap: var(--s1); }
.vignette { position: relative; display: inline-block; }
.vignette img { width: 64px; height: 48px; object-fit: cover; border-radius: var(--r-badge); display: block; }
.vignette .btn { position: absolute; top: -8px; right: -8px; min-height: 0; padding: 0 7px; background: var(--bg); }

/* ---------- Documents : feuille blanche, identique au PDF ---------- */
.doc { background: var(--white); color: #000; max-width: 780px; padding: var(--s8); border-radius: var(--r-card); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-sm); display: block; font-family: var(--font); }
.doc h1 { text-align: center; font-size: 32px; line-height: 1.15; font-weight: 600; margin-bottom: var(--s6); }
.doc h2 { font-size: 22px; margin: var(--s5) 0 var(--s2); }
.doc .parties { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); margin-bottom: var(--s6); }
.doc table { margin: var(--s4) 0; }
.doc .legal { font-size: 12px; color: var(--muted); margin-top: var(--s6); }
.doc .photos { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s2) 0 var(--s4); }
.doc .photos img { max-width: 160px; max-height: 160px; border-radius: var(--r-badge); }

/* ---------- Analyses (chantier 16) ---------- */
.an-filtres { position: sticky; top: 76px; z-index: 3; background: var(--bg); display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; padding-block: var(--s2); box-shadow: 0 1px 0 var(--line); }
.an-segments { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-btn); }
.an-segments a { padding: 9px 12px; border-radius: var(--r-badge); color: var(--muted); font: 400 14px/1 var(--font); text-decoration: none; transition: color .3s var(--ease); }
.an-segments a:hover { color: var(--ink); }
.an-segments a[aria-current="true"] { background: var(--accent-teinte); color: var(--accent-700); box-shadow: inset 0 -2px 0 var(--accent); font-weight: 600; }
.an-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s3); }
.an-tuile { box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-card); padding: var(--s4) 18px; display: grid; gap: 6px; min-width: 0; }
.an-tuile .lib { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; }
.an-tuile .val { font: 400 32px/1.05 var(--titre); letter-spacing: -.01em; color: var(--ink); font-feature-settings: "lnum", "tnum"; white-space: nowrap; }
.an-tuile.fort { background: var(--accent-teinte); box-shadow: inset 0 0 0 1px var(--accent); }
.an-delta { font-size: 13px; font-feature-settings: "tnum"; }
.an-delta.bon { color: var(--vert); } .an-delta.mauvais { color: var(--rouge); } .an-delta.neutre { color: var(--muted); }
.an-grille { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--s4); align-items: start; }
.an-bloc { box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-card); padding: var(--s5); display: grid; gap: var(--s3); min-width: 0; }
.an-bloc header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--s2); }
.an-legende { display: flex; flex-wrap: wrap; gap: var(--s3); font-size: 13px; color: var(--muted); }
.an-legende i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.l-enc { background: var(--ink); } .l-att { background: #d7d3d3; } .l-dep { background: var(--rouge); }
svg.graphique { display: block; width: 100%; height: auto; font-family: var(--font); font-feature-settings: "tnum"; }
.an-defile { overflow-x: auto; }
table.chiffres td { white-space: nowrap; }
details.an-chiffres summary { cursor: pointer; color: var(--ink); font-weight: 600; font-size: 14px; }
.an-barre { display: block; height: 6px; border-radius: 3px; background: var(--ink); margin-top: 6px; }
.an-barre.neg { background: var(--rouge); }
.an-attention { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.an-attention a { display: grid; gap: 2px; padding: var(--s3) 14px; border-radius: var(--r-field); box-shadow: inset 0 0 0 1px var(--line); text-decoration: none; color: var(--text); }
.an-attention a:hover { background: var(--card-hover); }
.an-attention a strong { color: var(--ink); }
.an-attention li.prem a { background: var(--accent-teinte); box-shadow: inset 0 0 0 1px var(--accent); }
.an-impots { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s3); }
.an-impots > div { box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-field); padding: 14px; display: grid; gap: 4px; }
.an-impots .val { font: 400 26px/1.15 var(--titre); color: var(--ink); font-feature-settings: "lnum", "tnum"; }
.an-bande { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s6); align-items: baseline; box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-card); padding: 14px 18px; margin: 0; }
.an-bande b { color: var(--ink); font-feature-settings: "tnum"; }
.an-bande a { margin-left: auto; color: var(--ink); font-weight: 600; text-decoration-color: var(--accent); text-underline-offset: 4px; }
@media (max-width: 1100px) { .an-grille { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 767px) { .an-filtres { position: static; } .an-bande a { margin-left: 0; } }
@media (max-width: 1100px) {
  .accueil, .sections { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .content { padding: 0 var(--s4); }
  .sidebar { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 7; box-shadow: none; padding: var(--s5) var(--s5) var(--s6); opacity: 0; visibility: hidden; transition: opacity .3s var(--ease), visibility .3s; }
  .sidebar.open { opacity: 1; visibility: visible; }
  .sidebar li a { min-height: 44px; font-size: 19px; }
  #fermer-menu { display: inline-flex !important; }
  .topbar { flex-wrap: wrap; padding: var(--s3) 0 var(--s2); }
  .topbar::before { content: "Gestio"; font: 600 24px/1 var(--titre); color: var(--ink); }
  .btn.burger { display: inline-grid; place-content: center; gap: 6px; order: 2; margin-left: auto; width: 44px; min-width: 44px; padding: 0; background: transparent; box-shadow: none; }
  .btn.burger:hover { background: transparent; }
  .btn.burger .trait { display: block; width: 20px; height: 1.5px; background: var(--ink); }
  .recherche { order: 3; flex-basis: 100%; max-width: none; }
  .raccourci { display: none; }
  .btn, .btn.sm, main select, main input:not([type="checkbox"]):not([type="radio"]), .recherche input { min-height: 44px !important; }
  main { padding: var(--s2) 0 var(--s8); }
  h1 { font-size: 34px; line-height: 1.1; }
  .card, .carte-cas { padding: var(--s5); }
  .row2, .doc .parties { grid-template-columns: 1fr; }
  .doc { padding: var(--s5); }
  table.responsive, table.responsive tbody { display: block; }
  table.responsive thead { display: none; }
  table.responsive tr { display: block; border-bottom: 1px solid var(--line); padding: var(--s2) 0; }
  table.responsive td { display: flex; justify-content: space-between; gap: var(--s3); border: 0; padding: var(--s1) 0; }
  table.responsive td::before { content: attr(data-label); color: var(--muted); }
}
@media (prefers-reduced-motion: reduce) {
  main { animation: none; }
  .btn, .sidebar li a, .toast, .sidebar, .tuile-loyer, .ariane a { transition: none; }
}
@media print {
  .sidebar, .topbar, .no-print, .toast, .skip { display: none !important; }
  body, main, .shell, .content { background: none; padding: 0; animation: none; }
  .doc { padding: 0; max-width: none; box-shadow: none; }
}

/* Filtre d'une liste : le libellé reste collé à sa liste déroulante quand la barre passe à la ligne (téléphone). */
.toolbar .filtre { display: inline-flex; align-items: center; gap: var(--s2); }
