/* ==========================================================================
   Patrymo — design inspiré d'Apple : surfaces claires, verre dépoli, arrondis
   généreux, typographie serrée. Couleurs tirées du logo (verts profonds).
   Thème : clair / sombre automatiques, ou forcés via <html data-theme="light|dark">.
   ========================================================================== */

:root {
  /* Palette de la marque (logo) */
  --brand-900: #0a2a22;
  --brand-800: #0e3a30;
  --brand-700: #135c4a;
  --brand-600: #177059;
  --brand-500: #1f8a6e;
  --brand-400: #34a887;
  --brand-gradient: linear-gradient(135deg, #0a2a22 0%, #135c4a 55%, #1a6857 100%);

  /* Thème clair */
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f2f2f4;
  --field: #f2f2f4;
  --field-focus: #ffffff;
  --border: rgba(0, 0, 0, .08);
  --border-strong: rgba(0, 0, 0, .14);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --faint: #a1a1a6;
  --primary: var(--brand-700);
  --primary-hover: var(--brand-800);
  --primary-text: #ffffff;
  --primary-soft: rgba(19, 92, 74, .09);
  --link: var(--brand-600);
  --ring: rgba(31, 138, 110, .28);
  --good: #1b8a55;
  --good-soft: rgba(27, 138, 85, .1);
  --warn: #a15c00;
  --warn-soft: rgba(255, 159, 10, .14);
  --bad: #d70015;
  --bad-soft: rgba(255, 59, 48, .1);
  --info: #0066cc;
  --info-soft: rgba(0, 113, 227, .09);
  --glass: rgba(255, 255, 255, .72);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 24px rgba(0, 0, 0, .04);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .12);
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 24px;
  --topbar-h: 60px;
  color-scheme: light;
}

/* Thème sombre : uniquement sur choix de l'utilisateur (le thème clair est celui par défaut). */
:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --field: #2c2c2e;
  --field-focus: #3a3a3c;
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #f5f5f7;
  --muted: #98989d;
  --faint: #636366;
  --primary: #2fa37f;
  --primary-hover: #3bb892;
  --primary-text: #ffffff;
  --primary-soft: rgba(52, 199, 150, .14);
  --link: #4cc9a0;
  --ring: rgba(76, 201, 160, .35);
  --good: #30d158;
  --good-soft: rgba(48, 209, 88, .15);
  --warn: #ffb340;
  --warn-soft: rgba(255, 159, 10, .16);
  --bad: #ff6961;
  --bad-soft: rgba(255, 69, 58, .16);
  --info: #64aaff;
  --info-soft: rgba(10, 132, 255, .18);
  --glass: rgba(28, 28, 30, .72);
  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---- Base ---------------------------------------------------------------- */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -.011em;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", Inter, "Segoe UI", Roboto, sans-serif; }
h1 { font-size: 32px; line-height: 1.12; font-weight: 700; margin: 0 0 6px; letter-spacing: -.028em; }
h2 { font-size: 19px; line-height: 1.25; font-weight: 600; margin: 0 0 14px; letter-spacing: -.02em; }
h3 { font-size: 15px; font-weight: 600; margin: 18px 0 8px; letter-spacing: -.01em; }
p { margin: 0 0 10px; }
::selection { background: var(--ring); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- Barre du haut (verre dépoli) --------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 20px;
  height: var(--topbar-h); padding: 0 max(24px, calc((100vw - 1200px) / 2));
  border-bottom: 1px solid var(--border);
  isolation: isolate;
}
/* Flou sur une couche à part : un backdrop-filter sur la barre elle-même « capturerait »
   la barre d'onglets fixée en bas de l'écran sur mobile. */
.topbar::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.logo { display: block; width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 2px 8px rgba(10, 42, 34, .25); }
.nav { display: flex; gap: 2px; flex: 1; min-width: 0; }
.nav a {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px;
  color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.nav svg { width: 17px; height: 17px; fill: currentColor; flex: none; }
.me { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.me-name { color: var(--muted); font-size: 13px; font-weight: 500; }
.me form { margin: 0; }
.me .btn-link { font-size: 14px; font-weight: 500; }

/* Bouton de thème (auto / clair / sombre) */
.theme-toggle {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle svg { width: 18px; height: 18px; fill: currentColor; }
/* Clair : on propose la lune (passer en sombre) ; sombre : le soleil (revenir en clair). */
.theme-toggle [data-icon] { display: none; }
:root:not([data-theme="dark"]) .theme-toggle [data-icon="dark"],
:root[data-theme="dark"] .theme-toggle [data-icon="light"] { display: block; }

.container { max-width: 1200px; margin: 0 auto; padding: 36px 24px 72px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head p.muted { font-size: 15px; margin: 0; }

/* ---- Cartes & grilles ------------------------------------------------------ */

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow); min-width: 0;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.grid-2.grid-wide-left { grid-template-columns: 3fr 2fr; align-items: start; }
.grid-2.grid-wide-right { grid-template-columns: 2fr 3fr; align-items: start; }
.grid-2:not(.grid-wide-left):not(.grid-wide-right) { grid-template-columns: 3fr 2fr; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 20px; }
.stack { display: grid; gap: 20px; align-content: start; }
.stack > .card { margin: 0; }
.empty { text-align: left; }
.empty h2 { font-size: 22px; }
.steps { padding-left: 20px; }
.steps li { margin: 8px 0; }
.steps li.done { color: var(--muted); text-decoration: line-through; }

/* ---- Indicateurs (dashboard) ---------------------------------------------- */

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow);
}
.kpi:first-child { background: var(--brand-gradient); border-color: transparent; color: #fff; }
.kpi:first-child .kpi-label, .kpi:first-child .kpi-sub { color: rgba(255, 255, 255, .72); }
.kpi strong { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.03em; line-height: 1.15; }
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi-sub { color: var(--muted); font-size: 13px; }
.kpi-good strong { color: var(--good); }
.kpi-warn strong { color: var(--warn); }
.meter { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-500), var(--brand-400)); border-radius: 99px; }

/* ---- Graphique en barres -------------------------------------------------- */

.bars { display: flex; align-items: stretch; gap: 8px; height: 200px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bar {
  width: 100%; max-width: 30px; margin: 0 auto; min-height: 3px; border-radius: 7px;
  background: linear-gradient(180deg, var(--brand-400), var(--brand-600)); opacity: .35; transition: opacity .2s;
}
.bar-current { opacity: 1; }
.bar-col:hover .bar { opacity: .8; }
.bar-col span { font-size: 11px; color: var(--muted); font-weight: 500; }

/* ---- Tableaux & listes ----------------------------------------------------- */

.table-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.table th.num { text-align: right; }
.table td { padding: 14px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.row-muted td { opacity: .55; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.list-right { display: flex; align-items: center; gap: 10px; }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); white-space: nowrap; }
/* Une adresse e-mail longue passe à la ligne au lieu de déborder de la carte. */
.facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.person-mini, .list li > div, .card > p { min-width: 0; overflow-wrap: anywhere; }

/* ---- Pastilles --------------------------------------------------------------- */

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; letter-spacing: 0; }
a.badge:hover { text-decoration: none; filter: brightness(.96); }
.badge-paid { background: var(--good-soft); color: var(--good); }
.badge-partial, .badge-due { background: var(--warn-soft); color: var(--warn); }
.badge-late { background: var(--bad-soft); color: var(--bad); }
.badge-upcoming { background: var(--info-soft); color: var(--info); }
.badge-none { background: var(--surface-2); color: var(--muted); }
.tag { font-size: 12px; font-weight: 500; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 2px 9px; margin-left: 6px; }

/* ---- Boutons ---------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px; border-radius: 999px;
  /* Bouton secondaire « bordé » : fond blanc + contour + ombre légère, visible sur fond gris comme sur carte blanche. */
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background .15s, transform .08s, box-shadow .15s, border-color .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--text) 25%, transparent); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: var(--primary-text); border-color: transparent; }
.btn-primary:hover { background: var(--primary-hover); border-color: transparent; }
.btn-danger { background: var(--bad-soft); color: var(--bad); border-color: transparent; box-shadow: none; }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 20%, transparent); border-color: transparent; }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 6px 13px; font-size: 13px; }
.btn-block { width: 100%; padding: 12px 18px; font-size: 15px; }
.btn-google { width: 100%; padding: 12px 18px; background: var(--surface); color: var(--text); font-weight: 600; border: 1px solid var(--border-strong); }
.btn-google:hover { background: var(--surface-2); }
.btn-link { background: none; border: 0; padding: 0; color: var(--link); font: inherit; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.danger { color: var(--bad); }
.danger-zone { margin-top: 20px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; margin: 0; }

/* Contrôle segmenté (onglets) */
.tabs { display: inline-flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 10px; }
.tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 6px 14px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.tabs a.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* ---- Formulaires ------------------------------------------------------------ */

.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; color: var(--text); }
.form label > .muted { font-weight: 400; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
input, select, textarea {
  width: 100%; padding: 11px 14px; font: inherit; font-size: 15px; font-weight: 400; color: var(--text);
  background: var(--field); border: 1px solid transparent; border-radius: 12px;
  transition: background .15s, border-color .15s, box-shadow .15s; letter-spacing: -.01em;
}
input::placeholder { color: var(--faint); }
input:hover, select:hover { border-color: var(--border); }
input:focus, select:focus, textarea:focus { outline: none; background: var(--field-focus); border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
input:disabled { color: var(--muted); cursor: not-allowed; }
select {
  -webkit-appearance: none; appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 11px;
}
/* Cases à cocher et boutons radio redessinés (style iOS / macOS) */
input[type=checkbox], input[type=radio] {
  -webkit-appearance: none; appearance: none; flex: none; cursor: pointer;
  width: 20px; height: 20px; padding: 0; margin: 0;
  background: var(--surface); border: 1.5px solid var(--border-strong);
  display: inline-grid; place-content: center; transition: background .15s, border-color .15s, box-shadow .15s;
}
input[type=radio] { border-radius: 50%; }
input[type=checkbox] { border-radius: 6px; }
input[type=checkbox]:hover, input[type=radio]:hover { border-color: var(--primary); }
input[type=radio]:checked { border: 6px solid var(--primary); background: #fff; }
input[type=checkbox]:checked {
  background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1.5 5.2l3.2 3.1L10.5 1.7' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
  border-color: var(--primary);
}
input[type=checkbox]:focus, input[type=radio]:focus { outline: none; box-shadow: none; }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { box-shadow: 0 0 0 4px var(--ring); }

/* Liste déroulante personnalisée (le <select> natif est gardé mais masqué) */
.select { position: relative; min-width: 0; }
.select > select { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.select-btn {
  width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer;
  padding: 11px 38px 11px 14px; font: inherit; font-size: 15px; font-weight: 400; color: var(--text); letter-spacing: -.01em;
  background: var(--field); border: 1px solid transparent; border-radius: 12px; position: relative;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.select-btn > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-btn > span.placeholder { color: var(--faint); }
.select-btn::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 11px; height: 11px; margin-top: -5px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3-3 3 3M3 7.5l3 3 3-3' fill='none' stroke='%238e8e93' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.select-btn:hover { border-color: var(--border); }
.select-btn:focus-visible, .select.open .select-btn { outline: none; background: var(--field-focus); border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.select-menu {
  position: absolute; z-index: 45; left: 0; right: 0; top: calc(100% + 6px); min-width: 180px;
  margin: 0; padding: 5px; list-style: none; max-height: 300px; overflow-y: auto;
  background: var(--glass); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  animation: menu-in .14s ease-out;
}
.select.up .select-menu { top: auto; bottom: calc(100% + 6px); }
.select-menu li {
  position: relative; padding: 9px 12px 9px 32px; border-radius: 9px; cursor: pointer;
  font-size: 14px; font-weight: 400; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.select-menu li:hover, .select-menu li.active { background: var(--primary-soft); }
.select-menu li.selected { font-weight: 600; color: var(--primary); }
.select-menu li.selected::before {
  content: ""; position: absolute; left: 11px; top: 50%; width: 12px; height: 10px; margin-top: -5px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1.5 5.2l3.2 3.1L10.5 1.7' fill='none' stroke='%23177059' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
:root[data-theme="dark"] .select-menu li.selected::before { filter: brightness(1.8); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
/* Dans un champ avec unité (« 3 | Ans ») : bouton compact, sans fond propre */
.select-unit { flex: none; border-left: 1px solid var(--border); }
.select-unit .select-btn { background: transparent; border: 0; box-shadow: none !important; color: var(--muted); font-weight: 500; font-size: 14px; padding: 11px 32px 11px 14px; border-radius: 0 12px 12px 0; }
.select-unit .select-btn::after { right: 10px; }
.select-unit .select-menu { left: auto; right: 0; }
.select.input-medium { max-width: 340px; }
.form-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
.form-grid .span-2 { grid-column: 1 / -1; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; min-width: 0; }
legend { font-weight: 700; font-size: 17px; margin-bottom: 4px; padding: 0; letter-spacing: -.02em; }
.form label.check { display: flex; align-items: center; gap: 10px; font-weight: 400; font-size: 15px; cursor: pointer; }
.choice-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form label.choice {
  display: flex; gap: 12px; align-items: flex-start; padding: 16px; border: 1.5px solid var(--border);
  border-radius: 14px; cursor: pointer; font-weight: 400; transition: border-color .15s, background .15s;
}
.form label.choice:hover { border-color: var(--border-strong); }
.form label.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice input { margin-top: 2px; }
.choice span { display: grid; gap: 3px; font-size: 15px; }
.choice small { color: var(--muted); font-size: 13px; }
.field-error { color: var(--bad); font-size: 13px; font-weight: 500; }

/* Champ avec unité (m², €, €/mois) */
.input-unit { display: flex; align-items: stretch; background: var(--field); border-radius: 12px; border: 1px solid transparent; transition: box-shadow .15s, border-color .15s; }
.input-unit:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); background: var(--field-focus); }
.input-unit input, .input-unit select { background: transparent; border: 0; box-shadow: none !important; min-width: 0; }
.input-unit > span, .input-unit > select:last-child {
  display: grid; place-items: center; padding: 0 14px; color: var(--muted); font-weight: 500; font-size: 14px;
  white-space: nowrap; width: auto; border-left: 1px solid var(--border);
}
.input-unit > select:last-child { padding-right: 32px; background-position: right 10px center; }
.input-short { max-width: 220px; }
.input-medium { max-width: 340px; }
.form .row-3 { grid-template-columns: 2fr 1fr 1fr; }
.checks { display: flex; flex-wrap: wrap; gap: 10px; }
.checks .check {
  padding: 8px 14px; border-radius: 999px; background: var(--surface-2); border: 1.5px solid transparent;
  font-size: 14px !important; transition: background .15s, border-color .15s;
}
.checks .check:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.checks .check input { width: 16px; height: 16px; }
fieldset.radios { display: grid; gap: 8px; }
fieldset.radios legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; letter-spacing: -.01em; }
fieldset.radios legend .muted { font-weight: 400; }
details.more { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; background: var(--surface); }
details.more summary { cursor: pointer; font-weight: 600; font-size: 14px; list-style: none; display: flex; align-items: center; gap: 8px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "›"; font-size: 18px; line-height: 1; color: var(--muted); transition: transform .2s; }
details.more[open] summary::before { transform: rotate(90deg); }
details.more[open] summary { margin-bottom: 16px; }
details.more > label, details.more > .row { margin-bottom: 14px; }

/* ---- Assistant par étapes --------------------------------------------------- */

/* Pas d'overflow: hidden ici : les menus déroulants doivent pouvoir dépasser de la carte. */
.wizard { padding: 0; }
.wizard-layout { display: grid; grid-template-columns: 240px 1fr; }
.wizard-nav {
  padding: 24px 16px; background: var(--surface-2); border-right: 1px solid var(--border); align-self: stretch;
  border-radius: calc(var(--radius) - 1px) 0 0 calc(var(--radius) - 1px);
}
.wizard-nav > strong { display: block; margin: 0 10px 12px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; text-transform: uppercase; }
.wizard-nav ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.wizard-nav button {
  width: 100%; text-align: left; background: none; border: 0; padding: 9px 10px 9px 34px; border-radius: 10px;
  color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; position: relative; transition: background .15s, color .15s;
}
.wizard-nav button::before {
  content: ""; position: absolute; left: 10px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%;
  border: 1.5px solid var(--border-strong); background: var(--surface); box-sizing: border-box;
}
/* Étape entièrement remplie : coche verte ; remplie en partie : demi-cercle orange. */
.wizard-nav li.complete button::before {
  content: "✓"; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 700;
  background: var(--good); border-color: var(--good);
}
.wizard-nav li.partial button::before {
  border-color: var(--warn); background: linear-gradient(90deg, var(--warn) 50%, var(--surface) 50%);
}
.wizard-nav li.current button { color: var(--text); font-weight: 600; background: var(--surface); box-shadow: var(--shadow-sm); }
.wizard-nav li.current:not(.complete):not(.partial) button::before { border: 5px solid var(--primary); }
.wizard-nav button:hover { color: var(--text); }
.wizard-body { display: grid; gap: 18px; min-width: 0; padding: 32px; align-content: start; }
.step { display: grid; gap: 16px; }
.step h2 { font-size: 24px; font-weight: 700; letter-spacing: -.025em; margin: 0 0 4px; }
.step h3 { margin: 10px 0 0; font-size: 15px; }
.wizard:not(.wizard-on) .step + .step { margin-top: 28px; }
.wizard:not(.wizard-on) { padding: 28px; }
.wizard-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding-top: 22px; margin-top: 6px; border-top: 1px solid var(--border); }
.wizard-actions .spacer { flex: 1; }
.wizard-actions .btn { padding: 11px 20px; }
.wizard:not(.wizard-on) [data-wizard-prev], .wizard:not(.wizard-on) [data-wizard-next] { display: none; }

.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.form label.choice-card {
  display: grid; justify-items: center; gap: 8px; padding: 30px 18px; text-align: center; cursor: pointer;
  border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); font-weight: 400;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.form label.choice-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.form label.choice-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
/* Carte sélectionnable : pas de bouton radio visible, une coche apparaît dans le coin. */
.form label.choice-card { position: relative; }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.form label.choice-card::after {
  content: ""; position: absolute; top: 14px; right: 14px; width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid var(--border-strong); transition: background .15s, border-color .15s;
}
.form label.choice-card:has(input:checked)::after {
  border-color: var(--primary);
  background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1.5 5.2l3.2 3.1L10.5 1.7' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.form label.choice-card:has(input:focus-visible) { box-shadow: 0 0 0 4px var(--ring); }
.choice-card-icon { font-size: 44px; line-height: 1; }
.choice-card strong { font-size: 17px; color: var(--text); letter-spacing: -.02em; }
.choice-card small { color: var(--muted); font-size: 13px; }

/* ---- Blocs d'information ---------------------------------------------------- */

.subform { display: grid; gap: 14px; padding: 18px; background: var(--surface-2); border-radius: 14px; }
/* Dans un encadré gris, les champs passent en blanc pour rester visibles. */
.subform input, .subform textarea, .subform .select-btn, .subform .input-unit { background: var(--surface); }
.note { border-radius: 14px; padding: 16px 18px; background: var(--surface-2); }
.diag-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.diag-list li { display: grid; gap: 2px; padding-left: 26px; position: relative; font-size: 14px; }
.diag-list li::before {
  content: ""; position: absolute; left: 2px; top: 3px; width: 14px; height: 16px; border-radius: 3px;
  background: var(--primary-soft); box-shadow: inset 0 0 0 1.5px var(--primary);
}
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; }
.doc-list li { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.doc-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.doc-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--primary-soft); display: grid; place-items: center; font-size: 20px; flex: none; }
.doc-main { display: grid; gap: 2px; flex: 1; min-width: 220px; }
.doc-deposit-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.doc-deposit-form .date { width: 160px; }
.doc-deposit-form .select { width: 130px; }
.diag-form .diag-list li { grid-template-columns: minmax(0, 1fr) 170px; align-items: center; gap: 12px; padding-left: 26px; }
.diag-form .diag-list li > div { display: grid; gap: 2px; min-width: 0; }
.diag-state { font-weight: 600; }
.autosave-status { font-weight: 600; margin-left: 4px; }
.autosave-status.ok { color: var(--good); }
.autosave-status.error { color: var(--bad); }
.wizard-nav button:focus { outline: none; }
.wizard-nav button:focus-visible { box-shadow: 0 0 0 3px var(--ring); }
.diag-ok .diag-state { color: var(--good); }
.diag-expired .diag-state { color: var(--bad); }
.diag-todo .diag-state { color: var(--warn); }
.diag-ok::before { background: var(--good-soft) !important; box-shadow: inset 0 0 0 1.5px var(--good) !important; }
.checks-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checks-list li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; font-size: 14px; overflow-wrap: anywhere; align-items: start; }
.checks-list li > span:first-child {
  display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 11px; font-weight: 700;
}
.checks-list .lvl-ok { color: var(--good); background: var(--good-soft); }
.checks-list .lvl-error { color: var(--bad); background: var(--bad-soft); }
.checks-list .lvl-warn { color: var(--warn); background: var(--warn-soft); }
.checks-list .lvl-info { color: var(--info); background: var(--info-soft); }
.revision-card { background: linear-gradient(135deg, var(--primary-soft), transparent 70%), var(--surface); }

.person { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: grid; gap: 14px; background: var(--surface); }
.person h3 { margin: 0; font-size: 16px; }
.person-head { display: flex; justify-content: space-between; align-items: center; }
.person-guarantor { background: var(--surface-2); border-style: dashed; }
.person-fields { display: grid; gap: 14px; }
/* Dans un bloc gris (garant), champs et choix sur fond blanc pour rester visibles. */
.person-guarantor input, .person-guarantor .choice { background: var(--surface); }
[data-repeater] { display: grid; gap: 14px; }
/* Locataires ajoutés numérotés à partir de 2 (le n°1 est le locataire principal). */
[data-repeater="cotenants"] { counter-reset: tenant 1; }
[data-repeater="cotenants"] > [data-repeat-row] { counter-increment: tenant; }
.tenant-num::after { content: counter(tenant); }
textarea { resize: vertical; min-height: 76px; line-height: 1.45; }
[data-repeater]:empty, [data-repeater]:not(:has([data-repeat-row])) { display: none; }
.person-mini { padding: 12px 0 0; margin-top: 12px; border-top: 1px solid var(--border); font-size: 14px; }

/* ---- État des lieux ------------------------------------------------------------ */

.edl-rooms { gap: 10px; }
.edl-room { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.edl-room > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 16px 18px;
  font-weight: 600; font-size: 16px; letter-spacing: -.015em;
}
.edl-room > summary::-webkit-details-marker { display: none; }
.edl-room > summary::before { content: "›"; font-size: 20px; line-height: 1; color: var(--muted); transition: transform .2s; }
.edl-room[open] > summary::before { transform: rotate(90deg); }
.edl-room[open] > summary { border-bottom: 1px solid var(--border); }
.edl-room-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edl-room-progress { font-size: 12px; font-weight: 600; color: var(--warn); background: var(--warn-soft); border-radius: 999px; padding: 3px 10px; font-variant-numeric: tabular-nums; }
.edl-room-progress:empty { display: none; }
.edl-room-progress.done { color: var(--good); background: var(--good-soft); }
.edl-room-body { display: grid; gap: 14px; padding: 16px 18px 18px; }
.edl-room-foot { display: flex; justify-content: flex-end; }
.edl-items { gap: 0; }
.edl-item {
  display: grid; grid-template-columns: minmax(140px, 1fr) auto minmax(160px, 1.4fr) 28px; gap: 8px 10px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.edl-items > .edl-item:first-child { padding-top: 0; }
.edl-furniture { grid-template-columns: minmax(140px, 1fr) 58px auto minmax(140px, 1.2fr) 28px; }
.edl-item input:not([type=radio]), .edl-key input { padding: 9px 12px; font-size: 14px; }
.edl-item-label { font-weight: 600; }
.edl-entry { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); margin-top: -2px; }
.edl-entry strong { color: var(--text); font-weight: 600; }
.edl-remove {
  width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--faint);
  font-size: 20px; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.edl-remove:hover { background: var(--bad-soft); color: var(--bad); }
/* Pastilles d'état : contrôle segmenté coloré */
.state-pills { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.form .state-pills label.state-pill { display: block; position: relative; cursor: pointer; font-weight: 500; }
.state-pill input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.state-pill span { display: block; padding: 6px 10px; border-radius: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; transition: background .12s, color .12s; }
.state-pill:hover span { color: var(--text); }
.state-pill input:focus-visible + span { box-shadow: 0 0 0 3px var(--ring); }
.state-pill input:checked + span { color: #fff; font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.state-neuf input:checked + span { background: #1b8a55; }
.state-bon input:checked + span { background: #2fa37f; }
.state-usage input:checked + span { background: #c77700; }
.state-mauvais input:checked + span { background: #d70015; }
.state-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.state-legend span { display: inline-flex; align-items: center; gap: 6px; }
.state-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.state-neuf { background: #1b8a55; } .dot.state-bon { background: #2fa37f; } .dot.state-usage { background: #c77700; } .dot.state-mauvais { background: #d70015; }
.edl-keys { gap: 8px; }
.edl-key { display: grid; grid-template-columns: minmax(160px, 1.3fr) auto 70px minmax(120px, 1fr) 28px; gap: 10px; align-items: center; }
.edl-key-entry { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.edl-key-entry:empty { display: none; }
.edl-count { text-align: center; }
.edl-meter { gap: 10px; }
.edl-meter legend { font-size: 15px; }
.edl-photos { display: flex; flex-wrap: wrap; gap: 10px; }
.edl-thumb { position: relative; width: 92px; height: 92px; margin: 0; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.edl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.edl-thumb button {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.edl-thumb.loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 24px; height: 24px; border-radius: 50%;
  border: 3px solid var(--border-strong); border-top-color: var(--primary); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.form label.edl-photo-add {
  width: 92px; height: 92px; border: 1.5px dashed var(--border-strong); border-radius: 12px; display: grid; place-items: center;
  cursor: pointer; color: var(--primary); font-size: 13px; font-weight: 600; text-align: center;
}
.edl-photo-add:hover { background: var(--primary-soft); border-color: var(--primary); }
.edl-photo-add input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.sign-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sign-list li { display: grid; grid-template-columns: 20px 1fr; column-gap: 8px; font-size: 14px; font-weight: 600; }
.sign-list li::before { content: ""; grid-row: span 2; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.sign-list li.signed::before {
  box-shadow: none;
  background: var(--good) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1.5 5.2l3.2 3.1L10.5 1.7' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 9px no-repeat;
}
.sign-list small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.edl-degraded { margin: 0 0 8px; padding-left: 18px; }
@media (max-width: 760px) {
  .edl-item, .edl-furniture { grid-template-columns: minmax(0, 1fr) 28px; }
  .edl-item .state-pills { grid-column: 1 / -1; order: 2; justify-self: start; }
  .edl-item .edl-item-note { grid-column: 1 / -1; order: 3; }
  .edl-item .edl-entry { order: 4; }
  .edl-furniture { grid-template-columns: minmax(0, 1fr) 58px 28px; }
  .edl-furniture .edl-remove { order: 1; }
  .edl-key { grid-template-columns: minmax(0, 1fr) 64px 28px; }
  .edl-key > input[name$="[note]"] { grid-column: 1 / -1; order: 5; }
  .edl-key-entry { grid-column: 1 / -1; order: 6; }
  .edl-room-body { padding: 14px; }
}

/* ---- Calendrier ---------------------------------------------------------------- */

.date { position: relative; min-width: 0; }
.date > input[type=text] { padding-right: 46px; font-variant-numeric: tabular-nums; }
.date-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px;
  display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer;
}
.date-btn:hover, .date.open .date-btn { background: var(--primary-soft); color: var(--primary); }
.date-btn svg { width: 18px; height: 18px; fill: currentColor; }
.date-pop {
  position: absolute; z-index: 45; top: calc(100% + 6px); left: 0; width: 300px; padding: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
  animation: menu-in .14s ease-out; font-weight: 400;
}
.date.up .date-pop { top: auto; bottom: calc(100% + 6px); }
.date-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.date-title {
  border: 0; background: none; font: inherit; font-size: 15px; font-weight: 700; color: var(--text); cursor: pointer;
  padding: 6px 8px; border-radius: 8px; text-transform: capitalize; letter-spacing: -.01em;
}
.date-title::after { content: " ›"; color: var(--primary); display: inline-block; transform: rotate(90deg) translateX(1px); margin-left: 4px; }
.date-title:hover { background: var(--surface-2); }
.date-nav { display: flex; gap: 2px; }
.date-arrow {
  width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--primary);
  font-size: 22px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding-bottom: 3px;
}
.date-arrow:hover { background: var(--primary-soft); }
.date-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.date-dow { text-align: center; font-size: 11px; font-weight: 600; color: var(--faint); padding: 4px 0 6px; }
.date-day {
  aspect-ratio: 1; border: 0; border-radius: 50%; background: transparent; color: var(--text);
  font: inherit; font-size: 14px; font-variant-numeric: tabular-nums; cursor: pointer; transition: background .12s;
}
.date-day:hover { background: var(--surface-2); }
.date-day.out { color: var(--faint); }
.date-day.today { color: var(--primary); font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--primary); }
.date-day.selected, .date-cell.selected { background: var(--primary); color: #fff; font-weight: 600; box-shadow: none; }
.date-grid-12 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.date-cell {
  padding: 12px 0; border: 0; border-radius: 12px; background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 14px; cursor: pointer; font-variant-numeric: tabular-nums;
}
.date-cell:hover { background: var(--primary-soft); color: var(--primary); }
.date-cell.today { color: var(--primary); font-weight: 700; }
.date-foot { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 14px; }
.date.input-medium { max-width: 340px; }

/* ---- Signature ---------------------------------------------------------------- */

.signature-form { display: grid; gap: 12px; }
.signature-form .spacer { flex: 1; }
/* Toujours sur fond blanc (comme une feuille), y compris en mode sombre. */
.signature-pad { position: relative; background: #fff; border: 1.5px dashed var(--border-strong); border-radius: 14px; overflow: hidden; }
/* Curseur stylo sombre (pointe en bas à gauche), bien visible sur le fond blanc. */
.signature-pad canvas {
  display: block; width: 100%; aspect-ratio: 3 / 1; touch-action: none;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M3 21l1.2-4.6L16.6 4a2 2 0 0 1 2.8 0l.6.6a2 2 0 0 1 0 2.8L7.6 19.8z' fill='%23135c4a' stroke='white' stroke-width='1.2'/%3E%3C/svg%3E") 3 21, crosshair;
}
.signature-pad::after { content: ""; position: absolute; left: 8%; right: 8%; bottom: 22%; border-bottom: 1px solid #d2d2d7; pointer-events: none; }
.signature-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #a1a1a6; font-size: 14px; pointer-events: none; }

/* ---- Page d'une quittance ------------------------------------------------------ */

.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.doc-preview { padding: 0; overflow: hidden; }
.doc-preview iframe { display: block; width: 100%; aspect-ratio: 1 / 1.414; border: 0; background: #fff; }
.doc-side { display: grid; gap: 16px; position: sticky; top: calc(var(--topbar-h) + 20px); }
.doc-side .card { margin: 0; }
.doc-amount { font-size: 34px; font-weight: 700; letter-spacing: -.03em; color: var(--good); line-height: 1.1; }
.doc-actions { display: grid; gap: 8px; }
.doc-actions .btn { width: 100%; justify-content: center; padding: 11px 18px; }
.doc-actions form { margin: 0; }
.share-form { display: grid; gap: 8px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.timeline li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; font-size: 14px; overflow-wrap: anywhere; }
.timeline li::before {
  content: ""; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%;
  background: var(--good) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1.5 5.2l3.2 3.1L10.5 1.7' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 10px no-repeat;
}

/* ---- Cartes de biens ------------------------------------------------------- */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.cards > .card { margin: 0; display: grid; gap: 10px; align-content: start; transition: transform .2s, box-shadow .2s; }
.cards > .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.property-card h2 { margin: 0; font-size: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text); }
.dpe { color: #fff; }
.dpe-a { background: #009c6d; } .dpe-b { background: #52b153; } .dpe-c { background: #a5cc74; color: #1d1d1f; }
.dpe-d { background: #f4e70f; color: #1d1d1f; } .dpe-e { background: #f0b40f; color: #1d1d1f; }
.dpe-f { background: #eb8235; } .dpe-g { background: #d7221f; }

/* ---- Téléphone international (intl-tel-input) ------------------------------ */

.iti { display: block; width: 100%; }
.iti input[type=tel] { width: 100%; }
.iti__selected-country { border-radius: 12px 0 0 12px; }
.iti__selected-country-primary:hover { background: transparent; }
.iti__selected-dial-code { color: var(--text); }
.iti__dropdown-content {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.iti__search-input { background: var(--surface); color: var(--text); border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none !important; }
.iti__country { padding: 8px 12px; }
.iti__country.iti__highlight { background: var(--primary-soft); }
.iti__dial-code { color: var(--muted); }

/* ---- Listes de suggestions (adresse, code postal) --------------------------- */

.ac-wrap { position: relative; }
.ac-list {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 6px;
  list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); max-height: 300px; overflow-y: auto;
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.ac-list li { display: grid; gap: 1px; padding: 9px 12px; border-radius: 9px; cursor: pointer; font-weight: 400; }
.ac-list li strong { font-weight: 600; font-size: 14px; }
.ac-list li span { color: var(--muted); font-size: 12px; }
.ac-list li:hover, .ac-list li.active { background: var(--primary-soft); }
.ac-list li.ac-status, .ac-list li.ac-status:hover { color: var(--muted); font-size: 13px; cursor: default; background: none; }

/* ---- Messages ---------------------------------------------------------------- */

.flash { padding: 13px 16px; border-radius: 14px; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.flash-success { background: var(--good-soft); color: var(--good); }
.flash-error { background: var(--bad-soft); color: var(--bad); }
.flash-warn { background: var(--warn-soft); color: var(--warn); }
.flash a { color: inherit; font-weight: 600; text-decoration: underline; }

/* ---- Fenêtre modale ------------------------------------------------------------ */

dialog.modal {
  border: 0; border-radius: var(--radius-lg); padding: 26px; width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); text-align: left; white-space: normal; box-shadow: var(--shadow-lg);
}
dialog.modal[open] { animation: pop .18s ease-out; }
dialog.modal::backdrop { background: rgba(0, 0, 0, .35); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
dialog.modal h3 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.02em; }
/* Confirmation (remplace le confirm() natif) */
.confirm-modal { width: min(380px, calc(100vw - 32px)); text-align: center; padding: 28px 24px 22px; }
.confirm-icon {
  width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center;
  font-size: 24px; font-weight: 700; background: var(--primary-soft); color: var(--primary);
}
.confirm-modal.is-danger .confirm-icon { background: var(--bad-soft); color: var(--bad); }
.confirm-msg { font-size: 15px; line-height: 1.5; font-weight: 500; margin: 0 0 22px; color: var(--text); }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.confirm-actions .btn { width: 100%; padding: 11px 16px; }
.btn-destructive { background: var(--bad); color: #fff; border-color: transparent; }
.btn-destructive:hover { background: color-mix(in srgb, var(--bad) 85%, #000); border-color: transparent; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

.log { background: var(--surface-2); padding: 14px; border-radius: 12px; font: 12px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; white-space: pre-wrap; margin: 12px 0 0; }

/* ---- Pages de connexion ----------------------------------------------------------- */

.layout-auth {
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 50% -10%, color-mix(in srgb, var(--brand-500) 22%, transparent), transparent 70%),
    var(--bg);
}
.auth-wrap { max-width: 420px; margin: 0 auto; padding: 64px 16px; display: flex; flex-direction: column; align-items: center; position: relative; }
.auth-wrap > .flash { width: 100%; }
.auth-wrap > .theme-toggle { position: fixed; top: 16px; right: 16px; z-index: 5; }
.auth-logo {
  display: block; width: 132px; height: 132px; border-radius: 30px; margin-bottom: 32px;
  box-shadow: 0 18px 40px rgba(10, 42, 34, .35);
}
.auth-card { width: 100%; padding: 32px; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: 26px; text-align: center; }
.auth-card > .muted { margin-bottom: 24px; text-align: center; }
.auth-card .center { margin: 18px 0 0; }
.auth-wrap:has(.legal) { max-width: 780px; }
.legal { width: 100%; padding: 36px; }
.legal h2 { margin-top: 28px; }
.legal ul { padding-left: 20px; }
.legal li { margin: 6px 0; }
.legal-links { margin-top: 24px; }
.forgot-link { justify-self: end; margin-top: -8px; }
.sep { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 20px 0; }
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---- Adaptation aux écrans ----------------------------------------------------------- */

@media (max-width: 1180px) {
  .me-name { display: none; }
}
@media (max-width: 1080px) {
  .nav span { display: none; }
  .nav a { padding: 8px 11px; }
}
@media (max-width: 960px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-side { position: static; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-2.grid-wide-left, .grid-2.grid-wide-right, .grid-2:not(.grid-wide-left):not(.grid-wide-right), .grid-3 { grid-template-columns: 1fr; }
  .wizard-layout { grid-template-columns: 200px 1fr; }
  .wizard-body { padding: 24px; }
}

/* Mobile : barre d'onglets en bas de l'écran, comme sur iOS */
@media (max-width: 720px) {
  :root { --topbar-h: 54px; }
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar .brand { font-size: 0; gap: 0; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; flex: none;
    justify-content: space-around; gap: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--border);
  }
  .nav a { flex-direction: column; gap: 3px; padding: 4px 6px; border-radius: 10px; font-size: 10px; flex: 1; min-width: 0; }
  .nav a span { display: block; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .nav a.active { background: transparent; }
  .nav svg { width: 22px; height: 22px; }
  .layout-app { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .container { padding: 24px 16px 40px; }
  h1 { font-size: 26px; }
  .card { padding: 20px; border-radius: 16px; }
  .table-wrap { margin: 0 -20px; padding: 0 20px; }
  .kpi strong { font-size: 24px; }
  .form-grid, .choice-group, .form .row, .form .row-3 { grid-template-columns: 1fr; }
  .wizard-layout { grid-template-columns: 1fr; }
  .wizard-nav { padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--border); border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; }
  .wizard-nav > strong { display: none; }
  .wizard-nav ol { position: static; }
  .wizard-nav li:not(.current) { display: none; }
  .wizard-body { padding: 20px; }
  .wizard-actions .spacer { display: none; }
  .wizard-actions .btn { flex: 1; }
  .auth-logo { width: 104px; height: 104px; border-radius: 24px; }
  .auth-card { padding: 24px; }
}
