/* =====================================================================
   « Mon entreprise » — accueil, clients, devis & factures, agenda, carte
   Uniquement des jetons de tokens.css (voir DESIGN.md)
   ===================================================================== */

/* ---------- icônes (icons.js) ---------- */
.ic { width: 1em; height: 1em; flex: none; vertical-align: -0.125em; }
.e-btn .ic, .e-doc .ic, .e-chantier .ic, .e-back .ic { width: 16px; height: 16px; }

/* ---------- anciens onglets (en-tête sans menu) ---------- */
.e-tabs { flex: 1; display: flex; justify-content: center; gap: var(--space-1); }
.e-tabs button { background: none; border: 0; color: var(--text-muted); font: var(--fw-medium) var(--fs-md) / 1 var(--font-sans); padding: var(--space-2) var(--space-4); border-radius: var(--radius-md); cursor: pointer; }
.e-tabs button:hover { color: var(--text); background: var(--surface-3); }
.e-tabs button.on { background: var(--surface-3); color: var(--text); }
.e-new { background: var(--accent); color: var(--accent-fg); text-decoration: none; font: var(--fw-semibold) var(--fs-sm) / 1 var(--font-sans); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); white-space: nowrap; }
.e-new:hover { background: var(--accent-hover); }

/* ---------- page ---------- */
.e-main { max-width: var(--content-max); margin: 0 auto; padding: var(--space-8) var(--page-pad) var(--space-20); overflow-x: clip; }
.e-hello { margin-bottom: var(--space-6); }
.e-hello h1 { font: var(--fw-semibold) var(--fs-title) / var(--lh-tight) var(--font-sans); letter-spacing: var(--tracking-tight); margin: 0; }
.e-hello p { color: var(--text-muted); margin: var(--space-1) 0 0; font-size: var(--fs-md); }
.e-hello p::first-letter, .e-agenda .e-head h1::first-letter { text-transform: uppercase; }
.e-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.e-head h1 { font: var(--fw-semibold) var(--fs-title) / var(--lh-tight) var(--font-sans); letter-spacing: var(--tracking-tight); margin: 0; }
.e-count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 var(--space-1-5); margin-left: var(--space-1);
  border-radius: var(--radius-full); background: var(--surface-3); color: var(--text-2);
  font: var(--fw-medium) var(--fs-xs) / 1 var(--font-sans); vertical-align: middle; font-variant-numeric: tabular-nums;
}
.e-search {
  flex: 1; max-width: 420px; height: var(--h-lg); padding: 0 var(--space-3); border: var(--border-w) solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text); font: var(--fs-md) var(--font-sans); box-shadow: var(--shadow-xs);
}
.e-search:focus { outline: none; border-color: var(--border-strong); box-shadow: var(--focus-ring); }

/* ---------- cartes ---------- */
.e-card { background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-lg); padding: var(--card-pad); margin-bottom: var(--section-gap); }
.e-card h2 { font: var(--fw-semibold) var(--fs-lg) / var(--lh-tight) var(--font-sans); margin: 0 0 var(--space-4); display: flex; align-items: center; gap: var(--space-2); }
.e-empty { color: var(--text-muted); margin: var(--space-1-5) 0; font-size: var(--fs-md); }
.e-muted { color: var(--text-muted); font-size: var(--fs-sm); }
.e-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--section-gap); }
.e-cols.wide { grid-template-columns: 1.15fr 1fr; align-items: start; }
.e-cols > .e-card, .e-cols > div > .e-card { margin-bottom: var(--section-gap); }
.e-cols > *, .e-kpis > *, .e-card { min-width: 0; }

/* ---------- chiffres clés ---------- */
.e-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--section-gap); margin-bottom: var(--section-gap); }
.e-kpi { background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-lg); padding: var(--card-pad); }
.e-kpi span { display: block; font: var(--fw-medium) var(--fs-sm) / var(--lh-snug) var(--font-sans); color: var(--text-muted); }
.e-kpi strong { display: block; font: var(--fw-semibold) var(--fs-2xl) / var(--lh-tight) var(--font-sans); letter-spacing: var(--tracking-tight); margin: var(--space-2) 0 var(--space-1); font-variant-numeric: tabular-nums; }
.e-kpi em { font-style: normal; color: var(--text-muted); font-size: var(--fs-sm); }

/* ---------- À faire ---------- */
.e-todo { display: flex; flex-direction: column; }
.e-todo-item {
  --c: var(--text-muted);
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
  padding: var(--space-3) 0; border-bottom: var(--border-w) solid var(--border);
}
.e-todo-item:last-child { border-bottom: 0; padding-bottom: 0; }
.e-todo-item:first-child { padding-top: 0; }
.e-todo-item.t-relance { --c: var(--stage-envoye); }
.e-todo-item.t-planifier { --c: var(--stage-signe); }
.e-todo-item.t-pose-bientot { --c: var(--stage-planifie); }
.e-todo-item.t-pose-retard { --c: var(--warning); }
.e-todo-item.t-ramonage { --c: var(--stage-pose); }
.e-todo-item.t-acompte { --c: var(--stage-signe); }
.e-todo-item.t-facturer { --c: var(--stage-facture); }
.e-todo-item.t-impaye { --c: var(--danger); }
.e-todo-ic {
  flex: none; width: var(--icon-box); height: var(--icon-box); display: grid; place-items: center; border-radius: var(--radius-md);
  color: var(--c); background: color-mix(in srgb, var(--c) 10%, var(--surface));
}
.e-todo-ic .ic { width: 16px; height: 16px; }
.e-todo-txt { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: var(--space-0-5); padding: 0; border: 0; background: none; text-align: left; cursor: pointer; color: var(--text); }
.e-todo-txt strong { font: var(--fw-medium) var(--fs-md) / var(--lh-snug) var(--font-sans); }
.e-todo-txt span { color: var(--text-muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.e-todo-txt:hover strong { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
.e-todo-act { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }

/* ---------- boutons (même famille que styles.css) ---------- */
.e-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1-5); height: var(--h-md); padding: 0 var(--space-3);
  border: var(--border-w) solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text);
  font: var(--fw-medium) var(--fs-sm) / 1 var(--font-sans); cursor: pointer; text-decoration: none; white-space: nowrap; box-shadow: var(--shadow-xs);
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.e-btn:hover { background: var(--surface-3); }
.e-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.e-btn:disabled { opacity: 0.5; cursor: default; }
.e-btn.ok { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.e-btn.ok:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.e-btn.ghost { background: none; border-color: transparent; box-shadow: none; color: var(--text-muted); }
.e-btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.e-btn.big { height: var(--h-lg); padding: 0 var(--space-4); font-size: var(--fs-md); }
.e-head .e-btn.ok.big { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.e-head .e-btn.ok.big:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.e-date-in {
  height: var(--h-md); padding: 0 var(--space-2); border: var(--border-w) solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text); font: var(--fs-sm) var(--font-sans); box-shadow: var(--shadow-xs);
}
.e-date-in:focus { outline: none; box-shadow: var(--focus-ring); }

/* ---------- lignes de liste ---------- */
.e-row {
  width: 100%; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-2); margin: 0 calc(var(--space-2) * -1);
  border: 0; border-bottom: var(--border-w) solid var(--border); border-radius: 0; background: none; cursor: pointer; text-align: left; color: var(--text);
  box-sizing: content-box;
}
.e-row:hover { background: var(--surface-2); }
.e-row:last-child { border-bottom: 0; }
.e-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-0-5); }
.e-row-main strong { font: var(--fw-medium) var(--fs-md) / var(--lh-snug) var(--font-sans); }
.e-row-main span { color: var(--text-muted); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e-row-end { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-0-5); font-weight: var(--fw-medium); white-space: nowrap; font-variant-numeric: tabular-nums; }
.e-row-end small { color: var(--text-muted); font-weight: var(--fw-regular); font-size: var(--fs-xs); }
.e-date {
  flex: none; width: 44px; padding: var(--space-1) 0; text-align: center; border: var(--border-w) solid var(--border); border-radius: var(--radius-md);
  color: var(--text-muted); font: var(--fw-medium) var(--fs-xs) / 1.2 var(--font-sans); text-transform: lowercase;
}
.e-date b { display: block; color: var(--text); font: var(--fw-semibold) var(--fs-lg) / 1.1 var(--font-sans); }

/* avatar et badge colorés par l'étape (--c posé par le JS) */
.e-av {
  flex: none; width: var(--avatar); height: var(--avatar); display: grid; place-items: center; border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--c) 12%, var(--surface)); color: color-mix(in srgb, var(--c) 80%, var(--text));
  font: var(--fw-semibold) var(--fs-sm) / 1 var(--font-sans); box-shadow: inset 0 0 0 var(--border-w) color-mix(in srgb, var(--c) 25%, transparent);
}
.e-av.big { width: var(--avatar-lg); height: var(--avatar-lg); font-size: var(--fs-xl); }
.e-badge {
  flex: none; display: inline-flex; align-items: center; gap: var(--space-1-5); height: 22px; padding: 0 var(--space-2);
  border: var(--border-w) solid var(--border); border-radius: var(--radius-full); background: var(--surface);
  color: var(--text-2); font: var(--fw-medium) var(--fs-xs) / 1 var(--font-sans); white-space: nowrap;
}
.e-badge .ic { width: 14px; height: 14px; color: var(--c); }

/* filtres */
.e-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
.e-chip {
  display: inline-flex; align-items: center; gap: var(--space-1-5); height: var(--h-sm); padding: 0 var(--space-3);
  border: var(--border-w) solid var(--border); border-radius: var(--radius-full); background: var(--surface); color: var(--text-2);
  font: var(--fw-medium) var(--fs-sm) / 1 var(--font-sans); cursor: pointer;
}
.e-chip:hover { background: var(--surface-3); }
.e-chip .ic { width: 16px; height: 16px; color: var(--c); }
.e-chip.on .ic { color: inherit; }
.e-chip b { color: var(--text-muted); font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; }
.e-chip.on { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.e-chip.on b { color: inherit; opacity: 0.7; }
.e-list { padding: var(--space-1) var(--card-pad); }

/* ---------- fiche client ---------- */
.e-back { display: inline-flex; align-items: center; gap: var(--space-1); background: none; border: 0; color: var(--text-muted); font: var(--fw-medium) var(--fs-md) / 1 var(--font-sans); padding: var(--space-1) 0 var(--space-4); cursor: pointer; }
.e-back:hover { color: var(--text); }
.e-fiche-h { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.e-fiche-id { flex: 1; min-width: 200px; }
.e-fiche-id h1 { font: var(--fw-semibold) var(--fs-2xl) / var(--lh-tight) var(--font-sans); letter-spacing: var(--tracking-tight); margin: 0 0 var(--space-2); }
.e-fiche-id > div { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.e-contact { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.e-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.e-form label { display: flex; flex-direction: column; gap: var(--space-1-5); min-width: 0; font: var(--fw-medium) var(--fs-sm) / 1.3 var(--font-sans); color: var(--text-2); }
.e-form input, .e-form select { box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; }
.e-form label:nth-child(3) { grid-column: span 2; }
.e-form input, .e-form select, .e-form-card select {
  height: var(--h-lg); padding: 0 var(--space-3); border: var(--border-w) solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text); font: var(--fs-md) var(--font-sans); box-shadow: var(--shadow-xs);
}
.e-form input:focus, .e-form select:focus, .e-form-card select:focus { outline: none; border-color: var(--border-strong); box-shadow: var(--focus-ring); }
.e-form-card .e-form { margin-top: var(--space-2); }
.e-form-act { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-5); }

.e-devis { border: var(--border-w) solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4); margin-bottom: var(--space-3); background: var(--surface); }
.e-devis-h { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); }
.e-devis-h div { display: flex; flex-direction: column; gap: var(--space-0-5); min-width: 0; }
.e-devis-h strong { font: var(--fw-semibold) var(--fs-md) / var(--lh-snug) var(--font-sans); }
.e-devis-h span { color: var(--text-muted); font-size: var(--fs-sm); }
.e-devis-h b { font: var(--fw-semibold) var(--fs-lg) / 1.2 var(--font-sans); color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.e-devis-row { display: flex; gap: var(--space-2); margin-top: var(--space-3); flex-wrap: wrap; }
.e-statut {
  height: var(--h-md); padding: 0 var(--space-8) 0 var(--space-6); border: var(--border-w) solid var(--border); border-radius: var(--radius-md);
  background: var(--icon-chevron) no-repeat right var(--space-3) center, radial-gradient(circle, var(--c) 3.5px, transparent 4px) no-repeat var(--space-2) center / 12px 12px, var(--surface);
  appearance: none; -webkit-appearance: none; color: var(--text); font: var(--fw-medium) var(--fs-sm) / 1 var(--font-sans); box-shadow: var(--shadow-xs); cursor: pointer;
}
.e-chantier, .e-docs { margin-top: var(--space-3); padding-top: var(--space-3); border-top: var(--border-w) solid var(--border); }
.e-chantier { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; font-size: var(--fs-md); color: var(--text-2); }
.e-chantier .ic { color: var(--text-muted); }
.e-docs { display: flex; flex-direction: column; gap: var(--space-1-5); }
.e-doc {
  display: flex; align-items: center; gap: var(--space-2); text-align: left; min-height: var(--h-md); padding: var(--space-2) var(--space-3);
  border: var(--border-w) solid var(--border); border-radius: var(--radius-md); background: var(--surface-2); color: var(--text-2);
  font: var(--fs-sm) / var(--lh-snug) var(--font-sans); cursor: pointer; font-variant-numeric: tabular-nums;
}
.e-doc b { color: var(--text); font-weight: var(--fw-medium); }
.e-doc:hover { background: var(--surface-3); }
.e-doc .ic { color: var(--text-muted); }
.e-doc.t-bc .ic { color: var(--stage-planifie); }
.e-doc.t-acompte .ic { color: var(--stage-signe); }
.e-doc.t-facture .ic { color: var(--stage-facture); }
.e-doc.t-ramonage .ic { color: var(--stage-pose); }
.e-docs-act { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-1); }
.ok-t { color: var(--success-text); font-weight: var(--fw-medium); }

.e-note-add { display: flex; gap: var(--space-2); margin-bottom: var(--space-4); align-items: flex-start; }
.e-note-add textarea {
  flex: 1; min-height: 72px; padding: var(--space-2) var(--space-3); border: var(--border-w) solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text); font: var(--fs-md) / var(--lh-normal) var(--font-sans); resize: vertical; box-shadow: var(--shadow-xs);
}
.e-note-add textarea:focus { outline: none; box-shadow: var(--focus-ring); }

/* historique */
.e-tl { list-style: none; margin: 0; padding: 0; position: relative; }
.e-tl::before { content: ''; position: absolute; left: 15px; top: var(--space-4); bottom: var(--space-4); width: var(--border-w); background: var(--border); }
.e-tl li { position: relative; display: flex; gap: var(--space-3); padding: var(--space-2) 0; }
.e-tl li.futur { opacity: 0.6; }
.e-tl-ic {
  flex: none; width: var(--icon-box); height: var(--icon-box); display: grid; place-items: center; border-radius: var(--radius-full); z-index: 1;
  background: var(--surface); border: var(--border-w) solid var(--border); color: var(--text-muted);
}
.e-tl-ic .ic { width: 14px; height: 14px; }
.e-tl li div { display: flex; flex-direction: column; gap: var(--space-0-5); padding-top: var(--space-1-5); min-width: 0; }
.e-tl strong { font: var(--fw-medium) var(--fs-md) / var(--lh-snug) var(--font-sans); }
.e-tl span { color: var(--text-muted); font-size: var(--fs-xs); }

/* photos */
.e-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: var(--space-2); }
.e-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-md); cursor: zoom-in; border: var(--border-w) solid var(--border); }
.e-photos .e-empty { grid-column: 1 / -1; }
#tp-viewer { position: fixed; inset: 0; z-index: var(--z-viewer); background: color-mix(in srgb, var(--neutral-950) 94%, transparent); display: grid; place-items: center; }
#tp-viewer[hidden] { display: none; }
#tp-viewer img { max-width: 94vw; max-height: 86vh; border-radius: var(--radius-md); }
#tp-viewer .v-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: var(--h-xl); height: var(--h-xl); border-radius: var(--radius-full); border: 0;
  background: color-mix(in srgb, var(--white) 14%, transparent); color: var(--white); font-size: var(--fs-2xl); cursor: pointer;
}
#tp-viewer .v-nav.l { left: var(--space-4); }
#tp-viewer .v-nav.r { right: var(--space-4); }
#tp-viewer .v-cap { position: absolute; bottom: var(--space-5); left: 0; right: 0; text-align: center; color: var(--neutral-300); font: var(--fw-medium) var(--fs-md) var(--font-sans); }

/* ---------- agenda (façon Google Agenda : glisser-déposer, pas de bandes de couleur) ---------- */
.e-legend { display: flex; gap: var(--space-4); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-2); margin-bottom: var(--space-3); }
.e-legend span { display: inline-flex; align-items: center; gap: var(--space-1-5); }
.e-legend span::before, .e-legend i { content: ''; width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--c, var(--text-faint)); display: inline-block; }
.e-head .e-legend { margin: 0; }
.e-head .e-legend span::before { display: none; }

.cal-head h1::first-letter { text-transform: uppercase; }
.cal-arrow { width: var(--h-md); padding: 0; }
.cal-arrow .ic { width: 18px; height: 18px; }
.cal-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: var(--section-gap); align-items: start; }

/* colonne « À planifier » */
.cal-side { position: sticky; top: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-1); border-radius: var(--radius-lg); transition: background var(--dur-fast) var(--ease-out); }
.cal-side.cal-over { background: var(--accent-soft); box-shadow: inset 0 0 0 var(--border-w) var(--accent-border); }
.cal-side-h { display: flex; align-items: center; gap: var(--space-1); font: var(--fw-semibold) var(--fs-md) / 1 var(--font-sans); }
.cal-hint { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); line-height: var(--lh-snug); }
.cal-todo { display: flex; flex-direction: column; gap: var(--space-2); }
.cal-card {
  display: flex; flex-direction: column; gap: var(--space-0-5); width: 100%; padding: var(--space-2) var(--space-3); text-align: left;
  border: var(--border-w) solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-xs); cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.cal-card:hover { border-color: var(--border-strong); }
.cal-card strong { font: var(--fw-medium) var(--fs-sm) / var(--lh-snug) var(--font-sans); }
.cal-card span { color: var(--text-muted); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-legend { display: flex; flex-direction: column; gap: var(--space-1-5); margin-top: var(--space-2); padding-top: var(--space-3); border-top: var(--border-w) solid var(--border); font-size: var(--fs-xs); color: var(--text-muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: var(--space-2); }
.cal-legend i { width: 8px; height: 8px; border-radius: var(--radius-full); }
.cal-legend .ev-pose i { background: var(--accent); }
.cal-legend .ev-fait i { background: var(--success); }
.cal-legend .ev-visite i { background: var(--text-faint); }

/* grille du mois */
.cal { padding: 0; overflow: hidden; }
.cal-wd, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-wd span { padding: var(--space-2) var(--space-2) var(--space-1); color: var(--text-muted); font: var(--fw-medium) var(--fs-xs) / 1 var(--font-sans); text-align: center; text-transform: uppercase; letter-spacing: 0.04em; }
.cal-day {
  min-height: 118px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-1);
  border-top: var(--border-w) solid var(--border); border-right: var(--border-w) solid var(--border); cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day:hover { background: var(--surface-2); }
.cal-day.cal-over { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent-border); }
.cal-num {
  align-self: center; min-width: 24px; height: 24px; padding: 0 var(--space-1-5); display: grid; place-items: center; border-radius: var(--radius-full);
  color: var(--text); font: var(--fw-medium) var(--fs-xs) / 1 var(--font-sans); font-variant-numeric: tabular-nums;
}
.cal-day.out .cal-num, .cal-day.out .cal-ev { color: var(--text-faint); }
.cal-day.today .cal-num { background: var(--accent); color: var(--accent-fg); font-weight: var(--fw-semibold); }
.cal-evs { display: flex; flex-direction: column; gap: var(--space-0-5); min-width: 0; }

/* événement : pose prévue = pastille pleine (déplaçable) ; réalisée / visite = point + texte */
.cal-ev {
  display: flex; align-items: center; gap: var(--space-1-5); width: 100%; min-width: 0; height: 22px; padding: 0 var(--space-1-5);
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-2); text-align: left; cursor: pointer;
  font: var(--fw-medium) var(--fs-xs) / 1 var(--font-sans);
}
.cal-ev span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev i { flex: none; width: 7px; height: 7px; border-radius: var(--radius-full); background: var(--text-faint); }
.cal-ev:hover { background: var(--surface-3); }
.cal-ev.ev-fait i { background: var(--success); }
.cal-ev.ev-pose { background: var(--accent); color: var(--accent-fg); cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.cal-ev.ev-pose i { display: none; }
.cal-ev.ev-pose:hover { background: var(--accent-hover); }
.cal-day.past .cal-ev.ev-pose { background: var(--accent-soft); color: var(--accent-text); }
.cal-more { align-self: flex-start; border: 0; background: none; padding: var(--space-0-5) var(--space-1-5); border-radius: var(--radius-sm); color: var(--text-muted); font: var(--fw-medium) var(--fs-xs) / 1.2 var(--font-sans); cursor: pointer; }
.cal-more:hover { background: var(--surface-3); color: var(--text); }

/* pendant le glisser */
.cal-drag-on, .cal-drag-on * { cursor: grabbing !important; user-select: none !important; -webkit-user-select: none !important; }
.cal-dragging { opacity: 0.35; }
.cal-ghost {
  position: fixed; left: 0; top: 0; z-index: var(--z-toast); pointer-events: none; margin: 0;
  box-shadow: var(--shadow-lg); border-radius: var(--radius-md); opacity: 0.95;
}
.cal-ghost.cal-ev { height: 28px; font-size: var(--fs-sm); }

/* fenêtre d'un jour */
#cal-pop { position: fixed; inset: 0; z-index: var(--z-modal); }
#cal-pop[hidden] { display: none; }
.cal-pop-card {
  position: absolute; width: 300px; max-height: 70vh; overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-1);
  padding: var(--space-3); background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: fade var(--dur) var(--ease-out) both;
}
.cal-pop-h { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-1); }
.cal-pop-h strong { font: var(--fw-semibold) var(--fs-md) / 1.2 var(--font-sans); }
.cal-pop-h strong::first-letter { text-transform: uppercase; }
.cal-pop-evs { display: flex; flex-direction: column; gap: var(--space-0-5); }
.cal-pop-evs .cal-ev { height: 28px; font-size: var(--fs-sm); }
.cal-pop-sec { margin: var(--space-2) 0 var(--space-1); padding-top: var(--space-2); border-top: var(--border-w) solid var(--border); color: var(--text-muted); font: var(--fw-medium) var(--fs-xs) / 1 var(--font-sans); }
.cal-pop-plan {
  display: flex; align-items: center; gap: var(--space-2); width: 100%; min-height: var(--h-md); padding: var(--space-1-5) var(--space-2);
  border: 0; border-radius: var(--radius-md); background: none; color: var(--text-2); text-align: left; cursor: pointer; font: var(--fs-sm) / var(--lh-snug) var(--font-sans);
}
.cal-pop-plan b { color: var(--text); font-weight: var(--fw-medium); }
.cal-pop-plan .ic { width: 16px; height: 16px; color: var(--text-muted); }
.cal-pop-plan:hover { background: var(--surface-3); }

/* bandeau « Annuler » */
#cal-snack {
  position: fixed; left: 50%; bottom: calc(var(--space-6) + env(safe-area-inset-bottom)); z-index: var(--z-toast); transform: translate(-50%, 20px);
  display: flex; align-items: center; gap: var(--space-4); max-width: calc(100vw - 32px); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  background: var(--neutral-900); color: var(--neutral-50); border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  font: var(--fw-medium) var(--fs-sm) / var(--lh-snug) var(--font-sans); opacity: 0; pointer-events: none;
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
#cal-snack.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#cal-snack span::first-letter { text-transform: uppercase; }
#cal-snack button { flex: none; height: var(--h-sm); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm); background: none; color: var(--accent-300); font: var(--fw-semibold) var(--fs-sm) / 1 var(--font-sans); cursor: pointer; }
#cal-snack button:hover { background: color-mix(in srgb, var(--white) 10%, transparent); }
.cal-list { display: none; }

/* ---------- carte ---------- */
.e-mapwrap { padding: 0; overflow: hidden; position: relative; }
#e-map { height: calc(100vh - 220px); min-height: 420px; }
.e-map-note { position: absolute; left: var(--space-3); bottom: var(--space-3); z-index: 500; background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-md); padding: var(--space-1-5) var(--space-3); font-size: var(--fs-sm); box-shadow: var(--shadow-md); }
.e-map-note:empty { display: none; }
.e-hq { display: grid !important; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-full); background: var(--primary); color: var(--primary-fg); box-shadow: var(--shadow-md), 0 0 0 3px var(--surface); }
.e-hq .ic { width: 16px; height: 16px; }
.e-carte .e-legend span i { border-radius: var(--radius-full); }

/* ---------- aperçu d'un document ---------- */
.e-prev-wrap { width: min(var(--preview-w), 100%); max-height: 92vh; display: flex; flex-direction: column; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-lg); }
.e-prev-bar { display: flex; align-items: center; gap: var(--space-2); background: var(--surface); border-bottom: var(--border-w) solid var(--border); padding: var(--space-3) var(--space-4); }

/* ---------- devis & factures ---------- */
.dv-sum { color: var(--text-muted); font: var(--fs-sm) var(--font-sans); padding: var(--space-1) 0 var(--space-3); font-variant-numeric: tabular-nums; }
.dv-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto 110px auto; gap: var(--space-3); align-items: center; padding: var(--space-3) 0; border-bottom: var(--border-w) solid var(--border); }
.dv-row:last-child { border-bottom: 0; }
.dv-main { text-align: left; background: none; border: 0; cursor: pointer; padding: 0; display: flex; flex-direction: column; gap: var(--space-0-5); min-width: 0; color: var(--text); }
.dv-main strong { font: var(--fw-medium) var(--fs-md) / var(--lh-snug) var(--font-sans); }
.dv-main span { color: var(--text-muted); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-main:hover strong { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
.dv-docs { display: flex; gap: var(--space-1); }
.dv-docs i { font-style: normal; font: var(--fw-medium) var(--fs-xs) / 1 var(--font-mono); background: var(--surface-3); color: var(--text-2); padding: var(--space-1) var(--space-1-5); border-radius: var(--radius-sm); }
.dv-amt { text-align: right; font: var(--fw-semibold) var(--fs-md) / 1 var(--font-sans); font-variant-numeric: tabular-nums; }
.dv-act { display: flex; gap: var(--space-1-5); }

/* ---------- tablette / téléphone ---------- */
@media (max-width: 1100px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-side { position: static; }
  .cal-todo { flex-direction: row; overflow-x: auto; padding-bottom: var(--space-1); scrollbar-width: none; }
  .cal-todo .cal-card { flex: none; width: 200px; }
  .cal-legend { flex-direction: row; flex-wrap: wrap; gap: var(--space-4); border-top: 0; padding-top: 0; margin-top: 0; }
  .e-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .e-cols, .e-cols.wide { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .dv-row { grid-template-columns: minmax(0, 1fr) auto; }
  .dv-docs, .dv-row .e-badge { display: none; }
  .dv-act { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .cal { margin-left: calc(var(--page-pad) * -1); margin-right: calc(var(--page-pad) * -1); border-radius: 0; border-left: 0; border-right: 0; }
  .cal-day { min-height: 76px; padding: var(--space-0-5); }
  .cal-ev { height: 18px; padding: 0 var(--space-1); font-size: 10.5px; gap: var(--space-1); } /* 10,5 px : nom dans une case de 50 px, hors échelle volontairement */
  .cal-ev.ev-visite { display: none; }
  .cal-list { display: block; margin-top: var(--section-gap); }
  .cal-pop-card { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: auto; max-height: 75vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom)); }
  #cal-pop { background: var(--overlay); }
  #cal-snack { bottom: calc(var(--bottombar-h) + var(--space-4) + env(safe-area-inset-bottom)); }
  .e-main { padding-top: var(--space-5); }
  .e-kpis { gap: var(--space-2); }
  .e-kpi { padding: var(--space-3) var(--space-4); }
  .e-kpi strong { font-size: var(--fs-xl); }
  .e-todo-item { align-items: flex-start; }
  .e-todo-act { width: 100%; padding-left: calc(var(--icon-box) + var(--space-3)); }
  .e-tabs { order: 3; width: 100%; justify-content: space-between; }
  .e-tabs button { padding: var(--space-2) var(--space-2); font-size: var(--fs-sm); }
  .e-form { grid-template-columns: 1fr; }
  .e-form label:nth-child(3) { grid-column: auto; }
  .e-contact { width: 100%; }
  .e-contact .e-btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .e-btn, .e-chip { transition: none; } }

/* ---------- dates de pose proposées ---------- */
.pl-sugg { display: flex; flex-wrap: wrap; align-items: stretch; gap: var(--space-2); }
.pl-chip {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: var(--space-0-5);
  min-height: var(--h-lg); padding: var(--space-1-5) var(--space-3); border: var(--border-w) solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text); cursor: pointer; box-shadow: var(--shadow-xs); text-align: left;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.pl-chip:hover { border-color: var(--success); background: var(--success-soft); }
.pl-chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.pl-chip b { display: block; font: var(--fw-semibold) var(--fs-sm) / 1.2 var(--font-sans); }
.pl-chip b::first-letter { text-transform: uppercase; }
.pl-chip span { color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.2; }
.pl-chip:first-child { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.pl-autre { display: flex; flex-direction: column; justify-content: center; gap: var(--space-0-5); color: var(--text-muted); font-size: var(--fs-xs); }
.pl-bloc { display: flex; flex-direction: column; gap: var(--space-2); width: 100%; }
.pl-titre { display: inline-flex; align-items: center; gap: var(--space-2); font: var(--fw-medium) var(--fs-sm) / 1 var(--font-sans); color: var(--text-2); }
.pl-tag { font-style: normal; color: var(--success-text); font-size: var(--fs-xs); }
.cal-day.cal-sugg { background: var(--success-soft); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--success) 45%, transparent); }
.cal-day.cal-sugg .cal-num::after { content: ''; display: inline-block; width: 6px; height: 6px; margin-left: var(--space-1); border-radius: var(--radius-full); background: var(--success); vertical-align: middle; }
.cal-day.cal-sugg.cal-over { background: var(--accent-soft); }
@media (max-width: 640px) {
  .e-todo-act .pl-sugg { width: 100%; }
  .pl-chip { flex: 1 1 calc(50% - var(--space-2)); }
  .pl-autre { flex: 1 1 100%; }
}
.e-notes-ch { margin-top: var(--space-3); padding-top: var(--space-3); border-top: var(--border-w) solid var(--border); font-size: var(--fs-sm); }
.e-notes-ch summary { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; color: var(--text-2); font-weight: var(--fw-medium); }
.e-notes-ch summary .ic { width: 16px; height: 16px; color: var(--text-muted); }
.e-notes-ch ul { margin: var(--space-2) 0 0; padding-left: var(--space-5); line-height: var(--lh-normal); }

/* ---------- brouillon de facture (modifiable avant validation) ---------- */
.fb-card { max-width: 820px; display: flex; flex-direction: column; gap: var(--space-3); }
.fb-tete, .fb-l { display: grid; grid-template-columns: minmax(0, 1fr) 64px 96px 96px 32px; gap: var(--space-2); align-items: center; }
.fb-tete { color: var(--text-muted); font: var(--fw-medium) var(--fs-xs) / 1 var(--font-sans); padding: 0 var(--space-1); }
.fb-tete span:nth-child(n+2) { text-align: right; }
.fb-lignes { display: flex; flex-direction: column; gap: var(--space-1-5); max-height: 46vh; overflow-y: auto; padding: var(--space-0-5); }
.fb-l input { box-sizing: border-box; width: 100%; min-width: 0; height: var(--h-md); padding: 0 var(--space-2); border: var(--border-w) solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text); font: var(--fs-sm) var(--font-sans); }
.fb-l input:focus { outline: none; border-color: var(--border-strong); box-shadow: var(--focus-ring); }
.fb-num { text-align: right; font-variant-numeric: tabular-nums; }
.fb-lt { text-align: right; font: var(--fw-medium) var(--fs-sm) / 1 var(--font-sans); font-variant-numeric: tabular-nums; }
.fb-x { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: var(--radius-md); background: none; color: var(--text-muted); cursor: pointer; }
.fb-x:hover { background: var(--danger-soft); color: var(--danger-text); }
.fb-x .ic { width: 16px; height: 16px; }
#fb-add { align-self: flex-start; }
.fb-form { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.fb-form label:nth-child(3) { grid-column: auto !important; }
.fb-tot { display: grid; grid-template-columns: 1fr auto; gap: var(--space-1-5) var(--space-6); margin-left: auto; min-width: 280px; padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); background: var(--surface-2); font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.fb-tot span { color: var(--text-2); }
.fb-tot b { text-align: right; font-weight: var(--fw-medium); }
.fb-tot .fb-net { padding-top: var(--space-2); border-top: var(--border-w) solid var(--border); color: var(--text); font-weight: var(--fw-semibold); font-size: var(--fs-lg); }
@media (max-width: 640px) {
  .fb-tete { display: none; }
  .fb-l { grid-template-columns: minmax(0, 1fr) 56px 84px 32px; padding-bottom: var(--space-2); border-bottom: var(--border-w) solid var(--border); }
  .fb-l .fb-des { grid-column: 1 / -1; }
  .fb-lt { display: none; }
  .fb-form { grid-template-columns: 1fr !important; }
  .fb-tot { min-width: 0; margin-left: 0; }
}

/* ---------- poses sur plusieurs jours, dates « à confirmer » ---------- */
.cal-ev small { opacity: 0.8; font-size: 0.85em; margin-left: var(--space-0-5); }
.cal-ev.ev-pose.ev-suite { background: var(--accent-soft); color: var(--accent-text); }
.cal-ev.ev-pose.ev-souple { background: var(--surface); color: var(--accent-text); box-shadow: inset 0 0 0 1.5px var(--accent); background-image: repeating-linear-gradient(135deg, transparent 0 5px, var(--accent-soft) 5px 10px); }
.e-todo-item.t-confirmer { --c: var(--stage-planifie); }
.pl-duree { display: inline-flex; align-items: center; gap: var(--space-1-5); color: var(--text-2); }
.pl-duree input { width: 64px; text-align: center; }
.dv-q { display: block; width: 100%; max-width: none; margin-bottom: var(--space-3); box-sizing: border-box; }

/* ---------- carte : épingles aux couleurs des étapes ---------- */
.map-pin-wrap { background: none; border: 0; }
.map-pin { display: block; position: relative; width: 28px; height: 28px; margin: 2px 2px 0; border-radius: 50% 50% 50% 0; background: var(--c); border: 2px solid var(--white); transform: rotate(-45deg); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28); /* ombre portée sur la carte : valeur fixe volontaire */ }
.map-pin-ic { position: absolute; inset: 0; display: grid; place-items: center; transform: rotate(45deg); color: var(--white); }
.map-pin-ic .ic { width: 15px; height: 15px; }
.map-pin-wrap:hover .map-pin { transform: rotate(-45deg) scale(1.12); }
/* fond de carte atténué : seules les épingles des clients ressortent */
#e-map .leaflet-tile-pane { filter: grayscale(0.85) contrast(0.92) brightness(1.04); }
.e-todo-item.t-completer { --c: var(--warning); }
.e-resume { margin-top: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface-2); font-size: var(--fs-md); line-height: var(--lh-normal); color: var(--text-2); }
.e-resume p { margin: 0; }
.e-resume p + p { margin-top: var(--space-2); }
.e-souhait { display: flex; align-items: center; gap: var(--space-2); color: var(--text); }
.e-souhait .ic { width: 16px; height: 16px; color: var(--text-muted); }
.e-legend .leg-etape::before { display: none; }
.e-legend .leg-etape .ic { width: 16px; height: 16px; color: var(--c); }

/* ---------- agenda : choix Semaine / Mois ---------- */
.cal-vues { display: inline-flex; gap: var(--space-0-5); padding: var(--space-0-5); border-radius: var(--radius-md); background: var(--surface-3); margin-right: var(--space-2); }
.cal-vues button { display: inline-flex; align-items: center; gap: var(--space-1-5); height: var(--h-sm); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-muted); font: var(--fw-medium) var(--fs-sm) / 1 var(--font-sans); cursor: pointer; }
.cal-vues button .ic { width: 16px; height: 16px; }
.cal-vues button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* ---------- vue semaine : une colonne par jour, une carte par chantier ---------- */
.wk { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, 0.6fr)); padding: 0; overflow: hidden; }
.wk-day { min-height: 420px; min-width: 0; display: flex; flex-direction: column; border-right: var(--border-w) solid var(--border); cursor: pointer; transition: background var(--dur-fast) var(--ease-out); }
.wk-day:last-child { border-right: 0; }
.wk-day.we { background: var(--surface-2); }
.wk-day:hover { background: var(--surface-2); }
.wk-day.cal-over { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent-border); }
.wk-day.cal-sugg { background: var(--success-soft); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--success) 45%, transparent); }
.wk-h { display: flex; align-items: baseline; gap: var(--space-2); padding: var(--space-3); border-bottom: var(--border-w) solid var(--border); }
.wk-h span { color: var(--text-muted); font: var(--fw-medium) var(--fs-xs) / 1 var(--font-sans); text-transform: uppercase; letter-spacing: 0.04em; }
.wk-h b { font: var(--fw-semibold) var(--fs-xl) / 1 var(--font-sans); font-variant-numeric: tabular-nums; }
.wk-day.today .wk-h b { color: var(--accent); }
.wk-day.past .wk-h b { color: var(--text-muted); }
.wk-evs { flex: 1; display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-2); }
.wk-libre { margin: auto; color: var(--text-faint); font-size: var(--fs-xs); }
.wk-ev {
  display: flex; flex-direction: column; gap: var(--space-1); width: 100%; min-width: 0; padding: var(--space-2) var(--space-2-5, 10px); text-align: left; cursor: pointer;
  border: var(--border-w) solid color-mix(in srgb, var(--c) 30%, var(--border)); border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--c) 8%, var(--surface)); color: var(--text); box-shadow: var(--shadow-xs);
  font: var(--fs-sm) / var(--lh-snug) var(--font-sans);
}
.wk-ev:hover { border-color: var(--c); }
.wk-ev[data-drag] { cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.wk-ev-h { display: flex; align-items: center; gap: var(--space-1); color: var(--c); font: var(--fw-medium) var(--fs-xs) / 1.2 var(--font-sans); }
.wk-ev-h .ic { width: 14px; height: 14px; flex: none; }
.wk-ev strong { font-weight: var(--fw-semibold); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.wk-ev-s { color: var(--text-muted); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-ev.ev-suite { opacity: 0.75; box-shadow: none; }
.wk-ev.ev-souple { border-style: dashed; border-color: var(--c); }
.wk-ev.ev-visite, .wk-ev.ev-fait { background: var(--surface); box-shadow: none; }
@media (max-width: 900px) {
  /* téléphone / tablette portrait : les jours les uns sous les autres */
  .wk { grid-template-columns: 1fr; }
  .wk-day { min-height: 0; flex-direction: row; border-right: 0; border-bottom: var(--border-w) solid var(--border); }
  .wk-day:last-child { border-bottom: 0; }
  .wk-h { flex-direction: column; align-items: center; justify-content: flex-start; gap: var(--space-0-5); width: 64px; flex: none; border-bottom: 0; border-right: var(--border-w) solid var(--border); }
  .wk-evs { padding: var(--space-2); }
  .wk-libre { margin: auto 0; }
  .cal-vues { margin-right: 0; }
}
.wk-evs { min-width: 0; }
.cal-side { min-width: 0; max-width: 100%; }
@media (max-width: 640px) {
  .cal-head .e-nav { display: grid; grid-template-columns: 1fr auto auto auto; gap: var(--space-2); width: 100%; }
  .cal-head .cal-vues { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .cal-head .cal-vues button { justify-content: center; }
  .cal-head .e-nav > .e-btn:not(.cal-arrow) { justify-self: start; }
}

/* ---------- fiche client : lieu du chantier ---------- */
.lieu-carte { height: 260px; border-radius: var(--radius-md); overflow: hidden; border: var(--border-w) solid var(--border); background: var(--surface-3); }
.lieu-carte .leaflet-control-layers { border: 0; border-radius: var(--radius-md); box-shadow: var(--shadow-md); font: var(--fs-xs) var(--font-sans); }
.lieu-pied { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); }
.lieu-adr { color: var(--text-2); font-size: var(--fs-sm); }
.lieu-act { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ---------- carte d'un chantier : frise, prochaine étape, documents ---------- */
.e-devis { display: flex; flex-direction: column; gap: var(--space-3); }
.e-devis-tot { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-1-5); }
.pe-frise { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: var(--space-1) 0 0; padding: 0; list-style: none; }
.pe-frise li { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--space-1); color: var(--text-faint); font: var(--fw-medium) var(--fs-xs) / 1.2 var(--font-sans); text-align: center; }
.pe-frise li::before { content: ''; position: absolute; top: 10px; left: calc(-50% + 12px); right: calc(50% + 12px); height: 2px; background: var(--border); }
.pe-frise li:first-child::before { display: none; }
.pe-frise i { position: relative; z-index: 1; width: 22px; height: 22px; display: grid; place-items: center; border-radius: var(--radius-full); border: 2px solid var(--border-strong); background: var(--surface); }
.pe-frise i .ic { width: 12px; height: 12px; }
.pe-frise li.fait { color: var(--text-2); }
.pe-frise li.fait i { background: var(--success); border-color: var(--success); color: var(--white); }
.pe-frise li.fait + li::before, .pe-frise li.fait::before { background: var(--success); }
.pe-frise li.ici { color: var(--accent-text); font-weight: var(--fw-semibold); }
.pe-frise li.ici i { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.pe { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-lg); background: var(--accent-soft); border: var(--border-w) solid var(--accent-border); }
.pe.fini { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.pe-k { display: block; color: var(--accent-text); font: var(--fw-semibold) var(--fs-xs) / 1 var(--font-sans); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--space-1-5); }
.pe.fini .pe-k { color: var(--success-text); }
.pe-h strong { display: block; font: var(--fw-semibold) var(--fs-lg) / var(--lh-tight) var(--font-sans); color: var(--text); }
.pe-h p { margin: var(--space-1) 0 0; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-normal); }
.pe-act { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.pe-act .e-btn.ok.big { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.pe-act .e-btn.ok.big:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.pe-act .pl-sugg { width: 100%; }
.pe-plus { width: 100%; font-size: var(--fs-sm); color: var(--text-2); }
.pe-plus summary { cursor: pointer; }
.pe-plus-c { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-2); }
.pe-plus-c label { display: inline-flex; align-items: center; gap: var(--space-1-5); }
.e-infos, .e-docs { border-top: var(--border-w) solid var(--border); padding-top: var(--space-3); margin: 0; }
.e-infos summary, .e-docs summary { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; color: var(--text-2); font: var(--fw-medium) var(--fs-sm) / 1 var(--font-sans); list-style: none; }
.e-infos summary::-webkit-details-marker, .e-docs summary::-webkit-details-marker { display: none; }
.e-infos summary::after, .e-docs summary::after { content: ''; width: 12px; height: 12px; margin-left: auto; background: var(--icon-chevron) no-repeat center; transition: transform var(--dur-fast); }
.e-infos[open] summary::after, .e-docs[open] summary::after { transform: rotate(180deg); }
.e-infos summary .ic, .e-docs summary .ic { width: 16px; height: 16px; color: var(--text-muted); }
.e-infos .e-resume { margin-top: var(--space-3); }
.e-infos .e-notes-ch { border-top: 0; margin-top: var(--space-3); padding-top: 0; }
.e-docs-l { display: flex; flex-direction: column; gap: var(--space-1); margin-top: var(--space-3); }
.e-doc { display: grid !important; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: var(--space-2); background: var(--surface) !important; }
.e-doc-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e-doc-d { color: var(--text-muted); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .pe-frise span { font-size: 10px; } /* 6 étapes sur 360 px : libellés compacts, hors échelle volontairement */
  .pe-act .e-btn.big { flex: 1 1 auto; }
}
/* portrait dessiné : un liseré de la couleur de l'étape */
.e-av.img { overflow: hidden; background: var(--surface-2); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px color-mix(in srgb, var(--c) 70%, transparent); }
.e-av.img .tp-avatar { width: 100%; height: 100%; display: block; }
/* photos des visites : bandeau en haut de la fiche, qui défile sur le côté */
.e-photos-card .e-photos { display: flex; gap: var(--space-2); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: var(--space-1); }
.e-photos-card .e-photos img { flex: none; width: clamp(120px, 22vw, 180px); scroll-snap-align: start; }
.e-photos-card .e-photos .e-empty { margin: 0; }
.lieu-facade { position: relative; display: block; margin-bottom: var(--space-3); border-radius: var(--radius-lg); overflow: hidden; border: var(--border-w) solid var(--border); }
.lieu-facade img { display: block; width: 100%; aspect-ratio: 2 / 1; object-fit: cover; }
.lieu-facade span { position: absolute; left: var(--space-2); bottom: var(--space-2); display: inline-flex; align-items: center; gap: var(--space-1-5); padding: var(--space-1) var(--space-2); border-radius: var(--radius-full); background: color-mix(in srgb, var(--black, #000) 55%, transparent); color: #fff; font-size: var(--fs-xs); }
.lieu-facade span .ic { width: 14px; height: 14px; }
.e-photos-card.vide { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; padding-top: var(--space-3); padding-bottom: var(--space-3); }
.e-photos-card.vide h2 { margin: 0; font-size: var(--fs-md); }
/* étape en cours : un point plein qui bat et une onde qui s'élargit, pour voir d'un coup d'œil où on en est */
.pe-frise li.ici i { border-color: var(--accent); background: var(--surface); }
.pe-frise li.ici i::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: ici-bat 1.6s ease-in-out infinite; }
.pe-frise li.ici i::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--accent); animation: ici-onde 1.6s var(--ease-out) infinite; }
@keyframes ici-bat { 50% { transform: scale(0.6); opacity: 0.6; } }
@keyframes ici-onde { from { transform: scale(1); opacity: 0.7; } to { transform: scale(2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pe-frise li.ici i::before, .pe-frise li.ici i::after { animation: none; } }

/* ===== Bilan ===== */
.e-bilan .e-card { margin-bottom: 0; }
.e-bilan > * + * { margin-top: var(--section-gap); }
.bl-h { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.bl-h h2 { margin: 0; }
.bl-conseil { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); background: var(--accent-soft); border: var(--border-w) solid var(--accent-border); color: var(--text); }
.bl-conseil .ic { flex: none; width: 22px; height: 22px; color: var(--accent-text); }
.bl-conseil p { margin: 0; font-size: var(--fs-md); }
.bl-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }
.bl-kpi { display: flex; flex-direction: column; gap: var(--space-1); }
.bl-k { color: var(--text-muted); font-size: var(--fs-sm); }
.bl-kpi strong { font: var(--fw-semibold) clamp(24px, 2vw + 12px, 32px) / 1.1 var(--font-sans); letter-spacing: var(--tracking-tight); font-variant-numeric: tabular-nums; }
.bl-sub { color: var(--text-muted); font-size: var(--fs-xs); }
.bl-evo { align-self: flex-start; margin-top: var(--space-1); padding: 2px var(--space-2); border-radius: var(--radius-full); font: var(--fw-semibold) var(--fs-xs) / 1.4 var(--font-sans); }
.bl-evo small { font-weight: var(--fw-regular, 400); opacity: 0.8; }
.bl-evo.up { background: var(--success-soft); color: var(--success-text); }
.bl-evo.down { background: var(--danger-soft, #fbeae7); color: var(--danger-text); }
.bl-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--section-gap); align-items: start; }
.bl-obj-corps { display: flex; align-items: center; gap: var(--space-5); }
.bl-anneau-w { position: relative; flex: none; width: 132px; height: 132px; }
.bl-anneau { width: 100%; height: 100%; transform: rotate(-90deg); }
.bl-anneau circle { fill: none; stroke-width: 12; }
.bl-anneau .fond { stroke: var(--surface-2); }
.bl-anneau .val { stroke: var(--accent); stroke-linecap: round; animation: anneau-remplit 1.2s var(--ease-out) both; }
@keyframes anneau-remplit { from { stroke-dashoffset: 327; } }
.bl-anneau-txt { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.bl-anneau-txt strong { font: var(--fw-semibold) 26px / 1 var(--font-sans); }
.bl-anneau-txt span { color: var(--text-muted); font-size: var(--fs-xs); margin-top: 2px; }
.bl-obj-txt p { margin: 0 0 var(--space-1-5); }
.bl-serie, .bl-record { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-3) !important; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); background: var(--surface-2); font-size: var(--fs-sm); }
.bl-serie .ic { color: var(--accent); width: 20px; height: 20px; animation: scintille-f 1.8s ease-in-out infinite; }
.bl-record .ic { color: var(--accent); width: 18px; height: 18px; }
@keyframes scintille-f { 50% { transform: scale(1.15); } }
.bl-obj-form { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-4); }
.bl-obj-form input { width: 160px; height: var(--h-md); padding: 0 var(--space-3); border: var(--border-w) solid var(--border-strong); border-radius: var(--radius-md); font: inherit; background: var(--surface); }
.bl-liste { list-style: none; margin: 0; padding: 0; }
.bl-liste li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2-5, 10px) 0; border-bottom: var(--border-w) solid var(--border); font-size: var(--fs-md); }
.bl-liste li:last-child { border-bottom: 0; }
.bl-liste li span { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--text-2); }
.bl-liste li .ic { width: 18px; height: 18px; color: var(--text-muted); }
.bl-liste b { font-variant-numeric: tabular-nums; }
.bl-legende { display: inline-flex; align-items: center; gap: var(--space-1-5); color: var(--text-muted); font-size: var(--fs-xs); }
.bl-legende i { width: 10px; height: 10px; border-radius: 3px; margin-left: var(--space-2); }
.bl-legende i.n, .bl-col i.n { background: var(--accent); }
.bl-legende i.n1, .bl-col i.n1 { background: var(--border-strong); opacity: 0.6; }
.bl-barres { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-2); height: 200px; align-items: end; }
.bl-mois { display: flex; flex-direction: column; align-items: center; gap: var(--space-1-5); height: 100%; }
.bl-mois span { color: var(--text-muted); font-size: var(--fs-xs); }
.bl-mois.ici span { color: var(--accent-text); font-weight: var(--fw-semibold); }
.bl-mois.futur .bl-col i.n { display: none; }
.bl-col { position: relative; flex: 1; width: 100%; max-width: 34px; display: flex; align-items: flex-end; justify-content: center; }
.bl-col i { position: absolute; bottom: 0; border-radius: 5px 5px 2px 2px; transform-origin: bottom; animation: barre-monte 0.8s var(--ease-out) both; }
.bl-col i.n1 { left: 0; width: 70%; }
.bl-col i.n { right: 0; width: 70%; }
.bl-mois:nth-child(n) .bl-col i { animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes barre-monte { from { transform: scaleY(0); } }
.bl-badges-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.bl-badge { display: flex; flex-direction: column; align-items: center; gap: var(--space-1-5); padding: var(--space-4) var(--space-2) var(--space-3); border-radius: var(--radius-lg); border: var(--border-w) solid var(--border); text-align: center; font-size: var(--fs-sm); }
.bl-badge strong { font-weight: var(--fw-semibold); line-height: 1.25; }
.bl-badge-ic { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--text-faint); filter: grayscale(1); }
.bl-badge-ic .ic { width: 24px; height: 24px; }
.bl-badge.ok { border-color: var(--accent-border); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%); }
.bl-badge.ok .bl-badge-ic { filter: none; color: var(--white, #fff); background: linear-gradient(160deg, var(--accent-400), var(--accent-600)); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent-600) 60%, transparent); animation: badge-brille 3s ease-in-out infinite; }
@keyframes badge-brille { 50% { box-shadow: 0 6px 22px -4px color-mix(in srgb, var(--accent-500) 75%, transparent); } }
.bl-badge-k { color: var(--accent-text); font: var(--fw-semibold) var(--fs-xs) / 1 var(--font-sans); text-transform: uppercase; letter-spacing: 0.05em; }
.bl-badge-aide { color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.3; }
.bl-prog { width: 80%; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bl-prog i { display: block; height: 100%; background: var(--accent-300); border-radius: 3px; }
.bl-top { list-style: none; margin: 0; padding: 0; }
.bl-top li { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2-5, 10px) 0; border-bottom: var(--border-w) solid var(--border); }
.bl-top li:last-child { border-bottom: 0; }
.bl-rang { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font: var(--fw-semibold) var(--fs-xs) / 1 var(--font-sans); }
.bl-top li:first-child .bl-rang { background: var(--accent); color: var(--white, #fff); }
.bl-top-nom { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bl-top-nom span { color: var(--text-muted); font-size: var(--fs-xs); }
.bl-top b { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.bl-top b small { color: var(--text-muted); font-weight: var(--fw-regular, 400); font-size: var(--fs-xs); }
@media (max-width: 980px) { .bl-kpis { grid-template-columns: 1fr 1fr; } .bl-cols { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .bl-badges-grid { grid-template-columns: 1fr 1fr; } .bl-barres { gap: 3px; height: 160px; } .bl-mois span { font-size: 10px; } .bl-obj-corps { gap: var(--space-4); } .bl-anneau-w { width: 108px; height: 108px; } }
@media (prefers-reduced-motion: reduce) { .bl-anneau .val, .bl-col i, .bl-badge.ok .bl-badge-ic, .bl-serie .ic { animation: none; } }
.bl-obj-form[hidden] { display: none; }
.e-afaire-vide { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4) 0; color: var(--text-2); }
.e-afaire-vide .ic { flex: none; width: 40px; height: 40px; color: var(--success); }
.e-afaire-vide p { margin: 0; line-height: var(--lh-normal); }
.bl-intro { margin: calc(var(--space-2) * -1) 0 var(--space-2); font-size: var(--fs-sm); }
.bl-top-img { position: relative; flex: none; width: 56px; height: 56px; display: grid; place-items: center; border-radius: var(--radius-md); background: var(--surface-2); color: var(--text-faint); }
.bl-top-img img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; padding: 4px; }
.bl-top-img .ic { width: 22px; height: 22px; }
.bl-top-img .bl-rang { position: absolute; top: -6px; left: -6px; width: 22px; height: 22px; border: 2px solid var(--surface); }
.bl-evo { background: var(--surface-2); color: var(--text-2); }
.bl-evo.up { background: var(--success-soft); color: var(--success-text); }
.e-bilan .bl-record { margin-top: var(--space-4) !important; }
.bl-top-img .bl-rang { background: var(--surface); box-shadow: var(--shadow-xs); }
.bl-top li:first-child .bl-top-img .bl-rang { background: var(--accent); }
.cal-vues a { display: inline-flex; align-items: center; gap: var(--space-1-5); height: var(--h-sm); padding: 0 var(--space-3); border-radius: var(--radius-sm); color: var(--text-muted); font: var(--fw-medium) var(--fs-sm) / 1 var(--font-sans); text-decoration: none; }
.cal-vues a .ic, .cal-vues a svg { width: 16px; height: 16px; }
.cal-vues a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.e-clients .e-head .cal-vues, .e-carte .e-head .cal-vues { margin-right: auto; }
.e-head-sub { margin-top: calc(var(--space-3) * -1); }
.bl-barres { padding-top: 22px; }
.bl-col i.n em { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 4px; white-space: nowrap; font: var(--fw-semibold) 11px / 1 var(--font-sans); font-style: normal; color: var(--text-2); font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .bl-col i.n em { font-size: 9px; } }
