/* =============================================================================
   Event Scaler — feuille de style unique.

   Trois couches : les jetons, les éléments de base, puis les composants.
   Aucune ombre portée hors anneau de focus ; les blocs se distinguent par
   l'espace et des filets, pas par de l'élévation. Un seul accent, et des
   couleurs sémantiques réservées à ce qui porte une information.
   ========================================================================== */

/* --- 0. Polices ---------------------------------------------------------- */
/*
   Une seule police est téléchargée, et elle est servie par nos soins.

   L'interface se contente de la police système : à 14 px, un grotesque neutre
   en vaut un autre, et Instrument Sans coûtait trois graisses pour une
   différence qu'on ne voit pas. Le serif, lui, reste — il porte les titres de
   page et les trois grands chiffres, et son repli Georgia a des chiffres
   elzéviriens qui descendent sous la ligne de base : les grands nombres du
   tableau de bord s'afficheraient bancals.

   Hébergée ici plutôt que chez Google : une origine externe de moins, donc un
   DNS et une poignée de main TLS de moins à la première visite, et le fichier
   prend le nom empreinté de `collectstatic` — mis en cache une fois, pour un an.
*/
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  /* `swap` : le titre s'affiche tout de suite en repli, jamais en blanc. */
  font-display: swap;
  src: url("../fonts/instrument-serif-latin.c008db4e8a97.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Le latin étendu pèse 8 Ko et n'est chargé que si un nom d'événement en a
   besoin. Sans lui, un « Łódź » dans un titre partirait en Georgia au milieu
   d'un mot. */
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/instrument-serif-latin-ext.18e8ea957b6c.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- 1. Jetons ----------------------------------------------------------- */
:root {
  --canvas:     #fbfbfa;
  --surface:    #ffffff;
  --sidebar:    #f6f6f4;
  --sunken:     #f4f4f2;

  --ink:        #191b19;
  --ink-2:      #5b615c;
  --ink-3:      #8a908a;
  --ink-4:      #b4b8b3;

  --line:       #e8e8e5;
  --line-2:     #d6d7d2;

  --accent:     #2f6b4f;
  --accent-ink: #26563f;
  --accent-bg:  #edf3ef;

  --ok:         #2f6b4f;
  --ok-bg:      #edf3ef;
  --warn:       #8a5a12;
  --warn-bg:    #fbf2e4;
  --alert:      #a13a2b;
  --alert-bg:   #fbeeeb;
  --info-bg:    #eef1f4;

  --r-control:  6px;
  --r-card:     8px;
  --r-pill:     999px;

  --sans:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;

  --sidebar-w: 216px;
}

/* --- 2. Éléments --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 500; line-height: 1.2; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.tabular, table, .kpi-value { font-variant-numeric: tabular-nums; }

/* --- 3. Ossature --------------------------------------------------------- */
.app { min-height: 100vh; }

/* Case de commande du tiroir : jamais visible, à aucune taille. */
#drawer { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 21px;
  color: var(--ink);
  padding: 0 10px 14px;
  letter-spacing: -.01em;
}
.brand img { width: 26px; height: 26px; flex: none; }
.brand--sm { padding: 0; font-size: 18px; gap: 8px; }
.brand--sm img { width: 22px; height: 22px; }
.brand:hover { text-decoration: none; }

.nav { display: flex; flex-direction: column; gap: 1px; }

.nav-item {
  display: block;
  padding: 7px 10px;
  border-radius: var(--r-control);
  color: var(--ink-2);
  font-size: 13.5px;
}
.nav-item:hover { background: rgba(25, 27, 25, .045); color: var(--ink); text-decoration: none; }
.nav-item.is-active { background: var(--surface); color: var(--ink); font-weight: 500; }

.sidebar-foot { margin-top: auto; padding-top: 14px; }

.main { min-width: 0; }
.page { max-width: 1180px; padding: 26px 28px 64px; }

/* --- 4. En-tête de page -------------------------------------------------- */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px 16px;
  margin-bottom: 22px;
}
.page-title {
  font-family: var(--serif);
  font-size: 30px;
  letter-spacing: -.015em;
  text-wrap: balance;
}
.page-sub { color: var(--ink-2); margin-top: 2px; }
.page-head .spacer { margin-left: auto; }
/* Le texte prend la place, le bouton garde la sienne sur la même ligne. */
.grow   { flex: 1; min-width: 200px; }

.section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
  font-weight: 500;
}

/* --- 5. Indicateurs ------------------------------------------------------ */
.kpi-row {
  display: grid;
  /* Autant de colonnes que d'indicateurs : trois à l'import, cinq à l'accueil. */
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 26px;
}
.kpi { padding: 18px 22px; border-left: 1px solid var(--line); }
.kpi:first-child { border-left: 0; }
.kpi-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); font-weight: 500;
}
.kpi-value {
  font-family: var(--serif);
  font-size: 38px;
  line-height: 1.05;
  margin-top: 6px;
  letter-spacing: -.02em;
}
.kpi-note { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.kpi-note a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
/* Cinq tuiles sur un écran de portable : on resserre plutôt que de déborder. */
@media (min-width: 1024px) and (max-width: 1360px) {
  .kpi { padding: 16px 16px; }
  .kpi-value { font-size: 32px; }
}

/* --- 6. Cartes ----------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}
.card + .card { margin-top: 16px; }
.grid + .card { margin-top: 16px; }
.card-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}
.card-title { font-size: 14px; font-weight: 500; }
.card-head .spacer { margin-left: auto; }
/* Le texte prend la place, le bouton garde la sienne sur la même ligne. */
.grow   { flex: 1; min-width: 200px; }
.card-body { padding: 16px 18px; }
.card-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--sunken);
  border-radius: 0 0 var(--r-card) var(--r-card);
}
/* Carte entièrement cliquable : sur un stand, la cible est la carte, pas le
   titre. L'espacement vertical vient de la grille, jamais de la marge. */
.card--link { display: block; color: inherit; }
.card--link:hover { border-color: var(--accent); text-decoration: none; }
.grid > .card + .card { margin-top: 0; }

.divided > * { border-top: 1px solid var(--line); }
.divided > *:first-child { border-top: 0; }
/* Une ligne « Aujourd'hui » : l'événement à gauche, ses deux boutons à droite,
   qui passent dessous quand l'écran est étroit. */
.today-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 18px; }
.today-row__what { flex: 1; min-width: 200px; }
.today-row__what .chip { margin-left: 6px; vertical-align: middle; }
.today-row__actions { flex-wrap: wrap; }

.empty { padding: 28px 18px; text-align: center; color: var(--ink-3); }

/* --- 7. Tableaux --------------------------------------------------------- */
table { border-collapse: collapse; width: 100%; }
.table th {
  text-align: left;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); font-weight: 500;
  padding: 9px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--sunken);
  white-space: nowrap;
}
.table th .th-sort { color: inherit; }
.table th .th-sort:hover { color: var(--accent-ink); }
.table td { padding: 11px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--sunken); }
.num { text-align: right; }
/* Sa propre ligne dans un tableau partagé (objectifs d'un événement). */
.table tr.is-me td { background: var(--accent-bg); }

/* --- 8. Pastilles et puces ----------------------------------------------- */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--info-bg);
  color: var(--ink-2);
}
.pill--ok    { background: var(--ok-bg);    color: var(--ok); }
.pill--warn  { background: var(--warn-bg);  color: var(--warn); }
.pill--alert { background: var(--alert-bg); color: var(--alert); }
.pill--solid { background: var(--accent); color: #fff; }

/* Statut d'événement : un attribut plutôt qu'une cascade de conditions. */
/* Envoi vers Pipedrive (`Lead.sync_status`). */
.pill[data-sync="PENDING"]  { background: var(--warn-bg);  color: var(--warn); }
.pill[data-sync="SYNCED"]   { background: var(--ok-bg);    color: var(--ok); }
.pill[data-sync="ERROR"]    { background: var(--alert-bg); color: var(--alert); }
.pill[data-sync="DISABLED"] { background: var(--sunken);   color: var(--ink-3); }
.sync-error { color: var(--alert); }
.lead-row { padding: 9px 18px; }

.pill[data-status="PROPOSED"]    { background: var(--info-bg);  color: var(--ink-2); }
.pill[data-status="CONSIDERING"] { background: var(--warn-bg);  color: var(--warn); }
.pill[data-status="CONFIRMED"]   { background: var(--ok-bg);    color: var(--ok); }
.pill[data-status="READY"]       { background: var(--accent);   color: #fff; }
.pill[data-status="DONE"]        { background: var(--sunken);   color: var(--ink-3); }
.pill[data-status="CANCELLED"],
.pill[data-status="REJECTED"]    { background: var(--alert-bg); color: var(--alert); }

.pill[data-booking="BOOKED"]     { background: var(--ok-bg);    color: var(--ok); }
.pill[data-booking="TO_BOOK"]    { background: var(--warn-bg);  color: var(--warn); }
.pill[data-booking="NOT_NEEDED"] { background: var(--sunken);   color: var(--ink-3); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1.5px 7px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-control);
  font-size: 11.5px;
  color: var(--ink-2);
  background: var(--surface);
  white-space: nowrap;
}
.chip--ok    { border-color: #b9d3c5; background: var(--ok-bg);    color: var(--ok); }
.chip--warn  { border-color: #e6cfa4; background: var(--warn-bg);  color: var(--warn); }
.chip--alert { border-color: #e6bdb4; background: var(--alert-bg); color: var(--alert); }
.chip .lvl { color: var(--ink-3); }
.chip--ok .lvl, .chip--warn .lvl, .chip--alert .lvl { color: inherit; opacity: .75; }

/* --- 9. Boutons ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--sunken); text-decoration: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--sunken); color: var(--ink); }
.btn--danger { border-color: #e2bdb5; color: var(--alert); }
.btn--danger:hover { background: var(--alert-bg); }
.btn--sm { padding: 4px 9px; font-size: 12px; }
.btn--lg { padding: 11px 18px; font-size: 15px; }
.btn--block { width: 100%; }

.link-quiet { color: var(--ink-2); }
.link-quiet:hover { color: var(--accent-ink); }

/* --- 10. Formulaires ----------------------------------------------------- */
.field { min-width: 0; }
.field > label, .label {
  display: block;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); font-weight: 500;
  margin-bottom: 4px;
}
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-control);
  padding: 7px 10px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 15px; height: 15px; }
textarea { resize: vertical; }
select[multiple] { padding: 4px; }
select.select--auto { width: auto; }

.helptext { display: block; font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.errorlist { color: var(--alert); font-size: 12px; margin-top: 4px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; }
.check input { margin-top: 2px; flex: 0 0 auto; }
.check--boxed { background: var(--sunken); border-radius: var(--r-control); padding: 11px 13px; }
/* Un formulaire qu'on remplit au doigt : étroit, centré. */
.form-narrow { max-width: 620px; margin: 0 auto; }
/* Une confirmation de suppression : le filet vire au rouge, sans plus. */
.card--danger { border-color: #ebc9c1; }
/* Le scan d'un QR : un bouton, une ligne d'état dessous. */
.scan .btn { cursor: pointer; }
.scan p { margin: 6px 0 0; min-height: 1.4em; }
/* La carte de visite : deux boutons de même largeur, l'appareil et la galerie. */
.scan-cards { margin-top: 8px; }
.scan-cards .btn { flex: 1 1 200px; }
/* Le QR d'un badge, redessiné pour l'app du salon : assez grand pour un téléphone. */
.badge-qr { margin: 0; text-align: center; }
.badge-qr img { display: block; width: 100%; max-width: 220px; aspect-ratio: 1; margin: 0 auto 6px; }
/* Présent pour le clavier et le lecteur d'écran, invisible à l'œil. */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Un menu où l'on cherche (`static/js/select-search.js`) : le <select> reste
   dans le formulaire, masqué ; une case à son allure devient, à l'ouverture,
   un champ où l'on tape, au-dessus de la liste filtrée. */
.select-search { position: relative; }
.select-search__native { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.select-search__toggle {
  display: flex; align-items: center; width: 100%; min-height: 40px;
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%235b615c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  border: 1px solid var(--line-2); border-radius: var(--r-control);
  padding: 7px 30px 7px 10px;
}
.select-search__input { min-height: 40px; }
.select-search__toggle:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg);
}
.select-search__value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-search__panel {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0;
  width: 100%; min-width: 240px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-control);
  padding: 6px;
}
.select-search__list { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow-y: auto; }
.select-search__option {
  display: flex; align-items: center; min-height: 40px; padding: 6px 10px;
  border-radius: var(--r-control); cursor: pointer; font-size: 13.5px;
}
/* `display: flex` l'emporterait sur l'attribut `hidden` qui filtre la liste. */
.select-search [hidden] { display: none; }
.select-search__option[aria-selected="true"] { font-weight: 600; }
.select-search__option.is-active { background: var(--accent-bg); color: var(--accent-ink); }
.select-search__empty { padding: 10px; color: var(--ink-3); font-size: 13px; }

fieldset { border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px 16px; margin: 0; }
legend { padding: 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 500; }

/* --- 11. Messages -------------------------------------------------------- */
.notice {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface);
  font-size: 13.5px;
}
.notice--success { background: var(--ok-bg);    border-color: #cfe1d7; color: var(--ok); }
.notice--warning { background: var(--warn-bg);  border-color: #ecd9b4; color: var(--warn); }
.notice--error   { background: var(--alert-bg); border-color: #ebc9c1; color: var(--alert); }
/* Le bandeau d'abonnement ouvre la page : il se cale plus haut que le reste du
   contenu, sans quoi il flotte au milieu du blanc au-dessus du titre. */
.notice--banner { margin: -12px 0 18px; }

/* --- 12. Divers ---------------------------------------------------------- */
.progress { height: 4px; background: var(--line); border-radius: var(--r-pill); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: var(--r-pill); }
.progress--warn > span { background: #c08b2e; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-bg); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500;
}

.menu {
  position: absolute; z-index: 40;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-card);
  padding: 4px;
}
.menu a, .menu button {
  display: block; width: 100%; text-align: left;
  padding: 7px 10px; border-radius: var(--r-control);
  font-size: 13.5px; color: var(--ink); background: none; border: 0; cursor: pointer; font-family: inherit;
}
.menu a:hover, .menu button:hover { background: var(--sunken); text-decoration: none; }
.menu .sep { border-top: 1px solid var(--line); margin: 4px 0; }

details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::marker { content: ""; }
.caret { display: inline-block; color: var(--ink-3); transition: transform .12s ease; }
details[open] > summary .caret { transform: rotate(90deg); }

/* --- 13. Utilitaires ----------------------------------------------------- */
.row   { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row--tight { gap: 6px; }
.row--top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack--lg { gap: 18px; }
.grid  { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Colonne principale + colonne latérale. Un `style` en ligne l'emporterait sur
   la requête média : ces proportions doivent vivre dans la feuille. */
.grid--main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.grid--wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid--auto { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.span-2 { grid-column: span 2; }
/* Dans une grille de filtres, une case ou un bouton s'aligne sur le bas des champs. */
.field-end { align-self: end; }
/* Les boutons d'un formulaire de filtres : sur leur propre ligne, côte à côte. */
.filter-actions { grid-column: 1 / -1; display: flex; gap: 6px; align-items: center; }
.spacer { margin-left: auto; }
/* Le texte prend la place, le bouton garde la sienne sur la même ligne. */
.grow   { flex: 1; min-width: 200px; }
.muted { color: var(--ink-2); }
.dim   { color: var(--ink-3); }
.small { font-size: 12.5px; }
.tiny  { font-size: 11.5px; }
.strong { font-weight: 500; }
.serif { font-family: var(--serif); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scroller { overflow-x: auto; }
.rule { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }
.mt-0 { margin-top: 0 } .mt-1 { margin-top: 8px } .mt-2 { margin-top: 16px } .mt-3 { margin-top: 24px }
.mb-1 { margin-bottom: 8px } .mb-2 { margin-bottom: 16px } .mb-3 { margin-bottom: 24px }
.hide-sm { display: none; }

/* --- 14. Grand écran ----------------------------------------------------- */
@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; height: 100vh; }
  .hide-sm { display: revert; }
  .only-sm { display: none !important; }
}

/* --- 15. Petit écran ----------------------------------------------------- */
@media (max-width: 1023px) {
  .page { padding: 18px 16px 96px; }  /* les 96 px du bas : la place de .action-bar */

  /* La barre sous le pouce : deux boutons, ou un seul sur toute la largeur.
     Une notice (plafond atteint) prend aussi toute la largeur. */
  .action-bar {
    position: fixed; inset: auto 0 0 0; z-index: 20;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  }
  .action-bar > :only-child, .action-bar .notice { grid-column: 1 / -1; margin: 0; }

  /* Tiroir piloté par la case masquée : ouvrable au doigt, sans JavaScript. */
  .topbar {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 30;
  }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50;
    width: 268px; max-width: 82vw;
    transform: translateX(-100%);
    transition: transform .18s ease;
    overflow-y: auto;
  }
  #drawer:checked ~ .app .sidebar { transform: none; }
  .scrim {
    position: fixed; inset: 0; z-index: 45;
    background: rgba(25, 27, 25, .3);
    opacity: 0; pointer-events: none; transition: opacity .18s ease;
  }
  #drawer:checked ~ .app .scrim { opacity: 1; pointer-events: auto; }
  #drawer:focus-visible ~ .app .burger { outline: 2px solid var(--accent); outline-offset: 2px; }

  .kpi-row { grid-auto-flow: row; grid-template-columns: 1fr; }
  .kpi { border-left: 0; border-top: 1px solid var(--line); padding: 14px 16px; }
  .kpi:first-child { border-top: 0; }
  .kpi-value { font-size: 30px; }
  .grid--2, .grid--3, .grid--main, .grid--wide { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .page-title { font-size: 24px; }
}

@media (max-width: 640px) {
  /* Sous 16px, iOS zoome à chaque mise au point d'un champ. */
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; }

  /* Les tableaux deviennent des fiches ; chaque cellule porte son intitulé. */
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr {
    border: 1px solid var(--line); border-radius: var(--r-card);
    padding: 6px 2px; margin-bottom: 10px; background: var(--surface);
  }
  .table tbody tr:hover { background: var(--surface); }
  .table td { border: 0 !important; padding: 5px 14px; display: flex; gap: 12px; align-items: baseline; }
  .table td::before {
    content: attr(data-label);
    flex: 0 0 6rem;
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--ink-3); font-weight: 500;
  }
  .table td[data-label=""]::before { display: none; }
  .table td > * { min-width: 0; }
  .num { text-align: left; }
}

/* --- 16. Pages publiques -------------------------------------------------- */
/* Connexion et formulaire de stand : une colonne, des cibles généreuses. */
.public-shell {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  padding: 28px 16px calc(28px + env(safe-area-inset-bottom));
}
.public-card {
  width: 100%; max-width: 430px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 26px 24px;
}
.public-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 26px;
  text-align: center;
  letter-spacing: -.015em;
}
.public-brand img { width: 48px; height: 48px; }
.public-title { font-family: var(--serif); font-size: 24px; text-align: center; }
.public-lede { text-align: center; color: var(--ink-2); }

/* Sur un stand, on remplit debout : les champs doivent être grands. */
.public .field > label { font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--ink-2); }
.public input:not([type=checkbox]), .public select, .public textarea {
  font-size: 16px;
  padding: 11px 13px;
}
.public .btn { padding: 13px 18px; font-size: 15px; }

/* --- 17. Blocs de tâche (modèles de checklist) ----------------------------- */
.task-row { background: var(--sunken); }
.task-row .field > label { color: var(--ink-3); }

/* --- 17c. Lien d'invitation ------------------------------------------------ */
/* Le lien se lit et se copie, il ne se saisit pas : le champ reste un champ
   pour que la sélection au clavier marche, mais s'efface visuellement. */
.invitation-link {
  flex: 1; min-width: 0; background: var(--sunken); border: 1px solid var(--line);
  border-radius: var(--r-control); color: var(--ink-2);
  font-size: 12px; padding: 6px 9px; text-overflow: ellipsis;
}
.invitation--fresh { background: var(--ok-bg); }
/* Même champ pour l'adresse de dépôt ; le retour « copié » garde sa place
   vide pour que la carte ne saute pas. */
.copy-address-feedback { color: var(--ok); min-height: 20px; margin: 0; }

/* --- 17b. Calendrier ------------------------------------------------------- */
/* FullCalendar injecte ses styles : on l'accorde au reste plutôt que de le
   laisser détonner. */
/* Le filet par défaut est trop clair pour une grille : à cette densité, la
   structure du mois disparaît. Le calendrier prend le filet appuyé. */
.fc { --fc-border-color: var(--line-2); --fc-today-bg-color: var(--accent-bg); font-size: 13px; }
.fc .fc-toolbar-title { font-family: var(--serif); font-size: 20px; font-weight: 400; }
.fc .fc-button {
  background: var(--surface); border: 1px solid var(--line-2); color: var(--ink);
  font-size: 12.5px; font-weight: 400; padding: 5px 11px; border-radius: var(--r-control);
  text-transform: none; box-shadow: none;
}
.fc .fc-button:hover { background: var(--sunken); }
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.fc .fc-button-primary:disabled { background: var(--sunken); border-color: var(--line); color: var(--ink-3); }
.fc .fc-col-header-cell-cushion { color: var(--ink-3); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 7px 4px; }
.fc .fc-daygrid-day-number { color: var(--ink-2); font-size: 12px; }
.fc .fc-event { border-radius: 3px; border: 0; }
.fc .fc-list-day-cushion { background: var(--sunken); }

/* --- 17d. E-mail d'origine ------------------------------------------------ */
/* À côté du formulaire de modification : on lit à droite, on remplit à gauche.
   Le corps garde ses retours à la ligne et défile seul au-delà de l'écran. */
.mail-facts { display: flex; flex-direction: column; gap: 6px; font-size: 13px; margin: 0 0 12px; }
.mail-facts > div { display: flex; gap: 12px; }
.mail-facts dt { color: var(--ink-3); flex: 0 0 84px; }
.mail-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.mail-body {
  font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 60vh; overflow: auto; padding: 12px;
  background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r-control);
}
.mail-aside { align-self: start; position: sticky; top: 16px; }
/* Sur une colonne, l'e-mail passe avant le formulaire — c'est lui qu'on lit
   d'abord — et se borne à un demi-écran pour ne pas repousser les champs. */
@media (max-width: 1023px) {
  .mail-aside { position: static; order: -1; }
  .mail-body { max-height: 40vh; }
}

/* --- 18. Impression ------------------------------------------------------ */
@media print {
  .sidebar, .topbar, .scrim, .no-print { display: none !important; }
  .app { display: block; }
  .page { padding: 0; }
}

/* --- Prise de rendez-vous : le calendrier occupe la place, le reste s'efface. */
.book-frame { display: block; width: 100%; height: 720px; border: 0; border-top: 1px solid var(--line); }
@media (max-width: 1024px) { .book-frame { height: 640px; } }
.lead-figures { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 18px; border-bottom: 1px solid var(--line); color: var(--ink-2); }
/* Le statut d'un lead : du stand au contrat. Seul l'aboutissement porte le vert. */
.pill[data-stage="MET"]            { background: var(--sunken);  color: var(--ink-3); }
.pill[data-stage="RECONTACTED"]    { background: var(--info-bg); color: var(--ink-2); }
.pill[data-stage="MEETING_BOOKED"] { background: var(--warn-bg); color: var(--warn); }
.pill[data-stage="WON"]            { background: var(--ok-bg);   color: var(--ok); }

/* --- Écrire à un lead : une conversation, ce qui est parti à droite ------- */
/* Pas d'ombre ni de couleur vive : la bulle sortante prend le fond d'accent
   doux, comme un statut « fait », et un mail refusé le fond d'alerte. */
.chat { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.chat-empty { color: var(--ink-3); font-size: 13px; text-align: center; padding: 18px 0; }
.chat-bubble {
  align-self: flex-end; max-width: min(560px, 92%);
  background: var(--accent-bg); border: 1px solid #cfe1d7;
  border-radius: 12px 12px 4px 12px; padding: 11px 14px;
}
.chat-bubble--failed { background: var(--alert-bg); border-color: #ebc9c1; }
.chat-bubble__subject { font-weight: 600; margin-bottom: 4px; overflow-wrap: anywhere; }
.chat-bubble__body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; }
.chat-bubble__meta { font-size: 12px; color: var(--ink-3); margin-top: 6px; text-align: right; }
.chat-compose { border-top: 1px solid var(--line); padding: 16px 18px; }
.chat-compose textarea { min-height: 180px; }
.chat-footer-preview { white-space: pre-wrap; font-size: 12px; color: var(--ink-3); border-left: 2px solid var(--line); padding-left: 10px; }
.placeholder-list { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 640px) {
  .chat { padding: 12px; }
  .chat-compose { padding: 12px; }
  .chat-compose .btn--primary { width: 100%; }
}
.placeholder-help dd { margin: 0; }
/* Un libellé pour les lecteurs d'écran, invisible à l'œil. */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.select--sm { width: auto; padding-top: 5px; padding-bottom: 5px; font-size: 13px; }
/* Les actions d'un modèle restent au pied de la carte, quelle que soit sa hauteur. */
.template-card { display: flex; flex-direction: column; }
.template-card > .card-body { flex: 1; }

/* --- Follow-up : un lead à la fois, l'action au centre --------------------- */
/* En séance, la navigation s'efface : il ne reste que la carte. */
.app:has(.page--focus) .sidebar,
.app:has(.page--focus) .topbar { display: none; }
@media (min-width: 1024px) { .app:has(.page--focus) { grid-template-columns: minmax(0, 1fr); } }
.page--focus { max-width: none; }

.deck { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.deck--page { margin: 0; max-width: 980px; }
.deck-top { display: flex; flex-direction: column; gap: 8px; }
.deck-card > * + * { border-top: 1px solid var(--line); }
.deck-lead { display: flex; flex-direction: column; gap: 8px; }
.deck-name { font-size: 22px; font-weight: 600; line-height: 1.2; letter-spacing: -.01em; overflow-wrap: anywhere; }
.deck-facts, .deck-contact { flex-wrap: wrap; }
.deck-notes { background: var(--sunken); border-radius: var(--r-control); padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.deck-action { display: flex; flex-direction: column; gap: 12px; }
.deck-action > [data-copy] { align-self: flex-start; }
.deck-step { font-size: 17px; font-weight: 600; }
.deck-step-meta { text-transform: uppercase; letter-spacing: .05em; }
.deck-late { color: var(--warn); }
.deck-script { white-space: normal; background: var(--sunken); border-radius: var(--r-control); padding: 12px 14px; color: var(--ink-2); }
.deck-outcomes { display: flex; flex-direction: column; gap: 10px; }
.deck-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.deck-ends { flex-wrap: wrap; }
.deck-note textarea { margin-top: 6px; }
.deck-history h3 { text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.deck-hint { text-align: center; }
kbd {
  font: 500 10.5px/1 var(--sans); color: var(--ink-3);
  border: 1px solid var(--line-2); border-radius: 4px; padding: 2px 5px;
}
.btn--primary kbd { color: inherit; border-color: rgba(255, 255, 255, .45); }
@media (max-width: 1024px) { kbd { display: none; } }

.followup-start { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
.followup-count { font-size: 18px; font-weight: 600; }
.followup-go { padding: 14px 28px; font-size: 16px; }
.pill[data-followup="BOOKED"] { background: var(--ok-bg); color: var(--ok); }
.pill[data-followup="LOST"]   { background: var(--sunken); color: var(--ink-3); }
.followup-figures { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 18px; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.followup-figures .deck-late { font-weight: 500; }

.sequence-steps { display: flex; flex-direction: column; gap: 4px; list-style: decimal inside; }
.sequence-timeline { list-style: none; padding: 0; margin: 0; }
.input--narrow { max-width: 90px; }
.deck-languages { flex-wrap: wrap; align-items: center; }
.step-languages { display: flex; flex-direction: column; gap: 8px; }
.step-language { border: 1px solid var(--line); border-radius: var(--r-control); padding: 8px 12px; }

/* --- Tableau des événements ---------------------------------------------- */
/* Les onglets Liste / Tableau / Calendrier : du texte souligné, pas des boutons,
   pour qu'ils ne concurrencent pas l'action principale de la page. */
.view-tabs { display: flex; gap: 16px; margin-top: 6px; font-size: 13px; }
.view-tab { color: var(--ink-3); padding-bottom: 3px; border-bottom: 2px solid transparent; }
.view-tab:hover { color: var(--ink); text-decoration: none; }
.view-tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }

.board-views { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.board-views .chip { font-size: 12.5px; padding: 3px 10px; }
.board-views .chip:hover { border-color: var(--accent); text-decoration: none; }
.board-views .chip.is-active { border-color: var(--accent); background: var(--accent-bg); color: var(--accent-ink); }

.board-config__main { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.board-fields { display: flex; flex-wrap: wrap; gap: 6px 16px; border: 0; padding: 0; margin: 0; }
.board-fields legend { width: 100%; margin-bottom: 4px; }
.board-config__check { align-self: end; padding-bottom: 8px; }
.board-save { flex-wrap: wrap; }
.input--narrow-text { max-width: 200px; }

/* Les colonnes défilent à l'horizontale plutôt que de s'écraser : une carte
   de 260 px reste lisible, une colonne de 90 px non. */
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr);
  gap: 12px; overflow-x: auto; padding-bottom: 8px;
  scroll-snap-type: x proximity;
}
.board-col {
  background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r-card);
  display: flex; flex-direction: column; min-height: 120px; scroll-snap-align: start;
}
.board-col.is-over { border-color: var(--accent); background: var(--accent-bg); }
.board-col__head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.board-col__title { font-size: 13px; font-weight: 500; }
.board-col__budget { width: 100%; }
.board-col__cards { display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.board-col__empty { text-align: center; padding: 12px 0; }

.board-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-control);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
}
.board-card[draggable] { cursor: grab; }
.board-card.is-dragging { opacity: .5; }
.board-card__name { font-weight: 500; color: var(--ink); }
.board-card__facts { display: grid; gap: 2px; margin: 0; }
.board-card__facts > div { display: flex; gap: 6px; }
.board-card__facts dt { color: var(--ink-3); min-width: 74px; }
.board-card__facts dd { margin: 0; color: var(--ink-2); }
.board-card__progress { flex: 1; min-width: 52px; }
.board-card__move select { font-size: 12px; padding: 4px 6px; width: 100%; }

@media (max-width: 1023px) {
  .board { grid-auto-columns: 82%; }
}

/* --- Reporting ------------------------------------------------------------ */
.report-filters { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: end; }
.report-filters .field { min-width: 150px; }
.report-filters__scales { display: flex; flex-wrap: wrap; gap: 4px 14px; border: 0; margin: 0; padding: 0; }
.report-filters__scales legend {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3);
  margin-bottom: 6px; width: 100%;
}
.kpi-row--tight { margin-bottom: 12px; }

/* L'envergure est ordinale : un seul vert, du plus clair au plus foncé. Le
   plus clair passe sous 3:1 sur blanc, d'où la légende permanente et le
   tableau des chiffres sous le graphique. */
[data-scale="LARGE"]  { --scale-fill: #2f6b4f; }
[data-scale="MEDIUM"] { --scale-fill: #5b8f73; }
[data-scale="SMALL"]  { --scale-fill: #8fb59f; }
[data-scale="none"]   { --scale-fill: #c9ccc7; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none; margin: 0; padding: 0; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 2px; background: var(--scale-fill, var(--ink-4)); }
.swatch--pending { background: transparent; border: 1px dashed var(--ink-3); }

.stack-chart {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(28px, 1fr);
  gap: 8px; height: 200px; overflow-x: auto;
  border-bottom: 1px solid var(--line-2); padding-top: 4px;
}
.stack-chart__col { display: grid; grid-template-rows: 18px 1fr; min-width: 0; position: relative; padding-bottom: 20px; }
.stack-chart__total { text-align: center; color: var(--ink-2); white-space: nowrap; }
/* La colonne est la cible du survol, la barre reste fine : six mois ne
   doivent pas donner six pavés. */
.stack-chart__bar { display: flex; flex-direction: column-reverse; gap: 2px; height: 100%; width: 100%; max-width: 44px; margin: 0 auto; }
.stack-chart__seg { display: block; background: var(--scale-fill); min-height: 3px; }
/* Seule l'extrémité libre de la pile est arrondie : la base reste posée sur l'axe. */
.stack-chart__bar > .stack-chart__seg:last-child { border-radius: 4px 4px 0 0; }
.stack-chart__seg--pending { background: transparent; border: 1px dashed var(--ink-3); border-bottom: 0; }
.stack-chart__label { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; white-space: nowrap; }

.minicharts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px 24px; }
.minichart { margin: 0; }
.minichart__plot {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; align-items: end;
  height: 110px; margin-top: 8px; border-bottom: 1px solid var(--line-2);
}
.minichart__col { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; }
.minichart__value { text-align: center; color: var(--ink-2); margin-bottom: 3px; }
.minichart__bar { display: block; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; width: 100%; max-width: 36px; margin: 0 auto; }
.minichart__col.is-muted .minichart__bar { background: var(--line-2); }
.minichart__axis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; margin-top: 4px; }

@media (max-width: 1023px) {
  .kpi-row--tight { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
}
