/* ==========================================================================
   Patrimoine · feuille de style
   1. Jetons (couleurs, espacements, typographie)
   2. Base
   3. Navigation (barre du haut, onglets du bas sur téléphone)
   4. Mise en page (conteneur, en-têtes de page, cartes)
   5. Composants (boutons, formulaires, listes, tableaux, badges, messages…)
   6. Écrans particuliers
   7. Petits écrans
   ========================================================================== */

/* 1. Jetons ---------------------------------------------------------------- */
:root {
    --primary: #1f4e79;
    --primary-hover: #173c5e;
    --primary-ink: #ffffff;
    --primary-soft: #e8f0f8;
    --primary-ring: rgba(31, 78, 121, .35);

    --success: #1e6b34;
    --success-soft: #e4f3e8;
    --warning: #7a5300;
    --warning-soft: #fdf1d8;
    --warning-line: #c98a00;
    --danger: #b3261e;
    --danger-hover: #8f1e18;
    --danger-soft: #fbe9e7;
    --info: #1f4e79;
    --info-soft: #e8f0f8;

    --bg: #f4f6f9;
    --card: #ffffff;
    --ink: #1b1f24;
    --muted: #5b6470;      /* contraste 5,9:1 sur blanc */
    --border: #dde2e8;
    --border-strong: #c3cad3;
    --hover: #f5f7fa;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-lg: 0 8px 24px rgba(16, 24, 40, .14);

    --space-1: .25rem;
    --space-2: .5rem;
    --space-3: .75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;

    --tap: 2.75rem;          /* 44 px : taille minimale d'une cible tactile */
    --tabbar-h: 4rem;

    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 100%;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
    accent-color: var(--primary);
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
img { max-width: 100%; }

h1, h2, h3 { line-height: 1.25; color: var(--ink); }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; margin: 0 0 var(--space-4); }
h2 { font-size: 1.15rem; font-weight: 650; margin: var(--space-6) 0 var(--space-3); }
h3 { font-size: 1rem; font-weight: 650; margin: var(--space-5) 0 var(--space-2); }
p { margin: 0 0 var(--space-3); }

a { color: var(--primary); text-underline-offset: .15em; }
a:hover { color: var(--primary-hover); }

:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.texte-ko { color: var(--danger); }
address { font-style: normal; line-height: 1.6; }
.logo { max-width: 160px; max-height: 80px; display: block; margin-bottom: var(--space-3); }

.lien-evitement {
    position: absolute; left: var(--space-2); top: 0; z-index: 100;
    padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm);
    background: var(--card); color: var(--primary); font-weight: 600;
    transform: translateY(-200%);
}
.lien-evitement:focus { top: var(--space-2); transform: none; box-shadow: var(--shadow-lg); }

/* 3. Navigation ------------------------------------------------------------ */
.topbar {
    position: sticky; top: 0; z-index: 20;
    background: var(--primary);
    padding-top: env(safe-area-inset-top);
    box-shadow: 0 1px 0 rgba(0, 0, 0, .08);
}
.topbar-inner {
    max-width: 1120px; margin: 0 auto;
    display: flex; align-items: center; gap: var(--space-4);
    min-height: 3.5rem;
    padding: 0 max(var(--space-4), env(safe-area-inset-right)) 0 max(var(--space-4), env(safe-area-inset-left));
}
.topbar a { color: var(--primary-ink); text-decoration: none; }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.brand-mark {
    display: inline-grid; place-items: center; width: 2rem; height: 2rem;
    border-radius: var(--radius-sm); background: rgba(255, 255, 255, .15);
}
.brand-mark .icone { width: 1.2rem; height: 1.2rem; }

.nav-principale { display: flex; gap: var(--space-1); flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav-principale::-webkit-scrollbar { display: none; }
.nav-principale a, .nav-deconnexion, .nav-recherche {
    display: inline-flex; align-items: center; gap: var(--space-2);
    min-height: 2.5rem; padding: 0 var(--space-3); border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, .85); font-weight: 500; white-space: nowrap;
}
.topbar .nav-principale a, .topbar .nav-deconnexion, .topbar .nav-recherche { color: rgba(255, 255, 255, .85); }
.topbar .nav-recherche { background: rgba(255, 255, 255, .12); min-width: 11rem; }
.topbar .nav-recherche[aria-current="page"] { background: rgba(255, 255, 255, .22); color: #fff; }
.nav-recherche .icone { width: 1.15rem; height: 1.15rem; }
.nav-principale a:hover, .nav-deconnexion:hover, .nav-recherche:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.topbar .nav-principale a[aria-current="page"] { background: rgba(255, 255, 255, .18); color: #fff; font-weight: 600; }
.nav-deconnexion .icone { width: 1.15rem; height: 1.15rem; }
.topbar :focus-visible { outline-color: rgba(255, 255, 255, .7); }

.icone { width: 1.4rem; height: 1.4rem; flex-shrink: 0; }

/* Onglets d'une rubrique (Finances, Locataires) */
.sous-nav {
    display: flex; gap: var(--space-1); margin: calc(-1 * var(--space-2)) 0 var(--space-5);
    border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none;
}
.sous-nav::-webkit-scrollbar { display: none; }
.sous-nav a {
    display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--space-3);
    color: var(--muted); font-weight: 500; text-decoration: none; white-space: nowrap;
    border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.sous-nav a:hover { color: var(--ink); border-bottom-color: var(--border-strong); }
.sous-nav a[aria-current="page"] { color: var(--primary); font-weight: 650; border-bottom-color: var(--primary); }

/* Barre d'onglets du bas : masquée sur grand écran. */
.tabbar { display: none; }

/* 4. Mise en page ---------------------------------------------------------- */
.container {
    max-width: 1120px; margin: 0 auto;
    padding: var(--space-5) max(var(--space-4), env(safe-area-inset-right)) var(--space-6) max(var(--space-4), env(safe-area-inset-left));
}
.sans-navigation .container { max-width: 960px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-4); margin-bottom: var(--space-4); }
.page-head h1 { margin: 0; }
.page-head h2 { margin: 0; }
.page-head:has(> h2) { margin-top: var(--space-6); }
h2 + .page-head, .page-head + .page-head { margin-top: 0; }
.page-head .actions { flex-wrap: wrap; justify-content: flex-end; }

.breadcrumb { margin: 0 0 var(--space-2); font-size: .9rem; color: var(--muted); }
.breadcrumb a { text-decoration: none; font-weight: 500; }
.breadcrumb a:hover { text-decoration: underline; }

.card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: var(--space-5); margin-bottom: var(--space-4);
}
.card > :last-child { margin-bottom: 0; }
.card.narrow { max-width: 420px; margin: var(--space-6) auto; }
a.card { display: block; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
a.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-lg); color: inherit; }

/* 5. Composants ------------------------------------------------------------ */

/* Boutons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
    min-height: var(--tap); padding: .5rem 1rem;
    font: inherit; font-size: .95rem; font-weight: 600; line-height: 1.2; text-align: center;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--card); color: var(--ink); text-decoration: none; cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--hover); border-color: var(--muted); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-ink); }
.btn-danger { color: var(--danger); border-color: #e4b4b0; }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger-hover); }
.btn-small { min-height: 2.25rem; padding: .35rem .75rem; font-size: .875rem; }

.actions { display: flex; gap: var(--space-2); align-items: center; }
.actions form { margin: 0; }

/* Formulaires (thème Symfony par défaut : une div par champ) */
form > div > div, form .choix-multiples + div { margin-bottom: var(--space-4); }
label { display: block; margin: 0 0 var(--space-1); font-weight: 600; font-size: .95rem; }
label.required:not(:has(input))::after { content: " *"; color: var(--danger); font-weight: 600; }
form div:has(> input[type="checkbox"]) > label.required::after,
.choix-multiples label.required::after { content: none; }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) + label, select + label, textarea + label { margin-top: var(--space-4); }
label.checkbox { font-weight: 400; display: flex; gap: var(--space-2); align-items: center; margin: var(--space-3) 0; }

input[type=text], input[type=number], input[type=email], input[type=tel], input[type=date],
input[type=password], input[type=file], input[type=search], input[type=url], select, textarea {
    display: block; width: 100%; min-height: var(--tap);
    padding: .6rem .75rem; font: inherit; font-size: 1rem; color: var(--ink);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 6rem; resize: vertical; }
input[type=file] { padding: .45rem .5rem; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
input[readonly] { background: var(--hover); }
input[type=checkbox], input[type=radio] { width: 1.15rem; height: 1.15rem; margin: 0; vertical-align: middle; }
select { appearance: auto; }

/* Groupes de cases (checkbox / radio) rendus par Symfony */
form > div > div > div:has(> input[type="checkbox"]),
form > div > div > div:has(> input[type="radio"]) { display: flex; align-items: center; gap: var(--space-2); }
form div:has(> input[type="checkbox"]) > label,
form div:has(> input[type="radio"]) > label { margin: 0; font-weight: 400; }
form > div > div:has(> input[type="checkbox"]) { display: flex; align-items: center; gap: var(--space-1) var(--space-3); flex-wrap: wrap; }
form > div > div:has(> input[type="checkbox"]) > input { order: -1; }
form > div > div:has(> input[type="checkbox"]) > label { flex: 1; }
form > div > div:has(> input[type="checkbox"]) > :is(.help-text, .form-text, ul) { flex-basis: 100%; margin-left: calc(1.15rem + var(--space-3)); }

/* Erreurs de saisie */
form ul { list-style: none; color: var(--danger); padding: 0; margin: var(--space-1) 0; font-size: .875rem; font-weight: 500; }
form ul li::before { content: "⚠ "; }
form div:has(> ul) > input, form div:has(> ul) > select, form div:has(> ul) > textarea { border-color: var(--danger); }
.help-text, .form-text { color: var(--muted); font-size: .85rem; margin-top: var(--space-1); }

form > .actions, form > .btn-primary, form > div + .btn-primary { margin-top: var(--space-5); }
form > .actions { flex-wrap: wrap; }

.inline-form label { margin-top: 0; }
.inline-form .actions { flex-wrap: wrap; }
.inline-form select, .inline-form input { flex: 1 1 14rem; width: auto; }
.inline-form .btn-primary { margin-top: 0; }

/* Encart dans un formulaire (ex. nouveau locataire) et grille à deux colonnes */
.encart { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4) 0; margin: 0 0 var(--space-4); background: #fafbfc; }
.encart legend { font-weight: 650; padding: 0 var(--space-2); }
.encart > .help-text { margin: 0 0 var(--space-3); }
.grille-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 var(--space-4); }
.grille-2 > div { margin-bottom: var(--space-4); }

/* Listes */
.list {
    list-style: none; padding: 0; margin: 0 0 var(--space-4);
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    overflow: hidden;
}
.list li {
    display: flex; justify-content: space-between; align-items: center; gap: var(--space-4);
    padding: var(--space-3) var(--space-4); min-height: 3.5rem;
    border-bottom: 1px solid var(--border);
}
.list li:last-child { border-bottom: 0; }
.list li:hover { background: #fafbfc; }
.list li > div:first-child > a:first-child, .list li > div:first-child > strong > a { font-weight: 600; text-decoration: none; }
.list li > div:first-child > a:first-child:hover { text-decoration: underline; }
.list li > .muted, .list li > span { text-align: right; }
.list .actions { flex-shrink: 0; }
.list .actions form { margin: 0; }
.list .actions .btn-primary { margin-top: 0; }
.list-compacte { box-shadow: none; }
.list-compacte li { padding: var(--space-2) var(--space-3); min-height: 0; }

/* Fiches (listes de définitions) */
.fiche { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-5); margin: 0; }
.fiche dt { color: var(--muted); }
.fiche dd { margin: 0; }

/* Tableaux */
.table-defile { overflow-x: auto; margin-bottom: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--card); }
.table { width: 100%; border-collapse: collapse; background: var(--card); margin-bottom: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius); }
.table-defile .table { margin: 0; border: 0; }
.table th, .table td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #f8f9fb; }
.table tbody tr:hover { background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot th { border-top: 2px solid var(--border); border-bottom: 0; background: #f8f9fb; }
.table .num { text-align: right; }
.table a { font-weight: 600; text-decoration: none; }
.table a:hover { text-decoration: underline; }
.table a.badge { font-weight: 600; }
.table td:first-child > a:first-child, .table td:nth-child(2) > a { white-space: nowrap; }

/* Tuiles de chiffres */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.stat {
    display: flex; flex-direction: column; gap: var(--space-1);
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: var(--space-4); min-width: 0;
}
.stat-value { display: block; font-size: 1.6rem; font-weight: 700; line-height: 1.15; white-space: nowrap; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.stat-label { color: var(--muted); font-size: .9rem; }
a.stat { text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
a.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
a.stat .stat-label { color: var(--primary); font-weight: 500; }
a.stat .stat-label::after { content: " ›"; }

/* Onglets (mois, années, filtres) */
.tabs {
    display: flex; gap: var(--space-1); margin: 0 0 var(--space-4); padding: var(--space-1);
    overflow-x: auto; scrollbar-width: none;
    background: #e9edf2; border-radius: 999px; width: fit-content; max-width: 100%;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
    display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0 var(--space-4);
    border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 500; font-size: .925rem; white-space: nowrap;
}
.tabs a:hover { background: rgba(255, 255, 255, .7); color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--card); color: var(--primary); font-weight: 650; box-shadow: var(--shadow); }

/* Badges d'état */
.badge {
    display: inline-flex; align-items: center; font-size: .75rem; font-weight: 600; line-height: 1.4;
    padding: .15rem .55rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary);
    text-decoration: none; white-space: nowrap; vertical-align: middle;
}
a.badge:hover { background: #d6e4f2; color: var(--primary-hover); }
.badge-ok { background: var(--success-soft); color: var(--success); }
.badge-warn { background: var(--warning-soft); color: var(--warning); }
.badge-ko { background: var(--danger-soft); color: var(--danger); }
.badge-off { background: #eceef1; color: var(--muted); }

/* Messages */
.flash {
    display: flex; gap: var(--space-3); align-items: flex-start; flex-wrap: wrap;
    padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); margin-bottom: var(--space-4);
    border: 1px solid transparent; border-left-width: 4px; font-weight: 500;
}
.flash a { color: inherit; font-weight: 600; }
.flash-success { background: var(--success-soft); color: var(--success); border-color: #b9dcc2; border-left-color: var(--success); }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: #f0c3be; border-left-color: var(--danger); }
.flash-warning { background: var(--warning-soft); color: var(--warning); border-color: #f0d79b; border-left-color: var(--warning-line); }
.flash-info { background: var(--info-soft); color: var(--info); border-color: #c4d6e8; border-left-color: var(--info); }

/* États vides */
.empty {
    margin: 0 0 var(--space-4); padding: var(--space-6) var(--space-5);
    text-align: center; color: var(--muted);
    background: var(--card); border: 1px dashed var(--border-strong); border-radius: var(--radius);
}

/* Zone des suppressions, en bas de fiche */
.zone-danger { margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.zone-danger form { margin: 0; }

/* 6. Écrans particuliers --------------------------------------------------- */

/* Accueil */
a.card.loyers-mois, .loyers-mois { display: flex; flex-direction: column; gap: var(--space-1); text-decoration: none; color: inherit; }
.loyers-mois strong { font-size: 1.15rem; }
.jauge { display: block; height: .5rem; margin: var(--space-2) 0 var(--space-1); background: #e6eaef; border-radius: 999px; overflow: hidden; }
.jauge > span { display: block; height: 100%; background: var(--success); border-radius: inherit; }
.a-faire { border-left: 4px solid var(--warning-line); }
section.a-faire { border-left: 1px solid var(--border); }
section.a-faire h2 { margin: 0 0 var(--space-3); }
.taches { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.tache a {
    display: flex; flex-direction: column; gap: 2px;
    padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm);
    border: 1px solid var(--border); border-left: 4px solid var(--primary);
    text-decoration: none; color: var(--ink); background: var(--card);
    transition: background-color .15s, border-color .15s;
}
.tache a:hover { background: var(--hover); color: var(--ink); }
.tache a::after { content: none; }
.tache-titre { font-weight: 650; }
.tache-detail { color: var(--muted); font-size: .875rem; }
.tache-ko a { border-left-color: var(--danger); }
.tache-ko .tache-titre { color: var(--danger); }
.tache-warn a { border-left-color: var(--warning-line); }
.tache-info a { border-left-color: var(--primary); }

/* Recherche */
.recherche { display: flex; gap: var(--space-2); margin-bottom: var(--space-5); }
.recherche input { flex: 1; }
.recherche .btn-primary { margin-top: 0; }
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Connexion */
.connexion-marque { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); margin: var(--space-6) 0 0; color: var(--primary); font-weight: 700; font-size: 1.25rem; }
.connexion-marque .brand-mark { width: 3rem; height: 3rem; background: var(--primary); color: #fff; border-radius: var(--radius); }
.connexion-marque .icone { width: 1.6rem; height: 1.6rem; }
.connexion-marque + .card.narrow { margin-top: var(--space-4); }
.card.narrow form .btn-primary { width: 100%; }

/* Loyers */
.table td.loyer-cellule { white-space: nowrap; vertical-align: middle; }
.loyer-cellule .encaisser { display: inline-flex; vertical-align: middle; margin-left: var(--space-2); }
.loyer-cellule .btn { margin-left: var(--space-2); vertical-align: middle; }
.loyer-cellule .encaisser .btn { margin-left: 0; }
.loyer-du-mois { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2) var(--space-4); flex-wrap: wrap; padding-top: var(--space-3); margin-top: var(--space-3); border-top: 1px solid var(--border); }
.encaisser { display: flex; gap: var(--space-2); align-items: center; margin: 0; }
.encaisser select { width: auto; min-height: 2.25rem; padding: .3rem .5rem; font-size: .875rem; }

/* Impayés et relances */
.impaye .page-head { align-items: flex-start; flex-wrap: nowrap; margin-bottom: var(--space-3); }
.impaye .page-head .num { font-size: 1.15rem; }
.list-compacte { margin-bottom: var(--space-3); }
.relance-pied { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.relance-pied form { margin: 0; }
.relance-pied .btn-primary { margin-top: 0; }

/* Charges et régularisation */
.regul .page-head { align-items: flex-start; flex-wrap: nowrap; margin-bottom: var(--space-3); }
.regul .fiche { grid-template-columns: 1fr max-content; margin-bottom: var(--space-3); }
.regul-form { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); margin: 0; }
.regul-form .btn-primary { margin-top: 0; }
.case { display: flex; gap: var(--space-2); align-items: flex-start; font-weight: normal; margin: 0; }
.case input { width: auto; margin-top: .2rem; }
.import-recurrentes { display: flex; gap: var(--space-2) var(--space-3); align-items: center; flex-wrap: wrap; margin: 0 0 var(--space-4); }
.import-recurrentes .btn { margin-top: 0; }

/* Accès des propriétaires */
.lien-invitation { width: 100%; margin-top: var(--space-2); font-size: .85rem; }
.choix-multiples { display: grid; grid-template-columns: auto 1fr; gap: var(--space-2) var(--space-3); align-items: center; margin: var(--space-1) 0; }
.choix-multiples label { margin: 0; font-weight: 400; }
.choix-multiples input[type="checkbox"] { width: 1.15rem; height: 1.15rem; margin: 0; }

/* 7. Petits écrans --------------------------------------------------------- */

/* Tablette et téléphone : navigation par onglets en bas d'écran. */
@media (max-width: 899px) {
    .nav-principale, .nav-deconnexion { display: none; }
    .topbar-inner { justify-content: space-between; }
    .topbar .nav-recherche { min-width: 0; padding: 0 var(--space-3); }
    .nav-recherche span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .nav-recherche .icone { width: 1.35rem; height: 1.35rem; }
    .topbar-inner { min-height: 3.25rem; }

    .avec-navigation { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }

    .tabbar {
        display: grid; grid-template-columns: repeat(5, 1fr);
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
        min-height: var(--tabbar-h);
        padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
        background: rgba(255, 255, 255, .97); border-top: 1px solid var(--border);
        box-shadow: 0 -2px 10px rgba(16, 24, 40, .06);
        backdrop-filter: saturate(180%) blur(8px);
    }
    .tabbar > a {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
        min-height: var(--tabbar-h); padding: var(--space-1) 0;
        color: var(--muted); font-size: .72rem; font-weight: 500; text-decoration: none;
        cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent;
    }
    .tabbar > a[aria-current="page"] { color: var(--primary); font-weight: 700; }
    .tabbar > a[aria-current="page"] .icone { stroke-width: 2.2; }
    .tabbar .icone { width: 1.5rem; height: 1.5rem; }


    .topbar .brand[aria-current="page"] { color: #fff; }
}

@media (max-width: 600px) {
    h1 { font-size: 1.4rem; }
    .container { padding-top: var(--space-4); }
    .card { padding: var(--space-4); }
    .hide-mobile { display: none; }

    .page-head { flex-wrap: wrap; }
    .page-head > .btn, .page-head > .actions { flex-shrink: 0; }

    .list li { flex-direction: column; align-items: stretch; gap: var(--space-1); }
    .list li > .muted, .list li > span { text-align: left; }
    .list li .actions { justify-content: flex-start; flex-wrap: wrap; margin-top: var(--space-1); }
    .list li .actions .num { margin-right: auto; font-weight: 600; }
    .list-compacte li { flex-direction: row; align-items: center; }

    .table th, .table td { padding: var(--space-2) var(--space-3); }

    .fiche { grid-template-columns: 1fr; gap: 0; }
    .fiche dt { font-size: .85rem; }
    .fiche dd { margin-bottom: var(--space-3); }
    .regul .fiche { grid-template-columns: 1fr max-content; gap: var(--space-1) var(--space-3); }
    .regul .fiche dd { margin-bottom: 0; }

    .stats { gap: var(--space-2); }
    .stat { padding: var(--space-3) var(--space-2) var(--space-3) var(--space-3); }
    .stat-value { font-size: clamp(.9rem, 4vw, 1.15rem); overflow: visible; }
    .stat-label { font-size: .8rem; }

    .tabs { width: auto; }
    .encaisser { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

@media print {
    .topbar, .tabbar, .lien-evitement, .zone-danger, .btn { display: none !important; }
    .avec-navigation { padding: 0; }
    body, :root { background: #fff; }
    .card, .list, .stat, .table-defile { box-shadow: none; }
}
.autres-biens { margin-top: 1.25rem; }
.autres-biens > summary { cursor: pointer; font-weight: 600; padding: .6rem 0; color: var(--primary); }
