/* Gestion locative — surcouche Bootstrap 5.3 */
:root {
    --gl-sidebar-w: 248px;
    --gl-sidebar-bg: #1c2b3a;
    --gl-sidebar-fg: #c8d3de;
    --gl-sidebar-active: #2f6fdd;
    --gl-bg: #f4f6f9;
    --bs-primary: #2f6fdd;
    --bs-primary-rgb: 47, 111, 221;
    --bs-link-color: #2459b8;
    --bs-link-color-rgb: 36, 89, 184;
    --bs-body-font-size: .95rem;
}
.btn-primary { --bs-btn-bg: #2f6fdd; --bs-btn-border-color: #2f6fdd; --bs-btn-hover-bg: #2459b8; --bs-btn-hover-border-color: #2459b8; --bs-btn-active-bg: #1f4d9f; }
.btn-outline-primary { --bs-btn-color: #2f6fdd; --bs-btn-border-color: #2f6fdd; --bs-btn-hover-bg: #2f6fdd; --bs-btn-hover-border-color: #2f6fdd; }

body { background: var(--gl-bg); }

/* ---------- Structure ---------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 1.5rem; max-width: 1280px; width: 100%; }
@media (max-width: 575.98px) { .content { padding: 1rem; } }

/* ---------- Menu latéral ---------- */
/* !important : Bootstrap rend .offcanvas-lg transparent au-dessus de 992px */
.sidebar { background-color: var(--gl-sidebar-bg) !important; color: var(--gl-sidebar-fg); }
@media (min-width: 992px) {
    .sidebar { width: var(--gl-sidebar-w); flex: 0 0 var(--gl-sidebar-w); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
@media (max-width: 991.98px) { .sidebar.offcanvas-lg { --bs-offcanvas-width: 270px; --bs-offcanvas-bg: var(--gl-sidebar-bg); } }
.sidebar-brand { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.25rem; color: #fff; font-weight: 600; font-size: 1.05rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand .bi { font-size: 1.35rem; color: #7fb0ff; }
.sidebar-nav { padding: .75rem .6rem 1.5rem; }
.sidebar-group { text-transform: uppercase; font-size: .7rem; letter-spacing: .06em; color: #7d8ea0; padding: 1rem .75rem .4rem; }
.sidebar-link { display: flex; align-items: center; gap: .7rem; padding: .5rem .75rem; margin-bottom: 2px; border-radius: .45rem; color: var(--gl-sidebar-fg); text-decoration: none; }
.sidebar-link .bi { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.sidebar-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-link.active { background: var(--gl-sidebar-active); color: #fff; }
.sidebar-link.disabled { opacity: .45; cursor: default; }
.sidebar-link.disabled:hover { background: none; color: var(--gl-sidebar-fg); }
.badge-soon { margin-left: auto; font-size: .65rem; border: 1px solid rgba(255,255,255,.3); border-radius: 1rem; padding: 0 .45rem; }

/* ---------- Barre du haut ---------- */
.topbar { display: flex; align-items: center; gap: .75rem; padding: .7rem 1.5rem; background: #fff; border-bottom: 1px solid #e3e7ed; position: sticky; top: 0; z-index: 10; }
.topbar-title { font-weight: 600; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: #dce7fb; color: #1f4d9f; font-size: .75rem; font-weight: 600; }
.avatar-lg { width: 48px; height: 48px; font-size: 1.05rem; }

/* ---------- Composants ---------- */
.card { border-color: #e3e7ed; }
.card-header { background: #fff; font-weight: 600; }
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.4rem; margin: 0; }
.page-header .subtitle { color: var(--bs-secondary-color); margin: .15rem 0 0; }
.stat { padding: 1rem 1.25rem; }
.stat-label { color: var(--bs-secondary-color); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.6rem; font-weight: 600; line-height: 1.2; }
.dl-grid { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: .45rem 1rem; margin: 0; }
.dl-grid dt { font-weight: 400; color: var(--bs-secondary-color); }
.dl-grid dd { margin: 0; overflow-wrap: anywhere; }
.form-section { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color); margin: 1.5rem 0 .75rem; padding-bottom: .35rem; border-bottom: 1px solid #e3e7ed; }
.form-section:first-child { margin-top: 0; }
.required::after { content: " *"; color: var(--bs-danger); }
.type-choice .btn { text-align: left; padding: .8rem 1rem; }
.type-choice .btn .bi { font-size: 1.4rem; }
.table > :not(caption) > * > * { padding: .6rem .75rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--bs-secondary-color); font-weight: 600; }
.table-hover tbody tr[data-href] { cursor: pointer; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--bs-secondary-color); }
.empty-state .bi { font-size: 2.5rem; display: block; margin-bottom: .5rem; color: #b5c2d1; }
.checklist li { display: flex; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid #eef1f5; }
.checklist li:last-child { border-bottom: 0; }
.checklist .bi-check-circle-fill { color: #2e9e5b; }
.checklist .bi-circle { color: #b5c2d1; }
.font-monospace-iban { font-family: var(--bs-font-monospace); letter-spacing: .02em; }
.filter-pills .btn { border-radius: 2rem; }

/* ---------- Pages sans menu ---------- */
body.minimal { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.minimal-wrap { width: 100%; max-width: 440px; }
.minimal-wrap.wide { max-width: 640px; }
.minimal-brand { text-align: center; font-size: 1.3rem; font-weight: 600; margin-bottom: 1.25rem; color: var(--gl-sidebar-bg); }
.minimal-brand .bi { color: var(--gl-sidebar-active); }

/* ---------- Lot 2 : biens ---------- */
.min-w-0 { min-width: 0; }
.bien-card { overflow: hidden; transition: box-shadow .15s; }
.bien-card:hover { box-shadow: 0 .25rem .75rem rgba(28,43,58,.12); }
.bien-card-photo { position: relative; height: 140px; background: #e8eef6; display: flex; align-items: center; justify-content: center; }
.bien-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.bien-card-photo > .bi { font-size: 2.6rem; color: #9fb3c8; }
.bien-card-statut { position: absolute; top: .6rem; left: .6rem; }
.dpe-badge { position: absolute; top: .6rem; right: .6rem; width: 26px; height: 26px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: var(--dpe); text-shadow: 0 0 2px rgba(0,0,0,.4); }
.bien-header-photo { width: 56px; height: 56px; border-radius: .5rem; object-fit: cover; flex: 0 0 auto; }
.dpe-scale { display: inline-flex; gap: 2px; }
.dpe-scale span { width: 22px; height: 24px; display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; color: #fff; background: var(--dpe); opacity: .35; border-radius: 3px; }
.dpe-scale span.on { opacity: 1; transform: scale(1.2); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--dpe); }
.doc-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: .35rem; border: 1px solid #e3e7ed; }
.nav-tabs { scrollbar-width: thin; }
.sticky-footer { position: sticky; bottom: 0; z-index: 5; }
/* Le fond du menu se prolonge sur toute la hauteur des pages longues */
@media (min-width: 992px) {
    .app { background: linear-gradient(to right, var(--gl-sidebar-bg) var(--gl-sidebar-w), var(--gl-bg) var(--gl-sidebar-w)); }
}

/* Aperçu des documents générés (contrat, EDL…) */
.doc-paper { font-family: Helvetica, Arial, sans-serif; font-size: .9rem; line-height: 1.45; max-width: 820px; margin: 0 auto; }
.doc-paper h1 { font-size: 1.35rem; margin-bottom: .75rem; }
.doc-paper h2 { font-size: 1.05rem; border-bottom: 1px solid #aab4c0; padding-bottom: .2rem; margin: 1.25rem 0 .6rem; }
.doc-paper h3 { font-size: .95rem; margin: .9rem 0 .4rem; }
.doc-paper table { width: 100%; border-collapse: collapse; margin: .4rem 0 .9rem; }
.doc-paper th, .doc-paper td { border: 1px solid #b8c1cc; padding: .3rem .45rem; vertical-align: top; }
.doc-paper th { background: #eef1f4; }
.doc-paper table.no-border td, .doc-paper table.no-border th { border: 0; background: none; padding: 0 .5rem 0 0; }
.doc-paper .center { text-align: center; } .doc-paper .right { text-align: right; } .doc-paper .small { font-size: .8rem; } .doc-paper .muted { color: #6b7785; }
.doc-paper .box { border: 1px solid #b8c1cc; padding: .5rem .75rem; margin: .75rem 0; }
.doc-paper .missing { background: #fff3cd; color: #8a6d3b; padding: 0 .15rem; }
.doc-paper .page-break { border-top: 1px dashed #b8c1cc; margin: 1.5rem 0; }
.edl-actions { position: sticky; bottom: 0; z-index: 5; background: linear-gradient(to top, var(--gl-bg) 70%, transparent); padding: .75rem 0; }
.edl-table td { padding-top: .35rem; padding-bottom: .35rem; }
.legend { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; vertical-align: -1px; }
.legend-rec { background: #2f9e6e; } .legend-dep { background: #d9822b; }
@media (max-width: 576px) { .stat-value { font-size: 1.2rem; } .stat { padding: .75rem .9rem; } }

/* Espace locataire */
.espace-nav { background: var(--gl-sidebar-bg); }
.espace-nav .nav-link { color: rgba(255,255,255,.75); }
.espace-nav .nav-link:hover, .espace-nav .nav-link.active { color: #fff; }
.espace-nav form .nav-link { border: 0; }
.espace main { max-width: 1040px; }
.card-link { transition: border-color .15s, box-shadow .15s; } .card-link:hover { border-color: #9db8e6; box-shadow: 0 2px 8px rgba(31,77,159,.08); }

/* Signature à l'écran */
.sign-pad-wrap { position: relative; border: 1px dashed #9aa8b8; border-radius: .5rem; background: #fff; overflow: hidden; }
.sign-pad { display: block; width: 100%; height: auto; aspect-ratio: 60 / 22; touch-action: none; cursor: crosshair; }
.sign-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #b5c2d1; pointer-events: none; font-size: 1.1rem; }
.sign-doc { max-height: 70vh; overflow: auto; }
.sign-doc img { max-width: 100%; height: auto; }
.doc-paper img { max-width: 100%; height: auto; }

/* Plans du bien et repères */
.plan-scroll { overflow: auto; -webkit-overflow-scrolling: touch; }
.plan-canvas { position: relative; display: block; width: 100%; background: #fff; border: 1px solid var(--bs-border-color); border-radius: .5rem; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.plan-canvas[data-plan="edit"], body.plan-moving .plan-canvas { cursor: crosshair; }
.plan-canvas.plan-zoom { width: 200%; }
.plan-canvas > img { display: block; width: 100%; height: auto; border-radius: .5rem; pointer-events: none; }
.plan-pin { position: absolute; transform: translate(-50%, -50%); min-width: 30px; height: 30px; padding: 0 5px; border-radius: 15px; border: 2px solid #fff;
    color: #fff; font-weight: 600; font-size: .8rem; line-height: 26px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.45); cursor: pointer; z-index: 2; }
.plan-pin:focus-visible { outline: 3px solid var(--bs-primary); outline-offset: 2px; }
.plan-pin-equip { border-radius: 7px; background: #24427a; font-size: .85rem; }
.plan-pin-entree { opacity: .7; border-style: dashed; background: #8a8f98; }
.plan-pin-ghost { background: var(--bs-primary); pointer-events: none; z-index: 3; }
.plan-pin-focus { animation: plan-pulse .8s ease-in-out 3; z-index: 4; }
@keyframes plan-pulse { 50% { transform: translate(-50%, -50%) scale(1.45); } }
body.plan-moving .plan-canvas { outline: 3px solid var(--bs-warning); outline-offset: 2px; }
.plan-banner { position: sticky; top: .5rem; z-index: 10; }
.plan-dot { display: inline-block; min-width: 1.6rem; height: 1.6rem; line-height: 1.6rem; border-radius: .8rem; color: #fff; font-size: .75rem; font-weight: 600; text-align: center; padding: 0 .3rem; }
.plan-thumb { width: 84px; height: 84px; object-fit: cover; border-radius: .375rem; border: 1px solid var(--bs-border-color); }
.plan-card-thumb { height: 150px; object-fit: contain; background: #fff; border-bottom: 1px solid var(--bs-border-color); }
.plan-legend .plan-dot { min-width: 1rem; height: 1rem; vertical-align: -2px; }
@media (pointer: coarse) { .plan-pin { min-width: 34px; height: 34px; line-height: 30px; border-radius: 17px; } }
.plan-banner[hidden] { display: none !important; }
.sidebar-version { padding: .75rem 1.25rem 1rem; font-size: .75rem; color: rgba(200, 211, 222, .55); }

/* Espace propriétaire (1.3.0) */
.espace-proprietaire main { max-width: 1140px; }
.apercu-bandeau { background: #fff3cd; color: #664d03; border-bottom: 1px solid #ffe69c; }
.espace-proprietaire .stat-card .stat-value { font-size: 1.5rem; }

/* Éditeur de plan (1.4.0) */
.pe-zone { overflow: auto; max-height: 72vh; background: #f6f7f9; padding: .5rem; }
.pe-zone svg { display: block; margin: 0 auto; touch-action: none; user-select: none; background: #fff; }
.pe-toolbar .pe-num { width: 4.6rem; }
.pe-symbole { cursor: move; }
.pe-poignee { cursor: nwse-resize; }
.pe-symboles { max-height: 60vh; overflow-y: auto; }
