/* HuttoMap CRM — page /crm. Version 2 (cahier §12) : sobre et dense.
   Jetons propres au CRM ; styles.css reste chargé pour la base (police, :root de la carte). */

body.crm {
  --hutto: #2E5E3A; --hutto-dark: #234a2d; --hutto-light: #EAF3DE; --hutto-tint: #f3f8f4;
  --ink: #1d2420; --ink-2: #3c4741; --muted: #66726a; --line: #e4e7e2; --line-2: #eef0ec;
  --bg: #f5f6f3; --panel: #fff; --red: #c0392b; --red-bg: #fbe9e7; --amber: #b7791f; --amber-bg: #fdf3dc;
  --r: 8px; --r-lg: 10px; --shadow: 0 1px 2px rgba(20,30,24,.06); --shadow-pop: 0 10px 30px rgba(20,30,24,.16);
  --top-h: 52px; --nav-w: 196px;
  background: var(--bg); font-size: 13px; color: var(--ink);
}
body.crm #gate { padding: 60px 18px; text-align: center; color: var(--muted); }
.ic { width: 16px; height: 16px; flex: none; vertical-align: -3px; }

/* ---------- En-tête ---------- */
.crm-top { position: sticky; top: 0; z-index: 40; height: var(--top-h); display: flex; align-items: center; gap: 14px; padding: 0 14px; background: var(--hutto); color: #fff; }
.crm-brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; flex: none; }
.crm-brand img { height: 28px; background: #fff; border-radius: 6px; padding: 3px 7px; display: block; }
.crm-brand span { font-weight: 600; font-size: 13px; letter-spacing: .04em; opacity: .9; }
.crm-search { flex: 1; max-width: 620px; position: relative; display: flex; align-items: center; }
.crm-search-ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,.75); display: flex; pointer-events: none; }
.crm-search input { width: 100%; height: 34px; padding: 0 34px 0 34px; border-radius: var(--r); border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.12); color: #fff; font-size: 13.5px; }
.crm-search input::placeholder { color: rgba(255,255,255,.72); }
.crm-search:focus-within .crm-search-ic { color: var(--muted); }
.crm-kbd { position: absolute; right: 8px; font: 11px ui-monospace, Consolas, monospace; color: rgba(255,255,255,.8); border: 1px solid rgba(255,255,255,.35); border-radius: 4px; padding: 0 5px; }
.crm-search:focus-within .crm-kbd { display: none; }
.crm-top-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; flex: none; }
.crm-topbtn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: var(--r); border: none; background: none; color: #fff; font: inherit; font-size: 13px; cursor: pointer; text-decoration: none; opacity: .92; }
.crm-topbtn:hover { background: rgba(255,255,255,.12); opacity: 1; }
.crm-topbtn.on { background: rgba(255,255,255,.2); }
.crm-topbtn[hidden] { display: none; }

/* ---------- Mise en page ---------- */
.crm-layout { display: flex; min-height: calc(100vh - var(--top-h)); }
.crm-layout[hidden] { display: none; }
.crm-nav { width: var(--nav-w); flex: none; background: var(--panel); border-right: 1px solid var(--line); padding: 10px 8px; position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow-y: auto; }
.crm-nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r); color: var(--ink-2); text-decoration: none; font-size: 13px; margin-bottom: 1px; }
.crm-nav a .ic { color: var(--muted); }
.crm-nav a:hover { background: var(--bg); }
.crm-nav a.on { background: var(--hutto-light); color: var(--hutto-dark); font-weight: 600; }
.crm-nav a.on .ic { color: var(--hutto); }
.crm-nav a[hidden] { display: none; }
.crm-nav .nav-n { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--muted); }
.crm-nav a.on .nav-n { color: var(--hutto); }
.crm-nav-sep { border-top: 1px solid var(--line); margin: 10px 4px; }
.crm-main { flex: 1; min-width: 0; padding: 14px 20px 60px; }

/* ---------- En-tête d'écran (titre + résumé d'une ligne + actions) ---------- */
.crm-summary { margin-bottom: 12px; }
.crm-summary .phrase { font-size: 13px; color: var(--ink-2); margin: 0; display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; }
.page-head { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 18px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.page-head .facts { display: flex; gap: 4px 14px; flex-wrap: wrap; color: var(--ink-2); font-size: 13px; }
.page-head .facts b { color: var(--ink); font-variant-numeric: tabular-nums; }
.page-head .facts .late b { color: var(--red); }
.page-head .tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.page-head .stamp { color: var(--muted); font-size: 12px; }
.crm-summary .counters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.crm-counter { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r); padding: 5px 10px; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.crm-counter b { font-size: 14px; margin-right: 4px; }
.crm-counter.on { border-color: var(--hutto); background: var(--hutto-light); }

.crm-muted { color: var(--muted); font-size: 12.5px; }
.crm-error { color: var(--red); font-size: 13px; }

/* ---------- Boutons ---------- */
.crm-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; font-size: 12.5px; text-decoration: none; white-space: nowrap; }
.crm-btn:hover { border-color: #cfd4cc; background: #fafbf9; }
.crm-btn:disabled { opacity: .5; cursor: default; }
.crm-btn.primary { background: var(--hutto); color: #fff; border-color: var(--hutto); }
.crm-btn.primary:hover { background: var(--hutto-dark); }
.crm-btn.ghost { border-color: transparent; background: none; }
.crm-btn.ghost:hover { background: var(--line-2); }
.crm-btn.small { height: 24px; padding: 0 8px; font-size: 11.5px; }
.crm-btn.icon { width: 30px; padding: 0; justify-content: center; }
.crm-btn .badge { background: var(--hutto); color: #fff; border-radius: 9px; font-size: 10.5px; padding: 0 6px; line-height: 16px; }

/* ---------- Tableaux ---------- */
.crm-table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); overflow-x: auto; box-shadow: var(--shadow); }
table.crm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.crm-table th, .crm-table td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); text-align: left; white-space: nowrap; vertical-align: top; }
.crm-table thead th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; background: #fafbf9; position: sticky; top: 0; z-index: 1; border-bottom: 1px solid var(--line); }
.crm-table tbody tr { cursor: pointer; }
.crm-table tbody tr:hover { background: var(--hutto-tint); }
.crm-table tbody tr:last-child td { border-bottom: none; }
.crm-table .sub { display: block; color: var(--muted); font-size: 11.5px; margin-top: 1px; }

/* ---------- Statuts ---------- */
.pill { display: inline-block; font-size: 11.5px; font-weight: 500; padding: 1px 8px; border-radius: 10px; white-space: nowrap; line-height: 18px; }
/* Couleurs de statut reprises d'Airtable */
.st-unprocessed { background: #eceeed; color: #444; }
.st-contact-initiated { background: #fbe1ef; color: #8a2457; }
.st-in-discussion { background: #fdf1c7; color: #7a5a00; }
.st-waiting-for-a-visit { background: #d5f2ee; color: #0d625a; }
.st-visited { background: #dff3d4; color: #2c6312; }
.st-waiting-to-be-transfered-in-app { background: #1f4fa3; color: #fff; }
.st-in-app-not-published { background: #dff3d4; color: #2c6312; }
.st-in-app-and-published { background: #2e7d32; color: #fff; }
.st-on-hold-inactive { background: #fde3c8; color: #8a4b08; }
.st-rejected { background: #f8d1cf; color: #9b1c15; }
.st-lost { background: #8e1b16; color: #fff; }
.st-non-attribue { background: #dbe8fb; color: #1f4f8a; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }

.crm-placeholder { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--r-lg); padding: 28px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* ---------- Assistant (panneau) ---------- */
.crm-chat { width: 400px; flex: none; background: var(--panel); border-left: 1px solid var(--line); padding: 12px 14px; display: flex; flex-direction: column; position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); }
.crm-chat[hidden] { display: none; }
.crm-chat-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.crm-chat-head #chatClose { border: none; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }

/* Recherche globale */
.crm-search input:focus { outline: none; background: #fff; color: var(--ink); }
.crm-search input:focus::placeholder { color: var(--muted); }
.crm-search-results {
  position: absolute; top: 40px; left: 0; right: 0; z-index: 50; background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.14); max-height: 70vh; overflow-y: auto;
}
.crm-search-results[hidden] { display: none; }
.sr-item, .sr-all { display: block; width: 100%; text-align: left; border: none; background: none; padding: 9px 12px; cursor: pointer; font: inherit; border-bottom: 1px solid var(--line); }
.sr-item:hover, .sr-item.sel { background: var(--bg); }
.sr-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.sr-snip { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.sr-snip i { font-style: normal; font-weight: 600; }
.sr-all { color: var(--hutto); font-weight: 600; font-size: 12.5px; border-bottom: none; }
.sr-msg { padding: 12px; font-size: 13px; color: var(--muted); }
mark { background: #fde68a; color: inherit; border-radius: 2px; padding: 0 1px; }
.crm-searchbanner { background: #fff8e1; border: 1px solid #f4dfa0; border-radius: 10px; padding: 9px 12px; font-size: 13px; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Filtres de liste */
.crm-filters { margin-bottom: 12px; }
.crm-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.crm-chip { border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 5px 12px; font-size: 12.5px; cursor: pointer; }
.crm-chip.on { background: var(--hutto); border-color: var(--hutto); color: #fff; }
.crm-selects { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12.5px; }
.crm-selects select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 12.5px; max-width: 190px; }
.crm-selects label { display: flex; align-items: center; gap: 4px; color: var(--ink); }
.crm-count { margin-left: auto; color: var(--muted); }

.crm-table th.sortable { cursor: pointer; user-select: none; }
.crm-table th.sortable:hover { color: var(--ink); }
.crm-table td.wrap { white-space: normal; min-width: 170px; max-width: 220px; }
/* max-width est ignoré sur une cellule de tableau : on limite un div intérieur */
.crm-table div.clip { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.crm-table div.clip .sub { overflow: hidden; text-overflow: ellipsis; }
.crm-table div.clip.w-id { max-width: 96px; }
.crm-table td.statut { white-space: normal; max-width: 165px; }
.crm-table td.statut .pill { white-space: normal; line-height: 1.3; }
.crm-table div.clip.w-hote { max-width: 190px; }
.crm-table .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.crm-table .sub.contact a { color: var(--hutto); text-decoration: none; margin-right: 6px; }
.crm-table .sub.contact a:hover { text-decoration: underline; }
.crm-table .sub.due { color: #b3261e; font-weight: 600; }
.crm-table .sub.alert-line { margin-top: 4px; display: flex; align-items: flex-start; gap: 5px; color: var(--ink); white-space: normal; max-width: 160px; line-height: 1.35; }
.crm-table .alert-line .alert-dot { flex: none; }
.crm-table .alert-line .alert-dot { min-width: 17px; height: 17px; font-size: 10.5px; }
.crm-table a.maps { color: var(--hutto); font-weight: 600; text-decoration: none; }
.crm-table a.maps:hover { text-decoration: underline; }
.crm-table .maps-none { color: #b3261e; }
.tag-stop { font-size: 10.5px; background: #fdeaea; color: #b3261e; border-radius: 8px; padding: 0 6px; }
.alert-dot { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; border-radius: 10px; font-size: 11px; font-weight: 700; color: #fff; }
.alert-dot.warn { background: #E8B445; }
.alert-dot.late { background: #d64541; }

.crm-dialog { max-width: 760px; width: 92vw; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }

/* Fiche prospect (popup) */
.crm-fiche { width: min(1180px, 96vw); max-height: 92vh; border: none; border-radius: 14px; padding: 0; background: var(--bg); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.crm-fiche::backdrop { background: rgba(20, 30, 24, .45); }
.fiche-head { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: #fff; border-bottom: 1px solid var(--line); padding: 12px 16px; }
.fiche-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; }
.fiche-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fiche-tools a.crm-btn { text-decoration: none; color: var(--ink); }
.fiche-close { font-size: 18px; line-height: 1; padding: 4px 10px; }
.fiche-loading { padding: 20px 16px; }
.fiche-saison { margin: 12px 16px 0; background: var(--hutto-light); color: #27500A; border-radius: 10px; padding: 9px 12px; font-size: 13.5px; }
.fiche-saison.warn { background: #fff4e0; color: #8a4b08; }
.fiche-alerts { margin: 8px 16px 0; display: flex; gap: 6px; flex-wrap: wrap; }
.alert-chip { font-size: 12px; border-radius: 12px; padding: 3px 10px; background: #fdf1c7; color: #7a5a00; }
.alert-chip.late { background: #f8d1cf; color: #9b1c15; }
.fiche-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; padding: 12px 16px 18px; }
.fiche-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.fiche-card.wide { grid-column: 1 / -1; }
.fiche-card h3 { margin: 0 0 8px; font-size: 13.5px; color: var(--hutto); text-transform: uppercase; letter-spacing: .03em; }
.frows { display: grid; gap: 4px; }
.frow { display: grid; grid-template-columns: 150px 1fr; gap: 8px; font-size: 13px; line-height: 1.45; }
.flab { color: var(--muted); font-size: 12px; }
.fval { min-width: 0; overflow-wrap: anywhere; }
.fval a, .biv-links a, .biv-docs a { color: var(--hutto); }
.ftext { margin: 8px 0; }
.ftext-body { white-space: pre-wrap; font-size: 13px; line-height: 1.5; background: #fafbf9; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; max-height: 260px; overflow-y: auto; }
.frise { list-style: none; margin: 10px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--line); font-size: 12.5px; }
.frise li { margin: 3px 0; color: var(--muted); }
.frise li.st { color: var(--ink); }
.frise li span { display: inline-block; min-width: 78px; font-variant-numeric: tabular-nums; }
.biv-top { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; }
.fiche-map { height: 260px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #eef1ec; }
.map-none { padding: 14px; font-size: 12.5px; color: var(--muted); }
.biv-links { font-size: 13px; margin: 10px 0 0; }
.biv-docs { font-size: 13px; }
.gallery { margin-top: 12px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.thumbs a { display: block; width: 120px; height: 90px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #f4f6f2; font-size: 11px; text-decoration: none; color: var(--muted); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.biv-texts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 12px; }
.crm-btn.reveal { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; padding: 2px 8px; }
.crm-btn.reveal.revealed { background: #fff8e1; }
.fiche-quick { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 6px; }
.fiche-quick a.crm-btn { text-decoration: none; color: var(--ink); }
.small { font-size: 12px; }

/* Édition directe (étape 4) : champs discrets, bordure au survol et au focus */
.ed { width: 100%; font: inherit; font-size: 13px; color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 3px 6px; margin: -3px -6px; box-sizing: content-box; max-width: calc(100% - 4px); }
.ed:hover { border-color: var(--line); background: #fafbf9; }
.ed:focus { outline: none; border-color: var(--hutto); background: #fff; box-shadow: 0 0 0 2px rgba(46,94,58,.12); }
select.ed { width: auto; min-width: 140px; cursor: pointer; }
input.ed[type=date], input.ed[type=datetime-local] { width: auto; }
.ed-num { width: 110px; }
textarea.ed-area { display: block; width: 100%; margin: 0; padding: 7px 9px; box-sizing: border-box; max-width: none; border-color: var(--line); background: #fafbf9; line-height: 1.5; resize: vertical; }
.ed.ed-error, .ed-error { border-color: #d64541 !important; background: #fdeaea !important; }
.ed-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.ed-check input { width: 16px; height: 16px; accent-color: var(--hutto); }
.ed-multi summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 4px; border: 1px solid transparent; border-radius: 6px; }
.ed-multi summary:hover { border-color: var(--line); background: #fafbf9; }
.ed-multi[open] summary { border-color: var(--hutto); }
.ed-multi-list { display: grid; gap: 3px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-top: 4px; max-height: 220px; overflow-y: auto; font-size: 12.5px; }
.ed-tag { background: var(--hutto-light); color: #27500A; border-radius: 10px; padding: 1px 8px; font-size: 12px; }
.ed-secret summary { list-style: none; display: inline-block; }
.ed-secret[open] summary { margin-bottom: 4px; }
.fst { display: inline-block; margin-left: 6px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.fst.ok { color: #27500A; } .fst.error, .fst.conflict { color: #b3261e; font-weight: 600; } .fst.saving { color: var(--muted); }
.ed-conflict { margin-top: 6px; background: #fff4e0; border: 1px solid #f4d39a; border-radius: 8px; padding: 8px 10px; font-size: 12.5px; line-height: 1.6; }
.saison-ed { margin-left: 14px; font-size: 12.5px; color: var(--ink); white-space: nowrap; }
.saison-ed .ed { margin: 0 8px 0 2px; }
.addline { display: flex; gap: 6px; margin-bottom: 8px; }
.addline input { flex: 1; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.fhist .crm-table.hist td { white-space: normal; vertical-align: top; font-size: 12.5px; }
.crm-toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; z-index: 2000; background: #1f2622; color: #fff; border-radius: 10px; padding: 9px 12px; font-size: 13px; display: flex; gap: 10px; align-items: center; transition: opacity .15s, transform .15s; max-width: 90vw; }
.crm-toast.on { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
.crm-toast .crm-btn { background: #fff; }

/* Galeries modifiables (étape 4bis) */
.thumb { position: relative; display: inline-block; }
.thumb-del { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 11px; border: none; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 14px; line-height: 22px; padding: 0; }
.thumb-del:hover { background: #b3261e; }
.thumb-file { display: flex; align-items: center; justify-content: center; height: 100%; padding: 4px; text-align: center; word-break: break-all; }
.thumb-add { display: flex; align-items: center; justify-content: center; width: 120px; height: 90px; border: 1px dashed var(--line); border-radius: 8px; color: var(--hutto); font-size: 12.5px; cursor: pointer; background: #fafbf9; }
.thumb-add:hover { border-color: var(--hutto); }
.ed-link-search { width: 100%; box-sizing: border-box; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 4px; font-size: 12.5px; }
.ed-link label[hidden] { display: none; }

/* Écran Aujourd'hui (étape 5) */
.today-cat { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.today-cat > header { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 10px 14px; cursor: pointer; user-select: none; }
.today-cat > header:hover { background: #fafbf9; }
.today-cat .caret { color: var(--muted); width: 12px; }
.today-n { background: var(--hutto); color: #fff; border-radius: 10px; padding: 0 8px; font-size: 12px; font-weight: 700; }
.today-n.zero { background: #e3e6e1; color: var(--muted); }
.today-list { border-top: 1px solid var(--line); }
.task { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.5fr) minmax(0, 1.6fr) auto; gap: 10px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.task:last-child { border-bottom: none; }
.task:hover { background: var(--bg); }
.task.late { box-shadow: inset 3px 0 0 #d64541; }
.task-main { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-width: 0; }
.task-who a { color: var(--hutto); text-decoration: none; }
.task-why { color: var(--ink); }
.task.late .task-why { color: #b3261e; font-weight: 600; }
.snooze { grid-column: 1 / -1; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; background: #fafbf9; border: 1px solid var(--line); border-radius: 8px; padding: 8px; cursor: default; }
.snooze-why { flex: 1; min-width: 200px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; font-size: 12.5px; }
.snooze-date { padding: 5px 6px; border: 1px solid var(--line); border-radius: 7px; }

/* Éditeur de mail (étape 6) */
.crm-mail { width: min(820px, 96vw); max-height: 92vh; border: none; border-radius: 14px; padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.crm-mail::backdrop { background: rgba(20, 30, 24, .45); }
.mail-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 3; }
.mail-body { padding: 12px 16px; }
.mrow { display: grid; grid-template-columns: 60px 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.mrow label { color: var(--muted); font-size: 12.5px; }
.mrow input, .mrow select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; }
.mrow-more summary { cursor: pointer; font-size: 12px; color: var(--muted); margin: 0 0 8px 68px; }
.mail-editor { min-height: 220px; font-size: 14px; }
.mail-editor .ql-editor { min-height: 220px; font-family: Arial, Helvetica, sans-serif; font-size: 14px; }
.mail-sig { margin-top: 10px; padding: 10px; border: 1px dashed var(--line); border-radius: 8px; background: #fafbf9; }
.mail-err { min-height: 1em; margin: 8px 0 0; }
.mail-foot { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff; }
.mail-foot .crm-muted { margin-right: auto; }
.sent-mails { margin-top: 10px; }
.sent-mail { border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; background: #fff; }
.sent-mail summary { cursor: pointer; padding: 7px 9px; font-size: 12.5px; display: flex; gap: 8px; flex-wrap: wrap; }
.sent-body iframe { width: 100%; height: 320px; border: none; border-top: 1px solid var(--line); background: #fff; }
.sig-preview { padding: 10px; border: 1px dashed var(--line); border-radius: 8px; background: #fff; }

/* Modèles de mail (étape 7) */
.model-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.model-other { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; background: #fff; }
.mail-preview-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 4px 0; }
.mail-preview { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.mail-html { margin-top: 8px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.mail-warn { background: #fff4e0; border: 1px solid #f4d39a; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.mail-pieces, .mail-apres { margin-top: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fafbf9; font-size: 13px; line-height: 1.7; }
.model-ed { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 8px; background: #fff; }
.model-ed > summary { cursor: pointer; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.model-ed[open] > summary { margin-bottom: 8px; }
.model-st { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; }

/* Visites et Contrats (étape 8) */
.crm-table tr.row-warn { box-shadow: inset 3px 0 0 #E8B445; }
.crm-table tr.row-late { box-shadow: inset 3px 0 0 #d64541; }
.crm-table td.due-cell { color: #b3261e; font-weight: 600; }
.crm-table td.nowrap { white-space: nowrap; }
.crm-table td.small { font-size: 12px; }

/* Relances Claude (étape 9) */
.mail-regen { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; background: #f1f5f3; border: 1px solid #dce7e2; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.mail-regen input { flex: 1; min-width: 220px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; font-size: 12.5px; }

/* Descriptions & traductions (étape 10) */
.desc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; padding: 12px 16px; }
.gen-row { display: flex; gap: 6px; margin-top: 8px; }
.gen-row input { flex: 1; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.gen-proposal { margin-top: 10px; border: 1px solid #c9dccf; background: #f3f8f4; border-radius: 10px; padding: 10px; }
.tr-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.tr-lang { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; }
textarea.tr-new { border-color: #E8B445 !important; background: #fffbea !important; }
.lang-dot { display: inline-block; width: 18px; text-align: center; color: #c4c9c3; font-size: 12px; }
.lang-dot.ok { color: #2e7d32; font-weight: 700; }
.crm-table td.langs { white-space: nowrap; letter-spacing: 1px; }

/* Propriétaires et mail groupé (étape 11) */
.group-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 8px 12px; margin: 8px 0; background: #f3f8f4; border: 1px solid #c9dccf; border-radius: 10px; font-size: 13px; }
.group-bar .crm-btn.primary { margin-left: auto; }
.crm-table tr.row-stop td { opacity: .6; }
.group-preview { margin-top: 10px; }
.group-preview .ftext-body { white-space: normal; }
.campagnes { margin-top: 8px; }
.crm-table td.nowrap { white-space: nowrap; }

/* Assistant (étape 12) */
.chat-hist { border: 1px solid var(--line); border-radius: 8px; max-height: 220px; overflow-y: auto; margin-bottom: 8px; }
.chat-hist a { display: block; padding: 6px 10px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 12.5px; }
.chat-hist a:hover { background: #f3f8f4; }
.chat-hist .sub { display: block; color: var(--muted); font-size: 11px; }
.chat-fil { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.chat-msg { font-size: 13px; line-height: 1.45; border-radius: 10px; padding: 7px 10px; max-width: 100%; }
.chat-msg p { margin: 0 0 6px; } .chat-msg p:last-child { margin-bottom: 0; }
.chat-msg ul { margin: 2px 0 6px; padding-left: 18px; }
.chat-msg.user { align-self: flex-end; background: var(--hutto); color: #fff; max-width: 88%; }
.chat-msg.assistant { background: #f4f6f3; }
.chat-ex { display: block; margin-top: 5px; text-align: left; }
.chat-table { border-collapse: collapse; width: 100%; font-size: 12px; margin: 4px 0; }
.chat-table td, .chat-table th { border: 1px solid var(--line); padding: 3px 5px; vertical-align: top; text-align: left; }
.chat-table .sub { display: block; color: var(--muted); font-size: 11px; }
.chat-card { margin-top: 8px; border: 1px solid #E8B445; background: #fffbea; border-radius: 10px; padding: 8px 10px; }
.chat-card.done { border-color: #9cc7a7; background: #f3f8f4; }
.chat-card.refused { border-color: var(--line); background: #fafafa; opacity: .75; }
.chat-card:has(> [data-go]:only-child) { border: none; background: none; padding: 0; }
.chat-quote { font-style: italic; }
.chat-btns { display: flex; gap: 8px; margin-top: 6px; }
.chat-card .ok { color: #2e7d32; margin: 6px 0 4px; }
.chat-form { display: flex; gap: 6px; margin-top: 8px; }
.chat-form textarea { flex: 1; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font: inherit; font-size: 13px; }
.chat-foot { margin: 6px 0 0; }

@media (max-width: 820px) {
  .chat-form textarea, .list-search input, .crm-search input { font-size: 16px; } /* évite le zoom automatique d'iOS */
  /* Assistant : plein écran au-dessus de la page (sinon il s'ouvrait tout en bas, invisible) */
  .crm-chat { position: fixed; top: var(--top-h); left: 0; right: 0; bottom: 0; width: auto; height: auto; z-index: 60; border: none; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .desc-grid { grid-template-columns: 1fr; }
  .task { grid-template-columns: 1fr; gap: 4px; }
  .biv-top { grid-template-columns: 1fr; }
  .frow { grid-template-columns: 120px 1fr; }
  .fiche-grid { grid-template-columns: 1fr; }
  .crm-search { min-width: 0; }
  .crm-layout { flex-direction: column; }
  .crm-nav { width: auto; height: auto; position: static; display: flex; overflow-x: auto; gap: 4px; border-right: none; border-bottom: 1px solid var(--line); padding: 6px; }
  .crm-top-actions .lbl, .crm-kbd, .crm-brand span { display: none; }
  .crm-nav a { white-space: nowrap; margin: 0; }
  .crm-nav-sep { display: none; }
  .crm-main { padding: 14px 12px 50px; }
}

/* Ajustements v2 : boutons à texte long */
.crm-btn.chat-ex, .crm-btn.multiline { height: auto; min-height: 30px; padding: 5px 10px; white-space: normal; text-align: left; }

/* ---------- Prospects v2 (cahier §12) ---------- */
.st-tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 10px; scrollbar-width: thin; }
.st-tab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px 8px; border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font: inherit; font-size: 12.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.st-tab b { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.st-tab:hover { color: var(--ink); background: var(--line-2); border-radius: 6px 6px 0 0; }
.st-tab.on { color: var(--hutto-dark); border-bottom-color: var(--hutto); font-weight: 600; }
.st-tab.on b { color: var(--hutto); }
.list-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.list-search { position: relative; display: flex; align-items: center; flex: 0 1 320px; min-width: 200px; }
.list-search .ic { position: absolute; left: 9px; color: var(--muted); }
.list-search input { width: 100%; height: 30px; padding: 0 10px 0 30px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); font: inherit; font-size: 12.5px; }
.list-search input:focus { outline: none; border-color: var(--hutto); box-shadow: 0 0 0 2px rgba(46,94,58,.12); }
.crm-btn.on { border-color: var(--hutto); color: var(--hutto-dark); background: var(--hutto-tint); }
.fchip { display: inline-flex; align-items: center; gap: 2px; height: 24px; padding: 0 2px 0 9px; border-radius: 12px; background: var(--hutto-light); color: var(--hutto-dark); font-size: 12px; }
.fchip button { display: inline-flex; border: none; background: none; color: inherit; cursor: pointer; padding: 3px; border-radius: 10px; }
.fchip button:hover { background: rgba(0,0,0,.08); }
.fchip .ic { width: 12px; height: 12px; }
.list-count { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.list-count b { color: var(--ink); }
.filter-panel { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 12px; margin-bottom: 10px; box-shadow: var(--shadow); }
.filter-panel[hidden] { display: none; }
.filter-panel > label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); }
.filter-panel select, .filter-panel input[type=date] { height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; font: inherit; font-size: 12.5px; color: var(--ink); max-width: 200px; }
.flag-row { display: flex; flex-wrap: wrap; gap: 4px 14px; flex-basis: 100%; }
.flag { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.flag input { accent-color: var(--hutto); }
.crm-table th.sorted { color: var(--hutto-dark); }
.plist td.c-main { min-width: 220px; }
.crm-table div.clip.w-main, .crm-table span.clip.w-main { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.crm-table .clip.w-lieu { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.plist .ic-link { display: inline-flex; color: var(--hutto); margin-left: 6px; vertical-align: -2px; }
.plist .ic-link .ic { width: 13px; height: 13px; }
.plist a.maps { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; margin-top: 2px; color: var(--hutto); text-decoration: none; font-weight: 600; }
.plist a.maps .ic { width: 12px; height: 12px; }
.plist a.maps:hover { text-decoration: underline; }
.st-btn { display: inline-flex; align-items: center; gap: 2px; border: none; background: none; padding: 0; cursor: pointer; font: inherit; border-radius: 10px; }
.st-btn .ic { width: 13px; height: 13px; color: var(--muted); opacity: 0; transition: opacity .1s; }
tr:hover .st-btn .ic, .st-btn:focus-visible .ic { opacity: 1; }
.alert-line { display: block; margin-top: 3px; font-size: 11.5px; white-space: normal; max-width: 170px; line-height: 1.3; }
.alert-line.warn { color: var(--amber); }
.alert-line.late { color: var(--red); font-weight: 600; }
.crm-table tr.row-late td:first-child { box-shadow: inset 3px 0 0 #d64541; }
.crm-table tr.row-warn td:first-child { box-shadow: inset 3px 0 0 #E8B445; }
.ok-txt { display: inline-flex; align-items: center; gap: 3px; color: #2c6312; font-weight: 600; }
.ok-txt .ic { width: 13px; height: 13px; }
.warn-txt { color: var(--amber); }
.nil { color: #c2c8c0; }
.crm-table-wrap .empty { padding: 16px; margin: 0; }
p.more { text-align: center; margin: 12px 0; }
.st-menu { position: fixed; z-index: 3000; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 4px; min-width: 230px; max-height: 70vh; overflow-y: auto; }
.st-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 9px; border: none; background: none; border-radius: 6px; font: inherit; font-size: 12.5px; color: var(--ink); cursor: pointer; text-align: left; }
.st-menu button:hover { background: var(--bg); }
.st-menu button.on { font-weight: 600; }
.st-menu button .ic { margin-left: auto; color: var(--hutto); width: 14px; height: 14px; }

/* Assistant v2 : image jointe, en-tête */
.chat-head-tools { display: inline-flex; align-items: center; gap: 4px; }
.chat-pj { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.chat-pj[hidden] { display: none; }
.chat-pj img { max-height: 70px; max-width: 120px; border-radius: 6px; border: 1px solid var(--line); }
.chat-img { display: block; max-width: 100%; max-height: 220px; border-radius: 6px; margin-bottom: 6px; }
.chat-form { align-items: flex-end; }
.chat-photo { cursor: pointer; flex: none; }

/* ---------- Fiche en panneau latéral (V3, cahier §12) ---------- */
body.crm { --fiche-w: clamp(560px, 46vw, 820px); }
.crm-fiche.panel { position: fixed; top: var(--top-h); right: 0; bottom: 0; left: auto; width: var(--fiche-w); max-width: 100vw; height: auto; max-height: none; margin: 0; padding: 0; border: none; border-left: 1px solid var(--line); border-radius: 0; box-shadow: -8px 0 24px rgba(20,30,24,.10); background: var(--bg); overflow-y: auto; z-index: 55; overscroll-behavior: contain; }
@media (min-width: 1280px) { body.fiche-open .crm-main { margin-right: var(--fiche-w); } }
body.fiche-open .plist th:nth-child(n+5), body.fiche-open .plist td:nth-child(n+5) { display: none; }
.crm-table tbody tr.sel { background: var(--hutto-light); }
.crm-table tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--hutto); }
.crm-fiche .fiche-head { display: block; padding: 8px 16px 12px; }
.fiche-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -6px 2px; }
.fiche-nav, .crm-fiche .fiche-tools { display: flex; align-items: center; gap: 4px; }
.ic.up { transform: rotate(180deg); }
.crm-fiche .fiche-title { display: block; }
.crm-fiche .fiche-title h2 { font-size: 17px; margin: 0; line-height: 1.3; font-weight: 650; }
.fiche-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.fiche-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.qa-statut select.ed { margin: 0; height: 30px; padding: 0 8px; border: 1px solid var(--line); background: #fff; font-weight: 600; box-sizing: border-box; max-width: 100%; }
.qa-note { display: flex; gap: 6px; margin-top: 8px; }
.qa-note input { flex: 1; min-width: 0; height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r); font: inherit; font-size: 13px; }
.qa-note input:focus { outline: none; border-color: var(--hutto); box-shadow: 0 0 0 2px rgba(46,94,58,.12); }
.crm-fiche .fiche-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); padding: 10px 16px 24px; }
.crm-fiche .biv-top { grid-template-columns: 1fr; }
.crm-fiche .fiche-map { height: 220px; }
.crm-dialog.keys { max-width: 420px; }
.crm-dialog.keys h3 { margin: 0 0 10px; font-size: 15px; }
.crm-dialog.keys td { padding: 4px 10px 4px 0; font-size: 13px; }
kbd:not(.crm-kbd) { font: 11.5px ui-monospace, Consolas, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; background: #fff; }
@media (max-width: 820px) {
  .crm-fiche.panel { top: 0; left: 0; right: 0; width: auto; border-left: none; z-index: 70; overflow-x: hidden; padding-bottom: env(safe-area-inset-bottom); }
  .crm-fiche .fiche-grid { grid-template-columns: minmax(0, 1fr); }
  .crm-fiche .frow { grid-template-columns: 108px minmax(0, 1fr); }
  .crm-fiche .saison-ed { display: block; white-space: normal; margin: 6px 0 0; }
  .crm-fiche .ed { max-width: 100%; box-sizing: border-box; }
  .crm-fiche .thumbs a, .crm-fiche .thumb-add { width: calc(50% - 4px); }
  .crm-fiche .fiche-head { padding: 6px 12px 10px; }
  .fiche-actions .crm-btn { height: 40px; padding: 0 14px; font-size: 14px; }
  .qa-statut select.ed { height: 40px; font-size: 15px; }
  .qa-note input { height: 40px; font-size: 16px; }
  .qa-note .crm-btn { height: 40px; }
  .crm-fiche .fiche-grid { padding: 8px 10px 30px; }
}

/* ---------- V4 : autres écrans dans le même langage (cahier §12) ---------- */
.page-note { margin: 6px 0 0; color: var(--muted); font-size: 12px; max-width: 900px; }
.page-date { color: var(--ink-2); font-weight: 600; font-size: 12.5px; }
.jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.jumpchip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); font-size: 12.5px; text-decoration: none; }
.jumpchip b { color: var(--hutto); font-variant-numeric: tabular-nums; }
.jumpchip:hover { border-color: var(--hutto); color: var(--ink); }
.today-cat { border-radius: var(--r-lg); box-shadow: var(--shadow); }
.today-cat > header { align-items: center; padding: 9px 14px; }
.today-cat > header .ic { color: var(--muted); transition: transform .12s; }
.today-cat > header .ic.closed { transform: rotate(-90deg); }
.today-cat > header .rule { margin-left: auto; text-align: right; }
.task { grid-template-columns: minmax(0, 2.6fr) auto minmax(0, 1.8fr) auto; gap: 12px; padding: 7px 14px; }
.task-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-main .sub, .task-why .sub { display: block; color: var(--muted); font-size: 11.5px; }
.task-main .ic-link { display: inline-flex; color: var(--hutto); margin-left: 6px; vertical-align: -2px; }
.task-main .ic-link .ic, .crm-table .ic-link .ic { width: 13px; height: 13px; }
.crm-table .ic-link { display: inline-flex; color: var(--hutto); margin-left: 6px; vertical-align: -2px; }
.task-act { display: flex; gap: 6px; justify-content: flex-end; }
.tag { display: inline-block; font-size: 11px; padding: 0 7px; border-radius: 9px; background: var(--line-2); color: var(--ink-2); line-height: 18px; white-space: nowrap; }
.tool-select { height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); font: inherit; font-size: 12.5px; max-width: 220px; }
.crm-table td.c-main { min-width: 200px; }
.filter-panel.crm-filters { display: block; }
.filter-panel.crm-filters[hidden] { display: none; }
@media (max-width: 820px) {
  .task { grid-template-columns: minmax(0, 1fr) auto; }
  .task-why { grid-column: 1 / -1; }
  .task-act { grid-column: 1 / -1; justify-content: flex-start; }
  .today-cat > header .rule { display: none; }
}

/* ---------- Nettoyage (V5) ---------- */
.crm-btn.danger { color: #9b1c15; border-color: #f0c4c0; }
.crm-btn.danger:hover { background: var(--red-bg); border-color: #e6a39d; }
.clean-bar .spacer { flex: 1; }
.clean-bar .crm-btn.primary { margin-left: 0; }

/* ---------- Téléphone (V6, cahier §12) ---------- */
.crm-tabbar, .crm-sheet { display: none; }
@media (max-width: 820px) {
  body.crm { --tab-h: 58px; }
  .crm-nav { display: none; }
  .crm-top { gap: 8px; padding: 0 10px; padding-top: env(safe-area-inset-top); height: calc(var(--top-h) + env(safe-area-inset-top)); }
  .crm-top-actions { display: none; }
  .crm-search { max-width: none; }
  .crm-main { padding: 12px 12px calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); }
  .crm-tabbar:not([hidden]) { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 65; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -2px 10px rgba(20,30,24,.06); }
  .crm-tabbar a, .crm-tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: none; background: none; color: var(--muted); font: inherit; font-size: 10.5px; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .crm-tabbar .ic { width: 22px; height: 22px; }
  .crm-tabbar a.on, .crm-tabbar button.on, .crm-tabbar button.current { color: var(--hutto); font-weight: 600; }
  .crm-sheet:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 64; background: rgba(20,30,24,.35); }
  .sheet-box { position: absolute; left: 8px; right: 8px; bottom: calc(var(--tab-h) + 8px + env(safe-area-inset-bottom)); background: var(--panel); border-radius: 14px; padding: 6px; box-shadow: var(--shadow-pop); }
  .sheet-box a, .sheet-box button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: none; background: none; border-radius: 10px; color: var(--ink); font: inherit; font-size: 15px; text-decoration: none; text-align: left; }
  .sheet-box a.on { background: var(--hutto-light); color: var(--hutto-dark); font-weight: 600; }
  .sheet-box .ic { width: 19px; height: 19px; color: var(--muted); }
  .sheet-box [hidden] { display: none; }
  .sheet-sep { border-top: 1px solid var(--line); margin: 4px 8px; }
  .sheet-ios { padding: 4px 14px 8px; margin: 0; }
  /* Assistant : au-dessus de la barre d'onglets */
  .crm-chat { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); top: calc(var(--top-h) + env(safe-area-inset-top)); }
  /* En-têtes d'écran */
  .page-head h1 { font-size: 17px; }
  .page-head .tools { margin-left: 0; width: 100%; justify-content: space-between; }
  .page-head .facts { font-size: 12.5px; gap: 2px 10px; }
  .page-note { display: none; }
  /* Tableaux → cartes */
  .crm-table-wrap { background: none; border: none; box-shadow: none; overflow: visible; }
  .crm-table, .crm-table tbody { display: block; }
  .crm-table thead { display: none; }
  .crm-table tbody tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); }
  .crm-table tbody tr:hover { background: var(--panel); }
  .crm-table tbody tr.sel { background: var(--hutto-light); }
  .crm-table td { display: block; border: none; padding: 0; white-space: normal; min-width: 0; font-size: 12.5px; }
  .crm-table td.c-main { flex: 1 1 100%; min-width: 0; font-size: 14px; }
  .crm-table td.c-main .clip { max-width: none; white-space: normal; }
  .crm-table td:has(> input[type=checkbox]) { order: -1; flex: 0 0 auto; }
  .crm-table td:has(> input[type=checkbox]) + td.c-main { flex: 1 1 calc(100% - 40px); }
  .crm-table td[data-label]:not(.c-main):not(.statut):not(:has(> input[type=checkbox]))::before { content: attr(data-label) " : "; color: var(--muted); font-size: 11px; }
  .crm-table td:has(> .nil:only-child), .crm-table td:empty { display: none; }
  .crm-table td .sub { display: inline; margin-left: 4px; }
  .crm-table td.c-main .sub { display: block; margin-left: 0; }
  .crm-table td.statut .sub, .crm-table td.wrap .sub { display: block; margin-left: 0; }
  .crm-table tr.row-late, .crm-table tr.row-warn { box-shadow: none; }
  .crm-table tr.row-late td:first-child, .crm-table tr.row-warn td:first-child { box-shadow: none; }
  .crm-table tr.row-late { border-left: 3px solid #d64541; }
  .crm-table tr.row-warn { border-left: 3px solid #E8B445; }
  .st-btn .ic { opacity: 1; }
  .crm-btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
  .plist .ic-link, .crm-table .ic-link, .task-main .ic-link { margin-left: 10px; }
  .plist .ic-link .ic, .crm-table .ic-link .ic, .task-main .ic-link .ic { width: 18px; height: 18px; }
  .list-search { flex: 1 1 100%; }
  .list-count { margin-left: 0; }
  .group-bar { position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top)); z-index: 5; }
  .crm-toast { bottom: calc(var(--tab-h) + 14px + env(safe-area-inset-bottom)); }
  .st-menu button { padding: 11px 12px; font-size: 14px; }
  /* Ordre dans les cartes : case, nom, statut, puis le reste en ligne */
  .crm-table td { order: 3; }
  .crm-table td:has(> input[type=checkbox]) { order: 0; }
  .crm-table td.c-main { order: 1; }
  .crm-table td.statut { order: 2; flex: 1 1 100%; }
  .crm-table td.statut .sub.alert-line { display: inline; margin-left: 8px; }
  .crm-table td .clip, .crm-table td .clip.w-lieu { display: inline; max-width: none; white-space: normal; }
  .crm-table td a.maps { display: inline-flex; margin-left: 8px; }
  .jump { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .jumpchip { flex: none; }
}

/* ---------- Retours du 2026-10-20 : chiffres repliés, statuts en ronds, fiche en colonnes ---------- */
.page-head .facts-toggle { color: var(--muted); }
.page-head .facts-toggle.on { color: var(--hutto-dark); }
.page-head .facts-toggle .ic { width: 14px; height: 14px; transition: transform .12s; }
.page-more { margin-top: 6px; }
.page-more[hidden] { display: none; }
.page-more .facts { display: flex; gap: 4px 14px; flex-wrap: wrap; color: var(--ink-2); font-size: 13px; }
.page-more .facts b { color: var(--ink); font-variant-numeric: tabular-nums; }
.page-more .facts .late b { color: var(--red); }
.st-tabs.dots { flex-wrap: wrap; overflow: visible; align-items: center; gap: 4px; }
.st-dot { display: inline-flex; align-items: center; gap: 6px; height: 30px; min-width: 30px; justify-content: center; padding: 0 8px; border: 1px solid transparent; border-radius: 15px; background: none; cursor: pointer; font: inherit; font-size: 12.5px; color: var(--ink); margin-bottom: 6px; }
.st-dot .dot { width: 14px; height: 14px; }
.st-dot:hover { background: var(--line-2); }
.st-dot.on { border-color: var(--line); background: var(--panel); box-shadow: var(--shadow); font-weight: 600; padding: 0 12px 0 9px; }
.st-dot.on b { color: var(--muted); font-size: 11.5px; }
.st-tabs.dots .st-tab { margin-bottom: 6px; }
/* Fiche : champs en colonnes (intitulé au-dessus de la valeur), textes longs sur toute la largeur */
.crm-fiche .frows { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px 14px; }
.crm-fiche .frow { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.crm-fiche .frow.wide { grid-column: 1 / -1; }
.crm-fiche .frow .flab { font-size: 11px; text-transform: none; }
.crm-fiche .frow select.ed, .crm-fiche .frow input.ed { min-width: 0; max-width: 100%; }
.fiche-saison.quiet { background: none; color: var(--muted); padding: 2px 0; font-size: 12.5px; }
.fiche-all { text-align: center; margin: 0 0 24px; }
@media (max-width: 820px) {
  .crm-fiche .frows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-dot { height: 36px; min-width: 36px; }
  .st-dot .dot { width: 18px; height: 18px; }
}

/* ---------- Fiche réorganisée (2026-10-21) : en-tête hôte, cards guidées, couleurs Airtable ---------- */
/* En-tête : nom de l'hôte en grand, puis ID + nom du bivouac + date de création */
.crm-fiche .fiche-title h2.fiche-host { font-size: 22px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; margin: 2px 0 0; }
.fiche-ident { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 5px; font-size: 14px; }
.id-badge { background: var(--hutto-light); color: var(--hutto-dark); border-radius: 6px; padding: 1px 7px; font-size: 12.5px; font-weight: 600; }
.fiche-biv { font-weight: 600; color: var(--ink); }
.fiche-cree { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: 12.5px; }
.fiche-cree .ic { width: 13px; height: 13px; color: var(--muted); }

/* Couleurs des listes Airtable (statut, contrat, RDV, paiements…) */
[data-tone] { --t-h: 0; --t-s: 0%; }
[data-tone^="blue"] { --t-h: 214; --t-s: 75%; } [data-tone^="cyan"] { --t-h: 192; --t-s: 70%; } [data-tone^="teal"] { --t-h: 172; --t-s: 60%; }
[data-tone^="green"] { --t-h: 128; --t-s: 50%; } [data-tone^="yellow"] { --t-h: 45; --t-s: 90%; } [data-tone^="orange"] { --t-h: 28; --t-s: 85%; }
[data-tone^="red"] { --t-h: 4; --t-s: 70%; } [data-tone^="pink"] { --t-h: 330; --t-s: 65%; } [data-tone^="purple"] { --t-h: 268; --t-s: 55%; }
[data-tone^="gray"] { --t-h: 0; --t-s: 0%; }
.tone-chip[data-tone], select.ed.tone[data-tone]:not([data-tone=""]) { --t-bg: hsl(var(--t-h) var(--t-s) 91%); --t-fg: hsl(var(--t-h) var(--t-s) 24%); background: var(--t-bg); color: var(--t-fg); border-color: transparent; }
[data-tone$="Light1"] { --t-bg: hsl(var(--t-h) var(--t-s) 82%) !important; --t-fg: hsl(var(--t-h) var(--t-s) 20%) !important; }
[data-tone$="Bright"] { --t-bg: hsl(var(--t-h) var(--t-s) 44%) !important; --t-fg: #fff !important; }
[data-tone$="Dark1"] { --t-bg: hsl(var(--t-h) var(--t-s) 28%) !important; --t-fg: #fff !important; }
[data-tone="yellowBright"] { --t-bg: hsl(45 95% 55%) !important; --t-fg: #3d2e00 !important; }
.tone-chip { display: inline-block; border-radius: 12px; padding: 2px 10px; font-size: 12.5px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.tone-chip[data-tone=""] { background: var(--line-2); color: var(--ink); }
select.ed.tone { border-radius: 14px !important; font-weight: 600; }
select.ed.tone option { background: #fff; color: var(--ink); font-weight: 400; }

/* Cards : titre + phrase d'aide */
.crm-fiche .fiche-card { padding: 14px 16px; border-radius: 12px; box-shadow: var(--shadow); }
.fc-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.fc-ic { flex: none; width: 30px; height: 30px; border-radius: 8px; background: var(--hutto-light); color: var(--hutto); display: flex; align-items: center; justify-content: center; }
.fc-ic .ic { width: 16px; height: 16px; }
.crm-fiche .fiche-card .fc-head h3 { margin: 0; font-size: 14.5px; color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 650; }
.fc-hint { margin: 1px 0 0; color: var(--muted); font-size: 12px; }
.fsub { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.fsub:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.fsub > h4 { margin: 0 0 8px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.fmore { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 8px; }
.fmore > summary { cursor: pointer; color: var(--hutto); font-size: 12.5px; font-weight: 600; list-style: none; }
.fmore > summary::before { content: "▸ "; }
.fmore[open] > summary::before { content: "▾ "; }
.fmore[open] > summary { margin-bottom: 10px; }

/* Où en est le prospect : quatre cases en tête */
.state-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.state-box { display: flex; flex-direction: column; gap: 5px; background: #fafbf9; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; min-width: 0; }
.state-box .flab { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.state-box .ed { margin: 0; box-sizing: border-box; width: 100%; max-width: 100%; height: 30px; padding: 0 8px; border: 1px solid var(--line); background: #fff; }
.state-since { color: var(--muted); font-size: 11.5px; }
.state-grid + .frows { margin-top: 10px; }
.docs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 14px; }
.gallery.compact .thumbs a, .gallery.compact .thumb-add { width: 92px; height: 70px; }

/* Bivouac en deux parties */
.biv-part + .biv-part { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.part-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; font-size: 13.5px; font-weight: 650; color: var(--ink); }
.part-title .crm-btn { margin-left: auto; }
.part-n { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 10px; background: var(--hutto); color: #fff; font-size: 11px; font-weight: 700; flex: none; }
.biv-loc { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; align-items: start; }
.crm-fiche .biv-loc .fiche-map { height: 230px; }
.biv-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.biv-links a.crm-btn.primary { color: #fff; text-decoration: none; }
.biv-other { font-size: 12.5px; }

/* Équipe : pilotage puis Recherche → Visite → Gestion */
.phases { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin-top: 12px; }
.phase { background: #fafbf9; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.phase h4 { display: flex; align-items: center; gap: 7px; margin: 0 0 8px; font-size: 13px; font-weight: 650; }
.crm-fiche .phase .frows { grid-template-columns: minmax(0, 1fr); gap: 8px; }

/* Actions */
.action-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; margin-bottom: 10px; }
.crm-btn.big { height: 36px; justify-content: flex-start; font-size: 13px; }
.action-list a.crm-btn { color: var(--ink); text-decoration: none; }
.crm-btn:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 820px) {
  .crm-fiche .fiche-title h2.fiche-host { font-size: 20px; }
  .crm-btn.big { height: 42px; font-size: 14px; }
  .state-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Fiche personnalisable en 3 colonnes (2026-10-21, suite) ---------- */
body.crm { --fiche-w: clamp(600px, 66vw, 1600px); }
.crm-fiche.panel { container-type: inline-size; }
.fiche-resize { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 6; }
.fiche-resize:hover, body.fiche-resizing .fiche-resize { background: rgba(46,94,58,.25); }
body.fiche-resizing { user-select: none; cursor: col-resize; }
.fiche-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 10px 14px 28px; align-items: start; }
.fcol { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
@container (max-width: 980px) {
  .fiche-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fiche-cols > .fcol:nth-child(3) { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@container (max-width: 620px) {
  .fiche-cols { grid-template-columns: minmax(0, 1fr); padding: 8px 10px 28px; }
  .fiche-cols > .fcol:nth-child(3) { display: flex; }
}
.crm-fiche .fiche-card { padding: 11px 12px; }
.crm-fiche .fc-head { margin-bottom: 9px; gap: 8px; }
.crm-fiche .fc-ic { width: 26px; height: 26px; }
.crm-fiche .fiche-card .fc-head h3 { font-size: 13.5px; }
.fc-hint { font-size: 11.5px; }
/* Champs : grille compacte (2 par ligne en général), textes longs et blocs sur toute la largeur */
.fc-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 9px 12px; }
.fi { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fi.wide { grid-column: 1 / -1; }
.fi > .flab, .fi .ftext > .flab, .fi .gallery > .flab { font-size: 11px; color: var(--muted); }
.fi .fval { font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.fi .fval .ed { margin: 0; width: 100%; max-width: 100%; box-sizing: border-box; padding: 3px 6px; border-color: var(--line-2); }
.fi .fval .ed:hover { border-color: var(--line); }
.fi .fval .ed-multi summary { padding: 3px 6px; }
.fi .ftext { margin: 0; }
.fi .gallery { margin: 0; }
.fi .addline { margin: 0 0 4px; }
.fi-hint { color: var(--muted); font-size: 11px; }
.nil { color: #b5bcb7; }
.fi .ic-link { margin-left: 4px; }
.fi .biv-links { margin: 0; }
.fi .action-list { margin: 0; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.fi .model-btns { margin: 4px 0 0; }
.crm-fiche .fiche-map { height: 220px; }
.leaflet-control-attribution { font-size: 9px !important; }
/* Historique en direct */
.hist-list { list-style: none; margin: 4px 0 0; padding: 0; max-height: 340px; overflow-y: auto; }
.hist-list li { padding: 6px 0; border-bottom: 1px solid var(--line-2); font-size: 12.5px; }
.hist-list li:last-child { border-bottom: none; }
.hist-top { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.hist-top .crm-muted { font-size: 11px; }
.hist-top .crm-btn { margin-left: auto; height: 22px; }
.hist-val { color: var(--ink-2); margin-top: 2px; overflow-wrap: anywhere; }
.hist-val .old { color: var(--muted); text-decoration: line-through; }
.hist-val .new { color: var(--ink); }
/* Titre des prospects dans les listes (comme l'en-tête de la fiche) */
.pt-host { font-weight: 650; font-size: 13.5px; color: var(--ink); }
.pt-ident .mono { color: var(--hutto-dark); font-weight: 600; }
.pt-ident b { font-weight: 600; color: var(--ink-2); }
.task-main .pt-ident { display: block; }

/* Mode « Personnaliser » */
.crm-fiche.editing .fiche-alerts, .crm-fiche.editing .fiche-saison { display: none; }
.lay-bar { position: sticky; top: 0; z-index: 7; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; margin: 10px 14px 0; padding: 10px 12px; background: #fff8e6; border: 1px solid #f1d58a; border-radius: 10px; font-size: 12.5px; }
.lay-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.fiche-cols.editing .fcol { min-height: 80px; border-radius: 10px; padding: 2px; }
.fiche-cols.editing .fcol.mark-empty { outline: 2px dashed var(--hutto); }
.lay-card { padding: 8px 10px !important; }
.lay-card.dragging, .lay-item.dragging { opacity: .4; }
.lay-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; cursor: grab; }
.lay-title { flex: 1; min-width: 0; font: inherit; font-weight: 650; font-size: 13px; border: 1px solid transparent; border-radius: 6px; padding: 3px 6px; background: transparent; }
.lay-title:hover, .lay-title:focus { border-color: var(--line); background: #fff; outline: none; }
.grip { color: var(--muted); cursor: grab; user-select: none; font-size: 14px; line-height: 1; }
.lay-items { list-style: none; margin: 0; padding: 0; min-height: 28px; display: flex; flex-direction: column; gap: 3px; border-radius: 6px; }
.lay-items.mark-empty { outline: 2px dashed var(--hutto); }
.lay-item { display: flex; align-items: center; gap: 6px; padding: 4px 6px; background: #fafbf9; border: 1px solid var(--line); border-radius: 6px; cursor: grab; font-size: 12.5px; }
.lay-item.k-bloc { background: var(--hutto-tint); }
.lay-item.k-introuvable { background: var(--red-bg); }
.lay-item.mark-before { box-shadow: 0 -3px 0 var(--hutto); }
.lay-item.mark-after { box-shadow: 0 3px 0 var(--hutto); }
.lay-card.mark-before { box-shadow: 0 -4px 0 var(--hutto); }
.lay-card.mark-after { box-shadow: 0 4px 0 var(--hutto); }
.lay-label { border: none; background: none; padding: 0; font: inherit; color: var(--ink); cursor: text; text-align: left; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lay-label:hover { text-decoration: underline dotted; }
.lay-kind { color: var(--muted); font-size: 10.5px; margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.lay-x { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; }
.lay-x:hover { color: var(--red); }
.lay-add { margin-top: 6px; }
.lay-newcard { align-self: flex-start; }
.lay-picker { border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }
.lay-picker input { width: 100%; box-sizing: border-box; height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 12.5px; margin-bottom: 4px; }
.lay-options { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; }
.lay-opt { text-align: left; border: none; background: none; padding: 5px 6px; border-radius: 5px; cursor: pointer; font: inherit; font-size: 12.5px; }
.lay-opt:hover { background: var(--hutto-light); }
.lay-opt.used { color: var(--muted); }

/* ---------- Largeur des champs réglable (⅓, ½, ⅔, pleine) : grille de 6 dans chaque carte ---------- */
.fc-body { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.fc-body .thumbs a, .fc-body .thumb-add { width: 92px; height: 70px; }
.lay-items { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.lay-item { min-width: 0; padding: 4px 5px; gap: 4px; }
.lay-item:not(.full) .lay-kind { display: none; }
.lay-item .lay-label { flex: 1; }
.lay-item.mark-before { box-shadow: -3px 0 0 var(--hutto); }
.lay-item.mark-after { box-shadow: 3px 0 0 var(--hutto); }
.lay-w { flex: none; min-width: 22px; height: 20px; padding: 0 4px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--hutto-dark); font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.lay-w:hover { border-color: var(--hutto); background: var(--hutto-light); }

/* ---------- Bandes de 1 à 3 colonnes, grille de 12 pour les champs, visionneuse (2026-10-21) ---------- */
.fiche-rows { display: flex; flex-direction: column; gap: 10px; padding: 10px 14px 28px; }
.fiche-rows .fiche-cols { padding: 0; }
.fiche-cols.cols-1 { grid-template-columns: minmax(0, 1fr); }
.fiche-cols.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fiche-cols.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@container (max-width: 980px) {
  .fiche-cols.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 620px) {
  .fiche-rows { padding: 8px 10px 28px; }
  .fiche-cols.cols-2, .fiche-cols.cols-3 { grid-template-columns: minmax(0, 1fr); }
  /* Téléphone : petits champs à moitié, les autres sur toute la largeur */
  .fc-body .fi[data-span="2"], .fc-body .fi[data-span="3"], .fc-body .fi[data-span="4"] { grid-column: span 6 !important; }
  .fc-body .fi[data-span="8"], .fc-body .fi[data-span="9"] { grid-column: span 12 !important; }
}
.fc-body { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 9px 10px; }
.fcol:empty { min-height: 0; }

/* Éditeur : bandes */
.fiche-rows.editing { padding-top: 10px; }
.lay-row { border: 1px dashed #c9d3cc; border-radius: 12px; padding: 8px; background: rgba(255,255,255,.4); }
.lay-row-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; font-size: 12.5px; }
.lay-cols { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.lay-cols .crm-btn.on { background: var(--hutto); color: #fff; border-color: var(--hutto); }
.lay-row .fiche-cols { padding: 0; }
.lay-row .fcol { min-height: 60px; }
.lay-newrow { align-self: flex-start; }
.lay-items { grid-template-columns: repeat(12, minmax(0, 1fr)); }
select.lay-w { flex: none; height: 22px; padding: 0 2px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--hutto-dark); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
select.lay-w:hover { border-color: var(--hutto); }

/* Visionneuse de photos */
.fc-body .thumbs a[data-full] { cursor: zoom-in; }
dialog.lightbox { width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; margin: 0; padding: 0; border: none; background: rgba(12,16,14,.94); color: #fff; display: flex; flex-direction: column; }
dialog.lightbox:not([open]) { display: none; }
dialog.lightbox::backdrop { background: rgba(0,0,0,.6); }
.lb-top { display: flex; align-items: center; gap: 12px; padding: 10px 14px; font-size: 13px; }
.lb-title { font-weight: 600; }
.lb-name { color: rgba(255,255,255,.6); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-top .crm-btn { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.2); text-decoration: none; }
.lb-top .lb-close { color: #fff; }
.lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; padding: 0 56px; }
.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; user-select: none; touch-action: pan-y; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: none; border-radius: 8px; background: rgba(255,255,255,.1); color: #fff; font-size: 34px; line-height: 1; cursor: pointer; }
.lb-nav:hover { background: rgba(255,255,255,.22); }
.lb-nav.prev { left: 8px; } .lb-nav.next { right: 8px; }
.lb-strip { display: flex; gap: 6px; padding: 10px 14px 14px; overflow-x: auto; justify-content: safe center; }
.lb-th { flex: none; width: 64px; height: 48px; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; background: #222; cursor: pointer; opacity: .6; }
.lb-th.on { border-color: #fff; opacity: 1; }
.lb-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 620px) { .lb-stage { padding: 0 6px; } .lb-nav { width: 36px; height: 52px; font-size: 28px; } .lb-name { display: none; } }

/* ---------- Imports et fiche propriétaire (cahier §13) ---------- */
.import-etat { margin: 8px 0 0; padding: 8px 12px; border-radius: var(--r); background: var(--hutto-tint); color: var(--ink-2); font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.import-etat.ok { background: var(--hutto-light); color: #27500A; }
.import-etat.late { background: var(--amber-bg); color: #8a4b08; }
.import-etat a { color: inherit; font-weight: 600; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 16px; border: 2px dashed var(--line); border-radius: var(--r-lg); background: var(--panel); cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.drop .ic { width: 26px; height: 26px; color: var(--hutto); }
.drop:hover, .drop.over { border-color: var(--hutto); background: var(--hutto-tint); }
.import-queue { display: grid; gap: 10px; margin-top: 12px; }
.import-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 14px; }
.import-card header { display: flex; align-items: center; gap: 10px; }
.import-card header b { overflow-wrap: anywhere; }
.import-card .import-st { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.import-card.pret .import-st { color: var(--hutto); font-weight: 600; }
.import-card.fait { border-color: #b9d8a6; }
.import-card.erreur { border-color: #f0b7b0; }
.import-card.erreur .import-st { color: var(--red); }
.import-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 4px; font-size: 13px; align-items: center; }
.import-facts input[type=month] { margin-left: 4px; }
.import-card details { margin: 4px 0; }
.import-card ul { margin: 4px 0 4px 18px; padding: 0; }
.warn-line { color: #8a4b08; }
.ok-line { color: #27500A; display: flex; gap: 6px; align-items: center; }
.import-go { display: flex; gap: 8px; margin: 10px 0 0; }
.sec-title { font-size: 14px; margin: 22px 0 8px; color: var(--hutto); text-transform: uppercase; letter-spacing: .03em; }
.tag-warn { font-size: 11px; background: var(--amber-bg); color: #8a4b08; border-radius: 8px; padding: 0 6px; white-space: nowrap; }
.tag-ok { font-size: 11px; background: var(--hutto-light); color: #27500A; border-radius: 8px; padding: 0 6px; white-space: nowrap; }
.crm-table td.num, .crm-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.owner-row { cursor: pointer; }
tr.owner-row.on td { background: var(--hutto-tint); }
.owner-body { display: grid; gap: 12px; padding: 12px 16px 24px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.kpi { background: var(--hutto-tint); border-radius: var(--r); padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; }
.kpi span { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }
.kpi b { font-size: 18px; font-variant-numeric: tabular-nums; color: var(--ink); }
.kpi b small { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi > small { font-size: 11.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.crm-table.compact td, table.crm-table.compact th { padding: 4px 6px; }
.crm-table tr[data-annee] { cursor: pointer; }
.crm-table tr[data-annee].on td { background: var(--hutto-tint); font-weight: 600; }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; height: 150px; align-items: end; margin: 12px 0 4px; }
.bar { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.bar i { display: block; width: 100%; max-width: 30px; min-height: 1px; background: var(--hutto); border-radius: 4px 4px 0 0; opacity: .85; }
.bar.cur i { background: #7aa86a; }
.bar .v { font-size: 10px; color: var(--ink-2); font-variant-numeric: tabular-nums; margin-bottom: 2px; }
.bar .l { font-size: 11px; color: var(--muted); margin-top: 3px; text-transform: uppercase; }
.pay-hist .pay-row { cursor: pointer; }
.pay-hist .pay-row:hover td { background: var(--hutto-tint); }
.pay-hist .pay-det > td { background: var(--bg); padding: 6px 8px 10px; }
.pay-hist .ic.closed { transform: rotate(-90deg); }
/* Récapitulatif propriétaires (recap.js) */
.crm-mail.recap { width: min(1180px, 97vw); }
.recap-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 900px) { .recap-cols { grid-template-columns: 1fr; } }
.recap-opts { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.recap-opts select { margin-left: 6px; }
.recap-owners { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r); padding: 4px 8px; background: #fff; margin-bottom: 10px; }
.recap-owner { padding: 4px 0; border-bottom: 1px solid var(--line-2); }
.recap-owner:last-child { border-bottom: none; }
.recap-owner summary { cursor: pointer; font-size: 13px; }
.recap-biv { display: block; font-size: 12.5px; margin: 3px 0 3px 14px; }
.recap-intro .ql-editor { min-height: 90px; }
.recap-frame { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.recap-subj { margin: 4px 0 6px; color: var(--ink-2); min-height: 18px; }
tr.biv-row { cursor: pointer; }
tr.biv-row:hover td { background: var(--hutto-tint); }

/* ---------- Aujourd'hui v2 (cahier §14) : tuiles par étape + liste unique ---------- */
.td-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.td-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); box-shadow: var(--shadow); cursor: pointer; font: inherit; color: var(--ink); text-align: left; }
.td-tile:hover { border-color: #cfd4cc; }
.td-tile b { font-size: 22px; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.td-tile .td-lab { font-size: 12px; color: var(--muted); }
.td-tile .td-late { font-size: 11.5px; color: var(--red); font-weight: 600; }
.td-tile.zero b { color: #b9c0b6; }
.td-tile.on { border-color: var(--hutto); background: var(--hutto-tint); box-shadow: inset 0 0 0 1px var(--hutto); }
.td-tile.on .td-lab { color: var(--hutto-dark); font-weight: 600; }
.td-table td.wrap { max-width: 320px; }
.td-table .td-what { display: block; font-weight: 600; }
.td-table .sub.late { color: var(--red); font-weight: 600; }
.td-table tr.td-sep td { background: var(--bg); color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 5px 10px; cursor: default; }
.td-table tr.td-sep td b { color: var(--ink-2); margin-left: 4px; }
.td-empty { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px; text-align: center; color: var(--hutto-dark); font-size: 14px; }
@media (max-width: 820px) {
  .td-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .td-tile { padding: 7px 9px; }
  .td-tile b { font-size: 18px; }
  .td-table tr.td-sep { display: block; }
}

/* ---------- Mode « Traiter les dossiers » (cahier §14) ---------- */
.crm-trait { width: min(1220px, 97vw); height: 94vh; max-height: 94vh; border: none; border-radius: 14px; padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.3); background: var(--bg); color: var(--ink); font-size: 13px; }
.crm-trait[open] { display: flex; flex-direction: column; }
.crm-trait::backdrop { background: rgba(20, 30, 24, .5); }
.crm-trait .spacer { flex: 1; }
.tr-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
.tr-head .tr-label { font-size: 14px; }
.tr-count { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-2); }
.tr-bar { width: 140px; height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.tr-bar span { display: block; height: 100%; background: var(--hutto); transition: width .2s; }
.tr-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px; padding: 14px; overflow: auto; }
.tr-ctx, .tr-act { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; min-width: 0; }
.tr-act { align-self: start; position: sticky; top: 0; }
.tr-who h2 { margin: 0 0 3px; font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.tr-ident { margin-bottom: 2px; }
.tr-contact { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; }
.tr-contact a { color: var(--hutto); text-decoration: none; font-weight: 600; }
.tr-contact a:hover { text-decoration: underline; }
.tr-why { margin: 12px 0; display: grid; gap: 4px; }
.tr-why > div { padding: 6px 10px; border-radius: var(--r); background: var(--line-2); }
.tr-why > div.cur { background: var(--hutto-tint); box-shadow: inset 3px 0 0 var(--hutto); }
.tr-why > div.late { background: var(--red-bg); box-shadow: inset 3px 0 0 var(--red); }
.tr-why b { margin-right: 6px; }
.tr-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 12px; }
.tr-facts dt { color: var(--muted); }
.tr-facts dd { margin: 0; }
.tr-hist { border-top: 1px solid var(--line-2); padding-top: 8px; }
.tr-hist ul { margin: 3px 0 8px; padding-left: 16px; }
.tr-hist li { margin: 2px 0; color: var(--ink-2); }
.tr-hist p { margin: 3px 0 8px; color: var(--ink-2); white-space: pre-wrap; }
.tr-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.tr-act > .tr-btns { flex-direction: column; align-items: stretch; }
.tr-act > .tr-btns .crm-btn { height: 38px; font-size: 13.5px; justify-content: flex-start; }
.tr-btns kbd { font-size: 10.5px; padding: 0 4px; margin-right: 2px; opacity: .75; color: var(--ink-2); }
.tr-btns .crm-btn.primary kbd { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.35); color: #fff; }
.tr-panel:not(:empty) { margin-top: 12px; }
.tr-box { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; display: grid; gap: 8px; background: #fbfcfa; }
.tr-box.danger { border-color: #f0c4c0; background: #fffafa; }
.tr-box input[type="text"], .tr-box input[type="date"], .tr-box select { height: 32px; border: 1px solid var(--line); border-radius: var(--r); padding: 0 8px; font: inherit; background: #fff; min-width: 0; }
.tr-box .tr-note { width: 100%; box-sizing: border-box; }
.tr-row { display: flex; align-items: center; gap: 8px; }
.tr-row label { width: 48px; color: var(--muted); flex: none; }
.tr-row select { flex: 1; }
.tr-box .crm-btn.big { justify-content: center; }
.tr-done { padding: 9px 12px; border-radius: var(--r); background: var(--hutto-light); color: var(--hutto-dark); font-weight: 600; margin-bottom: 10px; }
.tr-warn { padding: 8px 10px; border-radius: var(--r); background: var(--amber-bg); color: #7a4f0e; margin: 0 0 10px; }
.tr-foot { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--panel); border-top: 1px solid var(--line); flex: none; }
.tr-start { padding: 22px 26px; overflow: auto; }
.tr-start > p { margin: 0 0 14px; max-width: 640px; }
.tr-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin-top: 10px; }
.tr-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); cursor: pointer; font: inherit; color: var(--ink); text-align: left; }
.tr-choice:hover { border-color: var(--hutto); }
.tr-choice span { color: var(--muted); font-size: 12px; }
.tr-choice em { color: var(--red); font-style: normal; font-weight: 600; }
.tr-choice.main { width: 100%; max-width: 440px; background: var(--hutto); color: #fff; border-color: var(--hutto); }
.tr-choice.main b { font-size: 15px; }
.tr-choice.main span, .tr-choice.main em { color: rgba(255,255,255,.9); }
.tr-empty { font-size: 15px; color: var(--hutto-dark); font-weight: 600; }
.crm-btn.danger-text { color: #9b1c15; }
@media (max-width: 820px) {
  .crm-trait { width: 100vw; height: 100dvh; max-height: 100dvh; max-width: 100vw; border-radius: 0; }
  .tr-body { grid-template-columns: 1fr; padding: 10px; gap: 10px; }
  .tr-act { position: static; order: -1; }
  .tr-bar, .tr-head .crm-muted { display: none; }
  .tr-btns kbd { display: none; }
  .tr-start { padding: 16px; }
}
.tr-sec { margin-top: 12px; }
.tr-sec .gallery { margin-top: 0; }
.tr-map { height: 230px; margin: 4px 0; position: relative; }
.map-approx { position: absolute; left: 6px; bottom: 6px; z-index: 500; background: rgba(255,255,255,.92); color: #7a4f0e; font-size: 11.5px; padding: 2px 7px; border-radius: 5px; }
.tr-text { margin: 3px 0 0; white-space: pre-wrap; color: var(--ink-2); max-height: 180px; overflow: auto; }
.tr-disc { max-height: 220px; overflow: auto; margin: 3px 0 0; padding-left: 16px; }
.tr-hist .thumbs a { width: 104px; height: 78px; }

/* ---------- Suivi des propriétaires (cahier §15) ---------- */
.suivi-lot { margin: 12px 0 22px; }
.suivi-lot-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.suivi-lot-head h2 { margin: 0; font-size: 16px; }
.suivi-lot tr.off td { opacity: .45; }
.suivi-exclus { margin: 8px 0; font-size: 13px; }
.suivi-exclus summary { cursor: pointer; color: var(--ink-2); }
.suivi-photos { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.suivi-photos img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.suivi-apercu { width: min(820px, 96vw); }
.suivi-apercu .suivi-frame { height: min(62vh, 640px); }
.suivi-textes { display: grid; gap: 12px; max-width: 760px; }
.suivi-texte { display: grid; gap: 4px; }
.suivi-texte .flab { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.suivi-texte textarea, .suivi-texte input { width: 100%; box-sizing: border-box; font: inherit; font-size: 13px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.suivi-type { margin: 8px 0; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: #fff; }
.suivi-type > summary { cursor: pointer; padding: 4px 0; }
.suivi-type-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.suivi-lot .barre { text-decoration: line-through; opacity: .6; }
.suivi-avantage { border: 1px solid #c9dccf; border-radius: 10px; padding: 10px 12px; background: #f7faf6; display: grid; gap: 10px; }
.suivi-avantage legend { font-weight: 600; font-size: 13px; padding: 0 6px; display: flex; gap: 8px; align-items: center; }
.suivi-av-ligne { display: grid; grid-template-columns: 1fr 180px; gap: 10px; }
@media (max-width: 600px) { .suivi-av-ligne { grid-template-columns: 1fr; } }
.suivi-tem { display: flex; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 10px 0; background: #fff; }
.suivi-tem.publie { border-color: #9cc9a8; background: #f6fbf7; }
.suivi-tem.ecarte { opacity: .55; }
.suivi-tem img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; }
.suivi-tem-corps { flex: 1; min-width: 0; }
.suivi-tem blockquote { margin: 0 0 6px; padding-left: 10px; border-left: 3px solid #2E5E3A; font-style: italic; white-space: normal; }
.suivi-tem-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.suivi-anim { display: grid; gap: 14px; max-width: 820px; }
.suivi-anim h3 { margin: 0 0 6px; font-size: 15px; color: #2E5E3A; }
.suivi-anim ul { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.6; }
.suivi-anim textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 13px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
@media (max-width: 600px) { .suivi-tem { flex-direction: column; } .suivi-tem img { width: 100%; height: 180px; } }
.suivi-h3 { font-size: 15px; margin: 16px 0 6px; color: #2E5E3A; }
.bon-code { width: 150px; font-family: "Courier New", monospace; font-size: 13px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; }
.fiche-card.reseau .res-ligne { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 6px 0; border-top: 1px solid #eef1ec; font-size: 13px; }
.fiche-card.reseau .res-ligne:first-of-type { border-top: 0; }
.fiche-card.reseau .res-titre { color: var(--ink-2, #555); font-weight: 600; }
.fiche-card.reseau .res-actions { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 600px) { .fiche-card.reseau .res-ligne { grid-template-columns: 1fr; gap: 2px; } }
