/* Gestion copropriété — papier clair, encre foncée, un seul accent vert réservé à « payé ». */
:root {
  color-scheme: light;
  --papier: #f6f1e7;
  --carte: #fffdf8;
  --encre: #1b1a17;
  --encre-2: #3d3a33;
  --trait: #8a8273;
  --trait-clair: #ddd5c5;
  --vert: #1f7a3a;
  --alerte: #8a2a12;
  --rayon: 10px;
  --nav-l: 248px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--papier); color: var(--encre);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
.colonne { min-height: 100vh; display: flex; flex-direction: column; }
main { width: 100%; max-width: 640px; margin: 0 auto; padding: 8px 16px 24px; flex: 1; }
main:focus { outline: none; }
h1 { font-size: 26px; margin: 4px 0 12px; line-height: 1.2; }
h1:focus { outline: none; }
h1:focus-visible { outline: 3px solid var(--encre); outline-offset: 4px; }
h2 { font-size: 20px; margin: 24px 0 8px; line-height: 1.25; }
p { margin: 8px 0; }
a { color: var(--encre); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.muted { color: var(--encre-2); font-size: 15px; font-weight: 400; }
.vide { color: var(--encre-2); font-style: italic; padding: 8px 0; }
.chargement { padding: 24px 0; }
.vert { color: var(--vert); font-weight: 700; }
.alerte { color: var(--alerte); font-weight: 700; }

/* Lien d'évitement clavier */
.saut { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--encre); color: var(--papier); padding: 10px 14px; border-radius: 8px; }
.saut:focus { top: 8px; }

/* Barre du haut (téléphone) */
.barre { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 56px;
  padding: 6px 16px; padding-top: max(6px, env(safe-area-inset-top)); max-width: 640px; width: 100%; margin: 0 auto; }
.barre .qui { font-weight: 700; color: var(--encre-2); }

.titre-ligne { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 4px 0 8px; }
.titre-ligne h1 { margin: 0; }
.titre-section { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin: 24px 0 8px; }
.titre-section h2 { margin: 0; }
.total-court { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Cartes et chiffres */
.carte { background: var(--carte); border: 2px solid var(--encre); border-radius: var(--rayon); padding: 16px; margin: 12px 0; }
.carte > h2:first-child { margin-top: 0; }
.chiffres { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.chiffre { background: var(--carte); border: 2px solid var(--encre); border-radius: var(--rayon); padding: 12px; min-height: 96px; }
.chiffre .lib { font-size: 15px; font-weight: 700; color: var(--encre-2); }
.chiffre .val { font-size: 28px; font-weight: 800; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.chiffre .val small { font-size: 16px; font-weight: 700; }
.chiffre .val.date { font-size: 24px; white-space: nowrap; }
.chiffre .sous { margin-top: 4px; font-size: 15px; }
.chiffre.paye { border-color: var(--vert); }
.chiffre.paye .val { color: var(--vert); }
.chiffre.reste { background: var(--encre); color: var(--papier); }
.chiffre.reste .lib { color: var(--papier); }
.chiffre.reste.ajour { background: var(--carte); color: var(--encre); }
.chiffre.reste.ajour .lib { color: var(--encre-2); }
.total-bloc { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; background: var(--carte);
  border: 2px solid var(--encre); border-radius: var(--rayon); padding: 12px 16px; margin: 12px 0; }
.total-bloc .lib { font-weight: 700; color: var(--encre-2); }
.total-bloc .val { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; border: 2px solid var(--encre); border-radius: 999px; padding: 1px 10px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.badge.ok { border-color: var(--vert); color: var(--vert); }
.badge.plein { background: var(--encre); color: var(--papier); }
.badge.alerte { border-color: var(--alerte); color: var(--alerte); }
.pastille { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--alerte); color: #fff; font-size: 13px; font-weight: 800; }

.ccp-ligne { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ccp { font-size: 20px; font-weight: 800; overflow-wrap: anywhere; margin: 4px 0; }
.texte { white-space: pre-line; }
.annonce .ligne1 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.annonce h2 { margin: 0; font-size: 19px; }
.afaire { padding-left: 20px; margin: 8px 0 12px; }
.afaire li { margin: 8px 0; }
.pc-seul { display: none !important; }
a.btn.plein { width: 100%; margin-top: 8px; }
.grille-accueil { display: flex; flex-direction: column; }
.grille-accueil > aside { order: -1; }

/* Listes */
.liste { list-style: none; padding: 0; margin: 8px 0; }
.liste > li.carte { margin: 8px 0; border-width: 1px; border-color: var(--trait); }
.liste .ligne1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 700; }
.replie { margin: 16px 0; }
.replie summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; cursor: pointer; }

/* Menu « Plus » */
.menu { display: grid; gap: 8px; }
.menu a { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 14px; background: var(--carte);
  border: 2px solid var(--encre); border-radius: var(--rayon); text-decoration: none; font-weight: 700; }
.menu a .fleche { margin-left: auto; font-size: 24px; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; font-variant-numeric: tabular-nums; background: var(--carte);
  border: 2px solid var(--encre); border-radius: var(--rayon); border-spacing: 0; overflow: hidden; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--trait-clair); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: 14px; color: var(--encre-2); background: var(--papier); border-bottom: 2px solid var(--encre); }
td.n, th.n { text-align: right; white-space: nowrap; }
td.act { text-align: right; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
tr.retard td:first-child { box-shadow: inset 4px 0 0 var(--alerte); }
tr.coupe td { color: var(--encre-2); }

/* Formulaires */
label { display: block; font-weight: 700; margin: 12px 0 4px; }
fieldset { border: 0; padding: 0; margin: 12px 0 0; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
input, select, textarea {
  width: 100%; min-height: 48px; font: inherit; color: var(--encre); background: #fff;
  border: 2px solid var(--encre); border-radius: 8px; padding: 10px 12px;
}
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { width: 28px; height: 28px; min-height: 28px; accent-color: var(--encre); margin: 0; }
input[type=checkbox] { accent-color: var(--encre); }
.case { display: flex; align-items: center; gap: 12px; min-height: 48px; font-weight: 700; margin: 12px 0 0; font-size: 19px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible, .puce input:focus-visible + span {
  outline: 3px solid var(--encre); outline-offset: 2px;
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--encre); outline-offset: 1px; }
.choix { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.choix.trois { grid-template-columns: repeat(3, 1fr); }
.choix.quatre { grid-template-columns: repeat(2, 1fr); }
.puce { margin: 0; position: relative; }
.puce input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.puce span { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 8px 6px; border: 2px solid var(--encre);
  border-radius: 8px; background: #fff; cursor: pointer; font-weight: 700; text-align: center; }
.puce input:checked + span { background: var(--encre); color: var(--papier); }
.champ-btn { display: flex; gap: 8px; }
.champ-btn input { flex: 1; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; min-width: 44px;
  font: inherit; font-weight: 700; color: var(--papier); background: var(--encre);
  border: 2px solid var(--encre); border-radius: 8px; padding: 10px 16px; cursor: pointer; text-decoration: none; text-align: center;
}
button.second, .btn.second { color: var(--encre); background: var(--carte); }
button.petit, .btn.petit { min-height: 44px; padding: 6px 12px; font-size: 15px; }
button.icone { padding: 6px; min-width: 44px; font-size: 20px; line-height: 1; }
button.plein { width: 100%; margin-top: 16px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.actions.serre { margin: 0; justify-content: flex-end; }
.rangee { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.poste-tete { display: none; }
.poste-ligne { display: grid; grid-template-columns: 1fr 110px 44px; gap: 6px; margin: 6px 0; }
.zone-sep { margin-top: 20px; padding-top: 8px; border-top: 1px solid var(--trait-clair); }
.msg { border: 2px solid var(--encre); border-radius: 8px; padding: 10px 12px; margin: 12px 0; font-weight: 600; background: #fff; }
.msg .petit { margin-top: 8px; }
.msg.err { border-color: var(--alerte); color: var(--alerte); }

/* Connexion */
.connexion { max-width: 420px; margin: 8vh auto 0; padding: 24px; }
.connexion h1 { font-size: 32px; margin-bottom: 4px; }

/* Message flottant */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 40;
  max-width: min(92vw, 520px); padding: 12px 16px; border-radius: 10px; border: 2px solid var(--encre); background: var(--carte);
  font-weight: 700; box-shadow: 0 4px 18px rgba(27, 26, 23, .25); }
.toast.ok { border-color: var(--encre); color: var(--encre); }
.toast.err { border-color: var(--alerte); color: var(--alerte); }
body.sans-nav .toast { bottom: 24px; }

/* Dialogue */
dialog { width: min(94vw, 520px); border: 2px solid var(--encre); border-radius: 12px; padding: 16px 18px 20px; background: var(--carte); color: var(--encre); }
dialog::backdrop { background: rgba(27, 26, 23, .45); }
.dlg-tete { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dlg-tete h2 { margin: 0; }

/* Navigation */
.ico { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-cote { display: none; }
.nav-bas { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: var(--papier);
  border-top: 2px solid var(--encre); padding-bottom: env(safe-area-inset-bottom); }
.nav-bas a { position: relative; flex: 1; min-height: 64px; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 13px; font-weight: 700; text-decoration: none; color: var(--encre-2); padding: 6px 2px; line-height: 1.1; text-align: center; }
.nav-bas a span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.nav-bas a[aria-current="page"] { color: var(--encre); background: var(--carte); box-shadow: inset 0 4px 0 var(--encre); }
.nav-bas .pastille { position: absolute; top: 4px; right: calc(50% - 26px); min-width: 20px; height: 20px; font-size: 12px; }
body:not(.sans-nav) .colonne { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }

.pied { text-align: center; color: var(--encre-2); font-size: 14px; padding: 24px 16px 16px; margin: 0; }

.grille-2, .grille-form { display: block; }
.lecture-col { max-width: 760px; }
.etroit { max-width: 640px; }

/* Téléphone : tableaux « rt » en cartes */
@media (max-width: 699px) {
  table.rt, table.rt tbody, table.rt tr, table.rt td { display: block; width: 100%; }
  table.rt { border: 0; background: none; }
  table.rt thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.rt tr { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 6px 12px; margin: 8px 0; }
  table.rt tr.retard { border: 2px solid var(--alerte); }
  table.rt td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border: 0; text-align: right; white-space: normal; }
  table.rt td::before { content: attr(data-label); font-weight: 700; color: var(--encre-2); font-size: 14px; text-align: left; }
  table.rt td:first-child { font-size: 18px; border-bottom: 1px solid var(--trait-clair); padding-bottom: 8px; }
  table.rt td.act { justify-content: flex-end; }
  table.rt td.act::before, table.rt td[data-label=""]::before { content: none; }
  table.rt td:empty { display: none; }
  table.rt tr.retard td:first-child { box-shadow: none; }
}
@media (max-width: 699px) { .cache-tel { display: none; } }
@media (max-width: 359px) { .chiffre .val { font-size: 24px; } .nav-bas a { font-size: 12px; } }

/* Tablette */
@media (min-width: 700px) {
  main, .barre { max-width: 860px; padding-left: 24px; padding-right: 24px; }
  .chiffres.quatre { grid-template-columns: repeat(4, 1fr); }
}

/* PC : colonne de navigation à gauche, contenu large */
@media (min-width: 900px) {
  body { font-size: 16px; }
  .barre { display: none !important; }
  .nav-bas { display: none; }
  body:not(.sans-nav) .colonne { padding-bottom: 0; margin-left: var(--nav-l); }
  .nav-cote { display: flex; flex-direction: column; gap: 2px; position: fixed; top: 0; bottom: 0; left: 0; width: var(--nav-l);
    padding: 20px 14px; background: var(--carte); border-right: 2px solid var(--encre); overflow-y: auto; z-index: 30; }
  .nav-cote .marque { font-size: 19px; font-weight: 800; padding: 0 10px; line-height: 1.2; }
  .nav-cote .qui { padding: 2px 10px 14px; color: var(--encre-2); font-weight: 600; border-bottom: 1px solid var(--trait-clair); margin-bottom: 8px; }
  .nav-groupe { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--encre-2); padding: 14px 10px 4px; }
  .nav-cote a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 10px; border-radius: 8px;
    text-decoration: none; font-weight: 700; color: var(--encre-2); }
  .nav-cote a:hover { background: var(--papier); color: var(--encre); }
  .nav-cote a[aria-current="page"] { background: var(--encre); color: var(--papier); }
  .nav-cote a .pastille { margin-left: auto; }
  .nav-cote .deco { margin-top: auto; width: 100%; }
  main { max-width: 1120px; padding: 28px 40px 24px; margin: 0; }
  h1 { font-size: 30px; }
  .titre-ligne { margin-bottom: 16px; }
  .chiffres { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .chiffres.deux { grid-template-columns: repeat(2, minmax(0, 260px)); }
  .chiffre .val { font-size: 30px; }
  .grille-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
  .grille-2 > section > h2:first-child, .grille-2 > section.carte { margin-top: 12px; }
  .grille-accueil { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
  .grille-accueil > aside { margin-top: 24px; order: 0; }
  .pc-seul { display: flex !important; }
  .grille-form { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
  .grille-form > form { margin-top: 0; }
  .grille-form.inverse { grid-template-columns: 380px minmax(0, 1fr); }
  .grille-form > section > .titre-section:first-child { margin-top: 0; }
  .grille-form > section > h2:first-child { margin-top: 0; }
  .grille-form > section > .table-wrap:first-child { margin-top: 0; }
  .grille-cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
  .grille-cartes > li.carte { margin: 0; }
  .poste-tete { display: grid; grid-template-columns: 1fr 120px 44px; gap: 6px; font-size: 14px; font-weight: 700; color: var(--encre-2); }
  .poste-ligne { grid-template-columns: 1fr 120px 44px; }
  .choix.quatre { grid-template-columns: repeat(4, 1fr); }
  .toast { left: auto; right: 24px; transform: none; bottom: 24px; }
  .pied { text-align: left; padding-left: 40px; }
  tbody tr:hover td { background: #fbf7ee; }
  .actions.serre { flex-wrap: nowrap; }
}
@media (min-width: 1400px) { main { margin: 0 auto; } .pied { text-align: center; padding-left: 16px; } }
