:root {
  /* Couleurs des Résidences du Lac : bleu nuit et or du logo, turquoise du lac */
  --bg: #f3f6f7;
  --surface: #ffffff;
  --surface-2: #f6f9f9;
  --border: #e0e8ea;
  --text: #183141;
  --muted: #637c88;
  --primary: #0f7a6e;
  --primary-600: #0b6158;
  --primary-50: #e5f3f0;
  --lake: #2b6f8c;
  --lake-50: #e6f1f5;
  --gold: #c9bd1e;
  --gold-50: #f7f4c9;
  --navy: #0d2f47;
  --ok: #1e7b4f;
  --ok-50: #e3f4ea;
  --warn: #a35f00;
  --warn-50: #fdf1dc;
  --danger: #b42318;
  --danger-50: #fdeceb;
  --info: #2557a7;
  --info-50: #e8effb;
  --sidebar: #0d2f47;
  --sidebar-text: #c2d3dd;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(13, 47, 71, .06), 0 1px 3px rgba(13, 47, 71, .05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: 0 .3em; border-radius: 4px; font-size: .9em; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); padding: 1.25rem .9rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; gap: .6rem; align-items: center; padding: 0 .5rem 1.25rem; color: #fff; }
.brand-logo { width: 36px; height: 36px; border-radius: 9px; background: linear-gradient(135deg, #3c9a78, var(--lake)); display: grid; place-items: center; color: #fff; }
.brand-logo .icon { width: 20px; height: 20px; }
.brand-img { width: 40px; height: 40px; object-fit: contain; border-radius: 9px; background: #fff; padding: 3px; flex: none; }
.brand-img.officiel { border-radius: 50%; padding: 0; background: var(--navy); box-shadow: 0 0 0 2px rgba(201, 189, 30, .45); }
.brand strong { display: block; font-size: .98rem; line-height: 1.2; }
.brand span { font-size: .75rem; color: #9fb6c4; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; color: var(--sidebar-text); border-radius: 8px; font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .07); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .13); color: #fff; }
.nav .count { margin-left: auto; background: #e5484d; color: #fff; font-size: .72rem; font-weight: 700; padding: 0 .45rem; border-radius: 99px; line-height: 1.55; }
.nav-section { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #7f9cae; padding: 1rem .7rem .3rem; }
.nav-chat { display: flex; align-items: center; gap: .65rem; margin: 0 0 .5rem; padding: .65rem .75rem; border-radius: 10px; background: linear-gradient(110deg, #c5bb24, #e8e06a); color: #0a2236; font-weight: 700; line-height: 1.15; border: 1px solid #efe57a; }
.nav-chat:hover, .nav-chat.active { background: #f6ecae; color: #0a2236; text-decoration: none; }
.nav-chat .icon { width: 22px; height: 22px; }
.nav-chat small { display: block; font-size: .72rem; font-weight: 500; opacity: .8; }
.nav-chat .count { margin-left: auto; background: #c2452f; color: #fff; font-size: .72rem; font-weight: 700; padding: 0 .45rem; border-radius: 99px; line-height: 1.55; }
.sidebar-foot { margin-top: auto; padding: .75rem .5rem 0; font-size: .82rem; color: #9fb6c4; }
.sidebar-foot form { margin-top: .4rem; }
.sidebar-foot button { background: none; border: 0; color: var(--sidebar-text); padding: 0; cursor: pointer; display: inline-flex; gap: .4rem; align-items: center; font: inherit; }
.sidebar-foot button:hover { color: #fff; }

.main { min-width: 0; padding: 1.75rem 2rem 3rem; max-width: 1280px; width: 100%; }
.mobilebar { display: none; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin: .15rem 0 0; }
.crumb { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .85rem; margin-bottom: .35rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---------- Cards / grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.15rem 1.25rem; margin-bottom: 1.25rem; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .85rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card.flush { padding: 0; }
.card.flush .card-head { padding: 1rem 1.25rem 0; }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 1.25rem; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; display: flex; align-items: center; gap: .4rem; }
.kpi .value { font-size: 1.5rem; font-weight: 700; margin-top: .25rem; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: .82rem; color: var(--muted); }
.kpi.danger .value { color: var(--danger); }
.kpi.ok .value { color: var(--ok); }
.progress { height: 6px; background: var(--primary-50); border-radius: 99px; overflow: hidden; margin-top: .5rem; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }

dl.props { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: .6rem .75rem; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table td { padding: .65rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafcfc; }
.table .num, .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border); }
.table .row-actions { display: flex; gap: .35rem; justify-content: flex-end; flex-wrap: nowrap; }
.card.flush .table th:first-child, .card.flush .table td:first-child { padding-left: 1.25rem; }
.card.flush .table th:last-child, .card.flush .table td:last-child { padding-right: 1.25rem; }
.cell-sub { display: block; color: var(--muted); font-size: .82rem; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; font-weight: 600; padding: .12rem .55rem; border-radius: 99px; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge.paye, .badge.ok, .badge.envoye, .badge.actif { background: var(--ok-50); color: var(--ok); border-color: #bfe3cd; }
.badge.partiel, .badge.warn, .badge.simule, .badge.courrier { background: var(--warn-50); color: var(--warn); border-color: #f3d9a8; }
.badge.retard, .badge.danger, .badge.echec { background: var(--danger-50); color: var(--danger); border-color: #f5c6c2; }
.badge.du, .badge.info { background: var(--info-50); color: var(--info); border-color: #c7d7f2; }
.badge.lake { background: var(--lake-50); color: var(--lake); border-color: #bfdde4; }
.badge .icon { width: 13px; height: 13px; }
a.badge:hover { text-decoration: none; filter: brightness(.97); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; line-height: 1.3; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-600); }
.btn.danger { color: var(--danger); border-color: #f2c4bf; }
.btn.danger:hover { background: var(--danger-50); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: .3rem .6rem; font-size: .82rem; }
.btn.sm .icon { width: 15px; height: 15px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.chargement { opacity: .8; cursor: progress; }
.btn.chargement::after { content: ''; width: 14px; height: 14px; flex: none; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: tourne .7s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.chargement::after { animation-duration: 2s; } }
.btn-link { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
form.inline { display: inline; margin: 0; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.field label, .label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .3rem; }
.field .help { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=tel], input[type=file], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid #cdd9dd; border-radius: 8px; background: #fff; font: inherit; color: var(--text);
}
textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
textarea.tall { min-height: 260px; font-size: .9rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(15, 122, 110, .25); border-color: var(--primary); }
.check { display: flex; gap: .55rem; align-items: flex-start; font-weight: 500; }
.check input { margin-top: .25rem; width: 16px; height: 16px; accent-color: var(--primary); }
.form-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.25rem; flex-wrap: wrap; }
.input-group { display: flex; align-items: stretch; }
.input-group input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .suffix { padding: 0 .7rem; display: grid; place-items: center; border: 1px solid #cdd9dd; border-left: 0; border-radius: 0 8px 8px 0; background: var(--surface-2); color: var(--muted); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.15rem; margin: 0 0 1rem; }
legend { font-weight: 650; padding: 0 .4rem; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filters select, .filters input { width: auto; min-width: 150px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs a { padding: .6rem .95rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: .4rem; align-items: center; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-color: var(--primary); }
.pill-count { background: var(--danger); color: #fff; font-size: .72rem; border-radius: 99px; padding: 0 .45rem; }

/* ---------- Flash / callouts ---------- */
.flash { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.flash.success { background: var(--ok-50); border-color: #bfe3cd; color: #155c3a; }
.flash.error { background: var(--danger-50); border-color: #f5c6c2; color: #8f1d14; }
.flash.info { background: var(--info-50); border-color: #c7d7f2; color: #1d4685; }
.callout { padding: .85rem 1rem; border-radius: var(--radius); background: var(--lake-50); border: 1px solid #bfdde4; color: #1d5866; margin-bottom: 1rem; }
.callout.warn { background: var(--warn-50); border-color: #f3d9a8; color: #7a4700; }

.empty { text-align: center; padding: 2.25rem 1rem; color: var(--muted); }
.empty .icon { width: 36px; height: 36px; color: #a6bac3; margin-bottom: .4rem; }

/* ---------- Divers ---------- */
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .meta { color: var(--muted); font-size: .83rem; }
.amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.amount.danger { color: var(--danger); }
.amount.ok { color: var(--ok); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.nowrap { white-space: nowrap; }
.prewrap { white-space: pre-wrap; }
.mail-preview { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; white-space: pre-wrap; font-size: .92rem; }

.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--muted); }
.legend { display: flex; gap: 1rem; font-size: .82rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }

.bien-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.bien-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; color: inherit; }
.bien-card:hover { text-decoration: none; border-color: #b5cbd2; }
.bien-card .top { height: 76px; background: linear-gradient(120deg, #0d3a55 0%, #12706a 100%); position: relative; padding: .8rem 1rem; color: #fff; }
.bien-card .top .type { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; opacity: .85; }
.bien-card .top .badge { position: absolute; right: .8rem; top: .8rem; }
.bien-card .body { padding: .85rem 1rem 1rem; flex: 1; }
.bien-card .body h3 { margin: 0 0 .25rem; font-size: 1.02rem; }
.bien-card .foot { display: flex; justify-content: space-between; padding: .6rem 1rem; border-top: 1px solid var(--border); font-size: .88rem; background: var(--surface-2); }

/* Facture scannée (dépenses) */
.scan { border: 1px dashed #a9c3cb; background: var(--surface-2); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: 1.25rem; }
.scan .label { margin-bottom: .55rem; }
.scan-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.scan-actions .btn { cursor: pointer; }
.scan-preview { display: flex; align-items: center; gap: .8rem; margin-top: .2rem; }
.scan-preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: #fff; }
.scan-info { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.scan .help { margin-top: .5rem; font-size: .8rem; color: var(--muted); }
.scan .help.error { color: var(--danger); }
.justif { display: flex; align-items: center; gap: .7rem; min-width: 0; color: inherit; }
.justif img, .justif-pdf { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); flex: none; background: #fff; display: grid; place-items: center; color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (max-width: 520px) { .scan-actions .btn { flex: 1 1 100%; } }

details.collapse { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 1.25rem; }
details.collapse > summary { padding: .85rem 1.15rem; cursor: pointer; font-weight: 650; list-style: none; display: flex; align-items: center; gap: .5rem; }
details.collapse > summary::-webkit-details-marker { display: none; }
details.collapse > summary::before { content: '▸'; color: var(--muted); transition: transform .15s; }
details.collapse[open] > summary::before { transform: rotate(90deg); }
details.collapse > .content { padding: 0 1.15rem 1.15rem; }

dialog { border: 0; border-radius: 12px; padding: 0; width: min(480px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
dialog::backdrop { background: rgba(5, 25, 40, .5); }
dialog .dlg-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
dialog .dlg-head h2 { margin: 0; }
dialog .dlg-body { padding: 1.1rem 1.25rem; }
dialog .dlg-body .form-actions { margin-top: 1rem; }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; background: radial-gradient(circle at 20% 0%, #d6e7ee, transparent 55%), radial-gradient(circle at 100% 100%, #eeebc4, transparent 50%), var(--bg); }
.auth .card { width: min(420px, 100%); padding: 2rem; }
.auth .brand { color: var(--text); padding: 0 0 1.25rem; }
.auth .brand span { color: var(--muted); }

/* ---------- Chat locataires ---------- */
.chat { display: grid; grid-template-columns: 290px minmax(0, 1fr); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-height: 560px; overflow: hidden; margin-bottom: 1.25rem; }
.chat-fils { border-right: 1px solid var(--border); background: var(--surface-2); padding: .75rem .6rem; overflow-y: auto; max-height: 78vh; }
.chat-nouveau { margin-bottom: .6rem; }
.chat-vide { padding: .75rem; font-size: .88rem; }
.chat-fil { display: flex; gap: .6rem; align-items: center; padding: .6rem; border-radius: 10px; color: inherit; border: 1px solid transparent; margin-bottom: 2px; }
.chat-fil:hover { background: var(--primary-50); text-decoration: none; }
.chat-fil.actif { background: var(--primary-50); border-color: #b9ddd6; }
.chat-avatar { width: 36px; height: 36px; border-radius: 11px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.chat-fil-nom { flex: 1; min-width: 0; }
.chat-fil-nom strong, .chat-fil-nom small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-fil-nom small { color: var(--muted); font-size: .78rem; }
.chat-fil .count, .mobilebar-chat .count { background: #c2452f; color: #fff; font-size: .72rem; font-weight: 700; padding: 0 .45rem; border-radius: 99px; line-height: 1.6; }
.chat-fil .count.urgent { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-50); }
.chat-fenetre { display: flex; flex-direction: column; min-width: 0; }
.chat-tete { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.chat-flux { flex: 1; overflow-y: auto; padding: 1.1rem; display: flex; flex-direction: column; gap: .7rem; max-height: 60vh; min-height: 260px; background: radial-gradient(ellipse at top left, #f1f7f6, #fff 70%); }
.chat-saisie { display: flex; gap: .6rem; align-items: flex-end; padding: .8rem 1.1rem 0; }
.chat-saisie textarea { min-height: 46px; resize: vertical; }
.chat-saisie input { flex: 1; }
.chat-note { font-size: .78rem; color: var(--muted); padding: .35rem 1.1rem .8rem; margin: 0; }
.chat-fenetre > details.collapse { margin: 0 1.1rem 1.1rem; }
.bulle-ligne { display: flex; }
.bulle-ligne.droite { justify-content: flex-end; }
.bulle { max-width: 78%; padding: .6rem .85rem; border-radius: 14px; border: 1px solid var(--border); background: #fff; }
.bulle.locataire { background: #e2f2ec; border-color: #c6e5d9; }
.bulle.gestion { background: var(--navy); border-color: var(--navy); color: #fff; }
.bulle.assistant { background: #fff; border-color: #e3e0a8; }
.bulle.urgent { border: 2px solid var(--danger); }
.bulle-ligne.droite .bulle { border-bottom-right-radius: 4px; }
.bulle-ligne.gauche .bulle { border-bottom-left-radius: 4px; }
.bulle-auteur { font-size: .74rem; font-weight: 700; opacity: .75; margin-bottom: .2rem; }
.bulle-texte { white-space: pre-wrap; overflow-wrap: anywhere; }
.bulle-heure { font-size: .7rem; opacity: .65; text-align: right; margin-top: .3rem; }
.copie { display: flex; gap: .5rem; }
.copie input { font-size: .85rem; }
.questions-rapides { display: flex; gap: .4rem; flex-wrap: wrap; padding: .8rem 1.1rem 0; border-top: 1px solid var(--border); }
.questions-rapides .btn { border-radius: 99px; background: var(--primary-50); border-color: #c3e2db; color: var(--primary-600); }
.mobilebar-chat { margin-left: auto; color: #fff; display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .4rem; border-radius: 8px; background: rgba(255, 255, 255, .12); }

.notif { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.notif-ligne { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.notif-icone { width: 34px; height: 34px; border-radius: 10px; background: var(--gold-50); color: var(--navy); display: grid; place-items: center; flex: none; }
.notif-texte { flex: 1; min-width: 180px; }
.notif-texte strong, .notif-texte span { display: block; }
.notif-texte span { color: var(--muted); font-size: .85rem; }
.notif.actif .notif-icone { background: var(--ok-50); color: var(--ok); }
.notif [data-installer] { margin-top: .6rem; }
.notif-aide { margin-top: .5rem; font-size: .85rem; color: var(--muted); }
.notif-aide summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.notif-aide p { margin: .4rem 0 0; }
.espace-notif-aide { font-size: .82rem; margin: -.5rem 0 1rem; }

/* Espace locataire (page publique) */
body.espace { background: var(--bg); }
.espace-tete { background: var(--navy); padding: .8rem 16px; }
.espace-tete .brand { padding: 0; max-width: 760px; margin: 0 auto; }
.espace-corps { max-width: 760px; margin: 0 auto; padding: 1.25rem 16px 2.5rem; }
.espace-accueil { margin-bottom: 1rem; }
.espace-chat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 1rem; padding-bottom: 1rem; }
.espace-chat .chat-flux { max-height: 58vh; }
.espace-urgence, .espace-contact { margin-bottom: 1rem; }
.espace-contact p { display: flex; gap: .5rem; align-items: center; }
.espace-pied { font-size: .8rem; text-align: center; }

/* ---------- Tableau de bord : raccourcis ---------- */
.lanceur { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; border: 2px solid #ddd26a; border-radius: var(--radius); background: #fff; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.lanceur-icone { width: 46px; height: 46px; border-radius: 13px; background: var(--gold-50); color: var(--navy); display: grid; place-items: center; flex: none; }
.lanceur-icone .icon { width: 24px; height: 24px; }
.lanceur-texte { flex: 1; min-width: 0; }
.lanceur-texte strong { display: block; color: var(--navy); }
.lanceur-texte span { color: var(--muted); font-size: .88rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .mobilebar { display: flex; align-items: center; gap: .75rem; padding: .7rem 16px; background: var(--sidebar); color: #fff; position: sticky; top: 0; z-index: 30; }
  .mobilebar button { background: none; border: 0; color: #fff; padding: .25rem; cursor: pointer; }
  .main { padding: 1.25rem 16px 2.5rem; }
  .grid-2, .form-grid, .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 1.3rem; }
  .chat { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .chat-fils { border-right: 0; border-bottom: 1px solid var(--border); max-height: 230px; }
  .chat-flux { max-height: 55vh; }
  .bulle { max-width: 90%; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .kpi { padding: .75rem .8rem; }
  .kpi .label { font-size: .68rem; }
  .kpi .label .icon { display: none; }
  .kpi .value { font-size: 1.15rem; }
  .kpi .hint { font-size: .75rem; }
  .page-head .actions { width: 100%; }
  .chat-saisie { flex-direction: column; align-items: stretch; }
  .lanceur { flex-wrap: wrap; }
  .lanceur .btn { width: 100%; }
}

/* Tableaux en cartes sur téléphone : chaque ligne devient un bloc, l'intitulé de colonne
   (recopié dans data-label par app.js) s'affiche devant chaque valeur. */
@media (max-width: 640px) {
  .table-wrap { overflow-x: visible; }
  .table thead { display: none; }
  .table, .table tbody, .table tfoot, .table tr { display: block; width: 100%; }
  .table tr { padding: .75rem 16px; border-bottom: 1px solid var(--border); }
  .table tbody tr:hover td { background: transparent; }
  .table td, .card.flush .table td:first-child, .card.flush .table td:last-child {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .2rem 0; border: 0; text-align: right; white-space: normal;
  }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; text-align: left; flex: none; }
  .table td[data-label=""]::before, .table td:not([data-label])::before { content: none; }
  .table td:first-child { display: block; text-align: left; font-size: 1rem; padding-bottom: .35rem; }
  .table td:first-child::before { content: none; }
  .table td:empty { display: none; }
  .table td.text-right, .table td:last-child:has(.row-actions, .btn, form) { justify-content: flex-start; padding-top: .5rem; }
  .table .row-actions { justify-content: flex-start; flex-wrap: wrap; }
  .table .cell-sub { text-align: inherit; }
  .table tfoot td { background: transparent; }
  .table tfoot tr { background: var(--surface-2); }
}

@media print {
  .sidebar, .mobilebar, .actions, .btn, form { display: none !important; }
  .layout { display: block; }
  .card { box-shadow: none; }
}
