/* CRM Aircooling — module autonome : toutes les règles visent les écrans du CRM (#crm-view, #crm-account-view,
   #crm-dialog). Couleurs et typographie de l'application existante.
   Téléphone < 768 px · tablette 768–1199 px · PC ≥ 1200 px (menu latéral existant). */

.crm-view { --crm-soft:#f7f9fd; --crm-text:#41586d; --crm-radius:14px; }
.crm-icon { flex:0 0 auto; width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.crm-view .button,.crm-dialog .button { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; text-align:center; }
.crm-view .button:disabled,.crm-dialog .button:disabled { opacity:.45; cursor:not-allowed; filter:grayscale(.4); transform:none; }
.crm-view :is(button,a,input,select,textarea):focus-visible,.crm-dialog :is(button,a,input,select,textarea):focus-visible { outline:3px solid #9ab6ea; outline-offset:2px; }
.crm-view select,.crm-dialog select { width:100%; padding:10px 12px; border:1px solid #b9cad2; border-radius:8px; color:var(--ink); background:#fff; font-weight:400; }
.crm-muted { color:var(--muted); }
.crm-intro { max-width:82ch; margin:0 0 16px; color:var(--crm-text,#41586d); font-size:.92rem; line-height:1.55; }
.crm-empty { margin:0; padding:18px; border:1px dashed #cfd8e3; border-radius:12px; color:var(--muted); background:#fbfdff; text-align:center; }
.crm-loading { margin:0; padding:18px 0; color:var(--muted); }
.crm-failure { padding:14px 0; }
.crm-button-danger { color:#fff; background:#b42318; }
.crm-danger-link { color:#a62d2d; }

/* ---------- En-tête et onglets ---------- */
.crm-header { margin-bottom:18px; }
.crm-header-actions { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:8px; }
.crm-badges { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin-top:10px; }
.crm-tabs { display:flex; flex-wrap:wrap; gap:2px; margin:0 0 20px; border-bottom:1px solid var(--line); }
.crm-tab { display:inline-flex; align-items:center; gap:6px; min-height:46px; margin-bottom:-1px; padding:10px 12px; border:0; border-bottom:3px solid transparent; color:var(--muted); background:none; font-weight:800; white-space:nowrap; }
.crm-tab:hover { color:var(--navy); }
.crm-tab.is-active { color:var(--blue); border-bottom-color:var(--blue); }
.crm-count { display:inline-grid; min-width:22px; place-items:center; padding:1px 7px; border-radius:99px; color:var(--blue); background:var(--ice); font-size:.74rem; font-weight:800; }
.crm-count.is-alert { color:#a12a2a; background:#fdecec; }

/* ---------- Pastilles ---------- */
.crm-pill { display:inline-flex; align-items:center; padding:3px 9px; border-radius:99px; color:#41586d; background:#eef2f7; font-size:.76rem; font-weight:800; line-height:1.4; white-space:nowrap; }
.crm-pill.is-prospect { color:#7a4b00; background:#fff1cd; }
.crm-pill.is-client { color:#0d663d; background:#dcf5e7; }
.crm-pill.is-inactive { color:#4b5563; background:#eceff3; }
.crm-pill.is-archived { color:var(--muted); background:#fff; box-shadow:inset 0 0 0 1px #cfd8e3; }
.crm-pill.is-main { color:var(--blue); background:var(--ice); }
.crm-pill.is-warning { color:#8a4b00; background:#fff4e5; white-space:normal; }
.crm-flag { display:inline-flex; align-items:center; gap:5px; padding:3px 9px; border-radius:6px; font-size:.76rem; font-weight:800; line-height:1.4; white-space:nowrap; }
.crm-flag .crm-icon { width:14px; height:14px; }
.crm-flag.is-red_flag { color:#a12a2a; background:#fdecec; box-shadow:inset 0 0 0 1px #f3c2c2; }
.crm-flag.is-blacklist { color:#fff; background:#20262e; }

/* ---------- Cartes communes ---------- */
.crm-card { min-width:0; padding:20px; border:1px solid var(--line); border-radius:var(--crm-radius,14px); background:#fff; box-shadow:0 2px 5px #173d4c08; }
.crm-card-head,.crm-section-head { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px; margin-bottom:14px; }
.crm-card-head h2,.crm-section-head h2 { margin:0; color:var(--navy); font-size:1.12rem; }
.crm-section-actions { display:flex; flex-wrap:wrap; gap:8px; }
.crm-search { position:relative; display:block; min-width:0; }
.crm-search .crm-icon { position:absolute; top:50%; left:13px; color:var(--muted); transform:translateY(-50%); pointer-events:none; }
.crm-search input { min-height:46px; padding-left:42px; background:#fff; }

/* ---------- Tableau de bord ---------- */
.crm-kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:14px; margin-bottom:18px; }
.crm-kpi { display:grid; gap:6px; min-width:0; padding:18px; border:1px solid var(--line); border-radius:14px; color:var(--ink); background:#fff; box-shadow:0 2px 5px #173d4c08; text-align:left; transition:border-color .15s,box-shadow .15s; }
.crm-kpi span { color:var(--muted); font-size:.86rem; font-weight:700; overflow-wrap:anywhere; }
.crm-kpi strong { color:var(--navy); font-size:2rem; line-height:1.1; }
.crm-kpi:hover { border-color:#87b9d8; box-shadow:0 6px 18px #173d4c14; }
.crm-kpi.is-attention { box-shadow:inset 4px 0 0 var(--red),0 2px 5px #173d4c08; }
.crm-dashboard-grid { display:grid; gap:18px; }
.crm-quick-search { display:flex; gap:10px; }
.crm-quick-search .crm-search { flex:1 1 auto; }
.crm-recent { display:grid; margin:0; padding:0; list-style:none; }
.crm-recent li + li { border-top:1px solid #edf1f5; }
.crm-recent-item { display:flex; width:100%; align-items:center; justify-content:space-between; gap:12px; min-height:56px; padding:10px 4px; border:0; color:var(--ink); background:none; text-align:left; }
.crm-recent-item > span:first-child { min-width:0; }
.crm-recent-item strong { display:block; color:var(--navy); overflow-wrap:anywhere; }
.crm-recent-item small { display:block; color:var(--muted); font-size:.84rem; }
.crm-recent-item:hover { background:#fafcff; }

/* ---------- Liste des dossiers ---------- */
.crm-toolbar { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; }
.crm-toolbar .crm-search { flex:1 1 280px; max-width:460px; }
.crm-filter { margin-top:0; }
.crm-list-count { min-height:1.2em; margin:14px 0 8px; color:var(--muted); font-size:.86rem; }
.crm-list > .button { margin-top:12px; }
.crm-rows-head,.crm-row { display:grid; grid-template-columns:minmax(0,1.6fr) minmax(0,1.4fr) minmax(0,.9fr) minmax(0,1fr) 110px; align-items:center; gap:16px; }
.crm-rows-head { padding:11px 18px; border:1px solid var(--line); border-bottom:0; border-radius:12px 12px 0 0; color:var(--muted); background:#f3f7fc; font-size:.74rem; font-weight:800; letter-spacing:.05em; text-transform:uppercase; }
.crm-rows { margin:0; padding:0; overflow:hidden; list-style:none; border:1px solid var(--line); border-radius:0 0 12px 12px; background:#fff; }
.crm-rows li + li { border-top:1px solid #edf1f5; }
.crm-row { width:100%; min-height:64px; padding:12px 18px; border:0; color:var(--ink); background:#fff; text-align:left; }
.crm-row:hover { background:#fafcff; }
.crm-row > span { min-width:0; }
.crm-row-main strong { display:block; color:var(--navy); overflow-wrap:anywhere; }
.crm-row-main small { display:block; margin-top:2px; color:var(--muted); font-size:.84rem; }
.crm-row-contact { display:grid; gap:3px; color:var(--crm-text,#41586d); font-size:.86rem; }
.crm-row-contact > span,.crm-row-city { display:flex; align-items:center; gap:6px; min-width:0; overflow-wrap:anywhere; }
.crm-row-contact .crm-icon,.crm-row-city .crm-icon { width:15px; height:15px; color:var(--muted); }
.crm-row-city { color:var(--crm-text,#41586d); font-size:.88rem; }
.crm-row-status { display:flex; flex-wrap:wrap; gap:6px; }
.crm-row-date { color:var(--muted); font-size:.84rem; text-align:right; }
.crm-more { display:flex; justify-content:center; margin-top:14px; }

/* ---------- À rattacher ---------- */
.crm-pending { display:grid; gap:14px; margin:0; padding:0; list-style:none; }
.crm-pending-head { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:6px 12px; }
.crm-pending-item h3 { margin:10px 0 6px; color:var(--navy); font-size:1.05rem; overflow-wrap:anywhere; }
.crm-pending-meta { display:flex; flex-wrap:wrap; gap:6px 18px; margin:0; color:var(--crm-text,#41586d); font-size:.88rem; }
.crm-pending-meta span { display:inline-flex; align-items:center; gap:6px; min-width:0; overflow-wrap:anywhere; }
.crm-pending-meta .crm-icon { width:15px; height:15px; color:var(--muted); }
.crm-doc-type { display:inline-flex; align-items:center; gap:6px; color:var(--blue); font-size:.76rem; font-weight:800; letter-spacing:.04em; text-transform:uppercase; }
.crm-doc-type .crm-icon { width:16px; height:16px; }
.crm-matches { margin-top:14px; padding:4px 14px; border-radius:10px; background:var(--crm-soft,#f7f9fd); }
.crm-matches-title { margin:10px 0 4px; color:var(--navy); font-size:.86rem; font-weight:800; }
.crm-matches ul,.crm-matches-list { margin:0; padding:0; list-style:none; }
.crm-match { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px; padding:10px 0; }
.crm-match + .crm-match { border-top:1px solid #e3e9f1; }
.crm-match > span:first-child { min-width:0; flex:1 1 240px; }
.crm-match strong { display:block; color:var(--navy); overflow-wrap:anywhere; }
.crm-match small { display:block; color:var(--muted); font-size:.82rem; overflow-wrap:anywhere; }
.crm-match.is-reliable strong::after { content:"Fiable"; margin-left:8px; padding:1px 7px; border-radius:99px; color:#0d663d; background:#dcf5e7; font-size:.7rem; vertical-align:middle; }
.crm-matches-list .crm-match { padding:12px 0; }
.crm-match-actions { display:flex; align-items:center; gap:10px; }
.crm-no-match { margin:12px 0 0; font-size:.88rem; }
.crm-pending-actions { display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin-top:16px; }

/* ---------- Dossier ---------- */
.crm-account-layout { display:grid; gap:20px; }
.crm-identity { align-self:start; }
.crm-quick-contact { display:grid; gap:8px; margin:0; }
.crm-contact-chip { display:flex; align-items:center; gap:10px; min-height:44px; min-width:0; padding:9px 12px; border:1px solid var(--line); border-radius:10px; color:var(--navy); background:#fbfdff; font-weight:700; text-decoration:none; }
.crm-contact-chip span { min-width:0; overflow-wrap:break-word; }
.crm-facts-box { margin-top:14px; }
.crm-facts-box > summary { display:flex; align-items:center; min-height:44px; color:var(--blue); font-weight:800; cursor:pointer; }
.crm-facts-box > .crm-facts { margin-top:4px; }
.crm-equipment > .crm-pill { justify-self:start; }
.crm-contact-chip .crm-icon { color:var(--blue); }
.crm-contact-chip:hover { border-color:#87b9d8; background:var(--ice); }
.crm-facts { display:grid; gap:12px; margin:16px 0 0; }
.crm-facts dt { color:var(--muted); font-size:.72rem; font-weight:800; letter-spacing:.05em; text-transform:uppercase; }
.crm-facts dd { margin:3px 0 0; color:var(--ink); font-weight:600; overflow-wrap:anywhere; }
.crm-account-main { min-width:0; }
/* Onglets du dossier : pastilles qui passent à la ligne, aucune section masquée quelle que soit la largeur. */
.crm-account-tabs { flex-wrap:wrap; gap:6px; margin-bottom:18px; overflow:visible; border-bottom:0; }
.crm-account-tabs .crm-tab { min-height:42px; margin:0; padding:8px 12px; border:1px solid var(--line); border-radius:10px; background:#fff; }
.crm-account-tabs .crm-tab.is-active { border-color:var(--blue); background:var(--ice); box-shadow:inset 0 0 0 1px var(--blue); }
.crm-cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:14px; margin:0; padding:0; list-style:none; }
.crm-item { display:flex; flex-direction:column; }
.crm-item-head { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.crm-item h3 { display:flex; align-items:flex-start; gap:8px; min-width:0; margin:0; color:var(--navy); font-size:1rem; overflow-wrap:anywhere; }
.crm-item h3 .crm-icon { margin-top:2px; color:var(--blue); }
.crm-item > p { margin:8px 0 0; color:var(--crm-text,#41586d); overflow-wrap:anywhere; }
.crm-item .crm-quick-contact { margin-top:10px; }
.crm-item-meta { display:flex; flex-wrap:wrap; gap:4px 14px; color:var(--muted) !important; font-size:.82rem; }
.crm-item-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:auto; padding-top:14px; }
.crm-archived-note { margin:12px 0 0; font-size:.84rem; }
.crm-equipment-group + .crm-equipment-group { margin-top:20px; }
.crm-equipment-group h3 { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:0 0 10px; color:var(--navy); font-size:.98rem; overflow-wrap:anywhere; }
.crm-equipment-group h3 .crm-icon { color:var(--blue); }
.crm-equipment-list { display:grid; gap:10px; margin:0; padding:0; list-style:none; }
.crm-equipment { display:grid; grid-template-columns:minmax(0,1.1fr) minmax(0,1.5fr) auto; align-items:center; gap:10px 16px; padding:14px 16px; border:1px solid var(--line); border-radius:12px; background:#fff; }
.crm-equipment-main strong { display:block; color:var(--navy); overflow-wrap:anywhere; }
.crm-equipment-main small { display:block; margin-top:2px; color:var(--muted); font-size:.84rem; overflow-wrap:anywhere; }
.crm-quantity { margin-left:4px; padding:1px 7px; border-radius:99px; color:var(--blue); background:var(--ice); font-size:.78rem; }
.crm-equipment-facts { display:flex; flex-wrap:wrap; gap:6px 18px; margin:0; }
.crm-equipment-facts dt { color:var(--muted); font-size:.7rem; font-weight:800; letter-spacing:.04em; text-transform:uppercase; }
.crm-equipment-facts dd { margin:0; font-size:.9rem; overflow-wrap:anywhere; }
.crm-equipment-details { grid-column:1 / -1; margin:0; color:var(--crm-text,#41586d); font-size:.88rem; }
.crm-equipment .crm-item-actions { grid-column:1 / -1; padding-top:4px; }
.crm-history { margin:0; padding:0; overflow:hidden; list-style:none; border:1px solid var(--line); border-radius:12px; background:#fff; }
.crm-history-item { display:grid; grid-template-columns:170px minmax(0,1fr) 110px auto auto; align-items:center; gap:12px; padding:12px 16px; }
.crm-history-item + .crm-history-item { border-top:1px solid #edf1f5; }
.crm-history-main { min-width:0; }
.crm-history-main strong { display:block; color:var(--navy); overflow-wrap:anywhere; }
.crm-history-main small { display:block; color:var(--muted); font-size:.82rem; overflow-wrap:anywhere; }
.crm-history-date { color:var(--crm-text,#41586d); font-size:.86rem; }
.crm-notes-grid { display:grid; gap:18px; }
.crm-notes-grid h3 { display:flex; align-items:center; gap:8px; margin:0; color:var(--navy); font-size:1rem; }
.crm-confidential h3 .crm-icon { color:#8a4b00; }
.crm-notes { display:grid; gap:10px; margin:12px 0 0; padding:0; list-style:none; }
.crm-note { padding:12px 14px; border:1px solid var(--line); border-radius:10px; background:#fff; }
.crm-confidential .crm-note { box-shadow:inset 3px 0 0 #e8b04a; }
.crm-note p { margin:0; white-space:pre-wrap; overflow-wrap:anywhere; }
.crm-note small { display:block; margin-top:6px; color:var(--muted); font-size:.8rem; }
.crm-notes-grid .crm-empty { margin-top:12px; }
.crm-flag-card { display:grid; justify-items:start; gap:8px; margin-bottom:18px; }
.crm-flag-card p { margin:0; white-space:pre-wrap; overflow-wrap:anywhere; }
.crm-flag-card small { color:var(--muted); }
.crm-flag-card.is-red_flag { box-shadow:inset 4px 0 0 #d64545; }
.crm-flag-card.is-blacklist { box-shadow:inset 4px 0 0 #20262e; }
.crm-form-title { margin:22px 0 12px; padding-top:16px; border-top:1px solid #e8eef5; color:var(--navy); font-size:1rem; }
.crm-events,.crm-audit-list { margin:0; padding:0; list-style:none; }
.crm-events li,.crm-audit-list li { display:grid; grid-template-columns:170px minmax(0,1fr) auto; gap:12px; padding:10px 0; }
.crm-events li + li,.crm-audit-list li + li { border-top:1px solid #edf1f5; }
.crm-events small,.crm-audit-list small { display:block; margin-top:2px; color:var(--muted); font-size:.82rem; overflow-wrap:anywhere; }
.crm-audit-list .text-button { padding:0; min-height:0; }
.crm-audit-when { color:var(--muted); font-size:.84rem; }

/* ---------- Paramètres et droits ---------- */
.crm-settings { display:grid; gap:18px; }
.crm-permissions { display:grid; }
.crm-perm-head,.crm-perm-row { display:grid; grid-template-columns:minmax(190px,1.6fr) repeat(8,minmax(62px,1fr)) 120px; align-items:center; gap:8px; }
.crm-perm-head { padding:0 0 10px; border-bottom:1px solid var(--line); color:var(--muted); font-size:.7rem; font-weight:800; letter-spacing:.03em; text-align:center; text-transform:uppercase; }
.crm-perm-head span:first-child { text-align:left; }
.crm-perm-row { padding:12px 0; border-bottom:1px solid #edf1f5; }
.crm-perm-who { min-width:0; }
.crm-perm-who strong { display:block; color:var(--navy); overflow-wrap:anywhere; }
.crm-perm-who small { display:block; color:var(--muted); font-size:.8rem; overflow-wrap:anywhere; }
.crm-perm-cell { display:flex; justify-content:center; margin:0; }
.crm-perm-cell input { width:20px; height:20px; accent-color:var(--blue); }
.crm-perm-cell span { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
.crm-perm-save { display:flex; justify-content:flex-end; }

/* ---------- Fenêtre de saisie ---------- */
.crm-dialog { width:calc(100% - 24px); max-width:580px; padding:0; border:0; border-radius:16px; color:var(--ink); box-shadow:0 18px 50px #061d2d55; }
.crm-dialog.is-wide { max-width:780px; }
.crm-dialog::backdrop { background:#0b1b2c80; }
.crm-dialog-form { display:flex; flex-direction:column; max-height:calc(100dvh - 32px); }
.crm-dialog-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:18px 22px 12px; border-bottom:1px solid #e8eef5; }
.crm-dialog-head h2 { margin:0; color:var(--navy); font-size:1.2rem; }
.crm-close { display:grid; width:44px; height:44px; flex:0 0 44px; place-items:center; border:0; border-radius:10px; color:var(--muted); background:transparent; font-size:1.7rem; line-height:1; }
.crm-close:hover { background:var(--ice); }
.crm-dialog-body { flex:1 1 auto; min-height:0; overflow:auto; padding:18px 22px 6px; }
.crm-dialog-body .form-grid { gap:14px; }
.crm-dialog-body label > span { color:#354d58; }
.crm-dialog-body .checkbox-row { margin:0; }
.crm-dialog-body .choice-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.crm-choices { margin:0; }
.crm-dialog-error { padding:0 22px; }
.crm-dialog-error:empty { display:none; }
.crm-dialog-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:10px; padding:14px 22px 18px; border-top:1px solid #e8eef5; }
.crm-confirm-text { margin:0 0 8px; color:var(--crm-text,#41586d); line-height:1.55; }
.crm-doc-results { margin-top:14px; }

/* ---------- Entretiens (lot 2) ---------- */
.crm-maint-filter { flex-wrap:wrap; width:auto; margin-bottom:16px; overflow:visible; }
.crm-cycle-state .crm-pill,.crm-plan .crm-pill { white-space:normal; }
.crm-cycle,.crm-plan,.crm-cycle > *,.crm-plan > * { min-width:0; }
.crm-maint-filter .crm-count { margin-left:4px; }
.crm-cycles { display:grid; gap:12px; margin:0; padding:0; list-style:none; }
.crm-cycle { display:grid; gap:10px; }
.crm-cycle.is-todo { box-shadow:inset 4px 0 0 var(--blue),0 2px 5px #173d4c08; }
.crm-cycle.is-alert { box-shadow:inset 4px 0 0 var(--red),0 2px 5px #173d4c08; }
.crm-cycle.is-ok { box-shadow:inset 4px 0 0 #1f8a57,0 2px 5px #173d4c08; }
.crm-cycle h3 { display:flex; flex-wrap:wrap; align-items:baseline; gap:6px 10px; margin:0; font-size:1.02rem; }
.crm-cycle .crm-pending-meta,.crm-cycle .crm-item-meta { margin:0; }
.crm-cycle-head { display:flex; flex-wrap:wrap; align-items:flex-start; justify-content:space-between; gap:8px 14px; }
.crm-cycle-due { display:grid; justify-items:end; text-align:right; }
.crm-cycle-due strong { color:var(--navy); }
.crm-cycle-due small { color:var(--muted); font-size:.82rem; }
.crm-action { white-space:normal; }
.crm-action.is-todo { color:var(--blue); background:var(--ice); }
.crm-action.is-alert { color:#a12a2a; background:#fdecec; }
.crm-action.is-ok { color:#0d663d; background:#dcf5e7; }
.crm-action.is-wait { color:#41586d; background:#eef2f7; }
.crm-link { padding:0; border:0; color:var(--navy); background:none; font:inherit; font-weight:800; text-align:left; text-decoration:underline; text-decoration-color:#cfd8e3; text-underline-offset:3px; }
.crm-link:hover { color:var(--blue); }
.crm-cycle-state { display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; font-size:.84rem; }
.crm-steps { display:inline-flex; flex-wrap:wrap; gap:6px; }
.crm-step { display:inline-flex; align-items:center; padding:3px 9px; border:1px dashed #b9cad2; border-radius:99px; color:var(--muted); font-size:.76rem; font-weight:700; }
.crm-step.is-prepared { border-style:solid; border-color:#e8b04a; color:#8a4b00; background:#fff8ec; }
.crm-step.is-done { border-style:solid; border-color:#9fd6b8; color:#0d663d; background:#effaf4; }
.crm-cycle-actions { display:flex; flex-wrap:wrap; align-items:flex-start; gap:8px; }
.crm-menu { position:relative; }
.crm-menu > summary { list-style:none; cursor:pointer; }
.crm-menu > summary::-webkit-details-marker { display:none; }
.crm-menu-list { position:absolute; z-index:4; top:calc(100% + 6px); left:0; display:grid; min-width:260px; padding:6px; border:1px solid var(--line); border-radius:12px; background:#fff; box-shadow:0 12px 30px #061d2d26; }
.crm-menu-item { min-height:44px; padding:8px 12px; border:0; border-radius:8px; color:var(--ink); background:none; font-weight:700; text-align:left; }
.crm-menu-item:hover { background:var(--ice); }
.crm-plans { grid-template-columns:minmax(0,1fr); }
.crm-plan { display:grid; gap:12px; }
.crm-plan h4,.crm-price-block h4 { margin:0 0 8px; color:var(--navy); font-size:.92rem; }
.crm-plan-facts { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:10px 18px; margin:0; }
.crm-plan-facts dt { color:var(--muted); font-size:.72rem; font-weight:800; letter-spacing:.05em; text-transform:uppercase; }
.crm-plan-facts dd { margin:3px 0 0; font-weight:600; overflow-wrap:anywhere; }
.crm-plan-facts small { display:block; color:var(--muted); font-size:.8rem; font-weight:500; }
.crm-plan-cycle .crm-cycle { box-shadow:none; border-color:#e3e9f1; background:var(--crm-soft,#f7f9fd); }
.crm-price-block { padding:12px 14px; border:1px solid #e3e9f1; border-radius:10px; background:#fbfdff; }
.crm-price-block p { margin:0 0 6px; }
.crm-notice { margin:0 0 12px; padding:10px 12px; border-left:4px solid var(--sky); border-radius:8px; color:var(--navy); background:var(--ice); font-size:.9rem; }
.crm-warnings { margin:0 0 12px; padding:10px 12px 10px 30px; border-radius:8px; color:#8a4b00; background:#fff4e5; font-size:.88rem; }
.crm-reminder { border:1px solid var(--line); border-radius:10px; background:#fff; }
.crm-reminder p { margin:0; padding:10px 14px; border-bottom:1px solid #edf1f5; font-size:.9rem; overflow-wrap:anywhere; }
.crm-reminder-body { margin:0; padding:14px; color:var(--ink); font:inherit; font-size:.9rem; line-height:1.55; white-space:pre-wrap; overflow-wrap:anywhere; }
.crm-reminder-actions { margin-top:14px; align-items:end; }
.crm-inline-buttons { display:flex; flex-wrap:wrap; align-items:center; gap:8px 14px; }
.crm-days { display:flex; flex-wrap:wrap; gap:4px 18px; }
.crm-days .checkbox-row { margin:0; min-height:44px; }
.crm-template + .crm-template { margin-top:22px; padding-top:18px; border-top:1px solid #e8eef5; }
.crm-template h3 { margin:0 0 12px; color:var(--navy); font-size:1rem; }
.crm-template textarea { font-size:.9rem; line-height:1.5; }

/* ---------- Tournées (lot 3) ---------- */
.crm-tour-filter { margin-bottom:16px; }
.crm-tours { grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); }
.crm-tour-head { display:flex; flex-wrap:wrap; align-items:flex-end; justify-content:space-between; gap:12px 20px; margin:6px 0 12px; }
.crm-tour-head h2 { margin:0; color:var(--navy); font-size:1.5rem; overflow-wrap:anywhere; }
.crm-tour-head .eyebrow { margin-bottom:4px; }
.crm-publish-help { margin:0 0 12px; }
.crm-tour-layout { display:grid; gap:18px; }
.crm-stops { display:grid; gap:0; margin:0; padding:0; list-style:none; }
.crm-stop { position:relative; display:grid; grid-template-columns:36px minmax(0,1fr); gap:6px 12px; padding:12px 0; }
.crm-stop + .crm-stop { border-top:1px dashed #d8e1ed; }
.crm-stop-number { display:grid; width:32px; height:32px; place-items:center; border-radius:50%; color:#fff; background:var(--blue); font-weight:800; }
.crm-stop.is-depot .crm-stop-number { color:var(--navy); background:var(--ice); }
.crm-stop-main { display:grid; gap:3px; min-width:0; }
.crm-stop-main strong { color:var(--navy); overflow-wrap:anywhere; }
.crm-stop-main small { color:var(--muted); font-size:.84rem; overflow-wrap:anywhere; }
.crm-stop-main .crm-cycle-state { margin-top:4px; }
.crm-stop-actions { display:flex; flex-wrap:wrap; gap:6px; grid-column:2; }
.crm-icon-button { display:grid; min-width:44px; min-height:44px; place-items:center; border:1px solid var(--line); border-radius:8px; color:var(--blue); background:#fff; font-size:1.1rem; font-weight:800; }
.crm-icon-button:disabled { opacity:.35; cursor:default; }
.crm-candidate-filters { display:grid; gap:10px; margin-bottom:8px; }
.crm-candidate-group { margin:16px 0 6px; color:var(--navy); font-size:.92rem; }
.crm-candidate-list { display:grid; gap:6px; margin:0; padding:0; list-style:none; }
.crm-candidate { display:flex; align-items:flex-start; gap:10px; min-height:44px; margin:0; padding:10px 12px; border:1px solid var(--line); border-radius:10px; background:#fff; font-weight:400; cursor:pointer; }
.crm-candidate input { flex:0 0 auto; width:22px; height:22px; margin-top:2px; accent-color:var(--blue); }
.crm-candidate > span { display:grid; gap:2px; min-width:0; }
.crm-candidate strong { color:var(--navy); overflow-wrap:anywhere; }
.crm-candidate small { color:var(--muted); font-size:.82rem; overflow-wrap:anywhere; }
.crm-candidate.is-disabled { opacity:.6; cursor:default; }
.crm-candidate:has(input:checked) { border-color:var(--blue); background:var(--ice); }
.crm-day-events { display:grid; gap:8px; margin:0; padding:0; list-style:none; }
.crm-day-events li { display:grid; gap:2px; padding:8px 0; border-top:1px solid #edf1f5; }
.crm-day-events li:first-child { border-top:0; }
.crm-day-events small { color:var(--muted); font-size:.82rem; }

/* ---------- TVA, demandes et rendez-vous (lot 4) ---------- */
.crm-pill.is-alert { color:#a12a2a; background:#fdecec; }
.crm-vat-preview { min-width:0; }
.crm-vat-preview > p { margin:6px 0 0; font-size:.86rem; }
.crm-vat-table { width:100%; border-collapse:collapse; font-size:.9rem; font-variant-numeric:tabular-nums; }
.crm-vat-table caption { padding:0 0 6px; color:var(--navy); font-weight:800; text-align:left; }
.crm-vat-table th,.crm-vat-table td { padding:7px 8px; border-top:1px solid #e3e9f1; text-align:right; white-space:nowrap; }
.crm-vat-table thead th { border-top:0; color:var(--muted); font-size:.74rem; font-weight:800; text-transform:uppercase; }
.crm-vat-table tbody th { color:var(--ink); font-weight:700; text-align:left; white-space:normal; }
.crm-vat-table tbody tr:last-child { font-weight:800; }
.crm-vat-row + .crm-vat-row { margin-top:16px; padding-top:16px; border-top:1px solid #e8eef5; }
.crm-vat-row .form-actions { display:flex; flex-wrap:wrap; align-items:center; gap:10px; }
.crm-closed-block { margin-top:16px; }
.crm-closed-block > summary,.crm-history-box > summary { display:flex; align-items:center; min-height:44px; color:var(--blue); font-weight:800; cursor:pointer; }
.crm-closed-block > form,.crm-closed-block > .form-grid { margin-top:10px; }
.crm-history-box { margin-top:4px; }
.crm-history-box .crm-events { margin-top:4px; }
.crm-request,.crm-appt { display:grid; gap:10px; min-width:0; }
.crm-request > *,.crm-appt > * { min-width:0; }
.crm-request h3,.crm-appt h3 { display:flex; flex-wrap:wrap; align-items:baseline; gap:6px 10px; margin:0; font-size:1.02rem; }
.crm-request .crm-pending-meta,.crm-request .crm-item-meta,.crm-appt .crm-pending-meta,.crm-appt .crm-item-meta,.crm-request .crm-cycle-state { margin:0; }
.crm-request.is-closed { opacity:.85; }
.crm-request-details { margin:0; padding:10px 12px; border-radius:8px; color:var(--crm-text,#41586d); background:var(--crm-soft,#f7f9fd); font-size:.9rem; white-space:pre-wrap; overflow-wrap:anywhere; }
.crm-appt-badges .crm-pill { white-space:normal; }
.crm-appt.is-confirmed { box-shadow:inset 4px 0 0 #1f8a57,0 2px 5px #173d4c08; }
.crm-appt.is-proposed,.crm-appt.is-to_schedule { box-shadow:inset 4px 0 0 #e8b04a,0 2px 5px #173d4c08; }
.crm-appt.is-client_absent { box-shadow:inset 4px 0 0 var(--red),0 2px 5px #173d4c08; }
.crm-appt-infos { display:grid; gap:8px; margin:0; }
.crm-appt-infos dt { color:var(--muted); font-size:.72rem; font-weight:800; letter-spacing:.05em; text-transform:uppercase; }
.crm-appt-infos dd { margin:2px 0 0; font-size:.9rem; white-space:pre-wrap; overflow-wrap:anywhere; }
.crm-sub-appts .crm-appt { border-color:#e3e9f1; background:var(--crm-soft,#f7f9fd); }
.crm-picked:empty { display:none; }
.crm-account-results { margin-top:8px; }

/* ---------- Frais d'absence, confirmations, rappels, « Mes rendez-vous » (lot 5) ---------- */
.crm-appt-extra { display:grid; gap:6px; padding:10px 12px; border-radius:10px; background:var(--crm-soft,#f7f9fd); font-size:.86rem; color:var(--crm-text,#41586d); }
.crm-appt-extra > span { overflow-wrap:anywhere; }
.crm-appt-extra .crm-pill { justify-self:start; white-space:normal; }
.crm-reminder-toolbar { display:flex; flex-wrap:wrap; align-items:flex-end; gap:10px 16px; margin:0 0 16px; padding:12px 14px; border:1px solid var(--line); border-radius:12px; background:#fff; }
.crm-reminder-toolbar label { display:grid; gap:4px; margin:0; font-weight:700; }
.crm-reminder-toolbar .field-help { flex:1 1 100%; margin:0; }
#crm-my-view .crm-contact-chip { display:inline-flex; min-height:44px; }

/* ======================== Tablette et PC (≥ 768 px) ======================== */
@media (min-width:768px) {
  .crm-dashboard-grid { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
  .crm-identity .crm-facts { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .crm-notes-grid { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
}

/* Tablette : liste sans la colonne de date, droits en cartes. */
@media (min-width:768px) and (max-width:1199px) {
  .crm-rows-head,.crm-row { grid-template-columns:minmax(0,1.5fr) minmax(0,1.3fr) minmax(0,1fr) minmax(0,auto); }
  .crm-rows-head span:last-child,.crm-row-date { display:none; }
  .crm-history-item { grid-template-columns:150px minmax(0,1fr) auto auto; }
  .crm-history-item .crm-history-date { display:none; }
}

/* PC et grande tablette paysage : fiche du dossier en deux colonnes. */
@media (min-width:1024px) {
  .crm-tour-layout { grid-template-columns:minmax(0,1.15fr) minmax(0,1fr); align-items:start; }
  .crm-tour-layout > .crm-card:last-child:nth-child(3) { grid-column:1; }
  .crm-candidates { grid-row:span 2; }
  .crm-candidate-filters { grid-template-columns:minmax(0,1fr) minmax(0,220px); align-items:end; }
  .crm-account-layout { grid-template-columns:300px minmax(0,1fr); align-items:start; }
  .crm-identity { position:sticky; top:96px; }
  .crm-identity .crm-facts { grid-template-columns:minmax(0,1fr); }
}

/* Droits CRM en tableau seulement quand la largeur le permet. */
@media (max-width:1199px) {
  .crm-perm-head { display:none; }
  .crm-perm-row { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 14px; }
  .crm-perm-who,.crm-perm-save { grid-column:1 / -1; }
  .crm-perm-save { justify-content:flex-start; }
  .crm-perm-cell { justify-content:flex-start; align-items:center; gap:10px; min-height:44px; }
  .crm-perm-cell input { width:24px; height:24px; }
  .crm-perm-cell span { position:static; width:auto; height:auto; overflow:visible; clip:auto; white-space:normal; font-size:.86rem; font-weight:600; }
}

/* ======================== Téléphone (< 768 px) ======================== */
@media (max-width:767px) {
  .crm-header { margin-bottom:12px; }
  .crm-header-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); justify-content:stretch; width:100%; }
  .crm-header-actions .button { width:100%; padding:10px 12px; }
  .crm-header-actions > :only-child { grid-column:1 / -1; }
  .crm-header-actions .crm-danger-link { grid-column:1 / -1; justify-self:center; }
  .crm-tabs { flex-wrap:wrap; gap:6px; overflow:visible; border-bottom:0; }
  .crm-tab { flex:1 1 auto; justify-content:center; margin:0; padding:8px 10px; border:1px solid var(--line); border-radius:10px; background:#fff; font-size:.92rem; text-align:center; line-height:1.2; }
  .crm-tab.is-active { border-color:var(--blue); background:var(--ice); box-shadow:inset 0 0 0 1px var(--blue); }
  .crm-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .crm-kpi:last-child:nth-child(odd) { grid-column:1 / -1; }
  .crm-kpi { padding:14px; }
  .crm-kpi strong { font-size:1.6rem; }
  .crm-card { padding:16px; }
  .crm-quick-search { flex-direction:column; }
  .crm-toolbar .crm-search { flex-basis:100%; max-width:none; }
  .crm-filter { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); width:100%; }
  .crm-filter button { min-height:44px; padding:6px 4px; white-space:normal; line-height:1.15; }
  .crm-rows-head { display:none; }
  .crm-rows { border-radius:12px; }
  .crm-row { grid-template-columns:minmax(0,1fr) auto; grid-template-areas:"main status" "contact contact" "city date"; gap:8px 12px; padding:14px; }
  .crm-row-main { grid-area:main; }
  .crm-row-status { grid-area:status; justify-content:flex-end; }
  .crm-row-contact { grid-area:contact; }
  .crm-row-city { grid-area:city; }
  .crm-row-date { grid-area:date; }
  .crm-match-actions { width:100%; justify-content:space-between; }
  .crm-pending-actions .button { flex:1 1 100%; }
  .crm-cards { grid-template-columns:minmax(0,1fr); }
  .crm-section-head .button,.crm-section-actions { width:100%; }
  .crm-section-actions .button { flex:1 1 140px; }
  .crm-equipment { grid-template-columns:minmax(0,1fr); }
  .crm-item-actions .billing-action { flex:1 1 30%; min-height:44px; }
  .crm-history-item { grid-template-columns:minmax(0,1fr) auto; grid-template-areas:"type type" "main main" "date status" "action action"; gap:6px 10px; }
  .crm-history-item > :nth-child(1) { grid-area:type; }
  .crm-history-item > :nth-child(2) { grid-area:main; }
  .crm-history-item > :nth-child(3) { grid-area:date; }
  .crm-history-item > :nth-child(4) { grid-area:status; justify-self:end; }
  .crm-history-item > :nth-child(5) { grid-area:action; justify-self:start; }
  .crm-history-item > :nth-child(5):empty { display:none; }
  .crm-events li,.crm-audit-list li { grid-template-columns:minmax(0,1fr); gap:2px; }
  .crm-maint-filter { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .crm-cycle h3 .crm-link,.crm-tour-card h3 .crm-link { display:inline-flex; align-items:center; min-height:44px; }
  .crm-stop-actions { grid-column:1 / -1; }
  .crm-stop-actions .billing-action { min-height:44px; flex:1 1 auto; }
  .crm-inline-buttons .billing-action { min-height:44px; }
  .crm-cycle-actions { display:grid; grid-template-columns:minmax(0,1fr); }
  .crm-cycle-actions .button,.crm-menu > summary { width:100%; }
  .crm-menu-list { position:static; min-width:0; margin-top:6px; box-shadow:none; }
  .crm-cycle-due { justify-items:start; text-align:left; }
  .crm-dialog,.crm-dialog.is-wide { width:100%; max-width:none; height:100%; max-height:none; margin:0; border-radius:0; }
  .crm-dialog-form { height:100%; max-height:none; }
  .crm-dialog-head { padding:10px 12px 10px 16px; }
  .crm-dialog-body { padding:16px; }
  .crm-dialog-body .two-columns { grid-template-columns:minmax(0,1fr); }
  .crm-dialog-error { padding:0 16px; }
  .crm-dialog-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); padding:12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .crm-dialog-actions .button { width:100%; padding:10px; }
  .crm-dialog-actions > :only-child { grid-column:1 / -1; }
  .crm-request h3 .crm-link,.crm-appt h3 .crm-link { display:inline-flex; align-items:center; min-height:44px; }
  .crm-vat-table th,.crm-vat-table td { padding:6px 4px; font-size:.84rem; }
}
