/* ==========================================================================
   HCM immo — feuille de style commune
   Palette « Ardoise & laiton » · thème clair / sombre
   1. Jetons  2. Base  3. Coquille (menu)  4. Composants  5. Pages existantes
   6. Écran Loyers  7. Mobile
   ========================================================================== */
/* Les polices sont chargées par head.php */

/* ---------- 1. Jetons ---------- */
:root {
    --font-serif: 'Libre Caslon Text', Georgia, serif;
    --font-sans: 'Hanken Grotesk', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

    --bg: #F5F2EC;
    --surface: #FFFEFB;
    --surface-2: #EFEBE3;
    --line: #E4DED3;
    --line-strong: #CFC7B8;
    --ink: #1D2226;
    --ink-2: #555C63;
    --ink-3: #848A8F;

    --accent: #8A6A2E;
    --accent-ink: #FFFFFF;
    --accent-soft: #F1E8D6;
    --accent-text: #7A5C24;

    --side: #1E252B;
    --side-ink: #EDE8DE;
    --side-ink-2: #9BA3A9;
    --side-line: #2E373E;
    --side-active: #2B343B;
    --side-accent: #C9A35E;

    --col-cur: rgba(168, 131, 63, .07);

    --ok: #2D6A48;   --ok-soft: #E2EDE5;
    --warn: #8A5710; --warn-soft: #F6EACF;
    --bad: #A2302A;  --bad-soft: #F7E1DD;

    --r-xs: 2px; --r-sm: 5px; --r-md: 6px; --r-lg: 8px; --r-xl: 12px; --r-2xl: 14px;

    --shadow-xs: 0 1px 2px rgba(0,0,0,.08);
    --shadow-card: 0 1px 2px rgba(20,20,20,.04), 0 8px 24px -12px rgba(20,20,20,.08);
    --shadow-toast: 0 16px 40px -12px rgba(0,0,0,.25), 0 2px 6px rgba(0,0,0,.06);
    --focus-ring: 0 0 0 3px var(--accent-soft);

    /* Anciens noms, conservés pour les pages existantes */
    --muted: var(--ink-2);
    --accent-dark: var(--accent-text);
    --danger: var(--bad);

    --side-w: 252px;
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #121619; --surface: #191E22; --surface-2: #20262B;
    --line: #2C343A; --line-strong: #3F4950;
    --ink: #ECE7DE; --ink-2: #A7ACAE; --ink-3: #80868A;
    --accent: #C9A35E; --accent-ink: #17140D; --accent-soft: #2E2817; --accent-text: #D7B575;
    --side: #0E1114; --side-ink: #ECE7DE; --side-ink-2: #8D959B; --side-line: #20272C; --side-active: #1D2429; --side-accent: #C9A35E;
    --col-cur: rgba(201,163,94,.06);
    --ok: #8DC8A4; --ok-soft: #1C3127; --warn: #E5B867; --warn-soft: #382C15; --bad: #EF9088; --bad-soft: #3C201D;
    --shadow-card: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #121619; --surface: #191E22; --surface-2: #20262B;
        --line: #2C343A; --line-strong: #3F4950;
        --ink: #ECE7DE; --ink-2: #A7ACAE; --ink-3: #80868A;
        --accent: #C9A35E; --accent-ink: #17140D; --accent-soft: #2E2817; --accent-text: #D7B575;
        --side: #0E1114; --side-ink: #ECE7DE; --side-ink-2: #8D959B; --side-line: #20272C; --side-active: #1D2429; --side-accent: #C9A35E;
        --col-cur: rgba(201,163,94,.06);
        --ok: #8DC8A4; --ok-soft: #1C3127; --warn: #E5B867; --warn-soft: #382C15; --bad: #EF9088; --bad-soft: #3C201D;
        --shadow-card: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
        color-scheme: dark;
    }
}

/* ---------- 2. Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .display {
    font-family: var(--font-serif);
    font-weight: 400;
    letter-spacing: -0.01em;
    color: var(--ink);
}
a { color: inherit; }
::selection { background: var(--accent-soft); }
button, input, select, textarea { font: inherit; color: inherit; }
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- 3. Coquille : menu latéral ---------- */
body.avec-menu { padding-left: var(--side-w); }

.side {
    position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 50;
    background: var(--side); color: var(--side-ink-2);
    display: flex; flex-direction: column;
    overflow-y: auto; overscroll-behavior: contain;
}
.side a { text-decoration: none; }
.side-brand { display: flex; gap: 12px; align-items: center; padding: 24px 22px 22px; color: var(--side-ink); }
.monogram {
    width: 40px; height: 40px; flex-shrink: 0;
    border: 1px solid var(--side-accent); border-radius: var(--r-xs);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-serif); font-size: 15px; color: var(--side-ink); letter-spacing: -0.02em;
}
.monogram i { color: var(--side-accent); font-style: italic; }
.side-brand .nom { font-family: var(--font-serif); font-size: 20px; line-height: 1; }
.side-brand .nom small { font-family: var(--font-sans); font-size: 10.5px; text-transform: uppercase; letter-spacing: .3em; color: var(--side-ink-2); margin-left: 6px; }
.side-brand .sous { font-size: 10.5px; color: var(--side-ink-2); letter-spacing: .04em; margin-top: 5px; }

.side-nav { padding: 6px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.side-item {
    display: flex; align-items: center; gap: 9px;
    padding: 9px 10px; border-radius: var(--r-md);
    font-size: 13.5px; color: var(--side-ink-2);
    transition: background .15s, color .15s;
}
.side-item:hover { background: var(--side-active); color: var(--side-ink); }
.side-item .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--side-accent); display: none; }
.side-item.actif { background: var(--side-active); color: var(--side-ink); font-weight: 600; }
.side-item.actif .dot { display: block; }
.side-item .cpt { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--side-ink-2); font-weight: 400; }
.side-item .cpt.alerte { background: var(--bad); color: #fff; border-radius: 4px; padding: 1px 6px; font-weight: 500; }
[data-theme="dark"] .side-item .cpt.alerte { color: #1A0F0E; }
.side-groupe { padding: 18px 22px 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .16em; color: var(--side-ink-2); opacity: .8; }
.side-nav.secondaire .side-item { font-size: 13px; padding: 7px 10px; }

.side-pied { margin-top: auto; border-top: 1px solid var(--side-line); padding: 16px 18px 18px; }
.side-user { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    background: var(--side-active); color: var(--side-ink);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; letter-spacing: .02em;
}
.side-user .qui { min-width: 0; flex: 1; }
.side-user .qui b { display: block; color: var(--side-ink); font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .qui span { font-size: 11.5px; color: var(--side-accent); }
.side-user .quitter { font-size: 12px; color: var(--side-ink-2); text-decoration: underline; text-underline-offset: 2px; }
.side-user .quitter:hover { color: var(--side-ink); }
.theme-switch { display: flex; background: var(--side-active); border-radius: var(--r-lg); padding: 3px; margin-top: 14px; }
.theme-switch button {
    flex: 1; border: 0; background: transparent; color: var(--side-ink-2);
    font-size: 12.5px; padding: 6px 0; border-radius: 6px; cursor: pointer;
}
.theme-switch button.on { background: var(--side-ink); color: var(--side); font-weight: 600; }

/* En-tête et barre d'onglets mobiles (masqués sur ordinateur) */
.m-top, .m-tabs, .side-voile { display: none; }

/* Ancienne barre du haut (pages publiques : accueil, candidature) */
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 28px; background: var(--side); color: var(--side-ink);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-serif); font-size: 18px; text-decoration: none; color: var(--side-ink); }
.topbar .brand .mark { display: none; }
.topbar .session { display: flex; align-items: center; gap: 1rem; font-size: 13px; color: var(--side-ink-2); }
.topbar .session a { color: var(--side-ink-2); }
.topbar .btn { background: var(--side-accent); border-color: var(--side-accent); color: #17140D; }

/* ---------- 4. Composants ---------- */
.wrap { max-width: 1040px; margin: 0 auto; padding: 28px 36px 64px; }
.wrap-loyers { max-width: none; }

.page-head { margin-bottom: 1.8rem; }
.page-head h1 { font-size: 42px; line-height: 1; letter-spacing: -0.015em; margin: 0 0 10px; }
.page-head p { color: var(--ink-2); margin: 0; font-size: 14px; }
.surtitre, .dash-eyebrow {
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .16em;
    color: var(--ink-3); margin: 0 0 8px;
}

.back-link { display: inline-flex; align-items: center; gap: .4rem; color: var(--ink-2); text-decoration: none; font-size: 13px; margin-bottom: 1.2rem; }
.back-link:hover { color: var(--ink); }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-card);
    padding: 22px;
    margin-bottom: 18px;
}
.card h2, .card h3 { margin-top: 0; font-size: 19px; }

/* Boutons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 36px; padding: 0 14px;
    background: var(--accent); color: var(--accent-ink);
    border: 1px solid var(--accent); border-radius: var(--r-lg);
    font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none;
    box-shadow: var(--shadow-xs); white-space: nowrap;
    transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost, .btn.secondaire {
    background: var(--surface); color: var(--ink); border-color: var(--line-strong);
    box-shadow: none; font-weight: 500;
}
.btn.ghost:hover, .btn.secondaire:hover { background: var(--surface-2); filter: none; }
.btn.texte { background: transparent; border-color: transparent; color: var(--ink-2); box-shadow: none; font-weight: 500; padding: 0 8px; }
.btn.texte:hover { color: var(--ink); filter: none; }
.btn:disabled { opacity: .45; cursor: default; filter: none; }

/* Tableaux génériques */
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em;
    color: var(--ink-3); padding: 10px 10px; border-bottom: 1px solid var(--line-strong);
}
td { padding: 11px 10px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
tr:last-child td { border-bottom: none; }
tr.fait td { color: var(--ink-3); text-decoration: line-through; }

.badge {
    display: inline-flex; align-items: center; gap: .3rem; padding: 2px 8px; border-radius: 4px;
    font-size: 11.5px; font-weight: 500; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.check-btn { border: none; background: none; cursor: pointer; font-size: 1.05rem; padding: 0; }

/* Formulaires */
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=password],
input[type=search], input[type=url], input:not([type]), select, textarea {
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--line-strong); border-radius: var(--r-lg);
    padding: 8px 10px; font-size: 13.5px; font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
input[type=file] { font-size: 13px; color: var(--ink-2); }
::placeholder { color: var(--ink-3); }

form.inline-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 16px; border-top: 1px dashed var(--line-strong); }
form.inline-form input[type=text], form.inline-form input[type=email], form.inline-form input[type=tel] { flex: 1; min-width: 140px; }

.detail-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 16px; }
.detail-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--ink-2); font-weight: 500; }
.detail-form label.full { grid-column: 1 / -1; }
@media (max-width: 720px) { .detail-form { grid-template-columns: 1fr 1fr; } }

.delete-btn {
    background: var(--surface); border: 1px solid var(--line); color: var(--ink-3);
    width: 30px; height: 30px; border-radius: var(--r-lg); cursor: pointer; font-size: .9rem;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.delete-btn:hover { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }

/* Bouton d'aide (?) */
.help-wrap { position: relative; flex-shrink: 0; }
.help-btn {
    width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-strong);
    background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 14px; cursor: help;
}
.help-tooltip {
    display: none; position: absolute; top: 110%; right: 0; z-index: 20;
    width: 300px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-xl);
    padding: 18px; box-shadow: var(--shadow-toast);
}
.help-wrap:hover .help-tooltip, .help-wrap:focus-within .help-tooltip { display: block; }
.help-tooltip h4 { margin: 0 0 12px; font-size: 14px; }
.help-step { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.help-step p { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }

/* Toast commun */
.toast {
    position: fixed; right: 24px; bottom: 24px; z-index: 200; max-width: 440px;
    display: flex; align-items: center; gap: 12px;
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px;
    box-shadow: var(--shadow-toast); padding: 12px 14px;
    opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.visible { opacity: 1; transform: none; pointer-events: auto; }
.toast .coche { width: 26px; height: 26px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 13px; }
.toast.erreur .coche { background: var(--bad-soft); color: var(--bad); }
.toast .txt { min-width: 0; flex: 1; }
.toast .txt b { display: block; font-size: 13.5px; font-weight: 600; }
.toast .txt span { font-size: 12px; color: var(--ink-2); }
.toast button { border: 0; background: none; color: var(--accent-text); font-weight: 600; font-size: 13px; cursor: pointer; padding: 4px 2px; }

/* ---------- 5. Pages existantes ---------- */
/* Tableau de bord */
.dash-hero { padding-top: 28px; }
.dash-hero .wrap { padding-top: 0; }
.dash-title { font-size: 42px; line-height: 1.05; letter-spacing: -0.015em; margin: 0 0 24px; }
.status-strip-modern {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.status-pill { padding: 18px 22px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.status-pill:first-child { border-left: 0; padding-left: 0; }
.status-pill .num { font-family: var(--font-mono); font-weight: 500; font-size: clamp(18px, 1.7vw, 24px); letter-spacing: -0.02em; color: var(--ink); }
.status-pill.alert .num { color: var(--bad); }
.status-pill .lbl { font-size: 12px; color: var(--ink-2); }
.status-strip { display: flex; gap: 1.5rem; flex-wrap: wrap; padding: 14px 0; color: var(--ink-2); font-size: 13px; border-bottom: 1px solid var(--line); }
.status-strip strong { color: var(--ink); font-family: var(--font-mono); font-weight: 500; }

.grid-blocks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 24px; }
.grid-blocks .block-loyers { grid-column: span 2; }
.block {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
    box-shadow: var(--shadow-card); padding: 22px; text-decoration: none; color: var(--ink);
    display: block; position: relative; overflow: hidden;
    transition: border-color .15s, transform .15s;
}
.block:hover { border-color: var(--accent); transform: translateY(-2px); }
.block .glyph {
    width: 40px; height: 40px; border-radius: var(--r-lg);
    background: var(--accent-soft); color: var(--accent-text);
    display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.block .glyph svg { stroke: currentColor; }
.block h3 { margin: 0 0 4px; font-size: 19px; }
.block p { margin: 0; color: var(--ink-2); font-size: 13px; line-height: 1.45; }
.block .stat { position: absolute; top: 20px; right: 20px; font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2); background: var(--surface-2); padding: 2px 8px; border-radius: 4px; }
.block .stat.alert { color: #fff; background: var(--bad); }
[data-theme="dark"] .block .stat.alert { color: #1A0F0E; }
@media (max-width: 900px) {
    .grid-blocks { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
    .grid-blocks { grid-template-columns: 1fr; }
    .grid-blocks .block-loyers { grid-column: span 1; }
}

/* Carnets de contacts */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 14px; }
.contact-card { border: 1px solid var(--line); border-radius: var(--r-xl); padding: 16px; background: var(--surface); }
.contact-card .top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.contact-card .symbole { font-size: 1.2rem; }
.contact-card .nom { font-weight: 600; }
.contact-card .libelle { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-text); background: var(--accent-soft); padding: 2px 8px; border-radius: 4px; margin-bottom: 8px; }
.contact-card .coord { font-size: 13px; color: var(--ink-2); line-height: 1.6; overflow-wrap: anywhere; }
.contact-links-row { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-strong); }
.contact-tel-link { font-size: 13px; color: var(--accent-text); text-decoration: none; overflow-wrap: anywhere; }
.contact-tel-link:hover { text-decoration: underline; }

/* Biens */
.bien-card { border: 1px solid var(--line); border-radius: var(--r-xl); padding: 18px; margin-bottom: 14px; background: var(--surface); }
.bien-card .titre { font-family: var(--font-serif); font-size: 17px; margin-bottom: 2px; }
.bien-card .adresse { color: var(--ink-2); font-size: 13px; margin-bottom: 10px; }
.doc-list { list-style: none; padding: 0; margin: 10px 0 0; }
.doc-list li { display: flex; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.doc-list a { color: var(--accent-text); text-decoration: none; }
.doc-list a:hover { text-decoration: underline; }

.bien-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.bien-list-card {
    display: flex; justify-content: space-between; align-items: center; gap: 16px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
    box-shadow: var(--shadow-card); padding: 14px 18px; text-decoration: none; color: var(--ink);
    transition: border-color .15s;
}
.bien-list-card:hover { border-color: var(--accent); }
.bien-list-nom { font-family: var(--font-serif); font-size: 17px; }
.bien-list-adresse { color: var(--ink-2); font-size: 12.5px; margin-top: 2px; line-height: 1.4; }
.bien-list-locataire { margin-top: 6px; font-size: 13px; }
.bien-list-thumb, .identity-photo {
    width: 64px; height: 64px; border-radius: 10px; overflow: hidden; flex-shrink: 0;
    background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--line) 6px 7px);
    display: flex; align-items: center; justify-content: center; border: 1px solid var(--line);
}
.bien-list-thumb img, .identity-photo img { width: 100%; height: 100%; object-fit: cover; }
.placeholder-glyph { font-size: 1.5rem; color: var(--ink-3); }

.identity-head { display: flex; gap: 20px; align-items: flex-start; margin: 20px 0 24px; }
.identity-photo { width: 110px; height: 110px; border-radius: var(--r-2xl); }
.identity-photo .placeholder-glyph { font-size: 2.2rem; }

.rentabilite-box { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.rentabilite-chiffre { font-family: var(--font-mono); font-size: 34px; font-weight: 500; letter-spacing: -0.02em; color: var(--accent-text); }
.rentabilite-detail { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); line-height: 1.7; }
.bilan-line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.bilan-line:last-child { border-bottom: none; }
.bilan-line span { color: var(--ink-2); }

.timeline { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.timeline-item { display: flex; gap: 12px; align-items: flex-start; border-left: 2px solid var(--line); padding-left: 16px; position: relative; }
.timeline-item.actuel { border-left-color: var(--accent); }
.timeline-dot { display: none; }

.doc-thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; margin-bottom: 16px; }
.doc-thumb-card { text-align: center; font-size: 12.5px; }
.doc-thumb-card img, .doc-thumb-placeholder {
    width: 100%; height: 100px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line);
    background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 1.8rem;
}

.alpha-group { margin-bottom: 26px; }
.alpha-letter { font-family: var(--font-serif); font-size: 20px; color: var(--accent-text); border-bottom: 2px solid var(--accent); padding-bottom: 4px; margin-bottom: 14px; display: inline-block; min-width: 28px; }

.permissions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.permission-check { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); cursor: pointer; }
.permission-check input { width: auto; }

.statut-badge {
    width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0;
    transition: transform .1s ease;
}
.statut-badge:hover { transform: scale(1.08); }
.statut-badge.statut-a_faire { background: var(--bad-soft); color: var(--bad); }
.statut-badge.statut-en_cours { background: var(--warn-soft); color: var(--warn); }
.statut-badge.statut-terminee { background: var(--ok-soft); color: var(--ok); }

.section-num-head { display: flex; align-items: center; gap: 10px; margin: 26px 0 14px; }
.section-num-head:first-of-type { margin-top: 4px; }
.section-num-head h2 { margin: 0; font-size: 21px; }
.section-num {
    width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--accent); color: var(--accent-text);
    display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; flex-shrink: 0;
    font-family: var(--font-mono);
}

/* Connexion et accueil public */
.login-shell { background: var(--side); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-box { background: var(--surface); padding: 36px; border-radius: var(--r-2xl); width: 340px; max-width: 100%; border: 1px solid var(--line); box-shadow: var(--shadow-toast); }
.login-box .monogram { margin-bottom: 20px; color: var(--ink); border-color: var(--accent); }
.login-box .monogram i { color: var(--accent); }
.login-box h1 { font-size: 26px; margin: 0 0 4px; }
.login-box input { width: 100%; margin-bottom: 12px; padding: 11px 12px; font-size: 14px; }
.login-box button { width: 100%; height: 42px; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: var(--r-lg); font-size: 14px; font-weight: 600; cursor: pointer; }
.login-box button:hover { filter: brightness(1.08); }
.login-box .erreur { color: var(--bad); background: var(--bad-soft); border-radius: var(--r-lg); padding: 8px 10px; font-size: 13px; margin-bottom: 14px; }

.hero-a { position: relative; padding: 96px 24px; text-align: center; }
.hero-a .monogram { width: 64px; height: 64px; font-size: 24px; margin: 0 auto 28px; color: var(--ink); border-color: var(--accent); }
.hero-a .monogram i { color: var(--accent); }
.hero-a svg { display: none; }
.hero-a h1 { font-size: 48px; line-height: 1.05; letter-spacing: -0.015em; margin: 0 auto 28px; max-width: 640px; }
.hero-a p { color: var(--ink-2); font-size: 16px; max-width: 440px; margin: 0 auto 28px; }
.landing-hero { max-width: 560px; margin: 64px auto; text-align: center; padding: 0 24px; }
.landing-hero h1 { font-size: 34px; margin: 0 0 10px; }
.landing-hero p { color: var(--ink-2); font-size: 15px; margin: 0; }

/* Ancien bouton « Vue d'ensemble » : remplacé par le menu */
.home-icon, .topbar-left { display: none; }

/* Espace propriétaire : tableau annuel en lecture seule */
.year-switch { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-family: var(--font-mono); }
.year-switch a { text-decoration: none; color: var(--accent-text); padding: 4px 8px; border-radius: var(--r-md); }
.year-switch a:hover { background: var(--accent-soft); }
.scroll-hint { display: none; text-align: center; font-size: 12px; color: var(--ink-3); padding: 6px 0; }
.ledger-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); }
.ledger { min-width: 720px; }
.ledger th { text-align: right; }
.ledger td { text-align: right; font-family: var(--font-mono); font-size: 12.5px; }
.ledger th.bien-col, .ledger td.bien-col { position: sticky; left: 0; background: var(--surface); text-align: left; font-family: var(--font-sans); border-right: 1px solid var(--line); white-space: nowrap; }
.ledger-total-row td { background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--line-strong); }
.ledger-total-row td.bien-col { background: var(--surface-2); }
@media (max-width: 900px) { .scroll-hint { display: block; } }

/* ---------- 6. Écran Loyers ---------- */
.ly { display: flex; flex-direction: column; height: 100vh; min-width: 0; }
.ly-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; padding: 28px 36px 0; flex-wrap: wrap; }
.ly-head h1 { font-size: 42px; line-height: 1; letter-spacing: -0.015em; margin: 0; }
.ly-actions { display: flex; align-items: center; gap: 10px; height: 36px; flex-wrap: wrap; }

.save-ind { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); margin-right: 8px; white-space: nowrap; }
.save-ind .pt { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex-shrink: 0; transition: background .2s; }
.save-ind[data-etat="saving"] .pt { background: var(--warn); }
.save-ind[data-etat="error"] .pt { background: var(--bad); }
.save-ind[data-etat="error"] { color: var(--bad); cursor: pointer; }

.annee-sel { display: inline-flex; align-items: center; height: 36px; border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--surface); }
.annee-sel a, .annee-sel span.fl { width: 32px; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--ink-2); text-decoration: none; font-size: 15px; }
.annee-sel a:hover { color: var(--ink); background: var(--surface-2); }
.annee-sel span.fl { color: var(--line-strong); }
.annee-sel b { font-family: var(--font-mono); font-weight: 500; font-size: 13.5px; padding: 0 10px; color: var(--ink); }

.ly-tabs { display: flex; gap: 36px; padding: 18px 36px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.ly-tab { border: 0; background: none; padding: 0 0 12px; cursor: pointer; text-align: left; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; flex-shrink: 0; }
.ly-tab .n { display: block; font-family: var(--font-serif); font-size: 18px; line-height: 1.3; }
.ly-tab .m { display: block; font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); margin-top: 3px; white-space: nowrap; }
.ly-tab.on { color: var(--ink); border-bottom-color: var(--accent); }
.ly-tab:hover { color: var(--ink); }

.ly-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); padding: 22px 36px; }
.kpi { padding: 0 22px; border-left: 1px solid var(--line); min-width: 0; }
.kpi:first-child { border-left: 0; padding-left: 0; }
.kpi .l { font-size: 12px; color: var(--ink-2); }
.kpi .v { font-family: var(--font-mono); font-weight: 500; font-size: clamp(18px, 1.7vw, 24px); letter-spacing: -0.02em; white-space: nowrap; margin: 8px 0 6px; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi .v.bad { color: var(--bad); }
.kpi .mt { font-size: 12px; color: var(--ink-3); }
.kpi .barre { height: 4px; background: var(--surface-2); border-radius: 2px; margin-top: 12px; overflow: hidden; }
.kpi .barre i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

.ly-tools { display: flex; align-items: center; gap: 12px; padding: 0 36px 14px; flex-wrap: wrap; }
.ly-search { width: 260px; height: 34px; padding: 0 12px; font-size: 13px; }
.segment { display: inline-flex; background: var(--surface-2); border-radius: var(--r-lg); padding: 3px; }
.segment button { border: 0; background: transparent; padding: 0 12px; height: 28px; border-radius: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.segment button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-xs); }
.legende { margin-left: auto; display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.legende span { display: inline-flex; align-items: center; gap: 6px; }

.pt7 { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.pt7.ok { background: var(--ok); }
.pt7.warn { background: var(--warn); }
.pt7.bad { background: var(--bad); }
.pt7.avenir { border: 1px dashed var(--ink-3); background: transparent; }

.ly-card {
    margin: 0 36px; flex: 1; min-height: 160px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
    box-shadow: var(--shadow-card); overflow: auto; position: relative;
}
.ly-aide { padding: 12px 36px 18px; font-size: 11.5px; color: var(--ink-3); }
.ly-aide kbd { font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); }

.grille { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; table-layout: fixed; }
.grille th, .grille td { border-bottom: 1px solid var(--line); padding: 0 6px; height: 46px; background: var(--surface); font-size: 13px; }
.grille th {
    position: sticky; top: 0; z-index: 3; height: 38px; text-align: right;
    font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
    color: var(--ink-2); border-bottom: 1px solid var(--line-strong); white-space: nowrap; padding: 0 12px;
}
.grille th.futur { color: var(--ink-3); }
.grille th.cur { background: var(--accent-soft); color: var(--accent-text); border-bottom-color: var(--accent); }
.grille td.cur { background-image: linear-gradient(var(--col-cur), var(--col-cur)); }
.grille .c-bien { position: sticky; left: 0; z-index: 2; width: 320px; min-width: 300px; text-align: left; border-right: 1px solid var(--line); padding: 0 16px; }
.grille th.c-bien { z-index: 4; text-align: left; }
.grille .c-loyer { width: 84px; text-align: right; font-family: var(--font-mono); color: var(--ink-2); font-size: 12.5px; padding-right: 12px; }
.grille .c-mois { width: 76px; padding: 0 3px; }
.vue-detail .grille .c-mois { width: 96px; }
.grille .c-percu { width: 112px; text-align: right; border-left: 1px solid var(--line); font-family: var(--font-mono); font-weight: 500; font-size: 12.5px; padding-right: 14px; }
.grille .c-retard { width: 104px; text-align: right; font-family: var(--font-mono); font-size: 12.5px; padding-right: 16px; }
.grille .c-retard.bad { color: var(--bad); }
.grille .c-retard.nul { color: var(--ink-3); }
.vue-detail .grille td { height: 60px; }

.grille tr.r-bien.ouvert td { background-color: var(--surface-2); }
.grille tr.r-bien.ouvert td.cur { background-image: none; }
.grille tr.r-lot .c-bien { padding-left: 54px; }
.grille tr:hover td.c-bien { color: var(--ink); }

.bien-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pli {
    width: 22px; height: 22px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
    display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; color: var(--ink-2); padding: 0;
}
.pli svg { transition: transform .18s; }
.ouvert .pli svg { transform: rotate(90deg); }
.pli-vide { width: 22px; flex-shrink: 0; }
.vign {
    width: 34px; height: 34px; border-radius: var(--r-md); flex-shrink: 0; overflow: hidden;
    background: repeating-linear-gradient(135deg, var(--surface-2) 0 5px, var(--line) 5px 6px);
    border: 1px solid var(--line);
}
.vign img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bien-txt { min-width: 0; line-height: 1.25; }
.bien-txt a { text-decoration: none; color: var(--ink); }
.bien-txt a:hover { text-decoration: underline; text-underline-offset: 2px; }
.bien-txt .nm { font-family: var(--font-serif); font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.r-lot .bien-txt .nm { font-family: var(--font-sans); font-size: 13.5px; font-weight: 500; }
.bien-txt .sl { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; margin-top: 2px; }

/* Cellule de mois */
.cel {
    width: 100%; height: 34px; border: 0; border-radius: var(--r-md); padding: 0 8px;
    background: transparent; cursor: pointer;
    display: flex; align-items: center; justify-content: flex-end; gap: 6px;
    font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; color: var(--ink);
    font-variant-numeric: tabular-nums; white-space: nowrap;
    transition: box-shadow .25s;
}
.vue-detail .cel { height: 46px; flex-direction: column; align-items: flex-end; justify-content: center; gap: 1px; }
.cel .ligne { display: flex; align-items: center; gap: 6px; }
.cel .det { display: none; font-family: var(--font-sans); font-size: 10.5px; font-weight: 400; color: var(--ink-3); }
.vue-detail .cel .det { display: block; }
.cel:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.cel:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cel.s-ok .pt7 { background: var(--ok); }
.cel.s-part { background: var(--warn-soft); color: var(--warn); }
.cel.s-part .pt7 { background: var(--warn); }
.cel.s-part .det { color: var(--warn); }
.cel.s-imp { background: var(--bad-soft); color: var(--bad); }
.cel.s-imp .pt7 { background: var(--bad); }
.cel.s-imp .det { color: var(--bad); }
.cel.s-av { color: var(--ink-3); }
.cel.s-av .pt7 { border: 1px dashed var(--ink-3); background: transparent; }
.cel.s-vac {
    cursor: default; color: var(--ink-3);
    background: repeating-linear-gradient(135deg, transparent 0 5px, var(--line) 5px 6px);
}
.cel.s-vac:hover { box-shadow: none; }
.cel.lect { cursor: default; font-weight: 600; }
.cel.lect:hover { box-shadow: none; }
.cel.flash { box-shadow: 0 0 0 2px var(--ok); }
.cel.echec { box-shadow: 0 0 0 2px var(--bad); }
.cel-input {
    width: 100%; height: 34px; text-align: right; padding: 0 8px;
    font-family: var(--font-mono); font-size: 12.5px; font-weight: 500;
    border: 1.5px solid var(--accent); border-radius: var(--r-md); box-shadow: var(--focus-ring);
    background: var(--surface);
}
.vue-detail .cel-input { height: 46px; }

.grille tfoot td {
    position: sticky; bottom: 0; z-index: 2; background: var(--surface-2);
    border-top: 1px solid var(--line-strong); border-bottom: 0; height: 54px;
    font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; text-align: right; padding: 0 9px;
}
.grille tfoot td.c-bien { z-index: 3; font-family: var(--font-sans); text-align: left; padding: 0 16px; }
.grille tfoot .att { display: block; font-size: 11px; font-weight: 400; color: var(--ink-3); margin-top: 2px; }
.grille tfoot .bad { color: var(--bad); }
.grille tfoot td.c-bien b { font-size: 13px; }

.ly-vide { padding: 48px; text-align: center; color: var(--ink-2); }

/* Loyers — mobile */
.lym { display: none; }

/* ---------- 7. Mobile (< 760px) ---------- */
@media (max-width: 759px) {
    body.avec-menu { padding-left: 0; padding-bottom: 60px; }
    .side { transform: translateX(-100%); transition: transform .22s ease; width: min(300px, 86vw); }
    body.menu-ouvert .side { transform: none; }
    body.menu-ouvert .side-voile { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 45; }

    .m-top {
        display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 40;
        background: var(--bg); padding: 10px 18px; border-bottom: 1px solid var(--line);
    }
    .m-top .monogram { width: 32px; height: 32px; font-size: 12px; color: var(--ink); border-color: var(--accent); }
    .m-top .monogram i { color: var(--accent); }
    .m-top .titre { font-family: var(--font-serif); font-size: 24px; line-height: 1; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .m-top .theme-pill { height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
    .m-top .avatar { width: 36px; height: 36px; background: var(--ink); color: var(--bg); border: 0; cursor: pointer; }
    .m-top .save-ind { margin: 0; }
    .m-top .save-ind .lbl { display: none; }

    .m-tabs {
        display: grid; grid-template-columns: repeat(5, 1fr);
        position: fixed; left: 0; right: 0; bottom: 0; height: 60px; z-index: 40;
        background: var(--surface); border-top: 1px solid var(--line);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .m-tabs a, .m-tabs button {
        position: relative; border: 0; background: none; text-decoration: none; cursor: pointer;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        font-size: 11px; color: var(--ink-2);
    }
    .m-tabs svg { width: 20px; height: 20px; }
    .m-tabs .on { color: var(--ink); font-weight: 700; }
    .m-tabs .on::before { content: ''; position: absolute; top: 0; left: 50%; width: 16px; height: 2px; margin-left: -8px; background: var(--accent); }

    .wrap { padding: 18px 18px 40px; }
    .page-head h1, .dash-title { font-size: 30px; }
    .page-head { display: block !important; }
    .status-pill { padding: 14px 0 14px 14px; }
    .identity-head { flex-direction: column; }
    .toast { left: 12px; right: 12px; bottom: 72px; max-width: none; background: var(--ink); color: var(--bg); border-color: var(--ink); border-radius: var(--r-xl); }
    .toast .txt span { color: var(--bg); opacity: .75; }
    .toast button { color: var(--bg); text-decoration: underline; }
    .toast .coche { background: rgba(255,255,255,.12); color: var(--bg); }
    table { display: block; overflow-x: auto; }

    /* Loyers : la vue mobile remplace le tableau */
    .ly { display: none; }
    .lym { display: block; padding: 14px 18px 24px; }
    .lym .segment { display: grid; grid-template-columns: repeat(var(--n, 2), 1fr); width: 100%; margin-bottom: 14px; }
    .lym .segment button { height: 40px; font-size: 13.5px; }
    .mois-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin: 0 -18px 14px; padding-left: 18px; padding-right: 18px; scrollbar-width: none; }
    .mois-chip {
        width: 54px; height: 56px; flex-shrink: 0; border-radius: 10px; border: 1px solid var(--line);
        background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
        font-size: 12.5px; color: var(--ink-2); cursor: pointer; padding: 0;
    }
    .mois-chip i { width: 22px; height: 3px; border-radius: 2px; background: var(--line); }
    .mois-chip i.ok { background: var(--ok); } .mois-chip i.warn { background: var(--warn); } .mois-chip i.bad { background: var(--bad); }
    .mois-chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
    .m-synth { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2xl); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow-card); }
    .m-synth .hd { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); }
    .m-synth .hd b { color: var(--ink); font-weight: 600; }
    .m-synth .v { font-family: var(--font-mono); font-size: 26px; font-weight: 500; letter-spacing: -0.02em; margin: 8px 0 10px; white-space: nowrap; }
    .m-synth .v small { font-size: 14px; color: var(--ink-3); font-weight: 400; }
    .m-synth .barre { height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
    .m-synth .barre i { display: block; height: 100%; background: var(--accent); }
    .m-bien { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2xl); margin-bottom: 12px; overflow: hidden; box-shadow: var(--shadow-card); }
    .m-bien-hd { display: flex; gap: 12px; align-items: center; padding: 14px 14px 12px; border-bottom: 1px solid var(--line); }
    .m-bien-hd .vign { width: 44px; height: 44px; border-radius: 8px; }
    .m-bien-hd .nm { font-family: var(--font-serif); font-size: 16px; color: var(--ink); text-decoration: none; display: block; }
    .m-bien-hd .ad { font-size: 12px; color: var(--ink-2); }
    .m-lot { display: flex; align-items: center; gap: 12px; padding: 8px 14px; min-height: 60px; border-bottom: 1px solid var(--line); }
    .m-lot:last-child { border-bottom: 0; }
    .m-lot .q { flex: 1; min-width: 0; }
    .m-lot .q b { display: block; font-size: 13.5px; font-weight: 500; }
    .m-lot .q span { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
    .m-cel {
        width: 116px; height: 44px; border: 0; border-radius: 10px; flex-shrink: 0; cursor: pointer;
        display: flex; flex-direction: column; align-items: flex-end; justify-content: center; padding: 0 12px;
        background: var(--surface-2); color: var(--ink-2);
    }
    .m-cel .mt { font-family: var(--font-mono); font-size: 14px; font-weight: 500; }
    .m-cel .st { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
    .m-cel.s-ok { background: var(--ok-soft); color: var(--ok); }
    .m-cel.s-part { background: var(--warn-soft); color: var(--warn); }
    .m-cel.s-imp { background: var(--bad-soft); color: var(--bad); }
    .m-cel.s-vac { background: repeating-linear-gradient(135deg, transparent 0 5px, var(--line) 5px 6px); color: var(--ink-3); cursor: default; }
    .m-cel.flash { box-shadow: 0 0 0 2px var(--ok); }
    .m-cel.echec { box-shadow: 0 0 0 2px var(--bad); }
    .m-input { width: 120px; height: 44px; text-align: right; font-family: var(--font-mono); font-size: 15px; border: 1.5px solid var(--accent); border-radius: 10px; box-shadow: var(--focus-ring); padding: 0 12px; flex-shrink: 0; }
}

/* Impression : toujours en clair, sans menu */
@media print {
    body.avec-menu { padding: 0; }
    .side, .m-top, .m-tabs, .toast { display: none !important; }
}
/* Lignes « bien » (somme des lots) : lecture seule, sans fond coloré */
.cel.lect.s-part, .cel.lect.s-imp { background: transparent; }
