/* =========================================================
   Résidences — feuille de style (mobile-first)
   ========================================================= */

:root {
    --bg:        #f4f2ee;
    --surface:   #ffffff;
    --surface-2: #faf9f6;
    --primary:   #0f6e5a;
    --primary-d: #0b5646;
    --primary-l: #e5f2ee;
    --accent:    #d9a441;
    --text:      #1c2b28;
    --muted:     #6f7d78;
    --border:    #e7e3db;
    --danger:    #c0392b;
    --danger-l:  #fdece9;
    --ok:        #1f8a5b;
    --radius:    18px;
    --radius-sm: 12px;
    --shadow:    0 6px 20px rgba(24, 43, 38, .07);
    --shadow-lg: 0 12px 34px rgba(24, 43, 38, .12);
    --maxw:      560px;
}

* { box-sizing: border-box; }

/* Icônes SVG premium */
.ico { vertical-align: -0.15em; flex-shrink: 0; }
.qa-ico-svg { color: var(--primary); }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0 0 .4rem; line-height: 1.25; }
p { margin: 0 0 .6rem; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .82rem; }

/* ---------- Coquille application ---------- */
.app {
    max-width: var(--maxw);
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    position: relative;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .7rem 1rem;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.brand-logo { height: 34px; width: auto; max-width: 120px; border-radius: 8px; object-fit: contain; }
.brand-name {
    font-weight: 700;
    font-size: 1.02rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 34px; height: 34px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
}
.brand-mark.lg { width: 60px; height: 60px; font-size: 1.6rem; border-radius: 16px; }

.topbar-actions { display: flex; gap: .25rem; }
.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 40px; height: 40px;
    border-radius: 12px;
    color: var(--text);
    transition: background .15s;
}
.icon-btn:hover { background: var(--surface-2); }

.content {
    padding: 1rem 1rem 6.5rem;
}

/* ---------- Bottom nav ---------- */
.bottomnav {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: 100%;
    max-width: var(--maxw);
    display: flex;
    justify-content: space-around;
    padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    z-index: 30;
}
.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: .35rem 0;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 600;
    border-radius: 12px;
    transition: color .15s;
}
.nav-item svg { width: 23px; height: 23px; }
.nav-item.active { color: var(--primary); }
.nav-item.active svg { transform: translateY(-1px); }

/* ---------- Cartes ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}
.card-title { font-size: 1.02rem; font-weight: 700; margin-bottom: .9rem; }
.section-title { font-size: 1rem; font-weight: 700; margin: 1.4rem 0 .7rem; }
.page-title { font-size: 1.5rem; font-weight: 800; margin: .2rem 0 1rem; }

/* ---------- Hero ---------- */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-d));
    color: #fff;
    border-radius: var(--radius);
    padding: 1.4rem 1.3rem 1.5rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 1.1rem;
}
.hero-hello { opacity: .85; margin: 0 0 .1rem; font-size: .9rem; }
.hero-title { font-size: 1.5rem; font-weight: 800; margin: 0; }
.hero-sub { opacity: .9; margin: .35rem 0 0; font-size: .92rem; }

/* ---------- Bannière d'appel à l'action ---------- */
.banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--primary-l);
    border: 1px solid #cfe6df;
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}
.banner p { margin: .2rem 0 0; font-size: .85rem; }
.banner .btn { flex-shrink: 0; }

/* ---------- Statistiques ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .8rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: .3rem;
}
.stat-wide { grid-column: 1 / -1; }
.stat-label { font-size: .8rem; color: var(--muted); }
.stat-value { font-size: 1.5rem; font-weight: 800; }
.stat-card.positive .stat-value { color: var(--ok); }
.stat-card.negative .stat-value { color: var(--danger); }

/* ---------- Actions rapides ---------- */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .8rem;
}
.qa {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    box-shadow: var(--shadow);
    transition: transform .12s, box-shadow .12s;
}
.qa:active { transform: scale(.98); }
.qa-icon {
    width: 46px; height: 46px; border-radius: 13px;
    display: grid; place-items: center;
    background: color-mix(in srgb, var(--primary) 10%, #fff);
    color: var(--primary);
    font-size: 1.5rem;
}
.qa-label { font-weight: 600; font-size: .92rem; }

/* ---------- Formulaires ---------- */
.stack > * { margin-bottom: 1rem; }
.form-group { margin-bottom: .9rem; }
.form-group:last-child { margin-bottom: 0; }
label {
    display: block;
    font-weight: 600;
    font-size: .88rem;
    margin-bottom: .35rem;
}
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=tel], select, textarea {
    width: 100%;
    padding: .7rem .8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-l);
    background: #fff;
}
textarea { resize: vertical; }
input[type=file] {
    width: 100%;
    font-size: .9rem;
    color: var(--muted);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }

.logo-row { display: flex; align-items: center; gap: 1rem; }
.logo-preview {
    width: 64px; height: 64px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    display: grid;
    place-items: center;
    overflow: hidden;
    flex-shrink: 0;
}
.logo-preview img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }

.form-actions { margin-top: .5rem; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .75rem 1.1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: .95rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform .1s, background .15s, box-shadow .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn.is-loading { opacity: .7; pointer-events: none; }

/* ---------- Flash ---------- */
.flash {
    padding: .8rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: .9rem;
    font-weight: 500;
    border: 1px solid transparent;
}
.flash-success { background: #e8f6ee; color: #14663f; border-color: #c7e8d5; }
.flash-error   { background: var(--danger-l); color: #96271b; border-color: #f4c9c2; }

/* ---------- État vide ---------- */
.empty-state { text-align: center; padding: 2.4rem 1.2rem; }
.empty-emoji { font-size: 2.6rem; margin-bottom: .5rem; }

/* ---------- Authentification ---------- */
.auth-body {
    background: linear-gradient(160deg, var(--primary), var(--primary-d));
    min-height: 100vh;
}
.auth-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: 22px;
    padding: 2rem 1.6rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.auth-logo { display: flex; justify-content: center; margin-bottom: 1rem; }
.auth-logo img { height: 72px; width: auto; max-width: 220px; border-radius: 16px; object-fit: contain; }
.auth-title { font-size: 1.35rem; font-weight: 800; }
.auth-sub { color: var(--muted); font-size: .9rem; margin-bottom: 1.4rem; }
.auth-form { text-align: left; }
.auth-form .form-group { margin-bottom: 1rem; }
.auth-foot { color: rgba(255, 255, 255, .8); font-size: .82rem; margin-top: 1.4rem; }

/* ---------- En-tête de page avec action ---------- */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: .2rem 0 1rem;
}
.page-head .page-title { margin: 0; }

/* ---------- Listes ---------- */
.list { display: flex; flex-direction: column; gap: .7rem; }
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .9rem 1rem;
    box-shadow: var(--shadow);
    transition: transform .1s;
}
.list-item:active { transform: scale(.99); }
.li-main { min-width: 0; }
.li-top { display: flex; align-items: center; gap: .5rem; margin-bottom: .2rem; }
.li-num { font-weight: 700; }
.li-sub { font-size: .82rem; color: var(--muted); }
.li-amount { font-weight: 800; white-space: nowrap; }
.li-client { font-weight: 600; font-size: .92rem; margin: .15rem 0; }
.li-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.li-reste { font-size: .7rem; font-weight: 700; color: var(--danger); background: var(--danger-l); padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.li-paid { font-size: .7rem; font-weight: 700; color: var(--ok); background: #e2f5ea; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }

/* Recherche factures */
.fac-search {
    display: flex; align-items: center; gap: .5rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: .1rem .7rem; margin-bottom: 1rem; box-shadow: var(--shadow);
    color: var(--muted);
}
.fac-search input[type=search] { border: none; background: none; box-shadow: none; padding: .7rem 0; flex: 1; }
.fac-search input[type=search]:focus { outline: none; box-shadow: none; }
.fac-clear { font-size: 1.4rem; line-height: 1; color: var(--muted); padding: 0 .2rem; text-decoration: none; }
.tag-recu {
    display: inline-block;
    background: var(--accent);
    color: #3a2c05;
    font-size: .68rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 6px;
    margin-left: .3rem;
}

/* ---------- Badges de statut ---------- */
.badge {
    font-size: .68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}
.badge-brouillon { background: #eceae5; color: #6f7d78; }
.badge-envoyee   { background: #e6eefb; color: #2b5cad; }
.badge-partiel   { background: #fdf0d9; color: #8a5a10; }
.badge-payee     { background: #e2f5ea; color: #14663f; }

/* ---------- Formulaire de facture ---------- */
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: .6rem; }
.grid-extra { display: grid; grid-template-columns: 1fr .8fr; gap: .6rem; }

.ligne-row, .extra-row {
    position: relative;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: .9rem .8rem .3rem;
    margin-bottom: .8rem;
    background: var(--surface-2);
}
.row-del {
    position: absolute;
    top: -10px; right: -8px;
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--danger);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow);
}
.lg-residence { margin-bottom: .7rem; }
.montant-box {
    display: flex;
    align-items: center;
    padding: .7rem .8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    font-weight: 700;
    min-height: 44px;
}

/* ---------- Carte des totaux ---------- */
.totals-card { background: var(--surface); }
.trow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .4rem 0;
    font-size: .95rem;
}
.trow span { color: var(--muted); }
.trow b { font-weight: 700; }
.trow-total {
    border-top: 1px solid var(--border);
    margin-top: .3rem;
    padding-top: .7rem;
    font-size: 1.15rem;
}
.trow-total b { color: var(--primary); }
.trow-reste b { color: var(--danger); }

/* ---------- Desktop : léger cadre "device" ---------- */
@media (min-width: 640px) {
    body:not(.auth-body) { padding: 1.4rem 0; }
    .app {
        border-radius: 26px;
        box-shadow: var(--shadow-lg);
        overflow: hidden;
        min-height: calc(100vh - 2.8rem);
        border: 1px solid var(--border);
    }
    .topbar { border-radius: 26px 26px 0 0; }
}

/* ---------- Barres d'action (facture) ---------- */
.action-bar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.action-bar .btn { flex: 1 1 auto; }
.action-bar-2 { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.1rem; }
.btn.sm { padding: .5rem .8rem; font-size: .82rem; }

/* ---------- Document facture / reçu ---------- */
.invoice {
    --inv-primary: #0f6e5a;
    --inv-accent:  #d9a441;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.4rem 1.2rem;
    color: #1c2b28;
}
.inv-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--inv-primary);
    margin-bottom: 1.1rem;
}
.inv-brand { display: flex; gap: .8rem; }
.inv-logo { height: 56px; width: auto; max-width: 180px; border-radius: 8px; object-fit: contain; background: #fff; }
.inv-company { font-weight: 800; font-size: 1.1rem; }
.inv-muted { color: var(--muted); font-size: .8rem; }
.inv-meta { text-align: right; }
.inv-doctype { font-weight: 800; letter-spacing: .04em; color: var(--inv-primary); }
.inv-num { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }

/* En-tête empilé sur petit écran (l'impression A4 garde 2 colonnes). */
@media (max-width: 430px) {
    .inv-head { flex-direction: column; gap: .7rem; }
    .inv-meta { text-align: left; }
    .inv-logo { height: 46px; max-width: 120px; }
    .inv-brand { gap: .6rem; }
    .inv-company { font-size: 1rem; }
}

.inv-block-title {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    margin-bottom: .25rem;
}
.inv-client { margin-bottom: 1.1rem; }
.inv-client-name { font-weight: 700; font-size: 1.02rem; }

.inv-table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; font-size: .9rem; }
.inv-table th {
    text-align: left;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    padding: .5rem .4rem;
}
.inv-table td { padding: .55rem .4rem; border-bottom: 1px solid #f0eee9; vertical-align: top; }
.inv-table .c { text-align: center; }
.inv-table .r { text-align: right; white-space: nowrap; }
@media (max-width: 430px) {
    .inv-table { font-size: .78rem; }
    .inv-table th, .inv-table td { padding: .45rem .22rem; }
}

.inv-totals { margin-left: auto; max-width: 320px; }
.itot { display: flex; justify-content: space-between; padding: .3rem 0; font-size: .92rem; }
.itot span { color: var(--muted); }
.itot-total {
    border-top: 2px solid var(--inv-primary);
    margin-top: .3rem;
    padding-top: .6rem;
    font-size: 1.2rem;
    font-weight: 800;
}
.itot-total b { color: var(--inv-primary); }
.itot-reste b { color: var(--danger); }
.itot-paid b { color: var(--ok); }

.inv-pay, .inv-note, .inv-rules { margin-top: 1.1rem; font-size: .88rem; }
.inv-pay b { color: var(--inv-primary); }
.inv-note { background: var(--surface-2); border-radius: 10px; padding: .7rem .8rem; }
.inv-foot { margin-top: 1.4rem; text-align: center; color: var(--muted); font-size: .82rem; }
.il-name { font-weight: 600; }
.il-period { font-size: .82em; color: var(--muted); margin-top: 2px; }
.inv-cgl { margin-top: 2rem; padding-top: 1.4rem; border-top: 2px solid var(--inv-primary); page-break-before: always; }
.inv-cgl-title { font-weight: 800; color: var(--inv-primary); margin-bottom: .5rem; }
.inv-cgl-body { font-size: .82rem; color: #38453e; line-height: 1.6; white-space: pre-line; }

/* ===================== 5 modèles de facture ===================== */

/* 1 · Classique — sobre et professionnel */
.inv-classique .inv-head { border-bottom-width: 3px; }

/* 2 · Moderne — bandeau coloré */
.inv-moderne .inv-head {
    background: var(--inv-primary);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 1.1rem 1.2rem;
    margin-bottom: 1.3rem;
}
.inv-moderne .inv-head .inv-muted { color: rgba(255, 255, 255, .85); }
.inv-moderne .inv-doctype { color: #fff; }
.inv-moderne .inv-table thead th {
    background: color-mix(in srgb, var(--inv-primary) 10%, #fff);
    border-bottom: 2px solid var(--inv-primary);
    color: var(--inv-primary);
}
.inv-moderne .inv-block-title { color: var(--inv-accent); }
.inv-moderne .itot-total {
    background: color-mix(in srgb, var(--inv-primary) 8%, #fff);
    border-top: none;
    border-radius: 10px;
    padding: .7rem .8rem;
    margin-top: .5rem;
}

/* 3 · Élégant — serif, centré, boutique */
.inv-elegant { font-family: Georgia, "Times New Roman", serif; }
.inv-elegant .inv-head {
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-bottom: 1px solid var(--inv-primary);
    gap: .5rem;
}
.inv-elegant .inv-brand { flex-direction: column; align-items: center; gap: .35rem; }
.inv-elegant .inv-meta { text-align: center; }
.inv-elegant .inv-doctype {
    font-size: 1.4rem;
    letter-spacing: .28em;
    text-transform: uppercase;
    border-top: 1px solid var(--inv-accent);
    border-bottom: 1px solid var(--inv-accent);
    padding: .3rem 1rem;
    margin-bottom: .3rem;
}
.inv-elegant .inv-company { font-size: 1.25rem; }
.inv-elegant .itot-total { border-top: 1px solid var(--inv-primary); }

/* 4 · Minimal — épuré, beaucoup d'air */
.inv-minimal { padding: 1.7rem 1.5rem; }
.inv-minimal .inv-head { border-bottom: 1px solid #e8e6e1; }
.inv-minimal .inv-doctype {
    color: #14201d;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .14em;
    font-size: .92rem;
}
.inv-minimal .inv-table th { color: #b3b3ad; border-bottom-color: #ecebe6; }
.inv-minimal .itot-total { border-top: 1px solid #222; }

/* 5 · Bandeau latéral — bande colorée sur le côté */
.inv-bandeau { border-left: 6px solid var(--inv-primary); }
.inv-bandeau .inv-head { border-bottom: 1px dashed color-mix(in srgb, var(--inv-primary) 45%, #fff); }
.inv-bandeau .inv-doctype {
    display: inline-block;
    background: var(--inv-primary);
    color: #fff;
    padding: .28rem .8rem;
    border-radius: 6px;
    letter-spacing: .06em;
}
.inv-bandeau .inv-block-title { color: var(--inv-accent); }
.inv-bandeau .itot-total {
    border-top: none;
    border-left: 4px solid var(--inv-accent);
    padding-left: .7rem;
}

/* ---------- Page publique ---------- */
.public-body { background: var(--bg); }
.public-wrap { max-width: 720px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.public-actions { margin-bottom: 1rem; display: flex; justify-content: flex-end; }

/* ---------- Cartes résidences ---------- */
.res-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .8rem;
}
.res-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}
.res-card.is-inactive { opacity: .6; }
.res-cover {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    background: var(--surface-2);
}
.res-cover img { width: 100%; height: 100%; object-fit: cover; }
.res-cover-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 2rem;
}
.res-flag {
    position: absolute;
    top: .4rem; left: .4rem;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
}
.res-body { padding: .7rem; display: flex; flex-direction: column; gap: .25rem; }
.res-name { font-weight: 700; font-size: .95rem; }
.res-loc { font-size: .78rem; color: var(--muted); }
.res-price { font-weight: 800; color: var(--primary); }
.res-price span { font-weight: 500; font-size: .72rem; color: var(--muted); }
.res-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.res-actions .btn { flex: 1 1 auto; padding: .45rem .4rem; font-size: .78rem; }

/* ---------- Chips commodités (formulaire) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem .7rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    font-size: .85rem;
    cursor: pointer;
    user-select: none;
}
.chip input { accent-color: var(--primary); }
.chip:has(input:checked) {
    background: var(--primary-l);
    border-color: var(--primary);
    color: var(--primary-d);
    font-weight: 600;
}

/* ---------- Grille de médias (formulaire) ---------- */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: .5rem;
    margin-bottom: .5rem;
}
.media-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    display: block;
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-del {
    position: absolute;
    top: 4px; right: 4px;
    background: rgba(255,255,255,.92);
    border-radius: 6px;
    padding: 1px 4px;
    font-size: .8rem;
    display: flex;
    align-items: center;
    gap: 2px;
}
.media-thumb:has(input:checked) { outline: 3px solid var(--danger); }
.media-thumb:has(input:checked) img { opacity: .5; }

/* ===================== Landing page résidence (premium) ===================== */
.lp-body { background: #eeece8; }
.lp {
    --brand: #0f6e5a;
    max-width: 780px;
    margin: 0 auto;
    background: #fff;
    min-height: 100vh;
    position: relative;
    overflow-x: clip;
}

/* Hero galerie */
.lp-hero { position: relative; }
.lp-hero-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: #000;
}
.lp-hero-track::-webkit-scrollbar { display: none; }
.lp-hero-track img {
    flex: 0 0 100%;
    width: 100%;
    height: min(58vh, 470px);
    object-fit: cover;
    scroll-snap-align: center;
}
.lp-hero-empty {
    height: 42vh;
    display: grid;
    place-items: center;
    font-size: 4rem;
    background: linear-gradient(135deg, #e7e5e0, #f6f5f2);
}
.lp-hero-grad {
    position: absolute; left: 0; right: 0; bottom: 0; height: 55%;
    background: linear-gradient(to top, rgba(0,0,0,.66), rgba(0,0,0,.05) 70%, transparent);
    pointer-events: none;
}
.lp-hero-count {
    position: absolute; right: 12px; bottom: 74px;
    background: rgba(0,0,0,.55); color: #fff;
    font-size: .74rem; font-weight: 600; padding: 3px 10px;
    border-radius: 999px; backdrop-filter: blur(4px);
}
.lp-hero-top {
    position: absolute; top: 0; left: 0; right: 0;
    padding: 14px; display: flex; justify-content: space-between; align-items: flex-start;
}
.lp-badge {
    background: rgba(255,255,255,.92); color: #14201d;
    font-size: .72rem; font-weight: 700; padding: 5px 11px;
    border-radius: 999px; backdrop-filter: blur(6px); box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
.lp-iconbtn {
    position: relative;
    width: 40px; height: 40px; border-radius: 50%; border: none;
    background: rgba(255,255,255,.92); color: #14201d;
    display: grid; place-items: center; cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,.2); backdrop-filter: blur(6px);
    transition: background .2s, color .2s;
}
.lp-iconbtn.copied { background: var(--brand); color: #fff; }
.lp-hero-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 18px; color: #fff; }
.lp-hero-caption h1 { font-size: 1.75rem; font-weight: 800; margin: 0; line-height: 1.15; text-shadow: 0 2px 14px rgba(0,0,0,.45); }
.lp-hero-loc { margin: .3rem 0 0; font-size: .9rem; opacity: .96; text-shadow: 0 1px 10px rgba(0,0,0,.55); }

/* Contenu */
.lp-wrap { padding: 1.1rem 1.1rem 6.5rem; }
.lp-reveal { opacity: 0; transform: translateY(16px); transition: opacity .55s ease, transform .55s ease; }
.lp-reveal.in { opacity: 1; transform: none; }

.lp-topcard {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 9%, #fff), #fff);
    border: 1px solid color-mix(in srgb, var(--brand) 18%, #eee);
    border-radius: 18px; padding: 1rem 1.1rem; margin-bottom: 1rem;
    box-shadow: var(--shadow);
}
.lp-price { font-size: 1.55rem; font-weight: 800; color: var(--brand); white-space: nowrap; }
.lp-price span { font-size: .8rem; font-weight: 500; color: var(--muted); margin-left: .25rem; }
.lp-avail-pill {
    display: inline-flex; align-items: center; gap: .4rem;
    font-size: .76rem; font-weight: 600; color: var(--muted);
    background: #fff; border: 1px solid var(--border); padding: .35rem .7rem; border-radius: 999px;
}
.lp-avail-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #c2c2bb; }
.lp-avail-pill.ok .dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.18); }

.lp-quicklinks { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.lp-ql {
    display: inline-flex; align-items: center; gap: .4rem;
    background: #fff; border: 1px solid var(--border);
    padding: .5rem .8rem; border-radius: 12px; font-size: .85rem; font-weight: 600;
    box-shadow: var(--shadow);
}
.lp-ql span { font-size: 1.05rem; }

.lp-section { margin-bottom: 1.7rem; }
.lp-h2 { font-size: 1.18rem; font-weight: 800; margin: 0 0 .7rem; letter-spacing: -.01em; }
.lp-desc { color: #38453e; line-height: 1.7; font-size: .96rem; }

.lp-amenities { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.lp-amenity {
    display: flex; align-items: center; gap: .6rem;
    background: #fff; border: 1px solid var(--border); border-radius: 14px;
    padding: .7rem .8rem; box-shadow: var(--shadow);
}
.lp-am-ico {
    font-size: 1.2rem; width: 38px; height: 38px; flex-shrink: 0;
    display: grid; place-items: center; color: var(--brand);
    background: color-mix(in srgb, var(--brand) 10%, #fff); border-radius: 10px;
}
.lp-am-lbl { font-size: .87rem; font-weight: 600; }

.lp-video { position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-lg); }
.lp-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lp-videolink {
    display: inline-flex; align-items: center; gap: .4rem;
    background: var(--brand); color: #fff; font-weight: 700;
    padding: .8rem 1.2rem; border-radius: 14px;
}

/* Calendrier */
.lp-cal-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: .3rem; }
.lp-refresh {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .8rem; font-weight: 700; color: var(--brand);
    background: color-mix(in srgb, var(--brand) 10%, #fff);
    border: 1px solid color-mix(in srgb, var(--brand) 25%, #fff);
    padding: .35rem .7rem; border-radius: 999px; cursor: pointer;
}
.lp-refresh.spin svg { animation: lp-spin .8s linear infinite; }
@keyframes lp-spin { to { transform: rotate(360deg); } }
.lp-cal { background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 1rem; box-shadow: var(--shadow); }
.lp-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .8rem; }
.lp-cal-month { font-weight: 800; }
.lp-cal-nav { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: #fff; font-size: 1.3rem; line-height: 1; cursor: pointer; color: var(--text); }
.lp-cal-nav:disabled { opacity: .3; cursor: default; }
.lp-cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.lp-cal-dow span { text-align: center; font-size: .68rem; font-weight: 700; color: var(--muted); }
.lp-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.lp-cal-day { aspect-ratio: 1; display: grid; place-items: center; font-size: .85rem; font-weight: 600; border-radius: 10px; }
.lp-cal-day.blank { visibility: hidden; }
.lp-cal-day.free { background: color-mix(in srgb, #22c55e 13%, #fff); color: #15803d; }
.lp-cal-day.busy { background: color-mix(in srgb, #ef4444 13%, #fff); color: #b91c1c; text-decoration: line-through; }
.lp-cal-day.past { color: #cdcdc7; }
.lp-cal-day.today { outline: 2px solid var(--brand); outline-offset: -2px; }
.lp-legend { display: flex; gap: 1.1rem; justify-content: center; margin-top: .9rem; font-size: .74rem; color: var(--muted); }
.lp-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: 3px; }
.lp-legend .lg-free { background: color-mix(in srgb, #22c55e 28%, #fff); }
.lp-legend .lg-busy { background: color-mix(in srgb, #ef4444 28%, #fff); }
.lp-legend .lg-past { background: #e5e5e0; }
.lp-cal-note { font-size: .8rem; color: var(--muted); margin-top: .7rem; text-align: center; }

/* CTA */
.lp-ctacard {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 62%, #000));
    color: #fff; border-radius: 20px; padding: 1.2rem; margin: .4rem 0 1.6rem;
    box-shadow: var(--shadow-lg);
}
.lp-cta-h { font-weight: 800; font-size: 1.1rem; }
.lp-cta-sub { opacity: .9; font-size: .85rem; margin-top: .15rem; }
.lp-cta {
    display: inline-flex; align-items: center; gap: .5rem;
    background: #25D366; color: #fff; font-weight: 700;
    padding: .8rem 1.15rem; border-radius: 14px; white-space: nowrap;
    box-shadow: 0 6px 18px rgba(37,211,102,.42);
}
.lp-cta.sm { padding: .62rem 1.1rem; }

.lp-footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 1.6rem 0 1rem; border-top: 1px solid var(--border); margin-top: 1rem; }
.lp-foot-logo { height: 40px; width: auto; max-width: 150px; object-fit: contain; margin-bottom: .5rem; display: inline-block; }
.lp-foot-tel { margin-top: .2rem; }

/* Barre sticky */
.lp-sticky {
    position: fixed; left: 50%; transform: translateX(-50%); bottom: 0;
    width: 100%; max-width: 780px;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--border); box-shadow: 0 -4px 20px rgba(0,0,0,.06); z-index: 50;
}
.lp-sticky-price b { font-size: 1.15rem; font-weight: 800; }
.lp-sticky-price span { color: var(--muted); font-size: .78rem; margin-left: .2rem; }

@media (min-width: 800px) {
    .lp-body { padding: 1.5rem 0; }
    .lp { border-radius: 24px; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,.14); min-height: auto; }
    .lp-sticky { border-radius: 0 0 24px 24px; }
}

/* ---------- Sélecteur de modèle de facture (paramètres) ---------- */
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.tpl-card {
    position: relative;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: .5rem;
    cursor: pointer;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.tpl-card input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-card:has(input:checked) {
    border-color: var(--inv-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--inv-primary) 18%, transparent);
}
.tpl-name { font-size: .8rem; font-weight: 600; text-align: center; }

.tpl-mini {
    height: 94px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #eee;
    padding: 8px;
    overflow: hidden;
}
.tm-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding-bottom: 5px;
}
.tm-logo { width: 16px; height: 16px; border-radius: 4px; background: color-mix(in srgb, var(--inv-primary) 30%, #fff); }
.tm-title { width: 38px; height: 8px; border-radius: 3px; background: var(--inv-primary); }
.tm-rows { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.tm-row { height: 5px; border-radius: 2px; background: #e9e7e2; }
.tm-row:nth-child(2) { width: 80%; }
.tm-row:nth-child(3) { width: 58%; }
.tm-total { height: 9px; width: 46%; margin-left: auto; border-radius: 2px; background: var(--inv-primary); }

.tm-classique .tm-head { border-bottom: 2px solid var(--inv-primary); }
.tm-moderne .tm-head { background: var(--inv-primary); margin: -8px -8px 6px; padding: 8px; border-radius: 7px 7px 0 0; }
.tm-moderne .tm-title { background: #fff; }
.tm-moderne .tm-logo { background: rgba(255, 255, 255, .7); }
.tm-elegant .tm-head { flex-direction: column; gap: 4px; align-items: center; border-bottom: 1px solid var(--inv-primary); }
.tm-elegant .tm-title { background: transparent; border-top: 1px solid var(--inv-accent); border-bottom: 1px solid var(--inv-accent); width: 46px; height: 9px; }
.tm-elegant .tm-total { margin: 0 auto; }
.tm-minimal .tm-head { border-bottom: 1px solid #e2e0db; }
.tm-minimal .tm-title { background: #333; }
.tm-bandeau { border-left: 4px solid var(--inv-primary); }
.tm-bandeau .tm-title { background: var(--inv-primary); }
.tm-bandeau .tm-total { border-left: 3px solid var(--inv-accent); background: color-mix(in srgb, var(--inv-primary) 18%, #fff); }

.color-row { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.color-field { display: flex; flex-direction: column; gap: .35rem; }
.color-field label { margin: 0; }
input[type=color] {
    width: 54px; height: 40px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

/* ---------- Agenda / calendrier ---------- */
.ag-filter { margin-bottom: 1rem; }

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .8rem; }
.cal-month { font-weight: 800; font-size: 1.05rem; }
.cal-nav {
    width: 36px; height: 36px; display: grid; place-items: center;
    border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
    font-size: 1.3rem; line-height: 1; color: var(--text);
}
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.cal-dow span { text-align: center; font-size: .68rem; font-weight: 700; color: var(--muted); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day { aspect-ratio: 1; display: grid; place-items: center; font-size: .85rem; font-weight: 600; border-radius: 10px; }
.cal-day.blank { visibility: hidden; }
.cal-day.free { background: color-mix(in srgb, #22c55e 12%, #fff); color: #15803d; }
.cal-day.busy { background: color-mix(in srgb, #ef4444 13%, #fff); color: #b91c1c; text-decoration: line-through; }
.cal-day.past { color: #cdcdc7; }
.cal-day.today { outline: 2px solid var(--primary); outline-offset: -2px; }
.cal-day.picked { background: var(--primary) !important; color: #fff !important; }
.cal-legend { display: flex; gap: 1.1rem; justify-content: center; margin-top: .9rem; font-size: .74rem; color: var(--muted); }
.cal-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: 3px; }
.cal-legend .lg-free { background: color-mix(in srgb, #22c55e 28%, #fff); }
.cal-legend .lg-busy { background: color-mix(in srgb, #ef4444 28%, #fff); }
.cal-legend .lg-past { background: #e5e5e0; }

details.ag-new { padding: 0; }
.ag-new summary { padding: 1.1rem; font-weight: 700; cursor: pointer; list-style: none; }
.ag-new summary::-webkit-details-marker { display: none; }
.ag-new[open] summary { border-bottom: 1px solid var(--border); }
.ag-form { padding: 1.1rem; }

.ag-list-head { display: flex; align-items: center; justify-content: space-between; margin: 1.4rem 0 .7rem; }
.ag-toggle { font-size: .82rem; font-weight: 600; color: var(--primary); }

.ag-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: .9rem 1rem; box-shadow: var(--shadow);
}
.ag-card.is-cancelled { opacity: .6; }
.ag-card-top { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.ag-dates { font-weight: 800; }
.ag-meta { font-size: .82rem; color: var(--muted); margin-top: .15rem; }
.ag-note { font-size: .8rem; color: var(--muted); margin-top: .3rem; font-style: italic; }
.ag-actions { margin-top: .8rem; border-top: 1px dashed var(--border); padding-top: .8rem; }
.ag-setfin label { font-size: .8rem; margin-bottom: .3rem; }
.ag-setfin-row { display: flex; gap: .5rem; }
.ag-setfin-row input { flex: 1; }

.badge-resa-en_cours { background: #e2f5ea; color: #14663f; }
.badge-resa-terminee { background: #eceae5; color: #6f7d78; }
.badge-resa-annulee  { background: #fdece9; color: #96271b; }
.badge-pay-attente { background: #fdf0d9; color: #8a5a10; }
.badge-pay-acompte { background: #e6eefb; color: #2b5cad; }
.badge-pay-solde   { background: #e2f5ea; color: #14663f; }

.ag-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.doc-prev { display: flex; align-items: center; gap: .9rem; margin-bottom: .4rem; font-size: .85rem; }
.doc-prev a { font-weight: 600; color: var(--primary); }
.doc-del { display: inline-flex; align-items: center; gap: .25rem; font-size: .78rem; color: var(--danger); cursor: pointer; }
.pay-summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .4rem; font-size: .9rem; flex-wrap: wrap; }
.btn.disabled { opacity: .5; pointer-events: none; }

/* ---------- Lignes répétables (fiche résidence v2) ---------- */
.rep-label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: .5rem; }
.rep-row {
    position: relative;
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: .8rem .7rem;
    margin-bottom: .6rem;
    background: var(--surface-2);
}
.rep-row .grid-2, .rep-row .grid-3 { gap: .5rem; }
.add-row { margin-top: .2rem; }
.tag-conf, .tag-int {
    font-size: .64rem; font-weight: 700; letter-spacing: .01em;
    padding: 2px 7px; border-radius: 6px; margin-left: .4rem; white-space: nowrap;
}
.tag-conf { background: #fdf0d9; color: #8a5a10; }
.tag-int  { background: #eceae5; color: #6f7d78; }

/* ---------- Finances ---------- */
.fin-period { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.fin-filter { margin: 0 0 .8rem; }
.fin-tabs { display: flex; gap: .3rem; margin-bottom: 1rem; background: var(--surface-2); padding: 4px; border-radius: 12px; }
.fin-tabs a { flex: 1; text-align: center; padding: .5rem; border-radius: 9px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.fin-tabs a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Période : presets + plage */
.fin-presets { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.fin-presets a { font-size: .8rem; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: .35rem .7rem; border-radius: 999px; }
.fin-presets a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.fin-range { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.fin-range input[type=date] { flex: 1; padding: .5rem .6rem; }
.fin-range span { color: var(--muted); }

/* Rentabilité par résidence */
.rent-card { padding: 1.1rem 1rem; }
.rent-row { padding: .6rem 0; border-bottom: 1px solid #f0eee9; }
.rent-row:last-child { border-bottom: none; }
.rent-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.rent-rank { font-size: .72rem; font-weight: 800; color: #fff; background: var(--muted); border-radius: 6px; padding: 1px 6px; }
.rent-row:first-child .rent-rank { background: var(--accent); color: #3a2c05; }
.rent-nom { font-weight: 700; font-size: .92rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rent-solde { font-weight: 800; white-space: nowrap; }
.rent-solde.pos { color: var(--ok); }
.rent-solde.neg { color: var(--danger); }
.rent-bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.rent-fill { height: 100%; border-radius: 999px; min-width: 3px; }
.rent-fill.pos { background: linear-gradient(90deg, color-mix(in srgb, var(--ok) 60%, #fff), var(--ok)); }
.rent-fill.neg { background: linear-gradient(90deg, color-mix(in srgb, var(--danger) 60%, #fff), var(--danger)); }
.rent-detail { display: flex; gap: 1rem; margin-top: .35rem; font-size: .78rem; font-weight: 600; }
.rent-detail .pos { color: var(--ok); }
.rent-detail .neg { color: var(--danger); }

.fin-item {
    display: flex; gap: .7rem; align-items: flex-start;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: .8rem .9rem; box-shadow: var(--shadow);
}
.fin-ico { width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; }
.fin-ico.in { background: #e2f5ea; color: #15803d; }
.fin-ico.out { background: #fdece9; color: #b91c1c; }
.fin-main { flex: 1; min-width: 0; }
.fin-top { display: flex; justify-content: space-between; gap: .6rem; align-items: baseline; }
.fin-cat { font-weight: 700; }
.fin-amount { font-weight: 800; white-space: nowrap; }
.fin-amount.in { color: var(--ok); }
.fin-amount.out { color: var(--danger); }
.fin-sub { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.fin-note { font-size: .8rem; color: var(--muted); margin-top: .25rem; font-style: italic; }
.fin-actions { display: flex; align-items: center; gap: 1.1rem; margin-top: .5rem; }
.fin-link { font-size: .8rem; font-weight: 600; color: var(--primary); }
.fin-del { background: none; border: none; color: var(--danger); font-size: .8rem; font-weight: 600; cursor: pointer; padding: 0; }
button.fin-link { background: none; border: none; cursor: pointer; padding: 0; }
.fin-item.annulee { opacity: .65; }
.fin-item.annulee .fin-cat, .fin-item.annulee .fin-amount { text-decoration: line-through; }
.fin-annul-tag { font-size: .62rem; font-weight: 800; background: #fdece9; color: #96271b; padding: 1px 6px; border-radius: 6px; vertical-align: middle; text-decoration: none; display: inline-block; }
.fin-motif { font-size: .78rem; color: #96271b; margin-top: .25rem; font-style: italic; }

/* ---------- Landing v2 (Lot B) ---------- */
.lp-hero-count { display: flex; align-items: center; gap: 4px; }
.lp-dots { position: absolute; left: 0; right: 0; bottom: 60px; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.lp-dots span { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .5); transition: all .2s; }
.lp-dots span.on { background: #fff; width: 20px; border-radius: 4px; }

.lp-thumbs { display: flex; gap: 6px; overflow-x: auto; padding: .6rem .8rem; background: #fff; scrollbar-width: none; }
.lp-thumbs::-webkit-scrollbar { display: none; }
.lp-thumb { flex: 0 0 auto; width: 60px; height: 46px; object-fit: cover; border-radius: 8px; cursor: pointer; opacity: .55; border: 2px solid transparent; transition: opacity .2s, border-color .2s; }
.lp-thumb.on { opacity: 1; border-color: var(--brand); }

.lp-availcta {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: .5rem;
    background: var(--brand); color: #fff; font-weight: 700; font-size: 1rem;
    border: none; border-radius: 14px; padding: .95rem; margin-bottom: 1.2rem; cursor: pointer;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 40%, transparent);
}

.lp-facts { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1.4rem; }
.lp-fact { display: flex; align-items: center; gap: .6rem; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: .7rem .8rem; box-shadow: var(--shadow); }
.lp-fact-ic { font-size: 1.3rem; }
.lp-fact b { display: block; font-size: .9rem; }
.lp-fact small { color: var(--muted); font-size: .76rem; }

.lp-rules { display: flex; flex-wrap: wrap; gap: .5rem; }
.lp-rule { display: inline-flex; align-items: center; gap: .35rem; font-size: .84rem; font-weight: 600; padding: .4rem .7rem; border-radius: 999px; border: 1px solid; }
.lp-rule b { font-weight: 800; }
.lp-rule.ok { background: #e9f8ef; color: #15803d; border-color: #bfe8cf; }
.lp-rule.no { background: #fdeeec; color: #b91c1c; border-color: #f4ccc6; }

.lp-video { position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-lg); cursor: pointer; background: #000; }
.lp-video img { width: 100%; height: 100%; object-fit: cover; }
.lp-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lp-play { position: absolute; inset: 0; margin: auto; width: 66px; height: 66px; border-radius: 50%; border: none; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(2px); }
.lp-play svg { margin-left: 3px; }

.lp-cal-hint { font-size: .84rem; color: var(--muted); margin: -.2rem 0 .7rem; }
.lp-cal-day.free { cursor: pointer; }
.lp-cal-day.sel { background: var(--brand) !important; color: #fff !important; }
.lp-cal-day.inrange { background: color-mix(in srgb, var(--brand) 20%, #fff) !important; color: var(--brand) !important; border-radius: 0; }
.lp-cal-day.sel-start { border-radius: 10px 0 0 10px; }
.lp-cal-day.sel-end { border-radius: 0 10px 10px 0; }
.lp-legend .lg-sel { background: var(--brand); }

.lp-resa { margin-top: 1rem; background: #fff; border: 2px solid var(--brand); border-radius: 18px; padding: 1.1rem; box-shadow: var(--shadow-lg); }
.lp-resa-dates { font-size: 1rem; text-align: center; margin-bottom: .9rem; }
.lp-resa-people { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.lp-resa-people label { margin: 0; font-weight: 600; font-size: .9rem; }
.stepper { display: flex; align-items: center; gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.stepper button { width: 40px; height: 40px; border: none; background: var(--surface-2); font-size: 1.2rem; cursor: pointer; color: var(--text); }
.stepper input { width: 54px; text-align: center; border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border); border-radius: 0; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.lp-resa-lines { border-top: 1px solid var(--border); padding-top: .8rem; }
.rl { display: flex; justify-content: space-between; align-items: baseline; padding: .25rem 0; }
.rl b { font-size: 1.2rem; font-weight: 800; color: var(--brand); }
.rl-ac span { color: var(--muted); font-size: .85rem; }
.rl-ac b { font-size: 1rem; color: var(--accent); }
.lp-resa-note { font-size: .8rem; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: .6rem .7rem; margin: .8rem 0; }
.lp-resa-cta { width: 100%; justify-content: center; }

.lp-cond { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 0; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.lp-cond summary { padding: 1rem 1.1rem; font-weight: 700; cursor: pointer; list-style: none; }
.lp-cond summary::-webkit-details-marker { display: none; }
.lp-cond summary::after { content: '⌄'; float: right; color: var(--muted); }
.lp-cond[open] summary { border-bottom: 1px solid var(--border); }
.lp-cond .lp-desc { padding: 1rem 1.1rem; }
.lp-foot-note { font-size: .76rem; color: var(--muted); margin-top: .5rem; max-width: 340px; margin-left: auto; margin-right: auto; }

/* ---------- Carte d'alerte (cockpit) ---------- */
.alert-card {
    display: flex; align-items: center; gap: .8rem;
    background: linear-gradient(135deg, #fff6e8, #fff);
    border: 1px solid #f2d9a8; border-radius: 16px;
    padding: .9rem 1rem; margin-bottom: 1rem; box-shadow: var(--shadow);
}
.alert-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: #fdf0d9; color: #8a5a10; flex-shrink: 0; }
.alert-txt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.alert-txt b { font-size: .96rem; }
.alert-txt small { color: var(--muted); font-size: .82rem; }
.alert-arrow { font-size: 1.5rem; color: var(--muted); }

/* ---------- Sauvegarde / restauration ---------- */
.restore-box { margin-top: 1rem; border-top: 1px solid var(--border); padding-top: .8rem; }
.restore-box summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--muted); list-style: none; }
.restore-box summary::-webkit-details-marker { display: none; }
.restore-box[open] summary { color: var(--text); margin-bottom: .6rem; }

/* ---------- Paiements (facture) & clients ---------- */
.head-actions { display: flex; gap: .4rem; align-items: center; }
.pay-card .card-title { display: flex; align-items: center; gap: .4rem; }
.pay-recap { display: flex; gap: 1.2rem; flex-wrap: wrap; padding: .7rem .9rem; background: var(--surface-2); border-radius: 12px; margin-bottom: .8rem; font-size: .9rem; }
.pay-recap b { margin-left: .2rem; }
.pay-recap b.pos { color: var(--ok); }
.pay-recap b.neg { color: var(--danger); }
.pay-list { display: flex; flex-direction: column; margin-bottom: .6rem; }
.pay-line { display: flex; align-items: center; justify-content: space-between; padding: .55rem .2rem; border-bottom: 1px solid #f0eee9; }
.pay-line:last-child { border-bottom: none; }
.pay-amt { font-weight: 700; }
.pay-meta { font-size: .78rem; color: var(--muted); }
.pay-add { margin-top: .3rem; }
.pay-add summary { cursor: pointer; font-weight: 600; color: var(--primary); font-size: .9rem; list-style: none; display: inline-flex; align-items: center; gap: .3rem; }
.pay-add summary::-webkit-details-marker { display: none; }
.cl-avatar { width: 44px; height: 44px; border-radius: 50%; background: color-mix(in srgb, var(--primary) 12%, #fff); color: var(--primary); font-weight: 800; font-size: 1.1rem; display: grid; place-items: center; flex-shrink: 0; }

/* ---------- Micro-interactions / polish (v2.1) ---------- */
@media (hover: hover) {
    .list-item:hover, .qa:hover, .res-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
    .btn-primary:hover { box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 32%, transparent); }
    .stat-card:hover { transform: translateY(-1px); }
    .fin-item:hover, .ag-card:hover { border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
}
.res-card, .stat-card, .fin-item, .ag-card { transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease; }
.icon-btn:active { transform: scale(.9); }
.qa:active, .list-item:active { transform: scale(.985); }
.btn .ico { margin-top: -1px; }

/* ---------- Impression / PDF ---------- */
@media print {
    body { background: #fff; }
    .topbar, .bottomnav, .no-print, .action-bar, .action-bar-2 { display: none !important; }
    .app { max-width: none; box-shadow: none; border: none; min-height: 0; }
    .content, .public-wrap { padding: 0; max-width: none; }
    .invoice { border: none; box-shadow: none; padding: 0; border-radius: 0; }
    @page { margin: 14mm; }
}
