/* ==========================================================================
   PatrimoniaCD by MPS CORP — thème 2026 (même identité que le site vitrine)
   Bleu ciel, boutons d'action orange, menu blanc, police Poppins,
   animation d'ouverture et apparitions douces. Chargé après style.css et
   patrimonia.css : il ne change que l'apparence.
   ========================================================================== */
:root {
  --primary: #0f766e;
  --primary-600: #0b5f58;
  --primary-50: #e7f4f1;
  --primary-100: #c8e7e0;
  --orange: #d4a017;
  --orange-600: #b8890f;
  --navy-ink: #0b3b36;
  --sky-1: #14877c;
  --sky-2: #0d5c56;
  --bg: #f4f8fc;
  --surface-2: #f8fbfe;
  --line: #e3e9f0;
  --text: #1c2e44;
  --ring: 0 0 0 3px rgba(15, 118, 110, .22);
  --font: "Poppins", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(11, 59, 54, .05);
  --shadow: 0 2px 4px rgba(11, 59, 54, .04), 0 12px 28px rgba(11, 59, 54, .07);
}
body { font-family: var(--font); background: var(--bg); }
h1, h2, h3, .page-header h1, .modal-head h2 { font-weight: 600; letter-spacing: -.01em; }
.kpi-value { font-weight: 600; }

/* ---------- Logo ---------- */
.logo-mark { width: 38px; height: 38px; flex: none; }
.logo-mark .roof { stroke: var(--orange); }
.logo-mark .p { stroke: var(--primary); }
.brand { border-bottom: 1px solid var(--line); }
.brand-mark { width: auto; height: auto; background: none; box-shadow: none; border-radius: 0; }
.brand-text b { color: var(--navy-ink); font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand-text b span { color: var(--primary); }
.brand-text .brand-by, .simple-brand .brand-text .brand-by { font-style: normal; font-size: 10px; font-weight: 500; letter-spacing: .1em; color: #7b8ba0; margin-top: 3px; }

/* ---------- Menu latéral blanc ---------- */
.sidebar { background: #fff; color: #3b4a5e; border-right: 1px solid var(--line); }
.nav-label { color: #9aa8ba; font-weight: 600; }
.nav-link { color: #3b4a5e; font-weight: 500; }
.nav-link .icon { color: #8a9bb0; }
.nav-link:hover { background: #f2f7fc; color: var(--primary); }
.nav-link:hover .icon { color: var(--primary); }
.nav-link.active { background: var(--primary-50); color: var(--primary); font-weight: 600; }
.nav-link.active .icon { color: var(--primary); }
.nav-link.active::before { background: var(--orange); }
.user-card { background: var(--surface-2); border-color: var(--line); }
.user-meta b { color: var(--text); }
.user-meta small { color: #7b8ba0; }
.user-card .icon-btn { color: #7b8ba0; }
.user-card .icon-btn:hover { background: var(--primary-50); color: var(--primary); }
.avatar { background: linear-gradient(135deg, #e2b53e, var(--orange)); color: var(--navy-ink); }

/* ---------- Boutons : l'action principale en orange ---------- */
.btn.primary { color: var(--navy-ink); background: var(--orange); border-color: var(--orange); box-shadow: 0 4px 12px rgba(212, 160, 23, .28); }
.btn.primary:hover:not(:disabled) { color: #fff; background: var(--orange-600); border-color: var(--orange-600); }
.btn { border-radius: 8px; font-weight: 600; }
.eyebrow { color: var(--primary); font-weight: 600; }

/* ---------- Bandeau du tableau de bord ---------- */
.page-header { padding: 0 0 4px; }
body.page-index .page-header { padding: 22px 24px; border-radius: 16px; background: linear-gradient(115deg, var(--sky-1), var(--sky-2)); color: #fff; }
body.page-index .page-header h1, body.page-index .page-header .eyebrow { color: #fff; }
body.page-index .page-header p { color: rgba(255, 255, 255, .9); }
body.page-index .page-header .btn:not(.primary) { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .45); color: #fff; }

/* ---------- Connexion ---------- */
.auth-body { background: var(--bg); }
.auth-visual { background: linear-gradient(115deg, var(--sky-1), var(--sky-2)) !important; }
.auth-visual::after { background: none !important; border: 46px solid rgba(255, 255, 255, .07); border-radius: 50%; inset: auto auto -140px -140px !important; width: 420px; height: 420px; mask-image: none !important; }
.auth-visual .brand { border: 0; }
.auth-visual .logo-mark .p { stroke: #fff; }
.auth-visual .logo-mark .roof { stroke: #f0cf6b; }
.auth-visual .brand-text b, .auth-visual .brand-text b span { color: #fff; }
.auth-visual .brand-text .brand-by { color: rgba(255, 255, 255, .85); }
.auth-hero h1 { font-weight: 600; line-height: 1.25; }
.auth-hero p { color: rgba(255, 255, 255, .92); }
.auth-visual .flow-step { background: #fff; color: var(--text); border: 0; box-shadow: 0 12px 28px rgba(4, 34, 30, .18); }
.auth-visual .flow-step small { color: #66758a; }
.auth-visual .flow-arrow { color: rgba(255, 255, 255, .8); }
.auth-foot, .auth-foot .auth-space { color: rgba(255, 255, 255, .85); }
.auth-card h2 { font-weight: 600; color: var(--navy-ink); }
.auth-card .btn.primary { height: 46px; }

/* ---------- Apparitions douces ---------- */
@keyframes pcdUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.content > .kpi-grid .kpi, .content > .panel, .content > .grid-2 > *, .content > .page-header { animation: pcdUp .45s cubic-bezier(.22, .8, .24, 1) both; }
.content > .kpi-grid .kpi:nth-child(2) { animation-delay: .05s; }
.content > .kpi-grid .kpi:nth-child(3) { animation-delay: .1s; }
.content > .kpi-grid .kpi:nth-child(4) { animation-delay: .15s; }
.content > .panel:nth-of-type(2), .content > .grid-2 > *:nth-child(2) { animation-delay: .12s; }
.kpi, .panel { transition: box-shadow .25s ease, transform .25s ease; }
.kpi:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

/* ---------- Animation d'ouverture ---------- */
html.splash-on::before { content: ""; position: fixed; inset: 0; z-index: 9999; background: #fff; }
.splash { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; background: #fff; transition: opacity .55s ease, visibility .55s ease; }
.splash.out { opacity: 0; visibility: hidden; }
.splash-in { display: flex; flex-direction: column; align-items: center; }
.splash-mark { width: 84px; height: 84px; }
.splash-mark path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: pcdDraw .6s ease forwards; }
.splash-mark .roof { stroke: var(--orange, #d4a017); }
.splash-mark .p { stroke: var(--primary, #0f766e); animation-delay: .35s; }
.splash-name { margin-top: 14px; font: 700 30px/1 "Poppins", system-ui, sans-serif; color: #0b3b36; letter-spacing: -.01em; opacity: 0; transform: translateY(8px); animation: pcdUp .5s .75s ease forwards; }
.splash-name span { color: #0f766e; }
.splash-by { margin-top: 6px; font: 500 11px/1 "Poppins", system-ui, sans-serif; letter-spacing: .14em; color: #7b8ba0; opacity: 0; animation: pcdUp .5s .9s ease forwards; }
.splash-bar { width: 190px; height: 3px; margin-top: 18px; border-radius: 3px; background: #e9f0f7; overflow: hidden; }
.splash-bar i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #0f766e 75%, #d4a017 75%); animation: pcdBar .8s 1s ease forwards; }
@keyframes pcdDraw { to { stroke-dashoffset: 0; } }
@keyframes pcdBar { to { width: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .content > * , .content .kpi { animation: none !important; }
}

/* ---------- Petits écrans ---------- */
@media (max-width: 960px) {
  body.page-index .page-header { padding: 18px; }
}

/* Menu un peu plus large : les libellés tiennent sur une ligne avec Poppins. */
@media (min-width: 961px) { .app-shell { grid-template-columns: 268px minmax(0, 1fr); } }
.nav-link { font-size: 13px; }

/* Portail : choix de l espace quand un e-mail donne accès à plusieurs espaces. */
.space-choice { display: grid; gap: 10px; margin-top: 6px; }
.space-choice .btn { justify-content: flex-start; height: 48px; }

/* ---------- Diaporama derrière la page de connexion (mêmes photos que le site) ---------- */
.auth-visual { isolation: isolate; }
.auth-visual > .auth-slides { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.auth-visual > .auth-shade { position: absolute; inset: 0; z-index: -1; background: linear-gradient(160deg, rgba(8, 48, 44, .9), rgba(11, 82, 76, .82) 55%, rgba(15, 118, 110, .7)); }
.auth-slides span { position: absolute; inset: -3%; background-size: cover; background-position: center; opacity: 0; animation: pcdSlide 36s linear infinite, pcdZoom 12s ease-in-out infinite alternate; will-change: opacity, transform; }
.auth-slides .s1 { background-image: url(img/fond-1.jpg); opacity: 1; animation-name: pcdSlideFirst, pcdZoom; animation-delay: 0s, 0s; }
.auth-slides .s2 { background-image: url(img/fond-2.jpg); background-position: center; animation-delay: 6s, -3s; }
.auth-slides .s3 { background-image: url(img/fond-3.jpg); animation-delay: 12s, -6s; }
.auth-slides .s4 { background-image: url(img/fond-4.jpg); background-position: center 35%; animation-delay: 18s, -9s; }
.auth-slides .s5 { background-image: url(img/fond-5.jpg); background-position: center 30%; animation-delay: 24s, -2s; }
.auth-slides .s6 { background-image: url(img/fond-6.jpg); animation-delay: 30s, -7s; }
@keyframes pcdSlide { 0% { opacity: 0; } 3% { opacity: 1; } 16.6% { opacity: 1; } 20% { opacity: 0; } 100% { opacity: 0; } }
@keyframes pcdSlideFirst { 0% { opacity: 1; } 16.6% { opacity: 1; } 20% { opacity: 0; } 97% { opacity: 0; } 100% { opacity: 1; } }
@keyframes pcdZoom { from { transform: scale(1); } to { transform: scale(1.14); } }
@media (prefers-reduced-motion: reduce) { .auth-slides span { animation: none; } }

/* ---------- Application installable ---------- */
.install-app { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.install-btn { height: 46px; gap: 10px; background: var(--primary-50); border-color: var(--primary-100); color: var(--primary-600); font-weight: 600; }
.install-btn:hover { border-color: var(--primary); color: var(--primary); }
.install-btn .logo-mark { width: 24px; height: 24px; }
.install-ios { margin-top: 12px; padding: 14px 16px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--text); }
.install-ios ol { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; }

/* ---------- Connexion : carte structurée ; photos aussi sur téléphone ---------- */
.auth-panel { background: radial-gradient(900px 400px at 100% 0%, rgba(15, 118, 110, .08), transparent 60%), var(--bg); }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 38px 34px; box-shadow: 0 24px 60px rgba(11, 59, 54, .12); }
.auth-card h2 { font-size: 26px; margin-bottom: 4px; }
.auth-card > p { margin-bottom: 22px; }
.auth-card .field input { height: 46px; border-radius: 10px; }
.auth-card-brand { display: none; justify-content: center; margin: -6px 0 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.auth-card-brand .brand { border: 0; padding: 0; margin: 0; }
.auth-card .muted.hint { margin: 14px 0 0; font-size: 12.5px; text-align: center; }
@media (max-width: 1024px) {
  /* Les photos passent en fond plein écran, la carte au-dessus. */
  .auth-shell { position: relative; isolation: isolate; }
  .auth-visual { display: block !important; position: fixed !important; inset: 0; z-index: -1; padding: 0 !important; min-height: 0 !important; }
  .auth-visual > :not(.auth-slides):not(.auth-shade) { display: none !important; }
  .auth-visual::after { display: none; }
  .auth-panel { background: transparent; min-height: 100vh; padding: 28px 16px; }
  .auth-card { width: min(420px, 100%); padding: 30px 22px; box-shadow: 0 30px 70px rgba(4, 34, 30, .4); border: 0; }
  .auth-card-brand { display: flex; }
}

/* ---------- Rapport de gestion (écran et impression) ---------- */
.rg .rg-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 18px 0 8px; }
.rg .rg-kpi { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; }
.rg .rg-kpi span { display: block; font-size: 11.5px; color: #66758a; font-weight: 500; }
.rg .rg-kpi b { display: block; margin: 4px 0 2px; font-size: 19px; font-weight: 700; color: var(--navy-ink); font-variant-numeric: tabular-nums; }
.rg .rg-kpi small { display: block; font-size: 10.5px; color: #8a97a8; line-height: 1.35; }
.rg .rg-kpi.rg-ok { border-color: #b9e0d6; background: #f3faf8; }
.rg .rg-kpi.rg-ok b { color: var(--primary); }
.rg .rg-kpi.rg-warn { border-color: #f1d2a0; background: #fffaf0; }
.rg .rg-kpi.rg-warn b { color: #a35a00; }
.rg .rg-h { margin: 22px 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--primary); font-size: 14px; font-weight: 700; color: var(--navy-ink); text-transform: uppercase; letter-spacing: .04em; }
.rg .report-table small { color: #8a97a8; font-size: 10.5px; }
.rg .report-table tfoot td { font-weight: 700; }
.rg .rg-rouge { color: #b42318; }
.rg .rg-muted { color: #98a6b8; font-style: italic; }
.rg .rg-futur td { color: #98a6b8; }
.rg .rg-vide { margin: 6px 0 4px; padding: 10px 12px; border-radius: 8px; background: #f6f9fc; color: #66758a; font-size: 12.5px; }
.rg .rg-faits { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 12.5px; }
.rg .rg-faits li { display: grid; grid-template-columns: 82px 80px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.rg .rg-faits span { color: #66758a; }
.rg .rg-faits b { color: var(--primary); }
.rg .rg-note { margin: 18px 0 0; padding: 10px 12px; border-left: 3px solid var(--orange); background: #fffaf0; font-size: 11.5px; color: #4a5a6e; line-height: 1.5; }
@media (max-width: 760px) { .rg .rg-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media print {
  .rg .rg-kpis { grid-template-columns: repeat(4, 1fr); }
  .rg .rg-kpi, .rg .rg-note, .rg .rg-vide { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rg .rg-h, .rg .report-table { break-inside: avoid-page; }
}
.rg .rg-kpi { display: block; }
.rg .report-table thead th { background: var(--primary); color: #fff; border-color: var(--primary); }
.rg .report-table tfoot td { background: #eef7f4; }
@media print { .rg .report-table thead th, .rg .report-table tfoot td { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ---------- Messages locataires (agent IA) ---------- */
.conv-panel .panel-head { align-items: flex-start; }
.conv-head-side { display: flex; gap: 6px; flex-wrap: wrap; }
.conv-inter, .conv-resume { margin: 0 22px 10px; font-size: 13.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.conv-inter svg { width: 16px; height: 16px; color: var(--primary); }
.conv-resume { background: var(--primary-50); border: 1px solid var(--primary-100); border-radius: 10px; padding: 10px 12px; display: block; }
.conv-fil { display: flex; flex-direction: column; gap: 12px; padding: 8px 22px 18px; }
.conv-msg { max-width: 78%; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; background: #fff; box-shadow: var(--shadow-sm); }
.conv-msg.in { align-self: flex-start; border-top-left-radius: 4px; }
.conv-msg.out { align-self: flex-end; border-top-right-radius: 4px; background: var(--primary-50); border-color: var(--primary-100); }
.conv-msg.by-humain { background: #fff8e6; border-color: #f0dcb2; }
.conv-msg header { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: #66758a; margin-bottom: 4px; }
.conv-msg header b { color: var(--navy-ink); }
.conv-body { font-size: 14px; line-height: 1.55; word-wrap: break-word; }
.conv-pieces, .conv-wait { margin: 6px 0 0; font-size: 12px; color: #66758a; display: flex; gap: 6px; align-items: center; }
.conv-pieces svg { width: 14px; height: 14px; }
.conv-wait { color: #8a5a07; }
.conv-reply, .conv-assoc { border-top: 1px solid var(--line); }
.conv-assoc h3 { margin: 0 0 4px; font-size: 15px; }
.conv-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 22px 20px; border-top: 1px solid var(--line); }
.conv-extrait { color: #66758a; font-size: 13px; max-width: 280px; }
.row-unread td:first-child { box-shadow: inset 3px 0 0 var(--orange); }
@media (max-width: 720px) { .conv-msg { max-width: 94%; } .conv-fil, .conv-actions { padding-left: 14px; padding-right: 14px; } .conv-inter, .conv-resume { margin-left: 14px; margin-right: 14px; } }

/* ---------- Déconnexion automatique et journal d'activité ---------- */
.session-alerte { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 9999; display: flex; gap: 14px; align-items: center; max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 14px; background: var(--navy-ink); color: #fff; box-shadow: 0 12px 32px rgba(11, 59, 54, .35); font-size: 14px; }
.session-alerte .btn { flex: none; }
.journal-filtres { align-items: center; }
.journal-filtres label { display: flex; gap: 6px; align-items: center; font-size: 13px; color: #66758a; }
.journal-filtres input[type=search] { flex: 1 1 200px; }
.journal .t-nowrap, .t-nowrap { white-space: nowrap; }
.journal-detail { max-width: 380px; font-size: 13px; color: #44546a; word-break: break-word; }
.journal-note { padding: 12px 18px 16px; margin: 0; }
@media (max-width: 720px) { .session-alerte { flex-direction: column; align-items: stretch; text-align: center; } }

/* ---------- Utilisateurs et rôles ---------- */
.tabs .tab { display: inline-flex; align-items: center; gap: 7px; }
.tabs .tab .icon { width: 16px; height: 16px; }
.tab-count { min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--line); color: #44546a; font-size: 11.5px; font-weight: 700; text-align: center; }
.tab.on .tab-count { background: var(--primary-50); color: var(--primary); }
.users-table td { vertical-align: middle; white-space: normal; }
.users-table .t-right, .perm-matrix .t-right { text-align: right; }
.users-table a.pill { text-decoration: none; }
.user-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.user-actions .inline-form { display: inline-flex; margin: 0; }
.user-actions .btn.danger { color: #b42318; }
.users-bottom { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.role-brief { padding: 6px 10px 12px; }
.role-brief-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 44px; gap: 12px; align-items: center; padding: 10px 8px; border-radius: 10px; color: inherit; text-decoration: none; }
.role-brief-row:hover { background: var(--surface-2); }
.role-brief-name b { display: block; font-size: 13.5px; }
.role-brief-name small { font-size: 12px; color: #66758a; }
.role-brief-bar { height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.role-brief-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--orange)); }
.role-brief-n { font-size: 12.5px; font-weight: 700; color: var(--navy-ink); text-align: right; }

.roles-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.role-nav ul { list-style: none; margin: 0; padding: 6px 10px; }
.role-nav-item { display: flex; gap: 12px; align-items: center; padding: 11px 10px; border-radius: 12px; color: inherit; text-decoration: none; border: 1px solid transparent; }
.role-nav-item:hover { background: var(--surface-2); }
.role-nav-item.on { background: var(--primary-50); border-color: var(--primary-100); }
.role-nav-ico { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); color: var(--primary); }
.role-nav-item.on .role-nav-ico { background: var(--primary); color: #fff; }
.role-nav-ico .icon { width: 17px; height: 17px; }
.role-nav-txt b { display: block; font-size: 14px; color: var(--navy-ink); }
.role-nav-txt small { display: block; font-size: 12px; color: #66758a; line-height: 1.4; }
.role-nav-foot { padding: 6px 16px 16px; }
.role-detail-head { align-items: flex-end; gap: 16px; }
.role-detail-head .field { flex: 1; margin: 0; }
.role-detail-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.role-detail-meta small { font-size: 12px; color: #66758a; white-space: nowrap; }
.role-note { margin: 0 18px 4px; }
.perm-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 14px 18px 18px; }
.perm-section { margin: 0; padding: 12px 12px 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; min-width: 0; }
.perm-section legend { display: flex; gap: 8px; align-items: center; padding: 0 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--navy-ink); }
.perm-section legend span { padding: 1px 7px; border-radius: 99px; background: var(--primary-50); color: var(--primary); letter-spacing: 0; }
.switch.perm-row { justify-content: space-between; gap: 14px; margin-bottom: 6px; padding: 9px 12px; line-height: 1.4; }
.switch.perm-row span { flex: 1; }
.role-detail-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.role-detail-foot .foot-note { flex: 1; font-size: 12.5px; color: #66758a; }
.perm-matrix th, .perm-matrix td { white-space: normal; }
.perm-matrix .t-center { text-align: center; }
.perm-matrix th a { color: inherit; text-decoration: none; }
.perm-matrix-group td { background: var(--surface-2); font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--navy-ink); }
.perm-yes { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--primary-50); color: var(--primary); }
.perm-yes .icon { width: 14px; height: 14px; }
.perm-no { color: #b8c2cf; }

@media (max-width: 1100px) {
  .roles-layout, .users-bottom { grid-template-columns: 1fr; }
  .perm-sections { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  /* Tableau des comptes : une carte par utilisateur */
  .users-table thead { display: none; }
  .users-table, .users-table tbody, .users-table tr, .users-table td { display: block; width: 100%; }
  .users-table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .users-table td { padding: 4px 0; border: 0; }
  .users-table td[data-label]:not(:first-child)::before { content: attr(data-label) " : "; font-size: 12px; color: #66758a; }
  .users-table .t-right { text-align: left; padding-top: 10px; }
  .user-actions { justify-content: flex-start; }
  .role-detail-head { flex-direction: column; align-items: stretch; }
  .role-detail-meta { align-items: flex-start; }
  .role-brief-row { grid-template-columns: minmax(0, 1fr) 70px 40px; }
}

/* ---------- Double authentification et mot de passe oublié ---------- */
.auth-links { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; margin-top: 12px; font-size: 13.5px; }
.auth-links a, .auth-links .link-btn { color: var(--primary); font-weight: 600; text-decoration: none; cursor: pointer; }
.auth-links a:hover, .auth-links .link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.code-input { font-size: 26px !important; letter-spacing: .5em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.auth-card .switch { margin: 4px 0 14px; }

/* Maisons : sans longueur ni largeur, le tableau de saisie est plus étroit */
.houses-editor table { min-width: 480px; }

/* ---------- Locataire : une personne ou une entreprise ---------- */
.field-label { display: block; font-size: 12.5px; font-weight: 600; color: #3d5068; margin-bottom: 6px; }
.seg-choice { display: flex; flex-wrap: wrap; gap: 8px; }
.seg-choice label { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 13.5px; background: #fff; }
.seg-choice label:has(input:checked) { border-color: var(--primary); background: var(--primary-50); color: var(--navy-ink); font-weight: 600; }
.seg-choice input { accent-color: var(--primary); margin: 0; }
.seg-choice input[type=radio] { width: 16px; height: 16px; min-width: 0; flex: none; padding: 0; box-shadow: none; }
.seg-choice label span { line-height: 1.3; }

/* ---------- Tableau de bord : « À surveiller » en onglets ---------- */
.watch-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 12px 12px 4px; }
.watch-tab { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: left; cursor: pointer; font: inherit; color: var(--text); transition: border-color .15s, background .15s; }
.watch-tab > .icon { width: 30px; height: 30px; padding: 7px; border-radius: 9px; box-sizing: border-box; }
.watch-tab span { min-width: 0; }
.watch-tab b { display: block; font-size: 13.5px; }
.watch-tab small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.watch-tab em { font-style: normal; font-weight: 700; font-size: 15px; min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 999px; background: var(--surface-2); }
.watch-tab.red > .icon { background: var(--danger-bg); color: var(--danger); }
.watch-tab.wh > .icon { background: var(--wh-bg); color: var(--wh); }
.watch-tab.in > .icon { background: var(--in-bg); color: var(--in); }
.watch-tab:hover { background: var(--surface-2); }
.watch-tab[aria-selected=true] { border-color: var(--primary); background: var(--primary-50); box-shadow: inset 0 -3px 0 var(--primary); }
.watch-tab.red[aria-selected=true] em { background: var(--danger); color: #fff; }
.watch-tab.wh[aria-selected=true] em { background: var(--wh); color: #fff; }
.watch-tab.in[aria-selected=true] em { background: var(--in); color: #fff; }
.watch-pane { padding: 6px 12px 12px; }
.watch-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; border-bottom: 1px solid var(--line); }
.watch-row:last-of-type { border-bottom: 0; }
.watch-row:hover { background: var(--surface-2); }
.watch-row .dot { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; }
.watch-row .dot .icon { width: 17px; height: 17px; }
.watch-row .dot.red { background: var(--danger-bg); color: var(--danger); }
.watch-row .dot.wh { background: var(--wh-bg); color: var(--wh); }
.watch-row .dot.in { background: var(--in-bg); color: var(--in); }
.watch-main { min-width: 0; color: inherit; text-decoration: none; }
.watch-main b { display: block; font-size: 13.5px; font-weight: 650; }
.watch-main small { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.watch-main:hover b { color: var(--primary); }
.watch-amt { text-align: right; white-space: nowrap; }
.watch-amt b { display: block; font-size: 13.5px; }
.watch-amt small { display: block; font-size: 12px; color: var(--muted); }
.watch-amt small.late, .watch-amt .soon { color: var(--danger); font-style: normal; font-weight: 600; }
.watch-act { display: flex; gap: 6px; justify-content: flex-end; }
.watch-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 10px 0; margin-top: 4px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); }
.watch-foot b { color: var(--text); }
@media (max-width: 760px) {
  .watch-tabs { grid-template-columns: 1fr; }
  .watch-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .watch-act { grid-column: 2 / -1; justify-content: flex-start; }
}

/* ---------- Paramètres : menu de rubriques ---------- */
.settings-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 20px; align-items: start; }
.settings-nav { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 4px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.settings-nav a { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; color: var(--text); text-decoration: none; }
.settings-nav a:hover { background: var(--surface-2); }
.settings-nav a[aria-current] { background: var(--primary-50); box-shadow: inset 3px 0 0 var(--primary); }
.settings-nav a[aria-current] b { color: var(--primary); }
.sn-ico { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); color: var(--muted); }
.sn-ico .icon { width: 16px; height: 16px; }
.settings-nav a[aria-current] .sn-ico { background: var(--primary); color: #fff; }
.sn-txt b { display: block; font-size: 13.5px; font-weight: 650; }
.sn-txt small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sn-txt small.ok { color: var(--wh); }
.sn-txt small.warn { color: #b45309; }
.sn-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.settings-body { min-width: 0; }
.settings-layout.js .rubrique { display: none; }
.settings-layout.js .rubrique.on { display: block; }
@media (max-width: 860px) {
  .settings-layout { grid-template-columns: 1fr; gap: 12px; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding: 6px; scrollbar-width: thin; }
  .settings-nav a { flex: none; grid-template-columns: auto auto; padding: 7px 12px 7px 7px; border: 1px solid var(--line); }
  .settings-nav a[aria-current] { border-color: var(--primary); box-shadow: none; }
  .sn-ico { width: 26px; height: 26px; }
  .sn-txt b { font-size: 13px; white-space: nowrap; }
  .sn-txt small { display: none; }
  .sn-sep { width: 1px; height: auto; margin: 4px 2px; flex: none; }
}

/* « À surveiller » : vue de synthèse (chiffres clés, répartition par site, cinq cas principaux) */
.watch-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 6px 0 4px; }
.watch-sum > div { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.watch-sum small { display: block; font-size: 12px; color: var(--muted); }
.watch-sum b { display: block; font-size: 20px; font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.watch-sum > .red { background: var(--danger-bg); border-color: transparent; } .watch-sum > .red b { color: var(--danger); }
.watch-sum > .wh { background: var(--wh-bg); border-color: transparent; } .watch-sum > .wh b { color: var(--wh); }
.watch-sum > .in { background: var(--in-bg); border-color: transparent; } .watch-sum > .in b { color: var(--in); }
.watch-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; padding: 4px 4px 0; }
.watch-cols .mini-title { color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-size: 11.5px; margin: 14px 0 8px; }
.watch-bars { padding: 0; gap: 10px; display: grid; }
.watch-bars .aging-row.occ-row { grid-template-columns: minmax(0, 170px) 1fr 90px; }
.watch-bars .aging-row span small { display: block; font-size: 11.5px; color: var(--muted); }
.watch-mini { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.watch-mini:last-child { border-bottom: 0; }
.watch-mini > a, .watch-mini > span:first-child { min-width: 0; color: inherit; text-decoration: none; }
.watch-mini > a:hover b { color: var(--primary); }
.watch-mini b { display: block; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.watch-mini small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.watch-mini .red { color: var(--danger); }
.watch-mini .icon-btn { width: 30px; height: 30px; }
@media (max-width: 900px) {
  .watch-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .watch-cols { grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 480px) {
  .watch-bars .aging-row.occ-row { grid-template-columns: minmax(0, 110px) 1fr 76px; }
  .watch-sum b { font-size: 17px; }
}

/* Paramètres › Relances : calendrier et WhatsApp */
.relance-plan { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 10px 16px; align-items: center; }
.relance-plan .input-suffix input { width: 100%; }
.wa-modeles { margin: 6px 0 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--surface-2); }
.wa-modeles summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.wa-modeles .code-box { white-space: normal; margin: 6px 0; }
.wa-test { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.wa-test .input-suffix { flex: 1 1 220px; }
@media (max-width: 560px) { .relance-plan { grid-template-columns: 1fr; } }

/* ---------- Espace locataire (locataire.php), pensé d'abord pour le téléphone ---------- */
.loc-body { margin: 0; background: #f4f8fc; font-family: var(--font); color: var(--text); min-height: 100vh; }
.loc-app { max-width: 520px; margin: 0 auto; min-height: 100vh; background: #f4f8fc; position: relative; padding-bottom: 84px; }
.loc-marque { display: flex; align-items: center; gap: 9px; }
.loc-marque svg { width: 30px; height: 30px; flex: none; background: #fff; border-radius: 9px; padding: 3px; box-sizing: border-box; }
.loc-marque b { font-size: 15px; font-weight: 700; } .loc-marque b span { color: #f0cf6b; }
.loc-marque small { margin-left: auto; font-size: 11.5px; opacity: .8; font-weight: 500; }
.loc-haut { background: linear-gradient(160deg, var(--primary) 0%, var(--navy-ink) 100%); color: #fff; padding: 18px 20px 24px; }
.loc-haut h1 { font-size: 22px; font-weight: 700; margin: 16px 0 2px; }
.loc-haut p { font-size: 13.5px; opacity: .88; margin: 0; }
.loc-corps { padding: 16px; }
.loc-carte { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 12px; }
.loc-etat { border: 0; color: #fff; padding: 18px; }
.loc-etat.ok { background: linear-gradient(140deg, #1b8a5f, #0f766e); }
.loc-etat.du { background: linear-gradient(140deg, #c23b3b, #8f2525); }
.loc-etat.neutre { background: linear-gradient(140deg, #4f6478, #33475a); }
.loc-etat small { display: block; font-size: 12.5px; opacity: .92; }
.loc-etat .gros { font-size: 28px; font-weight: 800; margin: 4px 0 4px; letter-spacing: -.01em; }
.loc-lbl { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: #66758a; font-weight: 600; margin: 6px 2px 8px; }
.loc-echeance { display: flex; align-items: center; gap: 14px; }
.loc-echeance .cal { width: 56px; height: 60px; border-radius: 14px; background: #fbf3dc; color: #8a6508; display: grid; place-content: center; text-align: center; line-height: 1.05; flex: none; }
.loc-echeance .cal.ok { background: var(--primary-50); color: var(--primary); }
.loc-echeance .cal b { font-size: 22px; display: block; } .loc-echeance .cal small { font-size: 11px; font-weight: 600; text-transform: uppercase; }
.loc-echeance strong { display: block; font-size: 15px; } .loc-echeance span { font-size: 13px; color: #66758a; }
.loc-racc { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.loc-racc a { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; font-size: 13.5px; font-weight: 600; color: var(--text); text-decoration: none; }
.loc-racc a:hover { border-color: var(--primary); }
.loc-racc i { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-50); margin-bottom: 8px; font-style: normal; }
.loc-liste { padding: 4px 16px; }
.loc-pay { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.loc-pay:last-child { border-bottom: 0; }
.loc-pay i { width: 40px; height: 40px; border-radius: 12px; background: #eaf7f1; color: #1b8a5f; display: grid; place-items: center; font-style: normal; font-weight: 700; }
.loc-pay i.du { background: #fdeeee; color: #c23b3b; }
.loc-pay b { display: block; font-size: 14px; } .loc-pay small { font-size: 12px; color: #66758a; }
.loc-pdf { font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-50); padding: 8px 11px; border-radius: 10px; text-decoration: none; white-space: nowrap; }
.loc-pill { font-size: 11.5px; font-weight: 700; padding: 5px 10px; border-radius: 99px; } .loc-pill.du { background: #fdeeee; color: #c23b3b; }
.loc-ligne { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.loc-ligne:last-child { border-bottom: 0; } .loc-ligne span { color: #66758a; flex: none; } .loc-ligne b { font-weight: 600; text-align: right; }
.loc-btn { display: flex; gap: 8px; justify-content: center; align-items: center; width: 100%; padding: 13px; border-radius: 14px; font: inherit; font-weight: 700; font-size: 14.5px; border: 0; cursor: pointer; text-decoration: none; background: var(--primary); color: #fff; margin-bottom: 12px; box-sizing: border-box; }
.loc-btn.or { background: var(--orange); color: var(--navy-ink); }
.loc-btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.loc-btn.wa { background: #1faa59; }
.loc-btn.blanc { background: #fff; color: #c23b3b; width: auto; display: inline-flex; padding: 9px 14px; margin: 12px 0 0; font-size: 13.5px; }
.loc-contact { text-align: center; }
.loc-contact .avatar { width: 72px; height: 72px; border-radius: 50%; margin: 4px auto 10px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 700; }
.loc-contact > b { font-size: 17px; display: block; } .loc-contact p { color: #66758a; font-size: 13.5px; margin: 4px 0 14px; }
.loc-note { font-size: 12.5px; color: #66758a; text-align: center; }
.loc-vide { color: #66758a; font-size: 14px; text-align: center; padding: 14px 0; margin: 0; }
.loc-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px; height: 70px; background: #fff; border-top: 1px solid var(--line); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 6px 6px calc(8px + env(safe-area-inset-bottom)); box-sizing: content-box; }
.loc-nav a { display: grid; justify-items: center; align-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: #66758a; text-decoration: none; }
.loc-nav a .icon { width: 22px; height: 22px; }
.loc-nav a[aria-current] { color: var(--primary); }
/* Connexion et lien non valable */
.loc-auth { background: linear-gradient(170deg, var(--primary) 0%, var(--navy-ink) 70%); color: #fff; }
.loc-auth-box { max-width: 420px; margin: 0 auto; padding: 48px 26px; min-height: 100vh; box-sizing: border-box; display: flex; flex-direction: column; }
.loc-auth-box h1 { font-size: 25px; line-height: 1.2; margin: 44px 0 0; }
.loc-auth-box p { opacity: .88; font-size: 14.5px; line-height: 1.55; }
.loc-code-form { margin-top: 18px; }
.loc-code { width: 100%; box-sizing: border-box; font: inherit; font-size: 30px; font-weight: 700; letter-spacing: .5em; text-align: center; padding: 14px; border-radius: 16px; border: 1.5px solid rgba(255,255,255,.4); background: rgba(255,255,255,.12); color: #fff; margin-bottom: 14px; }
.loc-code::placeholder { color: rgba(255,255,255,.5); }
.loc-erreur { background: #fdeeee; color: #8f2525; border-radius: 12px; padding: 11px 14px; font-size: 14px; font-weight: 600; margin-top: 12px; }
.loc-mini { font-size: 12.5px; opacity: .7; text-align: center; margin-top: auto; }
/* Documents (quittance, contrat) */
.loc-doc .loc-doc-bar { position: sticky; top: 0; z-index: 3; display: flex; gap: 10px; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.loc-doc .loc-doc-bar .loc-btn { margin: 0; width: auto; flex: 1; padding: 11px; font-size: 13.5px; }
.loc-doc-aide { font-size: 12.5px; color: #66758a; text-align: center; margin: 10px 16px; }
.loc-doc .doc-stage { padding: 0 8px 24px; overflow-x: auto; }
@media print { .loc-doc-bar, .loc-doc-aide { display: none !important; } .loc-doc .doc-stage { padding: 0; } }
.espace-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
#espace .code-box { word-break: break-all; }
/* Espace locataire, version 2 : signalements */
.loc-form { display: grid; gap: 12px; }
.loc-form label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; }
.loc-form label small { font-weight: 500; color: #66758a; }
.loc-form input, .loc-form select, .loc-form textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 15px; font-weight: 400; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--text); }
.loc-form input[type=file] { padding: 9px; font-size: 13.5px; }
.loc-form .loc-check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; background: #fdeeee; border-radius: 12px; padding: 11px 12px; }
.loc-form .loc-check input { width: 18px; height: 18px; flex: none; margin-top: 2px; accent-color: #c23b3b; }
.loc-form .loc-btn { margin: 4px 0 0; }
.loc-form .loc-note { margin: 0; }
.loc-flash { border-radius: 14px; padding: 12px 14px; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.loc-flash.ok { background: #eaf7f1; color: #136b49; } .loc-flash.err { background: #fdeeee; color: #8f2525; }
.loc-sig { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.loc-sig:last-child { border-bottom: 0; } .loc-sig > div { min-width: 0; }
.loc-sig b { display: block; } .loc-sig small { display: block; color: #66758a; font-size: 12px; }
.loc-pill.recu { background: #fbf3dc; color: #8a6508; } .loc-pill.devis { background: #e8f0fb; color: #1d5fa8; } .loc-pill.cours { background: #e8f0fb; color: #1d5fa8; }
.loc-pill.fini { background: #eaf7f1; color: #1b8a5f; } .loc-pill.clos { background: #eef1f5; color: #66758a; }
.loc-pill { white-space: nowrap; }
/* Espace locataire : installer l'application */
.loc-install { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px; align-items: center; background: linear-gradient(140deg, #fbf3dc, #fff); border-color: #f0e2b0; }
.loc-install[hidden] { display: none; }
.loc-install b { display: block; font-size: 15px; } .loc-install small { display: block; font-size: 12.5px; color: #66758a; margin-top: 2px; }
.loc-install .loc-btn { width: auto; margin: 0; padding: 11px 16px; background: var(--orange); color: var(--navy-ink); }
.loc-install .loc-ios { grid-column: 1 / -1; margin: 0; font-size: 13px; background: #fff; border-radius: 10px; padding: 4px 12px; }
.loc-install .loc-ios p { margin: 6px 0; }
.loc-install .loc-ios p[hidden] { display: none; }
.loc-install .loc-ios b { display: inline; font-size: inherit; }
