:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-muted: #f7f8fa;
  --fill: #f1f2f5;
  --fill-hover: #e9eaee;
  --border: #e4e6ea;
  --border-strong: #cfd3d9;
  --hairline: rgba(20, 24, 40, 0.09);
  --text: #17181c;
  --text-muted: #6b7079;
  --text-faint: #9aa0a9;
  --accent: #0071e3;
  --accent-hover: #0a63c4;
  --accent-soft: #e6f0fc;
  --accent-text: #0a5fbd;
  --danger: #c8102e;
  --danger-soft: #fde8ea;
  --warning: #9a6400;
  --warning-soft: #fff3d6;
  --success: #1e8e3e;
  --success-soft: #e4f4e8;
  --purple: #6b3fa0;
  --purple-soft: #f0e9fb;
  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(20, 24, 40, 0.05);
  --shadow-card: 0 1px 1px rgba(20, 24, 40, 0.03), 0 10px 30px -18px rgba(20, 24, 40, 0.16);
  --shadow-md: 0 8px 24px -12px rgba(20, 24, 40, 0.18), 0 2px 8px rgba(20, 24, 40, 0.06);
  --shadow-lg: 0 24px 56px rgba(20, 24, 40, 0.18);
  --accent-grad: linear-gradient(180deg, #1b82ee 0%, #0067d3 100%);
  --glass: color-mix(in srgb, var(--surface) 82%, transparent);
  --brand-grad: linear-gradient(145deg, #2c2f37 0%, #111216 100%);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%236b7079' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
  --display: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1013;
    --surface: #17181c;
    --surface-muted: #1c1d22;
    --fill: #1f2026;
    --fill-hover: #26272e;
    --border: #2a2c33;
    --border-strong: #3a3d46;
    --hairline: rgba(255, 255, 255, 0.08);
    --text: #f1f2f4;
    --text-muted: #a2a7b1;
    --text-faint: #6e737d;
    --accent: #3b8ff0;
    --accent-hover: #5aa0f5;
    --accent-soft: #14304f;
    --accent-text: #8cc0ff;
    --danger: #ff6b7a;
    --danger-soft: #401419;
    --warning: #e0a83a;
    --warning-soft: #3a2c0c;
    --success: #47c26b;
    --success-soft: #14301c;
    --purple: #b58ff0;
    --purple-soft: #2a1f3f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 1px 1px rgba(0, 0, 0, 0.3), 0 10px 30px -18px rgba(0, 0, 0, 0.7);
    --shadow-md: 0 8px 24px -12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.6);
    --accent-grad: linear-gradient(180deg, #4a98f2 0%, #2b7fe0 100%);
    --brand-grad: linear-gradient(145deg, #4a4e5a 0%, #23252c 100%);
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%23a2a7b1' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--body);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}
h1, h2, h3, .stat-valeur { font-family: var(--display); letter-spacing: -0.015em; text-wrap: balance; }
.stat-valeur, .dashboard-table td, .tranches-table td { font-variant-numeric: tabular-nums; }
html { scroll-behavior: smooth; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }
:is(button, a, input, select, textarea, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Menus déroulants natifs : flèche fine et uniforme au lieu du rendu du système */
select:not([multiple]) { appearance: none; -webkit-appearance: none; background-image: var(--chevron); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px !important; }
/* Entrée en fondu de chaque vue (tableau de bord, dossier, salaire…) */
@keyframes vue-entree { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* Pas de fill-mode : une animation de transform maintenue (même à « none ») ferait de la vue le bloc conteneur
   des éléments en position: fixed (menus « ⋯ » des tableaux), qui seraient alors décalés. */
.view:not(.hidden) { animation: vue-entree .32s cubic-bezier(.2, .8, .2, 1); }
@media (prefers-reduced-motion: reduce) { .view:not(.hidden) { animation: none; } html { scroll-behavior: auto; } }

/* ---------- Coque : barre latérale + contenu ---------- */
#app { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 16px; max-width: 1360px; margin: 0 auto; padding: 16px 16px 56px; }
.content { min-width: 0; }
.side {
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 14px 12px;
  position: sticky;
  top: 16px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: calc(100vh - 32px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 10px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; color: #fff; display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: -0.02em;
  background: var(--brand-grad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 2px 6px rgba(20, 24, 40, 0.25);
}
.brand b { font-family: var(--display); font-weight: 800; display: block; line-height: 1.15; letter-spacing: -0.02em; }
.brand small { color: var(--text-muted); font-size: 12px; }
/* Feuille « Plus » de la barre de navigation du téléphone (bouton masqué ailleurs). */
#btn-nav-plus { display: none; }
.nav-plus { position: fixed; inset: 0; z-index: 60; }
body.nav-plus-ouvert { overflow: hidden; }
.nav-plus-fond { position: absolute; inset: 0; background: rgba(0, 0, 0, .38); }
.nav-plus-panneau {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 82vh; overflow-y: auto;
  background: var(--surface); border-radius: 18px 18px 0 0; box-shadow: var(--shadow-md);
  padding: 8px 12px calc(16px + env(safe-area-inset-bottom, 0px));
  overscroll-behavior: contain;
  animation: nav-plus-entree .24s cubic-bezier(.2, .8, .2, 1);
}
@keyframes nav-plus-entree { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .nav-plus-panneau { animation: none; } }
.nav-plus-poignee { width: 38px; height: 4px; border-radius: 999px; background: var(--border-strong); margin: 4px auto 6px; }
.nav-plus-titre { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); padding: 12px 8px 2px; font-weight: 600; }
.nav-plus-item {
  display: flex; align-items: center; gap: 12px; width: 100%; font: inherit; font-size: 15px; text-align: left;
  background: none; border: 0; color: var(--text); padding: 12px 8px; border-radius: 10px; cursor: pointer;
}
.nav-plus-item:active { background: var(--fill); }
.nav-plus-item .ico { width: 20px; height: 20px; flex: none; color: var(--text-muted); }
.nav-plus-item[aria-current="page"] { color: var(--accent-text); font-weight: 600; }
.nav-plus-item[aria-current="page"] .ico { color: var(--accent); }

/* Connexion par clé d'accès et panneau « Mon compte ». */
.btn-cle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-cle svg { width: 20px; height: 20px; flex: none; }
.separateur { display: flex; align-items: center; gap: 10px; margin: 14px 0 2px; color: var(--text-faint); font-size: 12px; }
.separateur::before, .separateur::after { content: ""; height: 1px; background: var(--hairline); flex: 1; }
.me-bouton { background: none; border: 0; padding: 0; font: inherit; text-align: left; cursor: pointer; min-width: 0; border-radius: 8px; }
.me-bouton:hover .utilisateur-connu { color: var(--accent-text); }
.compte-titre { font-size: 14px; font-weight: 600; margin: 18px 0 4px; }
.cle-ligne { display: flex; align-items: center; gap: 12px; }
.cle-ligne .cle-infos { min-width: 0; flex: 1; }
.cle-ligne b { display: block; font-size: 13.5px; }
.cle-ligne small { display: block; color: var(--text-muted); font-size: 12px; }

.filtre-texte { border: 1px solid transparent; border-radius: var(--radius-sm); padding: 7px 10px; background: var(--fill); color: var(--text); font: inherit; font-size: 13px; min-width: 200px; }
.tag-nature { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--fill); color: var(--text-muted); white-space: nowrap; }
.tag-nature.creation { background: var(--success-soft); color: var(--success); }
.tag-nature.modification { background: var(--accent-soft); color: var(--accent-text); }
.tag-nature.collective { background: var(--danger-soft); color: var(--danger); }
.tag-nature.vente { background: var(--warning-soft); color: var(--warning); }
.tag-nature.occupant { background: var(--success-soft); color: var(--success); }
.tag-nature.promoteur { background: var(--accent-soft); color: var(--accent-text); }

.nav-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); padding: 6px 10px 4px; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border: none; border-radius: var(--radius-sm); background: transparent;
  color: var(--text); font: inherit; font-weight: 500; cursor: pointer;
  transition: background-color .15s ease, color .15s ease, transform .15s ease;
}
.nav-item .ico { width: 18px; height: 18px; flex: none; color: var(--text-muted); transition: color .15s ease, transform .2s cubic-bezier(.2, .8, .2, 1); }
.nav-item:hover { background: var(--fill); }
.nav-item:hover .ico { transform: scale(1.08); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-item[aria-current="page"] .ico { color: var(--accent-text); }
.nav-spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 12px; padding: 12px 6px 2px; border-top: 1px solid var(--border); }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-family: var(--display); font-size: 15px; flex: none; overflow: hidden; box-shadow: 0 0 0 2px var(--surface), 0 2px 8px rgba(20, 24, 40, 0.18); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-liste { width: 56px; height: 56px; margin-right: 12px; font-size: 17px; }
/* Portrait du collaborateur (page « Votre interlocuteur » des plaquettes) */
.portrait-field { flex-direction: row; align-items: center; gap: 12px; justify-content: flex-start; }
.portrait { width: 128px; height: 128px; border-radius: 20px; object-fit: cover; box-shadow: var(--shadow-md); }
.portrait-legende { font-size: 13px; color: var(--text-muted); line-height: 1.4; }
.me-infos { flex: 1; min-width: 0; line-height: 1.2; }
.me-infos b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-infos small { color: var(--text-muted); font-size: 12px; }
.btn-deconnexion { padding: 6px !important; border-radius: 8px !important; }
.btn-deconnexion .ico { width: 18px; height: 18px; color: var(--text-muted); }

/* ---------- En-tête de page + menu Nouveau ---------- */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 28px; font-weight: 800; margin: 0; letter-spacing: -0.03em; line-height: 1.1; }
.page-sub { color: var(--text-muted); font-size: 13.5px; margin-top: 4px; }
.page-grow { flex: 1; }
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary svg { transition: transform .2s ease; }
details.menu[open] > summary svg { transform: rotate(180deg); }
@keyframes menu-entree { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.drop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 260px; padding: 6px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  animation: menu-entree .18s cubic-bezier(.2, .8, .2, 1) both;
}
.drop button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: none; border-radius: 8px; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.drop button:hover { background: var(--accent); color: #fff; }
.drop button b { display: block; font-weight: 600; font-size: 13.5px; }
.drop button small { display: block; font-size: 12px; color: var(--text-muted); }
.drop button:hover small { color: rgba(255, 255, 255, 0.82); }
.drop-titre { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); font-weight: 600; padding: 8px 10px 4px; }
.drop-sep { height: 1px; background: var(--hairline); margin: 4px 0; }

.dossier-titre-input {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 4px 10px;
  margin: -4px 0 -4px -10px;
  background: transparent;
  color: var(--text);
  flex: 1;
  min-width: 0;
  transition: background-color .15s ease;
}
.dossier-titre-input:hover { background: var(--fill); }
.dossier-titre-input:focus { outline: none; background: var(--surface); box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15); }

/* ---------- Boutons ---------- */
.btn {
  border: none;
  border-radius: 980px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .18s ease, opacity .18s ease, transform .06s ease, box-shadow .18s ease;
  font-family: inherit;
  letter-spacing: -0.005em;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn-primary { background: var(--accent-grad); color: white; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 2px rgba(0, 90, 190, 0.25); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 4px 12px -4px rgba(0, 90, 190, 0.5); }
.btn-secondary { background: var(--fill); color: var(--text); box-shadow: inset 0 0 0 1px var(--hairline); }
.btn-secondary:hover:not(:disabled) { background: var(--fill-hover); }
.btn-ghost { background: transparent; color: var(--accent); padding-left: 10px; padding-right: 10px; }
.btn-ghost:hover:not(:disabled) { background: rgba(0, 113, 227, 0.08); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { opacity: .9; }
.btn-full { width: 100%; margin-top: 16px; text-align: center; display: block; text-decoration: none; box-sizing: border-box; }

/* Boutons "+ LOI / + Mandat" de l'en-tête de page : discrets, pas des pilules pleines */
.page-head .btn-ghost {
  background: var(--fill);
  border-radius: 980px;
  color: var(--text);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
}
.page-head .btn-ghost:hover { background: var(--fill-hover); }

.dropzone {
  border: none;
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  background: var(--fill);
  transition: background-color .18s ease, box-shadow .18s ease;
}
.dropzone:hover { background: var(--fill-hover); }
.dropzone.dragover { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent) inset; }
.dropzone-hint { font-size: 12px; margin-top: 6px; }
.btn-choisir-dossier { margin-top: 16px; font-size: 12.5px; padding: 8px 16px; }

.liste-fichiers { list-style: none; padding: 0; margin: 16px 0; }
.liste-fichiers li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 13px;
  background: var(--fill);
}
.liste-fichiers button {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 12px;
}

.form-champs { display: flex; flex-direction: column; gap: 6px; }
.form-champs label { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-top: 14px; letter-spacing: -0.005em; }
.form-champs input, .form-champs textarea, .form-champs select {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  background: var(--fill);
  color: var(--text);
  transition: background-color .15s ease, box-shadow .15s ease;
}
.form-champs input:hover, .form-champs textarea:hover, .form-champs select:hover { background: var(--fill-hover); }
.form-champs input:focus, .form-champs textarea:focus, .form-champs select:focus {
  outline: none;
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18), inset 0 0 0 1px var(--accent);
}
.form-champs textarea[readonly] { background: var(--surface-muted); color: var(--text-muted); }
.form-champs textarea[readonly]:hover { background: var(--surface-muted); }
.form-champs hr { border: none; border-top: 1px solid var(--hairline); margin: 22px 0 8px; }
.form-champs h2 { font-size: 17px; font-weight: 600; margin: 6px 0 0; letter-spacing: -0.015em; }

.conditions-liste {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.condition-item {
  display: grid;
  grid-template-columns: 17px 1fr;
  align-items: center;
  column-gap: 10px;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
}
.condition-item input[type="checkbox"] { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }

.annexe-item { margin-bottom: 10px; }
.annexe-item label {
  display: grid;
  grid-template-columns: 17px 1fr;
  align-items: center;
  column-gap: 10px;
  font-size: 13px;
  cursor: pointer;
}
.annexe-item input[type="checkbox"] { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.annexe-desc { margin: 2px 0 0 27px; font-size: 12px; color: var(--text-muted); }
.condition-fixe { color: var(--text-muted); cursor: default; }
.condition-fixe input[type="checkbox"] { accent-color: var(--text-muted); }

.montant-row { display: flex; gap: 8px; }
.devise-input { max-width: 90px; }
.honoraires-unite { display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--text-muted); background: var(--fill); white-space: nowrap; }

.honoraires-type-row { display: flex; gap: 20px; margin: 8px 0 10px; flex-wrap: wrap; }
.radio-inline { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 400; color: var(--text); cursor: pointer; }
.radio-inline input[type="radio"], .radio-inline input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }

.autocomplete-wrap { position: relative; }
.autocomplete-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-faint);
  display: grid; place-items: center;
  pointer-events: none;
}
.autocomplete-wrap .search-icon svg { width: 16px; height: 16px; display: block; }
.autocomplete-wrap input.has-search-icon { padding-left: 34px; }
.suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 260px;
  overflow-y: auto;
}
.suggestions li {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}
.suggestions li:hover, .suggestions li.active { background: var(--fill); }
.suggestions .suggestion-nom { font-weight: 600; }
.suggestions .suggestion-detail { color: var(--text-muted); font-size: 12px; }
.suggestions .suggestion-empty { color: var(--text-muted); cursor: default; }
.suggestions .suggestion-empty:hover { background: none; }

.alt-list {
  margin: 8px 0 0;
  padding: 6px;
  list-style: none;
  background: var(--fill);
  border-radius: var(--radius-sm);
}
.alt-list li {
  padding: 7px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
}
.alt-list li:hover { background: var(--fill); }
.alt-list .alt-nom { font-weight: 600; }
.alt-list .alt-qualite { color: var(--text-muted); }

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--fill);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.25s ease;
}
.progress-bar-fill.error { background: var(--danger); }

.status-text { font-size: 13px; color: var(--text-muted); min-height: 18px; margin: 8px 0 0; }
.status-text.error { color: var(--danger); }
.status-text.ok { color: var(--success); }

.hidden { display: none !important; }

/* ---------- Barre du haut : infos utilisateur / actions de compte ---------- */
.utilisateur-connu { font-size: 13px; color: var(--text); }

/* ---------- Écran de connexion ---------- */
.login-view {
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 26px;
  padding: 40px 20px; min-height: 100vh;
  background:
    radial-gradient(60% 50% at 12% 8%, color-mix(in srgb, var(--accent) 16%, transparent) 0%, transparent 70%),
    radial-gradient(50% 45% at 90% 90%, color-mix(in srgb, var(--purple) 14%, transparent) 0%, transparent 70%),
    var(--bg);
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.login-brand .brand-mark { width: 56px; height: 56px; border-radius: 16px; font-size: 24px; }
.login-brand h1 { margin: 6px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.login-brand p { margin: 0; color: var(--text-muted); font-size: 14px; }
.login-form {
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--hairline);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 32px 36px 30px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-form h2 { margin: 0 0 14px; font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.login-form label { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-top: 12px; }
.login-form input {
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--fill);
  transition: background-color .15s ease, box-shadow .15s ease;
}
.login-form input:hover { background: var(--fill-hover); }
.login-form input:focus { outline: none; background: var(--surface); box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18), inset 0 0 0 1px var(--accent); }
.login-form button { margin-top: 18px; }

/* ---------- Panneau admin (utilisateurs) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(6px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 70px;
  z-index: 50;
}
@keyframes modal-entree { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-overlay:not(.hidden) > .modal, .modal-overlay:not(.hidden) > .modal-carte { animation: modal-entree .24s cubic-bezier(.2, .8, .2, 1) both; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.015em; }
.modal-header .btn-ghost { color: var(--text-muted); font-size: 16px; padding: 4px 8px; background: transparent; }
.modal-header .btn-ghost:hover { background: var(--fill); }
.form-nouvel-utilisateur { display: flex; gap: 8px; margin: 20px 0; flex-wrap: wrap; }
.form-nouvel-utilisateur input[type="text"],
.form-nouvel-utilisateur input[type="email"] {
  flex: 1;
  min-width: 120px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--fill);
  font-family: inherit;
  font-size: 13.5px;
}
.form-nouvel-utilisateur select { padding: 10px 12px; border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--fill); font-family: inherit; font-size: 13.5px; }
.liste-utilisateurs { list-style: none; padding: 0; margin: 0; }
.liste-utilisateurs li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--hairline);
}
.liste-utilisateurs li:last-child { border-bottom: none; }
.liste-utilisateurs .utilisateur-info { display: flex; flex-direction: column; }
.liste-utilisateurs .utilisateur-role { font-size: 12px; color: var(--text-muted); }
.liste-utilisateurs .utilisateur-actions { display: flex; gap: 6px; }
.liste-utilisateurs button { font-size: 12px; padding: 6px 12px; }
.admin-sauvegardes { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--hairline); }
.admin-sauvegardes h3 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.admin-sauvegardes button { margin-top: 10px; font-size: 12.5px; padding: 7px 14px; }

/* Fenêtre de choix de parcelle sur vue aérienne */
.modal-carte {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  width: 100%;
  max-width: 820px;
  max-height: 88vh;
  overflow-y: auto;
}
.modal-carte-entete { display: flex; justify-content: space-between; align-items: center; }
.modal-carte-entete h3 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.modal-carte-entete .btn-ghost { color: var(--text-muted); font-size: 14px; padding: 4px 10px; background: transparent; }
.modal-carte-entete .btn-ghost:hover { background: var(--fill); }
.modal-carte-aide { margin: 8px 0 14px; font-size: 12.5px; color: var(--text-muted); }
.carte-cadre {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--fill);
  min-height: 200px;
}
.carte-cadre img { display: block; width: 100%; cursor: crosshair; }
.carte-chargement {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  font-size: 13px;
  color: var(--text-muted);
}
.modal-carte-barre { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.carte-zoom { display: flex; align-items: center; gap: 8px; }
.carte-zoom button { min-width: 34px; padding: 6px 10px; font-size: 15px; line-height: 1; }
.carte-zoom span { font-size: 12.5px; color: var(--text-muted); }
.carte-recap { flex: 1; min-width: 200px; }
.carte-recap .status-text { margin: 0; }
.carte-liste { margin: 4px 0 0; padding-left: 16px; font-size: 12px; color: var(--text-muted); }
.carte-liste li { margin: 2px 0; }

/* Veille société (annonces BODACC) et contrôle de cohérence avant génération */
.veille, .controles {
  margin: 10px 0 4px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.5;
}
.veille { background: var(--warning-soft); border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent); color: var(--warning); }
.controles { background: var(--fill); border: 1px solid var(--hairline); color: var(--text); }
.veille p, .controles p { margin: 0 0 6px; font-weight: 600; }
.veille ul, .controles ul { margin: 0; padding-left: 18px; }
.veille li, .controles li { margin: 3px 0; }
.veille a { color: inherit; }
.controles li.bloquant { color: var(--danger); font-weight: 500; }
.controles li.alerte { color: var(--warning); }

/* ---------- Parcours LOI : étapes, sections repliables, barre d'action ---------- */
.page-head-titre { flex: 1; min-width: 240px; }
.page-head .dossier-titre-input { margin: 0 0 2px -10px; width: calc(100% + 10px); font-size: 22px; font-weight: 800; font-family: var(--display); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.brouillon { background: var(--fill); color: var(--text-muted); }
.pill.envoye { background: var(--purple-soft); color: var(--purple); }
.pill.signe, .pill.ok { background: var(--success-soft); color: var(--success); }
.pill.perdu, .pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.warn { background: var(--warning-soft); color: var(--warning); }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.step {
  display: flex; align-items: center; gap: 10px; text-align: left; font: inherit; cursor: pointer;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 11px 13px; color: var(--text);
  box-shadow: var(--shadow-card);
  transition: transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s ease, border-color .18s ease;
}
.step:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.step .n { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 12px; color: var(--text-muted); flex: none; transition: background-color .25s ease, border-color .25s ease, color .25s ease; }
.step.done .n { background: var(--success); border-color: var(--success); color: #fff; }
.step.current { border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-card); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.step.current .n { border-color: var(--accent); color: #fff; background: var(--accent); }
.step b { display: block; font-size: 13px; font-weight: 600; }
.step small { color: var(--text-muted); font-size: 12px; display: block; }

/* Panneau « Préparation du dossier » (plaquettes) : cinq étapes ordonnées, temps restant réel */
.prep { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow-card); margin-bottom: 16px; overflow: hidden; }
.prep-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--hairline); }
.prep-titre { flex: 1 1 320px; min-width: 0; }
.prep-titre h2 { margin: 0; font-size: 15px; }
.prep-titre p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-muted); }
.prep-head-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.prep-head-actions .status-text { margin: 0; max-width: 420px; text-align: right; }
.prep-etapes { list-style: none; margin: 0; padding: 0; }
.prep-etape { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; align-items: center; column-gap: 14px; row-gap: 6px; padding: 11px 18px; border-bottom: 1px solid var(--hairline); cursor: pointer; transition: background-color .18s ease; }
.prep-etape:last-child { border-bottom: 0; }
.prep-etape:hover { background: var(--fill); }
.prep-etape.current { background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.prep-n { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 12px; color: var(--text-muted); transition: background-color .25s ease, border-color .25s ease, color .25s ease; }
.prep-etape.done .prep-n { background: var(--success); border-color: var(--success); color: #fff; }
.prep-etape.current .prep-n, .prep-etape.running .prep-n { background: var(--accent); border-color: var(--accent); color: #fff; }
.prep-etape.error .prep-n { background: var(--danger); border-color: var(--danger); color: #fff; }
.prep-corps { min-width: 0; }
.prep-corps b { display: block; font-size: 13.5px; font-weight: 600; }
.prep-corps b em { font-style: normal; font-weight: 500; color: var(--text-muted); }
.prep-corps small { display: block; color: var(--text-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prep-etape.error .prep-corps small { color: var(--danger); white-space: normal; }
.prep-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.prep-suivi { grid-column: 2 / -1; display: flex; align-items: center; gap: 12px; }
.prep-suivi .progress-bar { margin: 0; flex: 1 1 160px; }
.prep-temps { font-size: 12px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill.en-cours { background: var(--accent-soft); color: var(--accent-text); }
.pill.en-cours::before { animation: prep-pulse 1.2s ease-in-out infinite; }
@keyframes prep-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.form-sections { display: flex; flex-direction: column; gap: 10px; }
.section { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow-card); transition: box-shadow .2s ease; }
.section[open] { box-shadow: var(--shadow-md); }
.section > summary { list-style: none; cursor: pointer; padding: 13px 16px; display: flex; align-items: center; gap: 12px; border-radius: var(--radius); transition: background-color .15s ease; }
.section > summary:hover { background: var(--surface-muted); }
.section[open] > summary { border-radius: var(--radius) var(--radius) 0 0; }
.section > summary::-webkit-details-marker { display: none; }
.section > summary .chev { width: 16px; height: 16px; color: var(--text-muted); flex: none; transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
.section[open] > summary .chev { transform: rotate(90deg); }
.section > summary h2 { font-size: 14.5px; margin: 0; font-weight: 700; }
.section > summary .sum { color: var(--text-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.section[open] > summary .sum { opacity: .7; }
.sec-badge:empty { display: none; }
.section .body { padding: 4px 16px 16px; border-top: 1px solid var(--hairline); display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.section .body.body-simple { display: block; }
.section .body > .field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.section .body > .field.full { grid-column: 1 / -1; }
.section .body .field > label:first-child, .section .body.body-simple > div > label { margin-top: 10px; }
.form-champs .section .body .field label { margin-top: 10px; }
.field.field-bouton { justify-content: flex-end; }
.field.field-bouton .btn { align-self: flex-start; }
.field .err { font-size: 12px; display: flex; gap: 6px; align-items: flex-start; margin-top: 2px; }
.field .err::before { content: "●"; font-size: 9px; margin-top: 3px; }
.field .err.bloquant { color: var(--danger); }
.field .err.alerte { color: var(--warning); }
.field.invalid input, .field.invalid select, .field.invalid textarea, .form-champs .champ-invalid { box-shadow: inset 0 0 0 1px var(--danger); }
.field.alerte input, .field.alerte select, .form-champs .champ-alerte { box-shadow: inset 0 0 0 1px var(--warning); }
.form-champs .err { font-size: 12px; display: flex; gap: 6px; align-items: flex-start; margin-top: 4px; }
.form-champs .err::before { content: "●"; font-size: 9px; margin-top: 3px; }
.form-champs .err.bloquant { color: var(--danger); }
.form-champs .err.alerte { color: var(--warning); }
.section .body .status-text:empty { display: none; }
.actionbar {
  position: sticky; bottom: 12px; z-index: 20; margin-top: 12px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--hairline); border-radius: var(--radius); padding: 10px 14px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; box-shadow: var(--shadow-lg);
}
.actionbar .state { color: var(--text-muted); font-size: 13px; display: inline-flex; align-items: center; gap: 8px; }
.actionbar .state.error { color: var(--danger); }
.actionbar .btn { margin: 0; text-decoration: none; }
.actionbar-progress { flex-basis: 100%; margin: 4px 0 0; }
.controles-titre.ok { color: var(--success); }
@media (max-width: 860px) {
  .steps, .section .body { grid-template-columns: 1fr; }
}

/* ---------- Tableau de bord ---------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}
.stats-row > .stat-card { transition: transform .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s ease; }
.stats-row > .stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-valeur { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin-top: 6px; }
.stat-libelle { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.stat-detail { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-alerte { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
.stat-alerte .stat-valeur { color: var(--warning); }
.stat-repartition .stat-libelle { margin-bottom: 8px; }
.repartition-liste { list-style: none; margin: 0; padding: 0; font-size: 13px; max-height: 140px; overflow-y: auto; }
.repartition-liste li { padding: 2px 0; display: flex; justify-content: space-between; }
/* Le tableau occupe toute la largeur ; « À traiter » et « Répartition » forment une rangée au-dessus. */
.dashboard-two { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.dashboard-main { min-width: 0; overflow-x: auto; }
.dashboard-side { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; margin-bottom: 16px; }
.dashboard-side .a-traiter { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.dashboard-side .a-traiter:empty::after { content: "Rien à traiter."; color: var(--text-faint); font-size: 13px; }
@media (max-width: 860px) { .dashboard-side { grid-template-columns: 1fr; } }
.a-traiter { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.a-traiter li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--fill); font-size: 13px; transition: background-color .15s ease; }
.a-traiter li:hover { background: var(--fill-hover); }
.a-traiter b { display: block; font-weight: 600; }
.a-traiter small { color: var(--text-muted); }
.a-traiter-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; }
.a-traiter-dot.bad { background: var(--danger); }
.a-traiter-dot.warn { background: var(--warning); }
.a-traiter-dot.ok { background: var(--success); }
@media (max-width: 1000px) {
  #app { grid-template-columns: 1fr; }
  .side { position: static; min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
  .nav-title, .nav-spacer, .me { display: none; }
  .nav-group { display: contents; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-item { width: auto; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .stats-row { grid-template-columns: 1fr; }
}

.dashboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.dashboard-recherche { flex: 1; min-width: 220px; }
.dashboard-toolbar select {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  background: var(--fill);
  color: var(--text);
}
.dashboard-archives-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); cursor: pointer; white-space: nowrap; }

.dashboard-actions-masse {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
}
.dashboard-actions-masse button { font-size: 12.5px; padding: 7px 14px; }

.dashboard-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  font-size: 13px;
}
.dashboard-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: 600;
  padding: 12px 14px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--hairline);
}
.dashboard-table td { padding: 11px 10px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.dashboard-table th { padding-left: 10px; padding-right: 10px; }
.dashboard-table td:first-child, .dashboard-table th:first-child { padding-right: 0; width: 34px; }
/* Écrans moyens : la colonne « Créé par » disparaît (le filtre « Tous créateurs » reste). */
@media (max-width: 1240px) { .dashboard-createur-cell { display: none; } }
.dashboard-table tbody tr:last-child td { border-bottom: none; }
.dashboard-table tbody tr { transition: background-color .12s ease; }
.dashboard-table tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); }
.dashboard-nom-cell { cursor: pointer; font-weight: 600; font-size: 13.5px; max-width: 360px; }
.dashboard-nom-cell .dashboard-nom { display: inline-block; max-width: calc(100% - 18px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.dashboard-nom-cell:hover .dashboard-nom { color: var(--accent); }
.dashboard-genere { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 8px; vertical-align: middle; background: var(--border-strong); }
.dashboard-genere.oui { background: var(--success); }
.dashboard-type-cell { white-space: nowrap; }
.dashboard-type-cell small { display: block; color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.dashboard-date-cell { white-space: nowrap; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.2; }
.dashboard-date-cell small { display: block; color: var(--text-muted); font-size: 11.5px; }
.dashboard-table td { white-space: nowrap; }
.dashboard-table td.dashboard-nom-cell { white-space: normal; }
/* État vide du tableau de bord : un message centré qui oriente vers « + Nouveau » */
#dashboard-vide { margin: 0; padding: 48px 20px; text-align: center; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); font-size: 14px; }
.dashboard-table:has(tbody:empty) { display: none; }
.dashboard-actions-cell { display: flex; gap: 6px; flex-wrap: nowrap; align-items: center; white-space: nowrap; }
.dashboard-actions-cell .btn { font-size: 12px; padding: 6px 12px; }
.btn-plus { padding: 6px 10px !important; font-size: 15px !important; line-height: 1; letter-spacing: 0.05em; min-width: 34px; text-align: center; }
.menu-ligne > .drop { min-width: 170px; }
.menu-ligne > .drop button { font-size: 13px; }
.menu-ligne > .drop button.danger { color: var(--danger); }
.menu-ligne > .drop button.danger:hover { background: var(--danger); color: #fff; }
.dashboard-table tbody tr:has(details[open]) { position: relative; z-index: 5; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 980px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-categorie-loi { background: var(--accent-soft); color: var(--accent); }
.badge-categorie-mandat { background: #f1e9fb; color: #6b3fa0; }
.badge-genere-oui { background: var(--success-soft); color: var(--success); }
.badge-genere-non { background: var(--fill); color: var(--text-muted); }
.badge-echeance-proche { background: #fff4e5; color: #7a4a05; }
.badge-echeance-expiree { background: var(--danger-soft); color: var(--danger); }

/* ---------- Salaire ---------- */
.salaire-annee { border: 1px solid transparent; border-radius: var(--radius-sm); padding: 8px 12px; font-size: 14px; font-family: inherit; background: var(--fill); color: var(--text); font-weight: 600; }
.avertissement { font-size: 12.5px; color: var(--text-muted); background: var(--fill); border-radius: var(--radius-sm); padding: 8px 12px 8px 34px; margin: 0 0 20px; position: relative; }
.avertissement::before { content: "i"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 10px; font-weight: 700; font-family: var(--display); display: grid; place-items: center; line-height: 1; }
.salaire-cartes { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .salaire-cartes { grid-template-columns: 1fr 1fr; } }
.stat-detail { font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.4; }
.progression-card { margin-bottom: 24px; }
.progression { position: relative; height: 12px; background: var(--fill); border-radius: 999px; margin: 10px 0 8px; overflow: visible; }
.progression-remplie { height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s ease; }
.progression-marqueur { position: absolute; top: -4px; width: 2px; height: 20px; background: var(--text); opacity: .45; transform: translateX(-1px); }
.progression-legende { font-size: 12px; color: var(--text-muted); }
.salaire-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
@media (max-width: 860px) { .salaire-grid { grid-template-columns: 1fr; } }
.chart-card canvas { margin-top: 10px; }
.chart-large { grid-column: 1 / -1; }
.chart-tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.chart-sous { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.chart-resume { font-size: 13px; color: var(--text-muted); text-align: right; line-height: 1.5; }
.chart-resume b { color: var(--text); font-variant-numeric: tabular-nums; }
.simulateur-row { margin-top: 10px; }
.simulateur-row input[type="text"], .sal-section input[type="text"], .sal-section select, .sal-section textarea, .stat-card input[type="text"] {
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13.5px; font-family: inherit; background: var(--fill); color: var(--text); width: 100%;
}
.stat-card input[type="text"]:focus, .sal-section input:focus, .sal-section select:focus, .sal-section textarea:focus { outline: none; background: var(--surface); box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18), inset 0 0 0 1px var(--accent); }
.sal-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin: 12px 0 6px; }
.sal-section { margin-bottom: 24px; }
.sal-section h2 { font-size: 17px; font-weight: 600; margin: 0 0 12px; letter-spacing: -0.015em; }
.sal-section-header { display: flex; align-items: center; gap: 10px; }
.sal-section-header h2 { margin: 0; }
.extraction-zone { background: var(--fill); border-radius: var(--radius-sm); padding: 12px 14px; margin: 12px 0 8px; }
.extraction-zone input[type="file"] { flex: 1; font-size: 13px; }
.tranches-table { width: 100%; border-collapse: collapse; }
.tranches-table td { padding: 4px 4px; vertical-align: middle; font-size: 13px; }
.tranches-table input[type="text"] { width: 80px; padding: 7px 9px; }
.tranche-prefixe { color: var(--text-muted); }
.tranche-unite { font-size: 12px; color: var(--text-muted); }
.tranche-supprimer { padding: 2px 8px; }
.sal-equipe-toggle { margin: 6px 0 4px; font-weight: 600; }
.sal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.ca-table { margin: 12px 0; }
.ca-ajout { display: grid; grid-template-columns: 150px 1fr 140px 130px auto auto; gap: 8px; align-items: center; margin-top: 10px; }
.ca-ajout input[type="date"] { border: 1px solid transparent; border-radius: var(--radius-sm); padding: 8px 10px; font-family: inherit; font-size: 13px; background: var(--fill); }
@media (max-width: 860px) { .ca-ajout { grid-template-columns: 1fr 1fr; } }
.variation-plus { color: var(--success); font-weight: 600; }
.variation-moins { color: var(--danger); font-weight: 600; }
#admin-salaires-totaux th { text-align: left; padding: 12px 14px; border-top: 2px solid var(--hairline); font-size: 13px; }
.courtier-ajout { grid-template-columns: 1fr auto auto; margin: 8px 0 4px; }
.courtier-inactif td { color: var(--text-muted); }

.badge-select {
  border: none;
  border-radius: 980px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.badge-statut-brouillon { background: var(--fill); color: var(--text-muted); }
.badge-statut-envoye { background: var(--accent-soft); color: var(--accent); }
.badge-statut-signe { background: var(--success-soft); color: var(--success); }
.badge-statut-perdu { background: var(--danger-soft); color: var(--danger); }

/* Saisie rapide d'une facturation (page Salaire) */
.ajout-rapide { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--hairline); }
.ajout-rapide-titre { font-family: var(--display); font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.ajout-rapide .dropzone-hint { margin: 0 0 10px; }
.ajout-rapide-row { display: grid; grid-template-columns: 150px 170px minmax(140px, 1fr) auto auto; gap: 8px; align-items: center; }
.ajout-rapide-row input[type="text"], .ajout-rapide-row input[type="date"] { border: 1px solid transparent; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; font-family: inherit; background: var(--fill); color: var(--text); width: 100%; }
.ajout-rapide-row input:focus { outline: none; background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft), inset 0 0 0 1px var(--accent); }
@media (max-width: 860px) { .ajout-rapide-row { grid-template-columns: 1fr 1fr; } .ajout-rapide-row .btn { grid-column: 1 / -1; } }

/* Pastilles (dates de visite) */
.visites-row input[type="date"] { max-width: 220px; }
.visites-row .btn { white-space: nowrap; }
.chips { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 500; }
.chip-suppr { border: none; background: transparent; color: inherit; cursor: pointer; font-size: 12px; padding: 2px 6px; border-radius: 999px; }
.chip-suppr:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }

/* Carte Direction d'équipe (Salaire) */
.direction-card { margin-bottom: 16px; border-left: 4px solid var(--purple); }
.progression-direction { background: var(--purple); }

/* Jauge de progression CA (perso : accent bleu ; équipe : violet) */
.jauge { --jauge-c: var(--accent); --jauge-c-soft: var(--accent-soft); --jauge-c-text: var(--accent-text); margin: 10px 0 6px; padding-top: 4px; }
.jauge-equipe { --jauge-c: var(--purple); --jauge-c-soft: var(--purple-soft); --jauge-c-text: var(--purple); }
.jauge-tete { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 54px; flex-wrap: wrap; }
.jauge-pct { font-family: var(--display); font-size: 30px; font-weight: 800; letter-spacing: -0.03em; color: var(--jauge-c-text); font-variant-numeric: tabular-nums; line-height: 1; }
.jauge-etat { font-size: 13px; color: var(--text-muted); }
.jauge-piste { position: relative; height: 14px; border-radius: 999px; background: var(--fill); overflow: visible; }
.jauge-segment { position: absolute; top: 0; height: 100%; background: color-mix(in srgb, var(--jauge-c) calc(var(--tone) * 16%), var(--fill)); border-right: 2px solid var(--surface); box-sizing: border-box; transition: background .4s ease; }
.jauge-segment:first-child { border-radius: 999px 0 0 999px; }
.jauge-segment:last-of-type { border-right: 0; border-radius: 0 999px 999px 0; }
.jauge-segment.courant { background: color-mix(in srgb, var(--jauge-c) calc(var(--tone) * 16% + 10%), var(--fill)); }
.jauge-attente { position: absolute; top: 0; height: 100%; width: 0; background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--jauge-c) 45%, transparent) 0 5px, transparent 5px 10px); transition: left .9s cubic-bezier(.2,.8,.2,1), width .9s cubic-bezier(.2,.8,.2,1); border-radius: 0 999px 999px 0; }
.jauge-remplie { position: absolute; top: 0; left: 0; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, color-mix(in srgb, var(--jauge-c) 70%, white), var(--jauge-c)); box-shadow: 0 1px 6px color-mix(in srgb, var(--jauge-c) 35%, transparent); overflow: hidden; transition: width .9s cubic-bezier(.2,.8,.2,1); }
.jauge-depasse .jauge-remplie { box-shadow: 0 1px 8px color-mix(in srgb, var(--jauge-c) 55%, transparent); }
.jauge-brillance { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.55) 50%, transparent 80%); transform: translateX(-120%); }
.jauge-brille .jauge-brillance { animation: jauge-balayage 1.3s cubic-bezier(.2,.8,.2,1) .25s 1 both; }
@keyframes jauge-balayage { from { transform: translateX(-120%); } to { transform: translateX(220%); } }
.jauge-curseur { position: absolute; top: 50%; left: 0; width: 22px; height: 22px; margin-left: -11px; margin-top: -11px; border-radius: 50%; background: var(--surface); border: 3px solid var(--jauge-c); box-shadow: 0 2px 8px rgba(20,24,40,.22); transition: left .9s cubic-bezier(.2,.8,.2,1); z-index: 3; }
.jauge-depasse .jauge-curseur { border-color: var(--success); }
.jauge-bulle { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums; box-shadow: var(--shadow-sm); }
.jauge-bulle::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 8px; height: 8px; background: var(--text); transform: translateX(-50%) rotate(45deg); border-radius: 1px; }
.jauge-seuil, .jauge-objectif { position: absolute; top: -5px; width: 2px; height: 24px; background: var(--border-strong); transform: translateX(-1px); z-index: 1; transition: background .4s ease; }
.jauge-seuil span, .jauge-objectif span { position: absolute; top: 28px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--text-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.jauge-objectif { background: var(--text); height: 26px; top: -6px; }
.jauge-objectif span { color: var(--text); font-weight: 600; text-align: center; line-height: 1.2; }
.jauge-seuil.atteint { background: var(--jauge-c); }
.jauge-seuil.atteint span { color: var(--jauge-c-text); }
.jauge-objectif.atteint { background: var(--success); }
.jauge-objectif.atteint span { color: var(--success); }
.jauge-objectif.atteint span::before { content: "✓ "; }
.jauge-paliers { position: relative; height: 40px; margin-top: 46px; }
.jauge-palier { position: absolute; top: 0; padding: 6px 0 0; border-top: 2px solid var(--border); text-align: center; font-size: 12px; color: var(--text-faint); transition: color .4s ease, border-color .4s ease; box-sizing: border-box; }
.jauge-palier b { display: block; font-family: var(--display); font-size: 15px; font-weight: 800; letter-spacing: -0.02em; }
.jauge-palier small { display: block; font-size: 11px; }
.jauge-palier.atteint { color: var(--text-muted); border-top-color: var(--jauge-c); }
.jauge-palier.courant { color: var(--jauge-c-text); border-top-color: var(--jauge-c); }
.jauge-palier.courant b { transform: scale(1.08); transform-origin: center; }
.jauge-fete .jauge-segment.courant, .jauge-fete .jauge-palier.courant b { animation: jauge-pulse 1.5s ease-out 1; }
.jauge-fete .jauge-curseur { animation: jauge-anneau 1.5s ease-out 1; }
@keyframes jauge-pulse { 0% { filter: brightness(1); } 25% { filter: brightness(1.35); } 100% { filter: brightness(1); } }
@keyframes jauge-anneau { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--jauge-c) 55%, transparent), 0 2px 8px rgba(20,24,40,.22); } 100% { box-shadow: 0 0 0 18px transparent, 0 2px 8px rgba(20,24,40,.22); } }
@media (max-width: 640px) {
  .jauge-pct { font-size: 24px; }
  .jauge-seuil span { display: none; }
  .jauge-palier small { display: none; }
  .jauge-paliers { height: 30px; margin-top: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .jauge-remplie, .jauge-curseur, .jauge-attente { transition: none; }
  .jauge-brille .jauge-brillance, .jauge-fete .jauge-segment.courant, .jauge-fete .jauge-curseur, .jauge-fete .jauge-palier.courant b { animation: none; }
}

/* Questionnaire des objectifs (Salaire, admin) */
.objectifs-wrap { overflow-x: auto; margin: 6px 0 10px; }
.objectifs-table th { white-space: nowrap; }
.objectifs-table th.inactif, .objectifs-table th.inactif small { color: var(--text-faint); }
.objectifs-table th small { display: block; font-weight: 400; font-size: 11px; color: var(--text-muted); }
.objectifs-table input { width: 110px; border: 1px solid transparent; border-radius: 6px; padding: 6px 8px; background: var(--fill); color: var(--text); font: inherit; font-size: 13px; text-align: right; }
.objectifs-table input:focus { outline: none; background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft), inset 0 0 0 1px var(--accent); }
.objectifs-table td.somme { font-weight: 700; white-space: nowrap; }
.objectifs-table td.annee { font-weight: 700; }

/* Plaquettes : chiffres clés et éditeur de pages */
/* PLU depuis l'adresse */
.plu-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.plu-actions .status-text { margin: 0; }
.plu-bloc .progress-bar { margin-top: 8px; }
.plu-resultat { margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--surface-muted); display: grid; gap: 10px; }
.plu-resultat h4 { margin: 4px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.plu-tete { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.plu-tete strong { font-size: 15px; }
.plu-meta { font-size: 12px; color: var(--text-muted); }
.plu-carte { width: 100%; max-width: 640px; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; }
.plu-synthese { margin: 0; line-height: 1.5; }
.plu-moteur { margin: 0; font-size: 12px; color: var(--text-muted); }
.ia-option { margin: 8px 0 0; font-size: 12px; color: var(--text-muted); text-align: center; }
.pieces-bloc { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--surface-muted); }
.pieces-tete { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.pieces-liste { margin: 8px 0 0; padding-left: 18px; font-size: 13px; display: grid; gap: 3px; }
.pieces-liste li.ok { color: var(--text-faint); text-decoration: line-through; }
.telechargements { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.telechargements .groupe { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-muted); font-size: 13px; }
.telechargements .groupe a { color: var(--accent-text); font-weight: 600; text-decoration: none; }
.telechargements .groupe small { color: var(--text-faint); }
.partage-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.partage-form input[type=number] { width: 70px; }
.partage-form input[type=text] { flex: 1; min-width: 180px; }
.partage-liste { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.partage-liste li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-muted); }
.partage-liste li.inactif { opacity: .55; }
.partage-liste code { font-size: 12px; background: var(--fill); padding: 2px 6px; border-radius: 4px; word-break: break-all; }
.badge-perime { background: var(--warning-soft); color: var(--warning); }
.btn-lien:disabled { color: var(--text-faint); cursor: default; text-decoration: none; }
.btn-lien { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; color: var(--accent-text); cursor: pointer; text-decoration: underline; }
.plu-colonnes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.plu-liste { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; line-height: 1.45; }
.plu-liste li.plu-plus::marker { color: var(--success); content: "✓  "; }
.plu-liste li.plu-moins::marker { color: var(--danger); content: "!  "; }
.plu-chips .chip.plu-ok { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.plu-chips .chip.plu-cond { background: color-mix(in srgb, #d98c00 18%, transparent); color: #a86a00; }
.plu-chips .chip.plu-non { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.plu-table { border-collapse: collapse; font-size: 13px; width: 100%; }
.plu-table th, .plu-table td { text-align: left; vertical-align: top; padding: 5px 8px; border-top: 1px solid var(--border); }
.plu-table th { width: 30%; font-weight: 600; color: var(--text-muted); }
.plu-sources { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.plu-vide { margin: 0; font-size: 13px; color: var(--text-muted); }
@media (max-width: 640px) { .plu-colonnes { grid-template-columns: 1fr; } }

.plq-chiffres { display: grid; gap: 6px; }
.plq-chiffres .montant-row input:first-child { max-width: 160px; font-weight: 600; }
.plq-page { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; background: var(--surface-muted); }
.plq-page-tete { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.plq-page-tete .num { font-family: var(--display); font-weight: 800; color: var(--accent-text); min-width: 28px; }
.plq-page-tete input { flex: 1; font-weight: 600; }
.plq-page-tete .btn { padding: 6px 10px; font-size: 12px; }
.plq-page-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.plq-page-grille label { font-size: 12px; margin: 4px 0 2px; }
.plq-page-grille .full { grid-column: 1 / -1; }
.badge-categorie-plaquette { background: var(--warning-soft); color: var(--warning); }
@media (max-width: 860px) { .plq-page-grille { grid-template-columns: 1fr; } }

/* Page Statistiques (admin) */
.stats-titre { margin: 6px 0 8px; }
.stats-mini { margin: 0 0 16px; }
.stats-mini > div { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--fill); }
.stats-mini .stat-valeur { font-size: 22px; }
#view-stats .dashboard-table { font-size: 12.5px; }
#view-stats .dashboard-table td:first-child { font-weight: 600; }
.stats-cle { color: var(--text-muted); font-weight: 400 !important; }

/* ---------- Téléphone (iPhone) : barre d'onglets en bas, saisie sans zoom, tableaux défilants ---------- */
.btn, .nav-item, .step, .section > summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.sal-section, .dashboard-main { -webkit-overflow-scrolling: touch; }
@media (max-width: 640px) {
  /* iOS zoome automatiquement sur tout champ dont la police est < 16 px : on l'impose partout. */
  input, select, textarea { font-size: 16px !important; }
  #app { padding: 12px 12px calc(72px + env(safe-area-inset-bottom, 0px)); gap: 12px; }
  .side {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 40;
    border-radius: 0; border-width: 1px 0 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    flex-wrap: nowrap; justify-content: space-around; gap: 0;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    box-shadow: var(--shadow-md);
  }
  .brand { display: none; }
  /* Une barre d'onglets n'affiche que quelques raccourcis, le reste passe par « Plus » : une
     barre défilante cache des entrées sans que rien ne l'indique (Prospection était invisible
     sur iPhone). */
  .side .nav-item:not([data-mobile]) { display: none; }
  /* Les groupes disparaissent de la mise en page : les cinq raccourcis deviennent les enfants
     directs de la barre et se répartissent à égalité, quel que soit le nombre d'entrées
     masquées (un groupe entièrement masqué laissait un trou). */
  .side .nav-group, .side .nav { display: contents; }
  .nav-title, .nav-spacer { display: none; }
  .nav-item { flex-direction: column; gap: 3px; padding: 6px 2px; font-size: 0; min-width: 0; flex: 1; border-radius: 10px; }
  .nav-item .ico { width: 22px; height: 22px; }
  .nav-item::after { content: attr(data-court); font-size: 10.5px; font-weight: 600; white-space: nowrap; }
  .nav-item[aria-current="page"] { background: transparent; }
  #btn-nav-plus { display: inline-flex; }
  /* Identité et déconnexion : dans la feuille « Plus », pour laisser la place aux raccourcis. */
  .me { display: none; }

  .page-head { margin-bottom: 14px; }
  .page-head h1, .page-head .dossier-titre-input { font-size: 20px; }
  .page-head .btn-ghost { padding: 7px 12px; font-size: 12.5px; }
  .steps { grid-template-columns: 1fr 1fr; gap: 6px; }
  .prep-head { padding: 12px 14px; }
  .prep-head-actions { width: 100%; justify-content: space-between; }
  .prep-head-actions .status-text { text-align: left; }
  .prep-etape { grid-template-columns: 26px minmax(0, 1fr) auto; padding: 10px 14px; }
  .prep-actions { grid-column: 2 / -1; justify-content: flex-start; }
  .prep-corps small { white-space: normal; }
  .step { padding: 8px 10px; gap: 8px; }
  .step small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
  .section > summary { padding: 12px; }
  .section > summary .sum { display: none; }
  .section .body { padding: 4px 12px 12px; }
  .dropzone { padding: 20px 12px; }
  .actionbar {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)); padding: 8px 10px; gap: 6px;
  }
  .actionbar .state { flex-basis: 100%; font-size: 12px; }
  .actionbar .btn { flex: 1; padding: 9px 6px; font-size: 12.5px; text-align: center; }
  .actionbar .page-grow { display: none; }
  .sal-section, .dashboard-toolbar + .dashboard-table, #view-dashboard .dashboard-main { overflow-x: auto; }
  .sal-section .dashboard-table, .tranches-table { min-width: 560px; }
  .modal-carte { padding: 14px; max-height: 92vh; border-radius: var(--radius); }
  .modal-overlay { padding: 8px; align-items: flex-end; }
  .modal { max-height: 90vh; overflow-y: auto; }
  .login-view { min-height: 100vh; padding: 24px 16px; align-items: flex-start; }
}

/* Marché et concurrence (administrateur) */
.marche-hint { margin: 6px 0 0; font-size: 12.5px; line-height: 1.45; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--fill); color: var(--text-muted); border-left: 3px solid var(--border-strong); }
.marche-hint.marche { border-left-color: var(--success); }
.marche-hint.fourchette_basse, .marche-hint.fourchette_haute { border-left-color: var(--warning); }
.marche-hint.bas, .marche-hint.haut { border-left-color: var(--danger); }
.marche-hint b { color: var(--text); }
.marche-filtres { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 8px 0 12px; font-size: 13px; }
.marche-filtres input[type="number"] { width: 64px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 6px 8px; background: var(--fill); color: var(--text); font: inherit; }
#view-marche .dashboard-table { font-size: 12.5px; }
#view-marche .dashboard-table td { white-space: normal; }
#view-marche .dashboard-table td:first-child { font-weight: 600; white-space: nowrap; }

/* Marché : sous-onglets et outils de prospection (avis de valeur, croissance, terrain) */
.sous-onglets { display: flex; gap: 4px; margin: 0 0 16px; padding: 4px; background: var(--fill); border-radius: var(--radius); width: fit-content; max-width: 100%; overflow-x: auto; }
.sous-onglet { font: inherit; font-size: 13px; font-weight: 600; border: 0; background: transparent; color: var(--text-muted); padding: 7px 14px; border-radius: calc(var(--radius) - 4px); cursor: pointer; white-space: nowrap; transition: background-color .18s ease, color .18s ease; }
.sous-onglet[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); }
.avis-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.avis-form .field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.avis-form .field.full { grid-column: 1 / -1; }
.avis-form label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.avis-form input, .avis-form select, .avis-form textarea { width: 100%; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 8px 10px; background: var(--fill); color: var(--text); font: inherit; font-size: 13.5px; }
.avis-valeurs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0 10px; }
.avis-valeur { background: var(--fill); border-radius: var(--radius); padding: 12px 14px; text-align: center; }
.avis-valeur.principale { background: var(--success-soft); }
.avis-valeur small { display: block; font-size: 12px; color: var(--text-muted); }
.avis-valeur b { display: block; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin: 3px 0; font-variant-numeric: tabular-nums; }
.avis-valeur.principale b { color: var(--success); }
.avis-valeur span { font-size: 12px; color: var(--text-muted); }
.avis-carte { display: block; width: 100%; max-width: 760px; border-radius: var(--radius); margin: 8px 0 14px; border: 1px solid var(--hairline); }
.score-pill { display: inline-block; min-width: 28px; text-align: center; padding: 2px 8px; border-radius: 999px; font-weight: 700; font-size: 12px; background: var(--fill); color: var(--text); }
.score-pill.fort { background: var(--success-soft); color: var(--success); }
.score-pill.moyen { background: var(--warning-soft); color: var(--warning); }
.terrain-adresse { flex: 1 1 220px; }
.terrain-adresse input { width: 100%; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 8px 10px; background: var(--fill); color: var(--text); font: inherit; font-size: 13.5px; }
.terrain-carte { position: relative; width: 100%; max-width: 760px; margin: 6px 0 12px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--hairline); }
.terrain-carte img { display: block; width: 100%; height: auto; }
.terrain-carte .marqueur { position: absolute; transform: translate(-50%, -50%); width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); cursor: pointer; }
.terrain-carte .marqueur.vente { background: #6b3fa0; }
.terrain-carte .marqueur.note { background: var(--warning); color: #111; }
.terrain-carte .marqueur.moi { width: 16px; height: 16px; background: #e31e24; }
.terrain-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.terrain-liste li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 12px; background: var(--fill); border-radius: var(--radius-sm); font-size: 13px; }
.terrain-liste .num { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.terrain-liste .num.vente { background: #6b3fa0; }
.terrain-liste .num.note { background: var(--warning); color: #111; }
.terrain-liste small { display: block; color: var(--text-muted); font-size: 12px; }
.terrain-liste a.btn { padding: 5px 10px; font-size: 12px; }
.terrain-notes { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.terrain-notes li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; background: var(--fill); border-radius: var(--radius-sm); font-size: 13px; }
.terrain-notes img { width: 84px; height: 84px; object-fit: cover; border-radius: var(--radius-sm); flex: none; }
.terrain-notes small { display: block; color: var(--text-muted); font-size: 12px; }
.terrain-notes .btn-lien { margin-left: auto; flex: none; }
@media (max-width: 640px) {
  .avis-form, .avis-valeurs { grid-template-columns: 1fr; }
  #view-marche .sal-section-header { flex-wrap: wrap; }
  .avis-valeur b { font-size: 18px; }
  .terrain-liste li { grid-template-columns: 26px minmax(0, 1fr); }
  .terrain-liste li > :last-child { grid-column: 2; }
}
.mk-barre { display: inline-block; height: 8px; border-radius: 999px; background: var(--accent); vertical-align: middle; margin-right: 6px; }
.mk-cbre { color: var(--success); font-weight: 700; }
