@font-face {
  font-family: "Inter";
  src: url("fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --fond: #f3f5fb;
  --surface: #ffffff;
  --surface-2: #f5f6fb;
  --texte: #161a2c;
  --texte-2: #5d6481;
  --bord: #e5e8f2;
  --accent: #5b4cf0;
  --accent-2: #8b5cf6;
  --accent-texte: #ffffff;
  --accent-doux: #efedff;
  --degrade: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #d946ef 100%);
  --ok: #0f8a5f;
  --ok-fond: #e3f7ee;
  --attention: #a15c00;
  --attention-fond: #fff3d6;
  --alerte: #d0302f;
  --alerte-fond: #ffe9e8;
  --neutre-fond: #eef0f6;
  --ombre: 0 1px 2px rgba(22, 26, 44, .04), 0 8px 24px -12px rgba(22, 26, 44, .12);
  --ombre-forte: 0 18px 40px -18px rgba(76, 29, 149, .35);
  --rayon: 16px;
  --nav-fond: linear-gradient(180deg, #1b1840 0%, #26205a 60%, #2e1f63 100%);
  --nav-texte: #c9c6ee;
  --blob-1: rgba(99, 102, 241, .14);
  --blob-2: rgba(236, 72, 153, .10);
  --blob-3: rgba(20, 184, 166, .10);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) { --fond: #0c0f1d;
    --surface: #151a2e;
    --surface-2: #1b2139;
    --texte: #e8eaf6;
    --texte-2: #9aa1c2;
    --bord: #262d4a;
    --accent: #8b7dff;
    --accent-2: #b197fc;
    --accent-texte: #ffffff;
    --accent-doux: #221f48;
    --ok: #4cd69a;
    --ok-fond: #12301f;
    --attention: #f5b94a;
    --attention-fond: #33270f;
    --alerte: #ff7a73;
    --alerte-fond: #3a1a1c;
    --neutre-fond: #232a45;
    --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
    --ombre-forte: 0 18px 40px -18px rgba(0, 0, 0, .7);
    --nav-fond: linear-gradient(180deg, #0f1124 0%, #141838 100%);
    --blob-1: rgba(99, 102, 241, .16);
    --blob-2: rgba(217, 70, 239, .08);
    --blob-3: rgba(20, 184, 166, .07); }
}
:root[data-theme="sombre"] { --fond: #0c0f1d;
    --surface: #151a2e;
    --surface-2: #1b2139;
    --texte: #e8eaf6;
    --texte-2: #9aa1c2;
    --bord: #262d4a;
    --accent: #8b7dff;
    --accent-2: #b197fc;
    --accent-texte: #ffffff;
    --accent-doux: #221f48;
    --ok: #4cd69a;
    --ok-fond: #12301f;
    --attention: #f5b94a;
    --attention-fond: #33270f;
    --alerte: #ff7a73;
    --alerte-fond: #3a1a1c;
    --neutre-fond: #232a45;
    --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
    --ombre-forte: 0 18px 40px -18px rgba(0, 0, 0, .7);
    --nav-fond: linear-gradient(180deg, #0f1124 0%, #141838 100%);
    --blob-1: rgba(99, 102, 241, .16);
    --blob-2: rgba(217, 70, 239, .08);
    --blob-3: rgba(20, 184, 166, .07); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--texte); background-color: var(--fond);
  background-image:
    radial-gradient(900px 500px at 100% -10%, var(--blob-1), transparent 60%),
    radial-gradient(700px 500px at 20% 0%, var(--blob-2), transparent 60%),
    radial-gradient(800px 600px at 60% 110%, var(--blob-3), transparent 60%);
  background-attachment: fixed;
  font: 15px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1 { font-size: 1.65rem; letter-spacing: -.02em; margin: 0 0 .2rem; font-weight: 750; }
h2 { font-size: 1.05rem; letter-spacing: -.01em; margin: 0 0 .9rem; font-weight: 680; }
h3 { font-size: .74rem; margin: 1.2rem 0 .55rem; color: var(--texte-2); text-transform: uppercase; letter-spacing: .07em; font-weight: 650; }
.muted { color: var(--texte-2); }
.petit { font-size: .85rem; }
.nombre { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.icone { flex-shrink: 0; vertical-align: -3px; }

/* ---------- Mise en page ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.nav {
  background: var(--nav-fond); color: var(--nav-texte); padding: 1.25rem .9rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
}
.nav .tete { display: flex; justify-content: space-between; align-items: center; }
.nav .marque { display: flex; align-items: center; gap: .65rem; padding: .25rem .5rem 1.4rem; color: #fff; font-weight: 750; font-size: 1.05rem; letter-spacing: -.01em; }
.nav .marque:hover { text-decoration: none; }
.nav .marque .logo-okodoc { height: 38px; width: auto; display: block; }
.marque-connexion { margin: 0 0 .9rem; }
.marque-connexion .logo-okodoc { height: 54px; width: auto; display: block; }
.marque-connexion.petite .logo-okodoc { height: 38px; }
.seul-sombre { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) .seul-clair { display: none; }
  :root:not([data-theme="clair"]) .seul-sombre { display: block; }
}
:root[data-theme="sombre"] .seul-clair { display: none; }
:root[data-theme="sombre"] .seul-sombre { display: block; }
.logo {
  width: 36px; height: 36px; border-radius: 11px; background: var(--degrade); display: grid; place-items: center;
  box-shadow: 0 6px 16px -6px rgba(139, 92, 246, .8); color: #fff;
}
.nav .liens { display: flex; flex-direction: column; flex: 1; }
.nav a.lien {
  display: flex; align-items: center; gap: .75rem; padding: .62rem .75rem; border-radius: 11px;
  color: var(--nav-texte); margin-bottom: 3px; font-weight: 500; transition: background .15s, color .15s;
}
.nav a.lien:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav a.lien.actif { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: inset 3px 0 0 #a78bfa; }
.nav a.lien.actif .icone { color: #c4b5fd; }
.nav .bas {
  margin-top: auto; padding: .9rem .75rem; border-radius: 14px; background: rgba(255, 255, 255, .06); font-size: .85rem;
}
.nav .bas .qui { color: #fff; font-weight: 600; display: flex; align-items: center; gap: .55rem; margin-bottom: .5rem; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #14b8a6, #6366f1);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .8rem; text-transform: uppercase;
}
.nav .bas a, .nav .bas button.lien-btn { color: var(--nav-texte); font-size: .82rem; }
.nav .bas form { display: inline; }
.contenu { padding: 1.75rem 2.25rem 3.5rem; max-width: 1240px; width: 100%; min-width: 0; }
.entete { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.entete .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.fil { font-size: .82rem; color: var(--texte-2); margin-bottom: .3rem; }
.fil a { color: var(--texte-2); }

/* ---------- Bandeau d'accueil ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; color: #fff; padding: 1.8rem 2rem 4.6rem;
  margin-bottom: 1.5rem; box-shadow: var(--ombre-forte); isolation: isolate; min-height: 210px;
}
.hero picture, .hero picture img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: bottom; z-index: -1; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(30, 20, 80, .55), rgba(30, 20, 80, 0) 70%); }
.hero h1 { font-size: 2rem; color: #fff; }
.hero p { margin: .2rem 0 0; color: rgba(255, 255, 255, .88); font-size: 1rem; }
.hero .actions { margin-top: 1.1rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.hero .btn { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .3); backdrop-filter: blur(6px); }
.hero .btn:hover { background: rgba(255, 255, 255, .26); }
.hero .btn.primaire { background: #fff; color: #4c1d95; border-color: #fff; }

/* ---------- Cartes ---------- */
.carte {
  background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon);
  padding: 1.3rem 1.45rem; box-shadow: var(--ombre); margin-bottom: 1.4rem; min-width: 0;
}
.carte > h2:first-child { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.titre-icone { display: inline-flex; align-items: center; gap: .55rem; }
.titre-icone .bulle { width: 30px; height: 30px; border-radius: 9px; }
.grille { display: grid; gap: 1.4rem; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); margin-bottom: 1.4rem; }
.grille > .carte { margin-bottom: 0; }
.grille { align-items: start; }

.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 1.4rem; }
.stat {
  position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon);
  padding: 1.1rem 1.2rem; box-shadow: var(--ombre);
}
.stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c, var(--accent)); }
.stat .tete { display: flex; justify-content: space-between; align-items: center; }
.stat .libelle { font-size: .8rem; color: var(--texte-2); font-weight: 550; }
.stat .valeur { font-size: 1.6rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: .35rem; }
.stat .sous { font-size: .8rem; color: var(--texte-2); }
.stat.alerte .valeur { color: var(--alerte); }
.stats .stat:nth-child(4n+1) { --c: #6366f1; --c-fond: rgba(99, 102, 241, .12); }
.stats .stat:nth-child(4n+2) { --c: #14b8a6; --c-fond: rgba(20, 184, 166, .13); }
.stats .stat:nth-child(4n+3) { --c: #f43f5e; --c-fond: rgba(244, 63, 94, .12); }
.stats .stat:nth-child(4n+4) { --c: #f59e0b; --c-fond: rgba(245, 158, 11, .14); }
.bulle {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--c-fond, var(--accent-doux)); color: var(--c, var(--accent));
}
.bulle.violet { --c: #8b5cf6; --c-fond: rgba(139, 92, 246, .13); }
.bulle.turquoise { --c: #14b8a6; --c-fond: rgba(20, 184, 166, .13); }
.bulle.rose { --c: #f43f5e; --c-fond: rgba(244, 63, 94, .12); }
.bulle.ambre { --c: #f59e0b; --c-fond: rgba(245, 158, 11, .14); }
.bulle.bleu { --c: #0ea5e9; --c-fond: rgba(14, 165, 233, .13); }

.jauge { height: 7px; border-radius: 99px; background: var(--neutre-fond); overflow: hidden; margin-top: .55rem; }
.jauge span { display: block; height: 100%; border-radius: 99px; background: var(--c, var(--accent)); }

/* Liste « à faire » */
.tache { display: flex; gap: .75rem; align-items: center; padding: .6rem 0; border-bottom: 1px dashed var(--bord); }
.tache:last-child { border-bottom: none; }
.tache .bulle { width: 34px; height: 34px; border-radius: 10px; }
.tache .quand { font-size: .8rem; color: var(--texte-2); }

/* ---------- Cartes de biens ---------- */
.biens { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.bien-carte {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--bord); border-radius: 18px;
  overflow: hidden; box-shadow: var(--ombre); color: var(--texte); transition: transform .18s, box-shadow .18s;
}
.bien-carte:hover { transform: translateY(-3px); box-shadow: var(--ombre-forte); text-decoration: none; }
.bien-carte .visuel { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.bien-carte .visuel img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s; }
.bien-carte:hover .visuel img { transform: scale(1.04); }
.bien-carte .visuel .badge { position: absolute; top: .7rem; left: .7rem; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.bien-carte .visuel .type { position: absolute; bottom: .6rem; right: .7rem; font-size: .72rem; font-weight: 650; background: rgba(15, 12, 40, .55); color: #fff; padding: .15rem .55rem; border-radius: 99px; backdrop-filter: blur(4px); }
.bien-carte .corps { padding: .95rem 1.05rem 1.05rem; display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.bien-carte .nom { font-weight: 680; font-size: 1rem; letter-spacing: -.01em; }
.bien-carte .lieu { font-size: .84rem; color: var(--texte-2); }
.bien-carte .pied { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: auto; padding-top: .65rem; border-top: 1px solid var(--bord); font-size: .85rem; }
.bien-carte .pied .qui { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--texte-2); }
.bien-carte .loyer { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bien-carte .corps .lieu { margin-bottom: .55rem; }
.bien-carte.ajout { align-items: center; justify-content: center; min-height: 180px; border: 2px dashed var(--bord); background: transparent; box-shadow: none; color: var(--texte-2); gap: .5rem; font-weight: 600; }
.bien-carte.ajout:hover { border-color: var(--accent); color: var(--accent); box-shadow: none; }

/* Bannière d'un bien */
.banniere { position: relative; border-radius: 22px; overflow: hidden; margin-bottom: 1.4rem; box-shadow: var(--ombre-forte); height: 280px; background: var(--surface-2); }
.banniere img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banniere::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(15, 10, 40, .75) 0%, rgba(15, 10, 40, .1) 55%, rgba(15, 10, 40, 0) 100%); }
.banniere .texte { position: absolute; left: 1.6rem; right: 1.6rem; bottom: 1.2rem; color: #fff; z-index: 1; display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.banniere .texte h1 { color: #fff; font-size: 1.9rem; }
.banniere .texte .fil, .banniere .texte .fil a { color: rgba(255, 255, 255, .85); }
.banniere .texte .adresse { color: rgba(255, 255, 255, .9); }
.banniere .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.banniere .btn { background: rgba(255, 255, 255, .18); color: #fff; border-color: rgba(255, 255, 255, .3); backdrop-filter: blur(6px); }
.banniere .btn:hover { background: rgba(255, 255, 255, .3); }
.banniere .btn.primaire { background: #fff; color: #4c1d95; border-color: #fff; }
.banniere .astuce { position: absolute; top: 1rem; right: 1rem; z-index: 1; font-size: .78rem; background: rgba(255, 255, 255, .85); color: #2e1065; padding: .3rem .7rem; border-radius: 99px; }
.banniere .astuce:hover { text-decoration: none; background: #fff; }

/* ---------- Fiches ---------- */
dl.fiche { display: grid; grid-template-columns: minmax(130px, max-content) 1fr; gap: .5rem 1.1rem; margin: 0; }
dl.fiche dt { color: var(--texte-2); font-size: .9rem; }
dl.fiche dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; margin: 0 -1.45rem; padding: 0 1.45rem; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .7rem .65rem; text-align: left; border-bottom: 1px solid var(--bord); vertical-align: middle; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--texte-2); font-weight: 650; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
tfoot td { font-weight: 700; border-bottom: none; border-top: 2px solid var(--bord); }
td.actions { white-space: nowrap; text-align: right; }
td.actions form { display: inline-block; vertical-align: middle; }
td.actions > a, td.actions > form { vertical-align: middle; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .16rem .62rem; border-radius: 999px; font-size: .76rem; font-weight: 650; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.ok { background: var(--ok-fond); color: var(--ok); }
.badge.attention { background: var(--attention-fond); color: var(--attention); }
.badge.alerte { background: var(--alerte-fond); color: var(--alerte); }
.badge.neutre { background: var(--neutre-fond); color: var(--texte-2); }
.type-fichier {
  display: inline-grid; place-items: center; min-width: 2.7rem; height: 1.7rem; font-size: .66rem; font-weight: 800; letter-spacing: .03em;
  border-radius: 7px; background: var(--accent-doux); color: var(--accent); margin-right: .55rem; vertical-align: middle;
}
.type-fichier.PDF { background: #ffe4e6; color: #e11d48; }
.type-fichier.IMG { background: #dcfce7; color: #15803d; }
.type-fichier.DOC { background: #dbeafe; color: #1d4ed8; }
.type-fichier.XLS { background: #d1fae5; color: #047857; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) .type-fichier.PDF { background: #3b1520; color: #fb7185; }
  :root:not([data-theme="clair"]) .type-fichier.IMG { background: #12301f; color: #4ade80; }
  :root:not([data-theme="clair"]) .type-fichier.DOC { background: #172554; color: #93c5fd; }
  :root:not([data-theme="clair"]) .type-fichier.XLS { background: #0f2e25; color: #34d399; }
}
:root[data-theme="sombre"] .type-fichier.PDF { background: #3b1520; color: #fb7185; }
:root[data-theme="sombre"] .type-fichier.IMG { background: #12301f; color: #4ade80; }
:root[data-theme="sombre"] .type-fichier.DOC { background: #172554; color: #93c5fd; }
:root[data-theme="sombre"] .type-fichier.XLS { background: #0f2e25; color: #34d399; }
.docs { display: flex; flex-direction: column; }
.doc { display: flex; align-items: center; gap: .75rem; padding: .65rem 0; border-bottom: 1px solid var(--bord); }
.doc:last-child { border-bottom: none; }
.doc-apercu { flex-shrink: 0; display: grid; place-items: center; width: 44px; }
.doc-apercu .type-fichier { margin: 0; }
.doc-apercu .vignette { margin: 0; }
.doc-infos { flex: 1; min-width: 0; }
.doc-titre { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-actions { display: flex; gap: .2rem; flex-shrink: 0; }
.btn-icone { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--texte-2); }
.btn-icone:hover { background: var(--surface-2); color: var(--accent); text-decoration: none; }
.btn-icone.danger:hover { background: var(--alerte-fond); color: var(--alerte); }
.vignette { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; margin-right: 0; vertical-align: middle; border: 1px solid var(--bord); }
.galerie { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: .5rem; }
.galerie a { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; border: 1px solid var(--bord); }
.galerie img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; display: block; }
.galerie a:hover img { transform: scale(1.05); }
.galerie .legende { position: absolute; inset: auto 0 0 0; padding: .35rem .5rem; font-size: .75rem; color: #fff; background: linear-gradient(0deg, rgba(0, 0, 0, .6), transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Boutons ---------- */
.btn, button {
  display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1rem; border-radius: 11px;
  border: 1px solid var(--bord); background: var(--surface); color: var(--texte); font: inherit; font-size: .88rem; font-weight: 580;
  cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2; transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:hover, button:hover { background: var(--surface-2); text-decoration: none; }
.btn:active, button:active { transform: translateY(1px); }
.btn.primaire, button.primaire {
  background: var(--degrade); color: #fff; border-color: transparent; box-shadow: 0 6px 16px -8px rgba(124, 58, 237, .9);
}
.btn.primaire:hover, button.primaire:hover { filter: brightness(1.07); box-shadow: 0 8px 20px -8px rgba(124, 58, 237, 1); }
.btn.danger, button.danger { color: var(--alerte); border-color: color-mix(in srgb, var(--alerte) 40%, transparent); background: transparent; }
.btn.danger:hover, button.danger:hover { background: var(--alerte-fond); }
.btn.mini, button.mini { padding: .3rem .62rem; font-size: .78rem; border-radius: 8px; }
button.lien-btn { border: none; background: none; padding: 0; color: var(--accent); font-weight: 500; box-shadow: none; }

/* ---------- Formulaires ---------- */
form.formulaire { max-width: 740px; }
.champ { margin-bottom: 1.05rem; }
.champ label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .35rem; }
.champ .aide { font-size: .8rem; color: var(--texte-2); margin-top: .3rem; }
.champ .erreur, .erreurs { color: var(--alerte); font-size: .85rem; margin-top: .3rem; }
input:not([type]), input[type=text], input[type=email], input[type=number], input[type=date], input[type=password], input[type=search], input[type=month],
input[type=file], select, textarea {
  width: 100%; padding: .62rem .75rem; border: 1px solid var(--bord); border-radius: 11px;
  background: var(--surface); color: var(--texte); font: inherit; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
input[type=file] { padding: .5rem; background: var(--surface); }
input[type=file]::file-selector-button { border: none; background: var(--accent-doux); color: var(--accent); padding: .45rem .8rem; border-radius: 8px; font: inherit; font-weight: 600; margin-right: .75rem; cursor: pointer; }
.champ ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.champ ul label { font-weight: normal; display: flex; gap: .45rem; align-items: center; }
.champ input[type=checkbox] { width: auto; accent-color: var(--accent); }
.champ.case label { display: flex; gap: .5rem; align-items: center; }
.boutons { display: flex; gap: .5rem; margin-top: 1.6rem; flex-wrap: wrap; }
.filtres { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.1rem; }
.filtres select, .filtres input { width: auto; }
.choix-bien { margin: .35rem 0; }
.encart-telephone { border: 1.5px solid var(--accent); border-radius: 12px; padding: .9rem 1rem; margin-bottom: 1.1rem; background: color-mix(in srgb, var(--accent) 7%, transparent); }
.adresse-a-ouvrir { font-family: ui-monospace, monospace; font-size: 1.05rem; font-weight: 600; word-break: break-all; margin: .4rem 0; }
td.actions form { display: inline-flex; gap: .3rem; align-items: center; }
input.date-encaissement { width: auto; padding: .2rem .35rem; font-size: .8rem; min-height: 0; }
.sous-titre-carte { font-size: .95rem; margin: 1.1rem 0 .4rem; padding-top: .8rem; border-top: 1px solid var(--bord); }
dl.fiche.notes dd ul { margin: 0; padding-left: 1.1rem; }
dl.fiche.notes dd li { margin: .1rem 0; }
.graphique-cadre { margin-top: 1.2rem; }
svg.graphique { display: block; width: 100%; height: auto; font-family: inherit; }
svg.graphique .grille { stroke: var(--bord); stroke-width: 1; }
svg.graphique .axe-base { stroke: var(--texte-2); stroke-width: 1.2; }
svg.graphique .axe, svg.graphique .legende.muted { fill: var(--texte-2); font-size: 12px; }
svg.graphique .annee { fill: var(--texte); font-size: 14px; font-weight: 600; }
svg.graphique .legende { fill: var(--texte); font-size: 13px; }
svg.graphique .valeur-barre { fill: var(--texte); font-size: 12px; font-weight: 600; }
.choix-bien select { width: auto; max-width: 100%; }
.ligne-formulaire { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.ligne-formulaire label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; }
.ligne-formulaire input { width: auto; max-width: 100%; }
tr.surligne td { font-weight: 600; background: var(--fond-doux, rgba(0,0,0,.04)); }

/* ---------- Messages ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 1.1rem; }
.messages li { padding: .75rem 1rem; border-radius: 12px; margin-bottom: .5rem; background: var(--accent-doux); font-weight: 500; }
.messages li.success { background: var(--ok-fond); color: var(--ok); }
.messages li.error { background: var(--alerte-fond); color: var(--alerte); }
.messages li.warning { background: var(--attention-fond); color: var(--attention); }

/* ---------- Documents ---------- */
.docs-layout { display: grid; grid-template-columns: 250px 1fr; gap: 1.4rem; align-items: start; }
.categories { position: sticky; top: 1rem; padding: .7rem; }
.categories a { display: flex; justify-content: space-between; align-items: center; padding: .48rem .65rem; border-radius: 9px; color: var(--texte); font-size: .88rem; }
.categories a span:last-child { font-size: .75rem; font-weight: 650; color: var(--texte-2); background: var(--neutre-fond); border-radius: 99px; padding: 0 .45rem; min-width: 1.5rem; text-align: center; }
.categories a:hover { background: var(--surface-2); text-decoration: none; }
.categories a.actif { background: var(--accent-doux); color: var(--accent); font-weight: 650; }
.categories a.actif span:last-child { background: var(--accent); color: #fff; }
.categories a.vide { color: var(--texte-2); }
.depot {
  border: 2px dashed color-mix(in srgb, var(--accent) 35%, var(--bord)); border-radius: var(--rayon); padding: 1.1rem;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 6%, transparent), color-mix(in srgb, #14b8a6 6%, transparent));
  transition: border-color .15s, background .15s;
}
.depot.survol { border-color: var(--accent); background: var(--accent-doux); }
.depot .ligne { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.vide-etat { text-align: center; padding: 2.2rem 1rem; color: var(--texte-2); }
.vide-etat img { width: 200px; max-width: 60%; display: block; margin: 0 auto 1rem; }
.vide-etat h2 { color: var(--texte); font-size: 1.3rem; }

/* ---------- Connexion ---------- */
.page-connexion { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; position: relative; isolation: isolate; background: #1e1b4b; }
.page-connexion picture, .page-connexion picture img { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: bottom; z-index: -1; }
.page-connexion .connexion {
  width: 100%; max-width: 400px; background: rgba(255, 255, 255, .86); backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); border: 1px solid rgba(255, 255, 255, .6); border-radius: 22px;
  padding: 2rem; box-shadow: 0 30px 60px -20px rgba(30, 10, 80, .55); color: #161a2c;
}
.page-connexion .connexion .logo { width: 48px; height: 48px; border-radius: 14px; margin-bottom: 1rem; }
.page-connexion .connexion h1 { font-size: 1.5rem; }
.page-connexion .connexion p { color: #5d6481; margin-top: 0; }
.page-connexion .connexion input { background: #fff; color: #161a2c; border-color: #dfe3ef; }
.page-connexion button.primaire { width: 100%; justify-content: center; padding: .75rem; font-size: .95rem; }
.page-connexion .pied { margin-top: 1.2rem; font-size: .78rem; color: #5d6481; display: flex; align-items: center; gap: .4rem; justify-content: center; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) .page-connexion .connexion { background: rgba(21, 26, 46, .82); border-color: rgba(255, 255, 255, .08); color: #e8eaf6; }
  :root:not([data-theme="clair"]) .page-connexion .connexion p,
:root:not([data-theme="clair"]) .page-connexion .pied { color: #9aa1c2; }
  :root:not([data-theme="clair"]) .page-connexion .connexion input { background: #0f1426; color: #e8eaf6; border-color: #2a3150; }
}
:root[data-theme="sombre"] .page-connexion .connexion { background: rgba(21, 26, 46, .82); border-color: rgba(255, 255, 255, .08); color: #e8eaf6; }
:root[data-theme="sombre"] .page-connexion .connexion p,
:root[data-theme="sombre"] .page-connexion .pied { color: #9aa1c2; }
:root[data-theme="sombre"] .page-connexion .connexion input { background: #0f1426; color: #e8eaf6; border-color: #2a3150; }

.menu-mobile { display: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .nav { position: sticky; top: 0; z-index: 10; height: auto; padding: .6rem 1rem; }
  .nav .marque { padding: .3rem 0; }
  .nav .liens { display: none; padding-bottom: .5rem; }
  .nav.ouvert .liens { display: flex; }
  .nav .bas { margin-top: .75rem; }
  .menu-mobile { display: inline-flex; background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .15); }
  .contenu { padding: 1.1rem 1rem 3rem; }
  .hero { padding: 1.4rem 1.3rem 4.8rem; border-radius: 18px; }
  .hero h1 { font-size: 1.55rem; }
  .banniere { height: 240px; border-radius: 18px; }
  .banniere .texte { left: 1rem; right: 1rem; bottom: .9rem; }
  .banniere .texte h1 { font-size: 1.4rem; }
  .docs-layout { grid-template-columns: 1fr; }
  .categories { position: static; display: flex; overflow-x: auto; gap: .3rem; }
  .categories a { flex-shrink: 0; gap: .5rem; }
  .depot .ligne { grid-template-columns: 1fr; }
  .carte { padding: 1.05rem; }
  .table-wrap { margin: 0 -1.05rem; padding: 0 1.05rem; }
  dl.fiche { grid-template-columns: 1fr; gap: .1rem; }
  dl.fiche dd { margin-bottom: .55rem; }
}
@media print {
  .nav, .actions, .boutons, td.actions, .filtres, .hero picture { display: none !important; }
  body { background: #fff; }
  .app { display: block; }
  .carte, .stat { box-shadow: none; break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Interactions sans rechargement (htmx) ---------- */
#toasts { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: .5rem; align-items: center; width: max-content; max-width: calc(100vw - 2rem); }
.toast {
  background: #1b1840; color: #fff; padding: .7rem 1.1rem; border-radius: 12px; font-size: .9rem; font-weight: 550;
  box-shadow: 0 12px 30px -10px rgba(20, 10, 60, .55); animation: toast-entree .25s ease-out; transition: opacity .4s, transform .4s;
  display: flex; align-items: center; gap: .55rem;
}
.toast::before { content: "✓"; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #14b8a6; font-size: .75rem; flex-shrink: 0; }
.toast.sortie { opacity: 0; transform: translateY(8px); }
@keyframes toast-entree { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) .toast { background: #2a2466; }
}
:root[data-theme="sombre"] .toast { background: #2a2466; }
.htmx-request button, .htmx-request.btn-icone, button.htmx-request { opacity: .55; pointer-events: none; }
tr.htmx-swapping, .doc.htmx-swapping { opacity: 0; transition: opacity .25s; }
tr.htmx-added, .doc.htmx-added { background: var(--ok-fond); }
tr.htmx-settling { transition: background 1.2s; }
#resultats.htmx-request, #liste-docs.htmx-request { opacity: .6; transition: opacity .15s; }
.apercu-revision { background: linear-gradient(135deg, var(--accent-doux), color-mix(in srgb, #14b8a6 10%, var(--surface))); border-color: color-mix(in srgb, var(--accent) 25%, var(--bord)); }
.grand-chiffre { font-size: 2rem; font-weight: 750; letter-spacing: -.02em; color: var(--accent); font-variant-numeric: tabular-nums; }

/* ---------- Numérisation ---------- */
.compteur { margin-left: auto; background: #f43f5e; color: #fff; border-radius: 99px; font-size: .72rem; font-weight: 700; padding: .05rem .5rem; }
.numeriser { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.gros-bouton {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .45rem; text-align: center;
  min-height: 220px; padding: 1.5rem; border-radius: 22px; cursor: pointer; background: var(--surface);
  border: 2px dashed color-mix(in srgb, var(--accent) 35%, var(--bord)); color: var(--texte); transition: transform .15s, box-shadow .15s;
}
.gros-bouton:hover { transform: translateY(-2px); box-shadow: var(--ombre-forte); }
.gros-bouton b { font-size: 1.15rem; }
.gros-bouton > span:last-child { color: var(--texte-2); font-size: .88rem; }
.gros-bouton .bulle { width: 72px; height: 72px; border-radius: 22px; }
.gros-bouton.primaire { background: var(--degrade); color: #fff; border: none; box-shadow: var(--ombre-forte); }
.gros-bouton.primaire > span:last-child { color: rgba(255, 255, 255, .85); }
.gros-bouton.primaire .bulle { background: rgba(255, 255, 255, .2); color: #fff; }
.conseils { margin: 0; padding-left: 1.2rem; color: var(--texte-2); }
.conseils li { margin-bottom: .3rem; }
.carte-classer { display: grid; grid-template-columns: 220px 1fr; gap: 1.4rem; align-items: start; }
.apercu-doc > a { display: block; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; border: 1px solid var(--bord); background: var(--surface-2); }
.apercu-doc img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.apercu-doc .petit { margin-top: .4rem; }
.champs-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.depense { border: 1px solid var(--bord); border-radius: 14px; padding: .8rem 1rem; margin: .2rem 0 .6rem; background: var(--surface-2); }
.case-depense { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; cursor: pointer; }
.case-depense input { width: auto; accent-color: var(--accent); }
.depense .details-depense { display: none; margin-top: .8rem; }
.depense.active .details-depense, .depense:has(input[name=creer_depense]:checked) .details-depense { display: grid; }
.texte-reconnu summary { cursor: pointer; color: var(--texte-2); font-size: .85rem; margin-top: .6rem; }
.texte-reconnu pre { white-space: pre-wrap; font-size: .78rem; max-height: 280px; overflow: auto; background: var(--surface-2); padding: .8rem; border-radius: 10px; }
.jauge .defile { width: 35%; animation: defile 1.2s ease-in-out infinite; }
@keyframes defile { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
@media (max-width: 900px) {
  .numeriser { grid-template-columns: 1fr; }
  .gros-bouton { min-height: 150px; }
  .carte-classer { grid-template-columns: 1fr; }
  .apercu-doc > a { aspect-ratio: 4 / 5; max-height: 70vh; }
  .champs-2 { grid-template-columns: 1fr; }
}
.outils-photo { display: flex; align-items: center; gap: .3rem; margin: .55rem 0 .3rem; flex-wrap: wrap; }
.outils-photo.htmx-request { opacity: .5; }
.segments { display: inline-flex; border: 1px solid var(--bord); border-radius: 10px; overflow: hidden; margin-right: auto; }
.segments button { border: none; border-radius: 0; padding: .35rem .6rem; font-size: .78rem; background: var(--surface); }
.segments button + button { border-left: 1px solid var(--bord); }
.segments button.actif { background: var(--accent-doux); color: var(--accent); font-weight: 700; }
.apercu-doc > a { background: #fff; }
.apercu-doc img { object-fit: contain; }

/* ---------- Onglet Documents ---------- */
.barre-recherche { display: grid; gap: .6rem; margin-bottom: 1.1rem; }
.barre-recherche input[type=search] { font-size: 1rem; padding: .75rem 1rem; }
.barre-outils { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; gap: .6rem; }
.tout-cocher { display: flex; gap: .4rem; align-items: center; font-size: .85rem; color: var(--texte-2); cursor: pointer; }
.tout-cocher input, .case-doc { width: auto; accent-color: var(--accent); }
.segments a { padding: .35rem .7rem; font-size: .8rem; color: var(--texte); background: var(--surface); }
.segments a + a { border-left: 1px solid var(--bord); }
.segments a.actif { background: var(--accent-doux); color: var(--accent); font-weight: 700; }
.segments a:hover { text-decoration: none; }
.barre-lot {
  position: sticky; top: .6rem; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  padding: .6rem .8rem; margin-bottom: .8rem; border-radius: 12px; background: var(--accent-doux);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.barre-lot select { width: auto; padding: .3rem .5rem; font-size: .8rem; }
.groupe-lot { display: inline-flex; gap: .3rem; align-items: center; }
.doc > .case-doc { flex-shrink: 0; }
.grille-docs { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.vignette-doc { position: relative; display: flex; flex-direction: column; gap: .25rem; cursor: pointer; }
.vignette-doc .case-doc { position: absolute; top: .5rem; left: .5rem; z-index: 1; width: 18px; height: 18px; }
.vignette-doc .image { display: grid; place-items: center; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; border: 1px solid var(--bord); background: #fff; }
.vignette-doc .image img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.vignette-doc .image .type-fichier { min-width: 3.4rem; height: 2.2rem; font-size: .85rem; margin: 0; }
.vignette-doc:has(.case-doc:checked) .image { outline: 3px solid var(--accent); outline-offset: 1px; }
.vignette-doc .titre { font-size: .85rem; font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pagination { display: flex; justify-content: center; align-items: center; gap: .8rem; margin-top: 1rem; }
@media (max-width: 900px) { .barre-lot { top: 3.6rem; } }
.groupe-lot { flex: 1 1 240px; min-width: 0; }
.groupe-lot select { flex: 1; min-width: 0; max-width: 100%; }
.filtres select { max-width: 100%; min-width: 0; }
@media (max-width: 900px) { .barre-recherche .filtres select { flex: 1 1 45%; } }
[hidden] { display: none !important; }
.vignette-doc .image img.pdf, .apercu-pdf { object-fit: cover; object-position: top; background: #fff; }

/* Sélection : grandes zones tactiles */
.case-zone { display: grid; place-items: center; width: 44px; height: 44px; margin: -4px 0 -4px -8px; flex-shrink: 0; cursor: pointer; border-radius: 10px; }
.case-zone:hover { background: var(--surface-2); }
.case-zone input, .case-doc, .case-doc-tout { width: 22px !important; height: 22px; margin: 0; cursor: pointer; accent-color: var(--accent); }
.tout-cocher.case-zone.large { width: auto; padding: 0 .6rem 0 .4rem; margin-left: -.4rem; gap: .5rem; display: inline-flex; }
.docs .doc { cursor: pointer; border-radius: 10px; padding-left: .3rem; padding-right: .3rem; margin: 0 -.3rem; }
.docs .doc.selectionne { background: var(--accent-doux); }
.vignette-doc { cursor: pointer; }
.vignette-doc .case-zone { position: absolute; top: 6px; left: 6px; z-index: 2; margin: 0; width: 42px; height: 42px;
  background: rgba(255, 255, 255, .92); box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.vignette-doc .case-zone:hover { background: #fff; }
.vignette-doc .case-doc { position: static; }
.vignette-doc.selectionne .image { outline: 3px solid var(--accent); outline-offset: 1px; }
.mode-selection .vignette-doc .image { cursor: pointer; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) .vignette-doc .case-zone { background: rgba(21, 26, 46, .92); }
}
:root[data-theme="sombre"] .vignette-doc .case-zone { background: rgba(21, 26, 46, .92); }
.rattachement { color: var(--texte); font-weight: 500; }
.docs .doc-actions .btn-icone { width: 40px; height: 40px; }

/* Thème choisi par l'utilisateur (Clair / Sombre / Auto) */
@media (prefers-color-scheme: dark) { :root:not([data-theme="clair"]) { color-scheme: dark; } }
:root[data-theme="sombre"] { color-scheme: dark; }
.choix-theme { display: flex; gap: 2px; margin: .2rem 0 .7rem; padding: 3px; border-radius: 10px; background: rgba(0, 0, 0, .22); }
.choix-theme button { flex: 1; justify-content: center; padding: .35rem .2rem; border: none; border-radius: 8px; background: transparent;
  color: var(--nav-texte); font-size: .74rem; gap: .25rem; }
.choix-theme button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.choix-theme button.actif { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 700; }
.nav .bas form.choix-theme { display: flex; }
.choix-theme button { min-height: 34px; }
.menu-mobile:hover, .menu-mobile:active { background: rgba(255, 255, 255, .18); color: #fff; }

/* Cases de sélection : carré fin, croix quand sélectionné ; zone tactile invisible de 44 px */
.case-zone, .case-zone:hover, .vignette-doc .case-zone, .vignette-doc .case-zone:hover {
  background: transparent !important; box-shadow: none !important;
}
.vignette-doc .case-zone { top: 2px; left: 2px; }
.case-doc, .case-doc-tout {
  -webkit-appearance: none; appearance: none; flex-shrink: 0;
  width: 20px !important; height: 20px; margin: 0; border-radius: 6px; cursor: pointer;
  border: 1.5px solid color-mix(in srgb, var(--texte-2) 75%, transparent);
  background: var(--surface) center / 14px 14px no-repeat;
  transition: background-color .12s, border-color .12s;
}
.vignette-doc .case-doc { box-shadow: 0 1px 4px rgba(0, 0, 0, .18); }
.case-doc:checked, .case-doc-tout:checked {
  border-color: var(--accent); background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 4.5l7 7M11.5 4.5l-7 7' stroke='white' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}
.case-doc:focus, .case-doc-tout:focus { outline: none; }
@media (hover: hover) and (pointer: fine) {
  .case-doc:focus-visible, .case-doc-tout:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
}
@media (hover: hover) {
  .case-zone:hover .case-doc:not(:checked), .case-zone:hover .case-doc-tout:not(:checked) { border-color: var(--accent); }
}
.case-doc:focus, .case-doc-tout:focus { box-shadow: none; }
.case-doc:not(:checked):focus, .case-doc-tout:not(:checked):focus { border-color: color-mix(in srgb, var(--texte-2) 75%, transparent); }
.vignette-doc .case-doc:focus { box-shadow: 0 1px 4px rgba(0, 0, 0, .18); }
.vignette-doc .case-doc:not(:checked), .vignette-doc .case-doc:not(:checked):focus { background-color: rgba(255, 255, 255, .92); border-color: #8a90a8; }

/* ---------- Fenêtre d'export ---------- */
.dialogue { border: none; border-radius: 20px; padding: 1.4rem 1.5rem; width: min(680px, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem);
  background: var(--surface); color: var(--texte); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5); }
.dialogue::backdrop { background: rgba(15, 12, 40, .55); backdrop-filter: blur(3px); }
.dialogue-tete { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.dialogue-tete h2 { margin: 0; display: flex; gap: .5rem; align-items: center; }
.dialogue h3 { margin-top: 1.1rem; }
.choix-cartes { display: grid; gap: .5rem; }
.choix-cartes.structures { grid-template-columns: 1fr 1fr; }
.choix { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem .85rem; border: 1px solid var(--bord); border-radius: 12px; cursor: pointer; }
.choix:has(input:checked) { border-color: var(--accent); background: var(--accent-doux); }
.choix input { width: auto; margin-top: .2rem; accent-color: var(--accent); }
.choix span { display: grid; gap: .15rem; min-width: 0; }
.choix small { color: var(--texte-2); }
.choix pre { margin: .3rem 0 0; font-size: .72rem; line-height: 1.45; color: var(--texte-2); white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.choix.desactive { opacity: .5; cursor: not-allowed; }
.case-option { display: flex; gap: .55rem; align-items: center; margin: .35rem 0; cursor: pointer; }
.case-option input { width: auto; accent-color: var(--accent); }
@media (max-width: 640px) { .choix-cartes.structures { grid-template-columns: 1fr; } .dialogue { padding: 1.1rem; } }

/* ---------- À régler ---------- */
.titre-section { display: flex; align-items: center; gap: .5rem; margin: 1.2rem 0 .7rem; }
.alerte-texte { color: var(--alerte); }
.attention-texte { color: var(--attention); }
.liste-reglements { display: grid; gap: .7rem; }
.reglement { display: grid; grid-template-columns: 76px 1fr auto; gap: 1rem; align-items: center; margin: 0; padding: .9rem 1.1rem; }
.reglement.retard { border-left: 4px solid var(--alerte); }
.reglement.regle { opacity: .8; }
.reglement-echeance { display: grid; justify-items: center; text-align: center; line-height: 1.15; }
.reglement-echeance b { font-size: 1.35rem; letter-spacing: -.02em; }
.reglement-echeance span { font-size: .75rem; color: var(--texte-2); }
.reglement-echeance small { font-size: .72rem; font-weight: 650; margin-top: .2rem; }
.reglement-titre { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.reglement-titre .montant { font-weight: 750; font-variant-numeric: tabular-nums; margin-left: auto; }
.reglement-actions { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.form-regler { display: flex; gap: .3rem; align-items: center; }
.form-regler input, .form-regler select { width: auto; padding: .35rem .45rem; font-size: .8rem; }
.suites { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.suite { display: flex; gap: .45rem; align-items: flex-start; padding: .55rem .6rem; border: 1px solid var(--bord); border-radius: 10px; background: var(--surface); cursor: pointer; }
.suite:has(input:checked) { border-color: var(--accent); background: var(--accent-doux); }
.suite input { width: auto; margin-top: .15rem; accent-color: var(--accent); }
.suite span { display: grid; } .suite small { color: var(--texte-2); font-size: .75rem; }
.depense .details-depense { display: grid; margin-top: .8rem; }
.depense:has(input[value=classer]:checked) .details-depense { display: none; }
.depense:not(:has(input[value=a_regler]:checked)) .champ-echeance { display: none; }
.hero .compteur { margin-left: .2rem; }
@media (max-width: 900px) {
  .reglement { grid-template-columns: 60px 1fr; }
  .reglement-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .suites { grid-template-columns: 1fr; }
}
.apercu-facture { position: relative; display: block; margin: 0 0 1.1rem; border-radius: 14px; overflow: hidden; border: 1px solid var(--bord); background: #fff; }
.apercu-facture img { display: block; width: 100%; max-height: 260px; object-fit: cover; object-position: top; }
.apercu-facture .btn { position: absolute; left: 50%; bottom: .8rem; transform: translateX(-50%); box-shadow: 0 6px 18px rgba(0, 0, 0, .2); }
.apercu-facture:not(:has(img)) { background: transparent; border: none; }
.apercu-facture:not(:has(img)) .btn { position: static; transform: none; width: 100%; justify-content: center; }

/* ---------- Rôles ---------- */
.lecture-seule .proprio { display: none !important; }
.choix-espace { margin: 0 0 .8rem; }
.choix-espace select { width: 100%; background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .15); font-size: .82rem; }
.choix-espace select option { color: #161a2c; }
.role-membre { display: block; font-size: .72rem; color: var(--nav-texte); font-weight: 500; }
.membre .avatar { flex-shrink: 0; }
.membre.suspendu { opacity: .6; }
.menu-scis { position: relative; }
.menu-scis[open] form { position: absolute; right: 0; top: 2.2rem; z-index: 5; min-width: 240px; background: var(--surface); border: 1px solid var(--bord); border-radius: 12px; padding: .8rem; box-shadow: var(--ombre-forte); }
.menu-scis summary { list-style: none; } .menu-scis summary::-webkit-details-marker { display: none; }
table.matrice td.centre { text-align: center; }
.case-droit:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-color: var(--ok); border-color: var(--ok); }

/* Bandeau de la SCI de démonstration */
.bandeau-demo { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 1rem 1.2rem; margin: 0 0 1.1rem; border-radius: 14px; background: var(--accent-doux);
  border: 1px solid var(--accent); line-height: 1.5; }
.bandeau-demo > div { flex: 1 1 420px; }
.bandeau-demo form { flex: 0 0 auto; }

/* Signature électronique */
table.signataires { width: 100%; border-collapse: collapse; }
table.signataires th { text-align: left; font-size: .8rem; font-weight: 600; color: var(--texte-doux, #5d6481); padding: 0 .3rem .3rem; }
table.signataires td { padding: .2rem .3rem; }
table.signataires input { width: 100%; min-width: 120px; }
.etapes-signature { list-style: none; counter-reset: etape; display: flex; gap: .5rem; padding: 0; margin: 1.2rem 0; }
.etapes-signature li { counter-increment: etape; flex: 1; padding: .55rem .7rem; border-radius: 10px; font-size: .88rem;
  background: var(--accent-doux); opacity: .55; }
.etapes-signature li::before { content: counter(etape) ". "; font-weight: 700; }
.etapes-signature li.actif { opacity: 1; outline: 2px solid var(--accent); }
.etapes-signature li.fait { opacity: 1; background: var(--ok-fond); color: var(--ok); }
.etapes-signature li.fait::before { content: "✓ "; }

/* États des lieux */
fieldset.edl { border: 0; padding: 0; margin: 0; min-width: 0; }
.titre-piece { display: flex; align-items: center; gap: .8rem; margin-bottom: .6rem; }
.nom-piece { margin-top: .3rem; }
.elements-edl { display: grid; gap: .55rem; }
.element-edl { display: grid; grid-template-columns: minmax(150px, 1fr) auto minmax(180px, 1.2fr); gap: .5rem .8rem; align-items: center;
  padding-bottom: .55rem; border-bottom: 1px solid var(--bord); }
.nom-element { font-weight: 600; font-size: .93rem; }
.choix-etat { display: flex; gap: .3rem; flex-wrap: wrap; }
.choix-etat label { cursor: pointer; }
.choix-etat input { position: absolute; opacity: 0; pointer-events: none; }
.choix-etat span { display: inline-block; padding: .38rem .6rem; border-radius: 999px; font-size: .8rem; border: 1px solid var(--bord); white-space: nowrap; }
.choix-etat input:focus-visible + span { outline: 2px solid var(--accent); }
.choix-etat .etat-neuf input:checked + span, .choix-etat .etat-bon input:checked + span { background: var(--ok-fond); color: var(--ok); border-color: var(--ok); font-weight: 600; }
.choix-etat .etat-usage input:checked + span { background: var(--attention-fond); color: var(--attention); border-color: var(--attention); font-weight: 600; }
.choix-etat .etat-mauvais input:checked + span { background: var(--alerte-fond); color: var(--alerte); border-color: var(--alerte); font-weight: 600; }
.photos-edl { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; margin: 1rem 0 .6rem; }
.photos-edl figure { margin: 0; position: relative; }
.photos-edl img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; display: block; }

.photos-edl .suppr-photo { position: absolute; top: .3rem; right: .3rem; }
.photos-edl .suppr-photo .btn-icone { background: var(--surface); }
.ajout-photos { display: flex; gap: .5rem; flex-wrap: wrap; }
.ajout-photos label.envoi { opacity: .6; pointer-events: none; }
.ajout-photos label.envoi::after { content: " — envoi…"; }
@media (max-width: 720px) { .element-edl { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .choix-etat { display: grid; grid-template-columns: repeat(4, 1fr); gap: .25rem; }
  .choix-etat label { display: flex; }
  .choix-etat span { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; padding: .45rem .15rem; font-size: .72rem; white-space: normal; line-height: 1.15; }
}
.piece-edl .photos-edl:empty { display: none; }
.piece-edl .ajout-photos { margin-bottom: 1rem; }
.element-edl .commentaire-element { padding: .4rem .6rem; font-size: .88rem; }
.dictee { margin: .2rem 0 1rem; }
.dictee > summary { list-style: none; display: inline-flex; }
.dictee > summary::-webkit-details-marker { display: none; }
.dictee[open] > summary { background: var(--accent-doux); }
.dictee textarea { width: 100%; }
.actions-dictee { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.micro.en-cours { background: var(--alerte-fond); color: var(--alerte); border-color: var(--alerte); animation: pulsation 1.4s ease-in-out infinite; }
@keyframes pulsation { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--alerte) 18%, transparent); } }
@media (prefers-reduced-motion: reduce) { .micro.en-cours { animation: none; } }
.photos-edl .legende-photo { position: relative; }
.photos-edl .legende-photo textarea { width: 100%; margin-top: .3rem; font-size: .8rem; padding: .35rem 2.3rem .35rem .45rem; resize: vertical; min-height: 2.6rem; field-sizing: content; max-height: 9rem; }
.photos-edl .micro-photo { position: absolute; right: .25rem; top: .55rem; }
.photos-edl .micro-photo.en-cours { color: var(--alerte); background: var(--alerte-fond); animation: pulsation 1.4s ease-in-out infinite; }
.titre-piece { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .4rem; }
.titre-piece h2 { margin: 0; }
.ordre-piece { display: flex; gap: .3rem; }
.ordre-piece .btn-icone { font-size: 1rem; font-weight: 700; }
.ordre-piece .btn-icone:disabled { opacity: .3; cursor: default; }
.nom-element { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.nom-element-champ { font-weight: 600; font-size: .93rem; border-color: transparent !important; background: transparent !important;
  padding: .2rem .3rem !important; margin-left: -.3rem; flex: 1 1 8rem; min-width: 0; box-shadow: none; }
.nom-element-champ:hover { border-color: var(--bord) !important; }
.nom-element-champ:focus { border-color: var(--accent) !important; background: var(--surface) !important; }
.suppr-element { color: var(--texte); opacity: .45; font-size: 1.1rem; line-height: 1; }
.suppr-element:hover { opacity: 1; color: var(--alerte); }
fieldset.edl:disabled .nom-element-champ { color: inherit; }
.photos-edl .tourner-photo { position: absolute; top: .3rem; left: .3rem; }
.photos-edl .tourner-photo .btn-icone { background: var(--surface); }
.element-edl.htmx-swapping { opacity: 0; transition: opacity .25s; }
.niveaux-signature { border: 1px solid var(--bord); border-radius: 12px; padding: .7rem 1rem .4rem; margin: 1rem 0 0; }
.niveaux-signature legend { font-weight: 600; padding: 0 .3rem; }
.niveaux-signature .case-option { align-items: flex-start; margin-bottom: .5rem; }
.niveaux-signature input:disabled + span { opacity: .55; }

/* Contrats */
.modeles-contrats { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.modele-contrat { display: flex; flex-direction: column; gap: .5rem; margin: 0; }
.modele-contrat h2 { margin: 0; }
.modele-contrat p { margin: 0; flex: 1; }
.choix-bail { display: flex; gap: .4rem; }
.choix-bail select { flex: 1; min-width: 0; }
.champs-contrat { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .2rem 1rem; }
.champs-contrat .champ.large { grid-column: 1 / -1; }
.champs-contrat .aide { font-size: .78rem; color: var(--texte-doux, #5d6481); margin-top: .2rem; }
.choix-signature { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.option-signature { border: 1px solid var(--bord); border-radius: 12px; padding: .9rem 1rem; }
.option-signature h3 { margin: 0 0 .3rem; font-size: 1rem; display: flex; align-items: center; gap: .4rem; }
.option-signature form, .option-signature .btn { margin: .25rem .3rem .25rem 0; }
.depot-signe { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.depot-signe label.envoi { opacity: .6; pointer-events: none; }
.depot-signe label.envoi::after { content: " — envoi…"; }
.liste-etapes { margin: 0 0 .7rem; padding-left: 1.2rem; }

/* Signature au doigt */
.pave-signature { border: 1.5px dashed var(--accent); border-radius: 14px; background: #fff; margin-bottom: .9rem; overflow: hidden; }
.pave-entete { display: flex; justify-content: space-between; align-items: center; padding: .45rem .7rem; font-size: .82rem; color: #5d6481; }
.pave-entete .mini { color: #161a2c; background: #f3f5fb; }
#pave { display: block; width: 100%; height: 190px; touch-action: none; cursor: crosshair; }
.pave-ligne { border-top: 1px solid #d9dce6; margin: 0 1rem; padding: .3rem 0 .6rem; font-size: .78rem; color: #5d6481; text-align: center; }
.sur-place { border: 1px solid var(--bord); border-radius: 12px; padding: .9rem 1rem .4rem; margin: .8rem 0 1rem; background: var(--accent-doux); }
.presence-choix { display: flex; gap: .4rem; flex-wrap: wrap; }
.presence-choix select { width: auto; }
.presence-choix input { width: 12rem; }
.resolution { border-bottom: 1px solid var(--bord); padding-bottom: .7rem; margin-bottom: .8rem; }
.vote-resolution { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.vote-resolution select { width: auto; }
.vote-resolution input { width: 7.5rem; }
.choix-code { display: grid; gap: .5rem; }
.choix-code button { width: 100%; }

/* Banque */
.import-releve { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.import-releve label.envoi { opacity: .6; pointer-events: none; }
.entete-banque { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.onglets { display: flex; gap: .3rem; flex-wrap: wrap; }
.onglets a { padding: .4rem .8rem; border-radius: 999px; text-decoration: none; color: inherit; border: 1px solid var(--bord); font-size: .88rem; }
.onglets a.actif { background: var(--accent-doux); border-color: var(--accent); font-weight: 600; }
.mvt { display: grid; grid-template-columns: 6.2rem 1fr 7.5rem minmax(260px, 1.3fr); gap: .3rem .9rem; align-items: center;
  padding: .55rem 0; border-bottom: 1px solid var(--bord); }
.mvt-date { font-size: .85rem; color: var(--texte-doux, #5d6481); }
.mvt-libelle { font-size: .9rem; overflow-wrap: anywhere; }
.mvt-montant { font-weight: 700; text-align: right; white-space: nowrap; }
.mvt.credit .mvt-montant { color: var(--ok); }
.choix-mvt { display: flex; gap: .4rem; }
.choix-mvt select { flex: 1; min-width: 0; font-size: .85rem; }
.mvt.statut-rapproche, .mvt.statut-ignore { opacity: .85; }
.mvt.htmx-swapping { opacity: 0; transition: opacity .2s; }
@media (max-width: 760px) {
  .mvt { grid-template-columns: 1fr auto; }
  .mvt-date { grid-column: 1 / -1; }
  .mvt-action { grid-column: 1 / -1; }
}

/* Reprise d'historique des loyers */
.periodes { display: grid; gap: .6rem; margin-bottom: .7rem; }
.periode-historique { display: grid; grid-template-columns: 6rem repeat(4, minmax(140px, 1fr)) 2rem; gap: .2rem .8rem; align-items: end;
  padding: .6rem .8rem; border: 1px solid var(--bord); border-radius: 12px; }
.numero-periode { font-weight: 700; font-size: .88rem; align-self: center; }
.periode-historique .champ { margin: 0; }
.actions-historique { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
@media (max-width: 760px) { .periode-historique { grid-template-columns: 1fr 1fr; } .numero-periode { grid-column: 1 / -1; } }
.grille-historique th[scope=row] { font-weight: 500; font-size: .86rem; min-width: 210px; text-align: left; }
.grille-historique td { padding: .25rem .3rem; vertical-align: top; }
.grille-historique input { width: 6.5rem; text-align: right; padding: .35rem .45rem; font-size: .88rem; }
.grille-historique .deja { font-size: .7rem; color: var(--attention); margin-top: .15rem; white-space: nowrap; }
.grille-historique tr.recette th[scope=row] { color: var(--ok); }
.grille-historique tbody th[scope=row] { text-transform: none; letter-spacing: 0; color: var(--texte); }

/* TVA */
.echeances-tva { display: grid; gap: .6rem; }
.echeance-tva { display: grid; grid-template-columns: minmax(200px, 1.3fr) minmax(220px, 1.6fr) 9rem minmax(200px, 1fr); gap: .5rem 1rem;
  align-items: center; padding: .75rem .9rem; border: 1px solid var(--bord); border-radius: 12px; }
.echeance-tva.retard { border-color: var(--alerte); background: var(--alerte-fond); }
.echeance-tva.terminee { opacity: .75; }
.et-montants { display: flex; gap: 1rem; flex-wrap: wrap; }
.et-montants > div { display: flex; flex-direction: column; font-size: .9rem; }
.et-actions { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.et-actions .form-ligne { display: flex; gap: .3rem; }
.et-actions .form-ligne input[type=date] { width: auto; padding: .3rem .4rem; font-size: .82rem; }
@media (max-width: 900px) { .echeance-tva { grid-template-columns: 1fr; } .et-actions { justify-content: flex-start; } }
