/* ===== Base ===== */
* { box-sizing: border-box; }
:root {
  --blue: #2f6bf0; --blue-dark: #1d4fd8; --bg: #eceef1; --line: #e2e6ea;
  --text: #1e2530; --muted: #6b7480; --green: #1e7a45; --red: #d64545;
}
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14.5px; }
a { color: var(--blue); text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }

/* ===== Login ===== */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; }
.login-brand { display: flex; align-items: center; gap: 16px; }
.login-logo { width: 64px; height: 64px; border-radius: 50%; background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 36px; font-style: italic; font-family: Georgia, serif; }
.login-brand h1 { margin: 0; font-size: 26px; font-weight: 600; }
.login-brand small { color: var(--muted); letter-spacing: 2px; font-size: 14px; }
.login-box { width: 390px; border: 1px solid #dfe3ff; border-radius: 10px; overflow: hidden; background: #eef2fe; }
.login-box .field { padding: 10px 14px; }
.login-box .field + .field { border-top: 1px solid #dfe3ff; }
.login-box label { display: block; color: var(--muted); font-size: 13.5px; }
.login-box input { width: 100%; border: 0; background: transparent; outline: none; font-size: 15px; padding: 2px 0; }
.btn-login { width: 390px; padding: 13px; background: var(--blue); border: 0; border-radius: 12px; color: #fff; font-size: 16px; }
.btn-login:hover { background: var(--blue-dark); }
.login-error { width: 390px; padding: 13px; text-align: center; background: #f6d7d7; border: 1px solid #e5b6b6;
  color: #7b1d1d; border-radius: 10px; }
.login-copy { color: var(--muted); }

/* ===== Barre de navigation ===== */
.topbar { background: #f7f8f9; border-bottom: 1px solid var(--line); padding: 0 8px; }
.nav-tabs { display: flex; flex-wrap: wrap; align-items: center; }
.nav-tab { display: flex; align-items: center; gap: 7px; padding: 13px 16px; color: var(--blue);
  border-bottom: 2px solid transparent; font-size: 15px; }
.nav-tab svg { width: 18px; height: 18px; }
.nav-tab.active { color: var(--text); border-bottom-color: var(--blue); font-weight: 500; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 14px; padding-right: 10px; }
.nav-user { color: var(--blue); display: flex; align-items: center; gap: 6px; cursor: pointer; position: relative; }
.user-menu { position: absolute; right: 0; top: 30px; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 170px; z-index: 60; }
.user-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 14px; }
.user-menu button:hover { background: #f2f4f7; }
.menu-lan { padding: 8px 14px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); user-select: text; }
.menu-lan b { font-size: 12.5px; }
.menu-lan a:hover b { text-decoration: underline; }
.menu-lan.hidden { display: none; }
.lan-actions { display: flex; gap: 6px; margin-top: 6px; }
.lan-actions button { flex: 1; font-size: 11.5px; padding: 4px 6px; border: 1px solid var(--line); background: #f6f8fa; border-radius: 6px; cursor: pointer; }
.lan-actions button:hover { background: #eef2f7; }
/* QR code plein écran : scannable de loin avec le téléphone */
.qr-overlay { position: fixed; inset: 0; background: rgba(20,26,34,.55); z-index: 500; display: flex; align-items: center; justify-content: center; }
.qr-box { background: #fff; border-radius: 14px; padding: 22px 26px; text-align: center; box-shadow: 0 18px 60px rgba(0,0,0,.35); }
.qr-box h3 { margin: 0 0 14px; font-size: 15px; }
.qr-box img { border: 1px solid var(--line); border-radius: 8px; }
.qr-url { font-weight: 700; margin: 12px 0; user-select: text; }

/* ===== Barre de filtres ===== */
.filterbar { background: #fff; border-bottom: 1px solid var(--line); padding: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filterbar input, .filterbar select { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; min-width: 120px; }
.fgroup { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 8px; padding: 2px 6px; background: #fff; }
.fgroup .flabel { font-size: 12px; color: var(--muted); white-space: nowrap; padding: 0 2px; }
.fgroup .dinput { border: 0; min-width: 128px; padding: 6px 4px; }
/* Boutons de filtre à 3 états : – (avec et sans) / ✓ (uniquement avec) / ✕ (uniquement sans) */
.tri-wrap { padding: 6px 10px 6px 6px; }
.tri-filter { width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; }
/* Neutre (– avec et sans) : case blanche, comme dans le CRM d'origine */
.tri-filter.tri-any, .tri-filter:not([class*=tri-]) { background: #fff; color: #b6bec8; }
.tri-filter.tri-yes { background: #1e7a45; color: #fff; border-color: #1e7a45; }
.tri-filter.tri-no { background: var(--red); color: #fff; border-color: var(--red); }
.btn { display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 8px; padding: 9px 14px; color: #fff; }
.btn-blue { background: var(--blue); } .btn-blue:hover { background: var(--blue-dark); }
.btn-grey { background: #6b7480; } .btn-green { background: var(--green); }
.btn-red-o { background: #fff; color: var(--red); border: 1px solid var(--red); }
.btn-green-o { background: #fff; color: var(--green); border: 1px solid var(--green); }
.btn-outline { background: #fff; color: var(--text); border: 1px solid var(--line); }

/* ===== Zone de contenu ===== */
.content { padding: 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.count-pill { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 14px; font-weight: 600; }

/* ===== Dashboard ===== */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.card { border-radius: 10px; padding: 20px 24px; position: relative; border-left: 5px solid; cursor: pointer;
  transition: transform .06s; min-height: 130px; }
.card:hover { transform: translateY(-2px); }
.card h3 { margin: 12px 0 8px; font-size: 22px; letter-spacing: .3px; }
.card .nb { font-size: 15px; } .card .eur { font-size: 14px; }

/* ===== Tables ===== */
.tablewrap { background: #fff; border-radius: 8px; overflow: auto; }
table.list { width: 100%; border-collapse: collapse; min-width: 900px; }
table.list th { text-align: left; padding: 12px 14px; font-size: 14.5px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 20px 14px; vertical-align: top; border-bottom: 1px solid #f0f2f4; font-size: 15px; line-height: 1.5; }
table.list tr:nth-child(odd) td { background: #f5f6f8; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 6px; color: #fff; font-size: 12.5px; white-space: nowrap; }
.q-sel { border: 0; border-radius: 6px; padding: 5px 8px; font-size: 13.5px; cursor: pointer;
  width: auto; max-width: 100%; box-sizing: border-box; appearance: auto; margin: 2px 0; }
.q-sel.q-statut2 { background: transparent; border: 1px solid transparent; }
.q-sel.q-statut2:hover { border-color: var(--line); background: #fff; }
.q-sel.q-team { background: transparent; border: 1px solid transparent; color: var(--blue); font-weight: 600; font-size: 14px; padding: 3px 6px; }
.q-sel.q-team.q-empty { color: #94a3b8; font-weight: 500; }   /* personne d'attribué : libellé discret en gris */
.q-sel.q-team:hover { border-color: var(--line); background: #fff; }
.q-sel:focus { outline: 2px solid var(--blue); }
/* La colonne Statut prend la largeur nécessaire pour afficher le libellé complet du statut */
td:has(> .q-statut1), td:has(> .q-statut2) { min-width: 210px; }
.obs-btn { border: 0; background: none; cursor: pointer; font-size: 15px; padding: 0 3px; opacity: .55; }
.obs-btn:hover { opacity: 1; }
.obs-txt { color: #7c5c10; background: #fdf3d5; border-radius: 5px; padding: 1px 6px; font-size: 12px; }
/* Carré vert : menu de la ligne (documents, dupliquer...) */
.row-menu-btn { position: relative; background: #198754; color: #fff; border: 0; border-radius: 8px;
  width: 38px; height: 34px; font-size: 16px; cursor: pointer; }
.row-menu-btn:hover { background: #146c43; }
.doc-count { position: absolute; top: -7px; right: -7px; background: #d63384; color: #fff; border-radius: 999px;
  font-size: 10.5px; min-width: 17px; height: 17px; line-height: 17px; padding: 0 3px; }
.row-menu { position: absolute; z-index: 200; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.16); min-width: 170px; padding: 5px; }
.row-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px;
  border-radius: 7px; font-size: 14px; }
.row-menu button:hover { background: #f2f4f7; }
.doc-list { max-height: 320px; overflow: auto; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid #f0f2f4; }
.doc-row a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row .btn { padding: 5px 9px; }
.rdv-card.is-instal { outline: 2px solid #1d4ed8; }
/* Doublons */
.type-cell { font-size: 12.5px; max-width: 190px; }
.dup-badge { background: #d64545; font-weight: 700; letter-spacing: .4px; cursor: pointer; }
.dup-badge:hover { background: #b83232; }
.dup-line { font-size: 11.5px; color: #8a1f1f; background: #fdeaea; border-radius: 6px; padding: 3px 6px; margin-top: 4px; }
.dup-flag { background: #d64545; color: #fff; font-weight: 700; text-align: center; padding: 4px 6px; border-radius: 5px;
  margin: 4px -2px 6px; letter-spacing: .4px; animation: dupPulse 1.6s ease-in-out infinite; cursor: pointer; }
.dup-flag:hover { background: #b83232; }
/* Cartes du planning : lignes et raccourcis comme le CRM d'origine */
.p-line { display: flex; align-items: center; gap: 6px; }
.p-blue { color: var(--blue); font-weight: 600; }
.p-tel-name { color: var(--blue); font-weight: 600; text-transform: uppercase; font-size: 12.5px; }
.p-none { color: var(--red); font-weight: 600; }
.p-com, .p-telpro { cursor: pointer; border-radius: 6px; }
.p-com:hover, .p-telpro:hover { background: #eef3ff; }
.p-addr { color: var(--blue); text-transform: uppercase; font-size: 12px; font-weight: 600; }
.p-st.p-click { cursor: pointer; border-bottom: 1px dashed transparent; }
.p-st.p-click:hover { color: var(--blue); border-bottom-color: var(--blue); }
/* Menu de statuts avec pastilles de couleur */
.st-menu { display: flex; flex-direction: column; max-height: 320px; overflow: auto; min-width: 230px; }
.st-opt { display: flex; align-items: center; gap: 9px; border: 0; background: none; text-align: left;
  padding: 7px 10px; font-size: 13.5px; cursor: pointer; border-radius: 7px; white-space: nowrap; }
.st-opt:hover { background: #f1f3f6; }
.st-opt.is-cur { background: #e8efff; font-weight: 700; }
.st-dot { width: 14px; height: 14px; min-width: 14px; border-radius: 3px; display: inline-block; }
/* Colonne ID + Nom (affichage comme le CRM d'origine) */
.id-cell { font-size: 14.5px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.cname-list { color: var(--blue); font-weight: 600; }
.camp-tag { color: #15803d; text-transform: uppercase; font-size: 11px; font-weight: 600; letter-spacing: .3px; }
/* Modification multiple (affectation) */
.bulk-warn { background: #fdeaea; border: 1px solid #f2c4c4; color: #8a1f1f; font-weight: 700; border-radius: 8px;
  padding: 12px 14px; margin: 10px 0 14px; }
.bulk-green { background: #e7f3ec; border-radius: 8px; padding: 12px 14px; margin-top: 14px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.bulk-green input[type=number] { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; }
.ba-users { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; margin: 8px 0;
  max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.ba-u-lab { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.ba-hint { color: #15803d; font-size: 12.5px; margin-top: 3px; }
/* Export Excel/CSV : choix des champs par onglet */
.exp-top { display: flex; gap: 18px; flex-wrap: wrap; }
.exp-fav { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; flex: 1; min-width: 300px; }
.exp-fav select { flex: 1; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.exp-fav .btn { padding: 7px 10px; }
.exp-groups { display: flex; flex-direction: column; gap: 14px; max-height: 55vh; overflow: auto; }
.exp-group { background: #e9ebee; border-radius: 10px; padding: 14px 18px; }
.exp-sec { display: flex; align-items: center; gap: 8px; color: var(--blue); font-weight: 700; font-size: 15.5px; cursor: pointer; margin-bottom: 10px; }
.exp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 7px 16px; }
.exp-item { display: flex; align-items: center; gap: 7px; font-size: 13.5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp-item input, .exp-sec input { width: 16px; height: 16px; accent-color: var(--blue); }
/* Champs Date + heure / Heure en raccourci : même présentation que la colonne Dates */
.rf-dates { white-space: nowrap; }
.rf-dates .dlabel { display: inline-block; min-width: 44px; max-width: 90px; overflow: hidden; text-overflow: ellipsis;
  font-size: 11.5px; color: var(--muted); font-weight: 600; vertical-align: middle; }
.rf-dates input { border: 1px solid transparent; border-radius: 6px; padding: 3px 4px; font-size: 12.5px; background: transparent; }
.rf-dates input:hover, .rf-dates input:focus { border-color: var(--line); background: #fff; }
.rf-dates .dinput { width: 128px; } .rf-dates input[type=time], .rf-dates .tinput { width: 62px; }
.rf-dates .dlabel.din { color: #1d4ed8; }
/* Choix multiple dans la FICHE : bouton compact + menu déroulant à cases (identique aux lignes et au CRM d'origine) */
.fmulti { position: relative; width: 100%; }
.fmulti-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font-size: 14px; text-align: left; }
.fmulti-btn:hover { border-color: var(--blue); }
.fmulti-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmulti-menu { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; max-height: 260px; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(20,24,32,.14); padding: 6px; }
.fmulti-opt { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 6px; font-size: 13.5px; cursor: pointer; }
.fmulti-opt:hover { background: #f1f3f6; }
/* Choix multiple en raccourci sur la ligne : ligne compacte + menu au clic (comme le CRM d'origine) */
.rf-multi-btn { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; max-width: 230px; border-radius: 6px; padding: 0 3px; }
.rf-multi-btn:hover { background: #eef3ff; }
.rf-mvals { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #15803d; font-weight: 600; }
.rf-chev { color: var(--muted); font-size: 11px; }
.st-menu label.st-opt { display: flex; align-items: center; }
.st-menu .mf-opt { width: 15px; height: 15px; accent-color: var(--blue); }
@keyframes dupPulse { 0%, 100% { opacity: 1; } 50% { opacity: .65; } }
/* Champs configurables sur les lignes */
.rf { font-size: 13px; margin-top: 3px; white-space: nowrap; display: flex; align-items: center; gap: 5px; }
.rf-lbl { font-weight: 600; font-size: 12px; }
.rf select.q-field { border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 2px 4px;
  font-size: 12.5px; max-width: 190px; cursor: pointer; }
.rf select.q-field:hover, .rf .rf-in:hover, .rf .rf-in:focus { border-color: var(--line); background: #fff; }
.rf .rf-in { border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 2px 5px;
  font-size: 12.5px; max-width: 160px; }
.multi-opts { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.multi-opts label { display: flex; gap: 5px; align-items: center; font-size: 13.5px; }
.drop-zone { display: block; border: 2px dashed #9fb8a8; background: #e7f2ea; color: #2c5e3f; border-radius: 10px;
  padding: 26px; text-align: center; cursor: pointer; font-size: 15px; }
.drop-zone.over { background: #d3e8da; border-color: var(--green); }
#imp-map select { max-width: 150px; padding: 5px; font-size: 12.5px; }
#imp-map th { vertical-align: bottom; }
.hist { font-size: 12px; color: var(--muted); width: 300px; max-width: 300px; }
.hist b { color: var(--text); font-weight: 500; }
.hist-scroll { width: 255px; overflow-x: scroll; padding-bottom: 4px; display: inline-block; vertical-align: top; }
.hist-scroll > div { white-space: nowrap; width: max-content; }
.hist-scroll::-webkit-scrollbar { height: 8px; }
.hist-scroll::-webkit-scrollbar-track { background: #f0f2f4; border-radius: 4px; }
.hist-scroll::-webkit-scrollbar-thumb { background: #b9c1ca; border-radius: 4px; }
.hist-scroll::-webkit-scrollbar-thumb:hover { background: #97a1ac; }
.dates-cell { white-space: nowrap; }
.dates-cell .dlabel { display: inline-block; width: 44px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.dates-cell .dlabel.din { color: #1d4ed8; }
.dates-cell input { border: 1px solid transparent; border-radius: 6px; padding: 3px 4px; font-size: 12.5px; background: transparent; }
.dates-cell input:hover, .dates-cell input:focus { border-color: var(--line); background: #fff; }
.dates-cell .dinput { width: 128px; } .dates-cell input[type=time], .dates-cell .tinput { width: 62px; }
.tinput { text-align: center; }
.duo .tinput { width: 90px; }
.created-at { margin-top: 6px; font-size: 12px; color: var(--muted); }
.created-at b { color: var(--text); }
.nrp-ctl { display: inline-flex; align-items: center; gap: 6px; }
.nrp-ctl button { border: 0; background: none; font-size: 17px; color: var(--muted); padding: 0 3px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px; color: var(--muted); }
.pager button { border: 0; background: none; font-size: 18px; color: var(--text); }

/* ===== Planning ===== */
.week { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; align-items: start; }
.day-head { color: var(--blue); font-size: 15px; }
.day-head .dow { color: #d64545; } .day-head .num { font-size: 26px; font-weight: 700; color: var(--blue); }
.day-col { background: #ccd9f2; border-radius: 6px; min-height: 220px; padding: 6px; }
.day-col .day-total { text-align: center; font-weight: 600; padding: 4px 0 8px; }
.rdv-card { background: #fff; border-radius: 6px; margin-bottom: 8px; padding: 8px; font-size: 13px; }
.rdv-card .rdv-status { border-radius: 4px; padding: 3px 6px; font-weight: 600; margin: -8px -8px 6px; display: flex; justify-content: space-between; }
.rdv-card .cname { color: var(--blue); font-weight: 600; }
.rdv-card div { margin: 2px 0; }
.day-empty { color: var(--muted); padding: 10px; text-align: center; }

/* ===== Modal ===== */
.modal-back { position: fixed; inset: 0; background: rgba(20,24,32,.55); display: flex; align-items: flex-start; justify-content: center; z-index: 100; overflow: auto; padding: 30px 16px; }
.modal { background: #fff; border-radius: 10px; width: min(1400px, 96vw); padding: 18px 28px 22px; }
.modal-tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.modal-tab { padding: 10px 2px; color: var(--blue); cursor: pointer; border-bottom: 3px solid transparent; font-size: 15px; }
.modal-tab.active { color: var(--text); border-bottom-color: var(--blue); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 60px; }
/* Fiche en DEUX COLONNES indépendantes (gauche = col 1, droite = col 2) */
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 60px; align-items: start; }
.fcol { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.fiche-fullrow { margin-top: 16px; }
.frow { display: grid; grid-template-columns: 210px 1fr; align-items: center; gap: 10px; }
.frow label { font-size: 14.5px; }
.frow input, .frow select, .frow textarea { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; width: 100%; }
/* Sélecteur de couleur : petit carré, pas une barre pleine largeur */
.frow input[type=color] { width: 46px; height: 36px; min-width: 46px; padding: 2px; cursor: pointer; vertical-align: middle; }
/* Interrupteur et case dans un formulaire de réglage : garder leur taille propre, pas 100% */
.frow input[type=checkbox] { width: auto; }
.frow .duo { display: flex; gap: 8px; } .frow .duo > * { flex: 1; }
.sep { grid-column: 1 / -1; border-top: 1px solid var(--line); margin: 8px 0; }
/* Modification multiple (autres champs) : libellé à gauche, menu pleine largeur, plus de texte coupé */
.bme-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.bme-row > label { flex: 0 0 150px; font-size: 14.5px; font-weight: 600; }
.bme-row > select, .bme-row > input { flex: 1; min-width: 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
.bme-obs { border-bottom: none; padding-top: 14px; }
/* Droits par rôle : panneau catégorisé */
.perm-scroll { max-height: 62vh; overflow: auto; padding-right: 6px; }
.perm-cat { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; overflow: hidden; }
.perm-cat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: #f5f7fb; }
.perm-cat-head > b { font-size: 15.5px; }
.perm-cat-body { padding: 12px 14px; }
.perm-sub { margin-bottom: 14px; }
.perm-sub:last-child { margin-bottom: 0; }
.perm-sub-t { font-weight: 700; font-size: 13.5px; color: #334155; margin-bottom: 4px; }
.permline { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid #eef1f5; }
.permline > span { font-size: 14px; }
.vm-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid #eef1f5; }
.vm-lab { flex: 1; min-width: 0; font-size: 14px; }
.vm-cell { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #64748b; white-space: nowrap; }
.fsec { border: 1px solid #eef1f5; border-radius: 8px; padding: 4px 10px; margin-bottom: 8px; }
.fsec-fields { margin-top: 2px; }
.ro-lock { font-size: 12px; opacity: .7; }
.perm-userpick { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: #f0f6ff; border: 1px solid #d5e4fb; border-radius: 8px; margin: 8px 0; }
.perm-userpick select { padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; margin-left: 6px; }
.perm-override { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.perm-locked { opacity: .45; pointer-events: none; filter: grayscale(.3); }
/* Droits par rôle : 5 volets (Menu / Catégories / Statuts / Filtres / Actions), un seul affiché à la fois */
.perm-panes { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 10px; }
.perm-pane-btn { padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: #334155; font-size: 14px; font-weight: 600; cursor: pointer; }
.perm-pane-btn:hover { background: #f0f6ff; }
.perm-pane-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.perm-pane { padding: 4px 2px; }
.perm-help { font-size: 12.5px; margin: 0 0 10px; }
.perm-menu-line { padding: 10px 0; }
.perm-menu-line > span > b { font-size: 15px; }
.perm-noclients { opacity: .45; pointer-events: none; position: relative; }
.perm-noclients::before { content: "Sans l'onglet « Clients » (volet Menu), ce volet n'a pas d'objet."; display: block; font-size: 12.5px; color: #b02a2a; font-weight: 600; margin-bottom: 8px; }
/* Interrupteur bascule (comme le CRM d'origine) : gris éteint, bleu allumé, pastille blanche qui glisse */
.switch, .frow input[type=checkbox].switch { position: relative; box-sizing: border-box;
  width: 42px; min-width: 42px; max-width: 42px; height: 24px; padding: 0; margin: 0;
  appearance: none; -webkit-appearance: none; background: #cfd5dd; border: 1px solid #c2c9d2;
  border-radius: 999px; outline: none; cursor: pointer; transition: background .18s ease, border-color .18s ease;
  justify-self: center; flex: 0 0 42px; vertical-align: middle; }
.switch:checked, .frow input[type=checkbox].switch:checked { background: #0d6efd !important; border-color: #0d6efd !important; }
.switch:focus-visible { box-shadow: 0 0 0 3px rgba(13,110,253,.30); }
.switch::after, .frow input[type=checkbox].switch::after { content: ''; position: absolute; top: 50%; left: 2px; transform: translateY(-50%);
  width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25);
  transition: left .18s ease; }
.switch:checked::after, .frow input[type=checkbox].switch:checked::after { left: 21px; }
/* Cases à cocher classiques : carré blanc → carré bleu plein avec coche blanche au clic */
input[type=checkbox]:not(.switch):not(.tri-filter) {
  appearance: none; -webkit-appearance: none; box-sizing: border-box;
  width: 18px; height: 18px; min-width: 18px; margin: 0; cursor: pointer; position: relative;
  border: 1.5px solid #b7bfc9; border-radius: 5px; background: #fff; transition: background .12s, border-color .12s; vertical-align: middle; }
input[type=checkbox]:not(.switch):not(.tri-filter):hover { border-color: #0d6efd; }
input[type=checkbox]:not(.switch):not(.tri-filter):checked { background: #0d6efd; border-color: #0d6efd; }
input[type=checkbox]:not(.switch):not(.tri-filter):checked::after {
  content: ''; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
input[type=checkbox]:not(.switch):not(.tri-filter):focus-visible { box-shadow: 0 0 0 3px rgba(13,110,253,.28); outline: none; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.histo-list { max-height: 300px; overflow: auto; font-size: 13px; }
.histo-list div { padding: 4px 0; border-bottom: 1px solid #f0f2f4; }

/* ===== Réglages ===== */
.settings-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.set-card { border-radius: 10px; border-left: 5px solid; padding: 20px; }
.set-card h3 { margin: 0 0 8px; font-size: 20px; }
.set-card p { margin: 0 0 14px; }
.set-card button { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; }
.color-dot { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: 6px; vertical-align: -2px; }

/* Éditeur de disposition des champs — DEUX COLONNES indépendantes, glisser fluide */
.layout-2col { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; background: #f4f6f8;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 500px; overflow: auto; }
.lay-col { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; min-height: 80px; }
.lay-col-head { font-weight: 700; font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 4px 8px; }
.lay-col-body { display: flex; flex-direction: column; gap: 8px; min-height: 44px; }
.lay-col-body:empty::after { content: "Colonne vide — glissez un champ ici"; color: #aab2bc; font-size: 12.5px; padding: 12px; display: block; text-align: center; }
.tile { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 10px; cursor: grab; user-select: none; }
.tile.drag-src { opacity: .35; border-style: dashed; }          /* l'emplacement d'origine pendant le glisser */
.lay-ghost { position: fixed; z-index: 5000; pointer-events: none; box-shadow: 0 10px 26px rgba(0,0,0,.22);
  opacity: .95; transform: rotate(-1deg); }
.lay-marker { height: 6px; border-radius: 4px; background: var(--blue); margin: 1px 0; }  /* repère : où le champ va se poser */
.tile.is-hidden { opacity: .45; }
.perm-search-bar { margin: 4px 0 10px; }
/* Lien Historique ↔ Observations : un même NUMÉRO des deux côtés (fiable même si les colonnes sont décalées) */
.lnk-arrow { color: var(--blue); font-weight: 800; cursor: help; }
.lnk-n { display: inline-block; background: var(--blue); color: #fff; font-weight: 800; font-size: 10.5px;
  border-radius: 999px; padding: 0 6px; cursor: help; vertical-align: middle; }
.lnk-n.lnk-0 { background: #cbd5e1; color: #64748b; }   /* 0 = pas de paire (statut sans commentaire, ou commentaire isolé) */
.h-linked, [data-h].h-linked .lnk-n { background: #f59e0b; }
[data-h].h-linked { background: #fef3c7; border-radius: 4px; }
.tile.is-hidden { opacity: .45; }
.tile.dragging { opacity: .4; border-style: dashed; }
.tile.drop-before { box-shadow: inset 3px 0 0 var(--blue); }
.tile-grip { color: #aab2bc; cursor: grab; }
.tile-label { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-badges { display: flex; gap: 6px; align-items: center; margin-left: auto; white-space: nowrap; }
.tile-badges .badge { font-size: 10.5px; padding: 2px 6px; }
.tile-actions { display: flex; gap: 2px; }
.tile-actions button { border: 0; background: none; cursor: pointer; font-size: 14px; padding: 3px 5px; border-radius: 6px; }
.tile-actions button:hover { background: #eef1f4; }

/* Lignes des listes de réglages (règles, agencement des filtres) */
.rule-row { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid #f0f2f4; }
.rule-row .btn { padding: 5px 9px; }
/* La barre de filtres respecte l'ordre choisi */
.filterbar { display: flex; }
.filterbar > * { order: 400; }
#f_go { order: 900 !important; } #f_reset { order: 901 !important; } #f_layout { order: 902 !important; }

/* Petit popup "Ajouter un commentaire" du bouton ⊕ (flotte sous le bouton) */
.obs-pop { position: absolute; z-index: 350; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 38px rgba(0,0,0,.22); padding: 13px; width: 330px; display: flex; flex-direction: column; gap: 9px; }
.obs-pop b { font-size: 14px; }
.obs-pop textarea { border: 1px solid var(--line); border-radius: 8px; padding: 9px; resize: vertical; font-size: 13.5px; }
.obs-plus { border: 1px solid var(--line); background: #fff; color: var(--green); border-radius: 7px; width: 30px; height: 30px;
  font-size: 16px; cursor: pointer; margin-right: 8px; flex: 0 0 auto; }
.obs-plus:hover { background: #e7f2ea; }

/* Suggestions d'adresses (Base Adresse Nationale) */
.addr-dd { position: absolute; z-index: 400; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.18); overflow: hidden; }
.addr-dd button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px;
  font-size: 13.5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.addr-dd button:hover { background: #eef2fe; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #16324f; color: #fff;
  padding: 11px 22px; border-radius: 10px; z-index: 300; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.muted { color: var(--muted); }
.hidden { display: none !important; }
@media (max-width: 1100px) { .week { grid-template-columns: 1fr 1fr; } .form-grid { grid-template-columns: 1fr; } }

/* Téléphone cliquable et itinéraire sur les cartes de RDV (surtout pour les commerciaux sur mobile) */
.p-call { text-decoration: none; }
.p-itin { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding: 2px 8px; border-radius: 999px;
  background: #e6effe; color: var(--blue); font-size: 11px; font-weight: 700; text-decoration: none; white-space: nowrap; }

/* ===== Mode "version mobile" activé depuis Réglages : tout le CRM bascule en affichage téléphone (sur place) ===== */
#mobile-exit { position: fixed; z-index: 5000; left: 50%; bottom: 14px; transform: translateX(-50%);
  background: #111827; color: #fff; border: 0; border-radius: 999px; padding: 10px 18px; font-size: 13px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,.4); cursor: pointer; }
body.force-mobile { background: #0f172a; }
body.force-mobile #app { max-width: 430px; margin: 0 auto; min-height: 100vh; background: #fff;
  box-shadow: 0 0 0 1px #cbd5e1, 0 12px 44px rgba(0,0,0,.5); overflow-x: hidden; }
/* Mêmes règles que la vue mobile réelle, mais forcées quelle que soit la taille de l'écran de l'ordinateur */
body.force-mobile .nav-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
body.force-mobile .nav-tab { padding: 12px 12px; white-space: nowrap; }
body.force-mobile .content { padding: 8px; }
body.force-mobile .week { grid-template-columns: 1fr; gap: 6px; }
body.force-mobile .day-col { min-height: auto; }
body.force-mobile .day-head { display: flex; align-items: baseline; gap: 8px; }
body.force-mobile .day-head .num { font-size: 20px; }
body.force-mobile .rdv-card { font-size: 15px; padding: 12px; }
body.force-mobile .rdv-card .p-line { padding: 3px 0; }
body.force-mobile .p-call { display: inline-block; padding: 4px 2px; font-size: 16px; }
body.force-mobile .p-itin { padding: 5px 12px; font-size: 13px; }
body.force-mobile .p-st.p-click { display: inline-block; padding: 4px 8px; background: #f1f5f9; border-radius: 6px; }
body.force-mobile .filterbar { padding: 8px; gap: 6px; }
body.force-mobile .filterbar input, body.force-mobile .filterbar select { min-width: 0; flex: 1 1 44%; }
body.force-mobile .modal { width: min(430px, 94vw) !important; max-height: 92vh; overflow: auto; padding: 14px 16px 18px; }
body.force-mobile .modal-tabs { overflow-x: auto; flex-wrap: nowrap; }
body.force-mobile .btn { padding: 11px 14px; }

/* ===== Vue mobile (commerciaux sur le terrain) : cartes de RDV en pleine largeur ===== */
@media (max-width: 640px) {
  /* Menu du haut : défilement horizontal plutôt que d'empiler sur plusieurs lignes */
  .nav-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .nav-tab { padding: 12px 12px; white-space: nowrap; }
  .content { padding: 8px; }
  /* Planning : une seule colonne, cartes pleine largeur, hauteur naturelle */
  .week { grid-template-columns: 1fr; gap: 6px; }
  .day-col { min-height: auto; }
  .day-head { display: flex; align-items: baseline; gap: 8px; }
  .day-head .num { font-size: 20px; }
  .rdv-card { font-size: 15px; padding: 12px; }
  .rdv-card .p-line { padding: 3px 0; }
  /* Cibles tactiles confortables */
  .p-call { display: inline-block; padding: 4px 2px; font-size: 16px; }
  .p-itin { padding: 5px 12px; font-size: 13px; }
  .p-st.p-click { display: inline-block; padding: 4px 8px; background: #f1f5f9; border-radius: 6px; }
  /* Barre de filtres : chaque champ prend toute la largeur, plus facile au doigt */
  .filterbar { padding: 8px; gap: 6px; }
  .filterbar input, .filterbar select { min-width: 0; flex: 1 1 44%; }
  /* Le tableau des clients défile de côté DANS son cadre : la page ne s'élargit plus, rien n'est rétréci */
  .tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Fenêtres (fiche, menus) : PLEIN ÉCRAN, une seule colonne, étiquette au-dessus du champ */
  .modal-back { padding: 0; align-items: stretch; }
  .modal { width: 100vw !important; max-width: 100vw; min-height: 100vh; max-height: none; border-radius: 0; padding: 10px 12px 24px; box-sizing: border-box; overflow: visible; }
  .modal-tabs { overflow-x: auto; flex-wrap: nowrap; gap: 14px; margin-bottom: 12px; position: sticky; top: 0; background: #fff; z-index: 5; }
  .modal-tab { font-size: 14px; white-space: nowrap; padding: 10px 2px; }
  .form-grid, .form-2col { grid-template-columns: 1fr; gap: 10px; }
  .fcol { gap: 10px; }
  .frow { grid-template-columns: 1fr; gap: 3px; }
  .frow label { font-size: 13px; color: #475569; }
  .frow input, .frow select, .frow textarea { font-size: 16px; padding: 10px 12px; }   /* 16px : pas de zoom automatique iPhone */
  .frow input[type=checkbox] { width: auto; }
  .modal-foot { position: sticky; bottom: 0; background: #fff; padding: 10px 0 4px; margin-top: 14px; border-top: 1px solid var(--line); z-index: 5; }
  .modal-foot .btn { flex: 1; justify-content: center; }
  .btn { padding: 11px 14px; }
}

/* ===== Mode Distance (planning) : sélection de deux cartes A/B et affichage de la distance ===== */
#dist-panel { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 2500;
  background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 8px 26px rgba(0,0,0,.4);
  display: flex; align-items: center; gap: 12px; font-size: 14px; max-width: 94vw; flex-wrap: wrap; }
#dist-panel .btn { padding: 6px 10px; }
#dist-panel .dist-res { color: #93c5fd; font-size: 16px; }
.dist-badge { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; font-weight: 700; color: #fff; }
.dist-badge.mk-a { background: #16a34a; }
.week.dist-mode .rdv-card { cursor: crosshair; }
.week.dist-mode .rdv-card:hover { outline: 2px dashed var(--blue); outline-offset: 1px; }
.rdv-card.mk-a, .rdv-card.mk-b { position: relative; }
.rdv-card.mk-a { outline: 3px solid #16a34a; }
.rdv-card.mk-b { outline: 3px solid #dc2626; }
.rdv-card.mk-a::after, .rdv-card.mk-b::after { position: absolute; top: -10px; left: -10px; width: 22px; height: 22px; border-radius: 50%;
  color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; z-index: 3; }
.rdv-card.mk-a::after { content: 'A'; background: #16a34a; }
.rdv-card.mk-b::after { content: 'B'; background: #dc2626; }


.cp-dept { font-weight: 800; }

/* Petite icône devant les menus Télépro / Commercial sur la ligne */
.q-ic{ flex:0 0 auto; font-size:13px; opacity:.75; line-height:1; }
/* Icône + menu (Télépro / Commercial) sur une SEULE ligne, bien alignés */
/* ===== Colonne Téléphone : icône fine + numéro à la française (bleu, comme le nom) + e-mail ===== */
.tel-cell .tel-line{ display:flex; align-items:center; gap:7px; line-height:1.6; }
.tel-cell .tel-ic{ flex:0 0 14px; display:inline-flex; color:#94a3b8; }
.tel-cell .tel-ic svg{ width:14px; height:14px; }
.tel-cell .tel-num{ font-weight:600; color:var(--blue); text-decoration:none; letter-spacing:.2px; white-space:nowrap; font-variant-numeric:tabular-nums; }
.tel-cell .tel-num:hover{ text-decoration:underline; }
.tel-cell .mail-line{ display:flex; align-items:center; gap:7px; margin-top:1px; }
.tel-cell .mail-lnk{ color:#475569; text-decoration:none; word-break:break-all; }
.tel-cell .mail-lnk:hover{ text-decoration:underline; color:var(--blue); }
/* ===== Colonne Adresse : icône fine, rue, puis « code postal · Ville » ===== */
.adr-cell{ min-width:210px; }
.adr-block{ display:flex; align-items:flex-start; gap:8px; }
.adr-ico{ flex:0 0 15px; display:inline-flex; color:#94a3b8; margin-top:3px; }
.adr-ico svg{ width:15px; height:15px; }
.adr-txt{ flex:1 1 auto; min-width:0; }
.adr-street{ color:#1e2530; font-weight:500; line-height:1.4; }
.adr-sub{ display:flex; flex-direction:column; align-items:flex-start; gap:0; margin-top:1px; color:#1e2530; line-height:1.4; }
.adr-cp{ font-variant-numeric:tabular-nums; letter-spacing:.3px; }
.adr-ville{ font-weight:600; }
/* Saisie directe « invisible » : même aspect que le texte, le cadre n'apparaît qu'au survol / à la saisie */
.adr-block .adr-in{ border:1px solid transparent; background:transparent; border-radius:6px; padding:1px 5px; margin-left:-5px;
  font:inherit; color:inherit; font-weight:inherit; width:100%; min-width:0; }
.adr-sub .adr-in{ width:auto; flex:0 0 auto; }
.adr-sub .adr-cp-in{ width:72px; }
.adr-block .adr-in:hover, .adr-block .adr-in:focus{ border-color:var(--line); background:#fff; outline:none; }
.q-teamrow{ display:flex; align-items:center; gap:6px; margin-bottom:2px; }
.q-teamrow .q-ic{ flex:0 0 15px; display:inline-flex; color:#94a3b8; }
.q-teamrow .q-ic svg{ width:15px; height:15px; }
.team-conf{ color:#1e2530; font-weight:600; padding:3px 6px; }
/* Champ affiché en lecture seule dans la fiche (ex. confirmateur, attribué automatiquement) */
.ro-line{ padding:8px 10px; border:1px dashed var(--line); border-radius:8px; color:#5b6b7c; background:#fafbfc; }
.q-teamrow .q-sel.q-team{ flex:1 1 auto; min-width:0; }
/* Ville + CP en saisie directe (raccourci de ligne sur les colonnes structurelles) */
.q-vcp{ display:flex; gap:4px; align-items:center; }
.q-vcp .rf-in{ min-width:0; flex:1 1 auto; }
.q-vcp .q-cp{ flex:0 0 62px; width:62px; }
/* Badge du rang d'attribution : chiffre à côté du télépro / commercial. 1 main = blanc, 2 ou + = orange. */
.attr-badge{ flex:0 0 auto; min-width:20px; height:20px; padding:0 5px; border-radius:10px; border:1px solid #c9d2dc;
  background:#fff; color:#1e2530; font-size:11.5px; font-weight:800; line-height:18px; cursor:pointer; }
.attr-badge:hover{ border-color:#8fa2b5; }
.attr-badge.attr-multi{ background:#ea8c1c; border-color:#c9720e; color:#fff; }
.attr-hist{ margin:8px 0; display:flex; flex-direction:column; gap:4px; }
.attr-hist-line{ padding:5px 8px; border:1px solid var(--line); border-radius:7px; background:#fafbfc; }
.attr-hist-line.attr-cur{ background:#eef6ee; border-color:#bcd8bc; font-weight:700; }
.attr-rang{ display:inline-block; min-width:26px; font-weight:800; color:#5b6b7c; }

/* ===== Diagnostic de configuration ===== */
.diag-badge{ background:#b02a2a; color:#fff; border-radius:11px; padding:0 8px; font-size:12px; font-weight:700; margin-left:4px; }
.diag-item{ border:1px solid #eadada; border-left:4px solid #b02a2a; border-radius:7px; padding:9px 12px; margin:8px 0; }
.diag-tag{ display:inline-block; color:#fff; font-size:11px; font-weight:700; border-radius:5px; padding:1px 7px; margin-right:5px; }
.diag-hint{ font-size:13px; color:#555; margin-top:4px; }
.diag-ok{ background:#eafaf1; border:1px solid #abe6c4; border-radius:7px; padding:14px; font-weight:600; color:#1e8449; }

/* ===== L'araignée (v2) — feuille imprimable A3 : toile des distances ===== */
.ara-bar{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.ara-sheet{ background:#fff; border:1px solid #e2e6ea; border-radius:10px; padding:16px 20px 26px; margin:0 auto; max-width:none; overflow-x:auto; }
.ara-sheet-head h2{ font-size:20px; margin:0 0 8px; }
.ara-legend{ display:flex; gap:16px; flex-wrap:wrap; align-items:center; font-size:13px; color:#3b4652; margin-bottom:6px; }
.ara-legend span{ display:inline-flex; align-items:center; gap:6px; }
.ara-legend i{ width:15px; height:15px; border-radius:4px; display:inline-block; border:1px solid rgba(0,0,0,.18); }
.ara-legend i.t-conf{ background:linear-gradient(135deg,#22c55e 0 50%,#e2e8f0 50% 100%); border-color:#94a3b8; }
.ara-legend i.t-inst{ background:#1d4ed8; border-color:#1d4ed8; }
.ara-legend i.t-resi{ background:#7c3aed; border-color:#7c3aed; }
.ara-legend i.t-rdv2{ background:#ea580c; border-color:#ea580c; }
.ara-legend i.t-hono{ background:#f3e5f5; border-color:#8e44ad; }
.ara-legend .ln-ok{ width:24px; height:0; border-radius:0; border:0; border-top:3px solid #1e8449; }
.ara-legend .ln-ko{ width:24px; height:0; border-radius:0; border:0; border-top:3px solid #c0392b; }
.ara-legend .ara-sep{ width:1px; height:18px; background:#ccd2d8; border:0; border-radius:0; }
.ara-board{ position:relative; padding:6px 0; width:max-content; min-width:100%; }
.ara-board svg{ position:absolute; inset:0; width:100%; height:100%; pointer-events:none; overflow:visible; }
.ara-row{ display:flex; align-items:flex-start; gap:20px; margin:52px 0; position:relative; z-index:1; }
.ara-row:first-child{ margin-top:20px; }
.ara-rowlabel{ flex:0 0 96px; font-weight:800; font-size:13px; color:#5b6672; text-align:right; padding-top:14px; }
.ara-rownodes{ display:flex; gap:48px; flex-wrap:nowrap; flex:1; align-items:flex-start; }
/* Le carré est un simple SUPPORT TRANSPARENT : la carte du planning s'affiche à l'IDENTIQUE dedans.
   Seules les spécificités araignée s'ajoutent autour : cadre couleur du commercial, ▲▼, distances dessous. */
.ara-node{ position:relative; width:242px; box-sizing:border-box; border-radius:14px; }
.ara-node .rdv-card{ margin:0; border:1px solid #dfe5ec; box-shadow:0 2px 8px rgba(0,0,0,.09); }   /* carte identique au planning, juste détachée du fond blanc */
/* Commercial attribué → un CADRE à sa couleur autour de la carte (la carte, elle, ne change pas) */
.ara-node[class*="ara-plan"]{ padding:5px; border-top:6px solid; }
.ara-node .ara-top{ display:flex; align-items:baseline; justify-content:space-between; gap:8px; }
.ara-node .ara-cp{ font-size:20px; font-weight:800; letter-spacing:.3px; color:#1c2833; }
.ara-node .ara-h{ font-size:13px; font-weight:800; color:#fff; background:#556; border-radius:999px; padding:2px 9px; }
.ara-node .ara-type{ font-size:11.5px; font-weight:900; text-transform:uppercase; letter-spacing:.4px; opacity:1; margin-top:2px; }
.ara-node .ara-name{ display:block; font-size:12.5px; font-weight:700; color:#243140; opacity:.95; margin-top:3px; max-width:170px; white-space:normal; line-height:1.15; }
a.ara-name{ text-decoration:none; cursor:pointer; margin-left:auto; margin-right:auto; }
a.ara-name:hover{ text-decoration:underline; color:#2471a3 !important; }
/* Boutons monter / descendre d'un créneau : DANS le bandeau du haut, à droite (toujours libre) */
.ara-node .ara-move{ position:absolute; top:3px; right:4px; display:flex; flex-direction:row; gap:2px; z-index:5; }
.ara-node .ara-move button{ width:20px; height:16px; line-height:1; font-size:8px; padding:0; cursor:pointer;
  border:0; background:rgba(255,255,255,.85); border-radius:4px; color:#33404e; }
.ara-node .ara-move button:hover{ background:#fff; }
.ara-node .ara-move button:disabled{ opacity:.35; cursor:default; }
/* Le cadre couleur commercial décale la carte de 5px → on suit avec les boutons */
.ara-node[class*="ara-plan"] .ara-move{ top:9px; right:10px; }
/* La veille : dernier RDV honoré de chaque commercial (point de départ du matin) — style propre complet */
.ara-node.t-hono{ background:#faf5fd; border:1.5px dashed #b98ecb; border-top:6px solid #8e44ad;
                  border-radius:12px; padding:9px 13px 11px; text-align:center; box-shadow:0 3px 10px rgba(0,0,0,.12); }
.ara-node.t-hono .ara-type{ color:#8e44ad; }
.ara-node .ara-vcom{ display:inline-block; margin-top:4px; font-size:11px; font-weight:800; color:#fff; background:#8e44ad; border-radius:999px; padding:2px 10px; }
.ara-vrow{ padding-bottom:26px; border-bottom:2px dashed #dbe2ea; margin-bottom:34px !important; }
.ara-leg.best{ box-shadow:0 0 0 2px #ff7a00 inset; font-weight:900; }
/* Couleur PAR COMMERCIAL (propre à l'araignée) : le carré attribué prend la couleur de son commercial */
.ara-node.ara-plan1{ background:#e0d2ff; border-top-color:#7c4dff; }
.ara-node.ara-plan2{ background:#c5ecf2; border-top-color:#0097a7; }
.ara-node.ara-plan3{ background:#ffddb8; border-top-color:#f57c00; }
.ara-node.ara-plan4{ background:#f9cfdf; border-top-color:#d81b60; }
.ara-node.ara-plan5{ background:#cfd6f5; border-top-color:#3949ab; }
.ara-node.ara-plan6{ background:#c2e8e2; border-top-color:#00897b; }
.ara-node.ara-plan7{ background:#ffe3ae; border-top-color:#ff8f00; }
.ara-node.ara-plan8{ background:#d5dee3; border-top-color:#546e7a; }
.ara-node.ara-plan9{ background:#ddd0f2; border-top-color:#5e35b1; }
.ara-node.ara-plan10{ background:#e2d3cc; border-top-color:#6d4c41; }
.ara-node[class*="ara-plan"]{ border-top-width:6px; }
.ara-tot-dot{ width:11px; height:11px; border-radius:50%; display:inline-block; margin-right:6px; vertical-align:-1px; }
/* Pastille commercial = raccourci cliquable (filtre sa tournée) */
.ara-tot-chip[data-com]{ cursor:pointer; user-select:none; }
.ara-tot-chip[data-com]:hover{ box-shadow:0 1px 5px rgba(0,0,0,.18); }
.ara-tot-chip.active{ background:#1c2833; color:#fff; border-color:#1c2833; }
.ara-tot-chip.active-plus{ background:#b05c00; color:#fff; border-color:#b05c00; }   /* tournée + non attribués */
.ara-filter-note{ font-size:12px; font-weight:600; color:#b05c00; background:#fff3df; border:1px solid #f2ce93; border-radius:999px; padding:2px 11px; }
/* Total des distances */
.ara-totaux{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-top:8px; font-size:13px; }
.ara-tot-chip{ background:#eef2f7; border:1px solid #dbe2ea; border-radius:999px; padding:3px 11px; font-weight:600; color:#33404e; }
.ara-tot-chip i{ font-style:normal; opacity:.6; }
.ara-tot-grand{ background:#1c2833; color:#fff; border-radius:999px; padding:3px 13px; font-weight:600; }
/* Petites flèches : une par rendez-vous du créneau suivant, avec le temps de route. Clic = flèche complète.
   Grille à 2 colonnes, un peu DÉTACHÉE sous la carte pour ne pas toucher à son affichage. */
.ara-node .ara-legs{ display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:4px; margin-top:12px; padding-top:8px; border-top:1px dashed rgba(0,0,0,.13); }
.ara-node.t-hono .ara-legs{ margin-top:9px; }
.ara-leg{ font-size:11px; font-weight:800; line-height:1.5; border-radius:6px; padding:1px 6px; cursor:pointer; border:1px solid; background:#fff; white-space:nowrap; text-align:center; }
.ara-node .ara-legs .ara-leg:nth-child(odd):last-child{ grid-column:1 / -1; }  /* pastille seule → pleine largeur, centrée */
.ara-leg.ok{ color:#0e6f38; border-color:#27ae60; background:#fff; }
.ara-leg.ko{ color:#a72a1d; border-color:#e74c3c; background:#fff; }
.ara-leg:hover{ filter:brightness(.97); box-shadow:0 1px 4px rgba(0,0,0,.16); }
.ara-leg.ok.active{ background:#1e8449; color:#fff; border-color:#1e8449; }
.ara-leg.ko.active{ background:#c0392b; color:#fff; border-color:#c0392b; }
/* Le rendez-vous ciblé par la flèche cliquée est mis en évidence */
.ara-node.ara-target{ outline:3px solid #ff7a00; outline-offset:2px; box-shadow:0 0 0 5px rgba(255,122,0,.22), 0 5px 16px rgba(0,0,0,.2); }
/* Distances DANS LE MÊME CRÉNEAU (« ↔ ») : intégrées au carré, au-dessus des flèches vers le créneau
   suivant (« ▼ »). Mêmes règles et couleurs : vert dans le seuil, rouge au-delà. */
.ara-legs-same{ border-top-style:dotted !important; }

/* ===== Vérification (onglet provisoire) : chaque champ ➜ les endroits vers lesquels il pointe ===== */
.verif-head h2 { margin: 0 0 4px; font-size: 20px; }
.verif-tag { font-size: 11.5px; font-weight: 700; color: #b05c00; background: #fff3df; border: 1px solid #f2ce93;
             border-radius: 999px; padding: 2px 10px; vertical-align: 3px; }
.verif-sec { margin: 22px 0 8px; font-size: 15px; color: #33404e; border-bottom: 2px solid var(--line); padding-bottom: 4px; }
.verif-row { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line);
             border-radius: 10px; padding: 9px 13px; margin-bottom: 7px; }
.verif-field { flex: 0 0 220px; }
.verif-field small { display: block; }
.verif-arrow { font-size: 19px; color: var(--blue); flex: 0 0 auto; }
.verif-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.verif-chip { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 11px; border: 1px solid; }
.vc-fiche  { background: #eef2fe; border-color: #b9c8f5; color: #1d4fd8; }
.vc-ligne  { background: #e9f7ee; border-color: #a9dcbb; color: #1e7a45; }
.vc-racc   { background: #f3ecfd; border-color: #d3bcf2; color: #6d28d9; }
.vc-filtre { background: #e8f6f8; border-color: #a8dde5; color: #0e7490; }
.vc-plan   { background: #fdf3d5; border-color: #ecd28a; color: #92600a; }
.vc-ara    { background: #fde8f0; border-color: #f2b1cb; color: #be185d; }
.vc-oblig  { background: #fdeaea; border-color: #efb3b3; color: #b02a2a; }
.vc-masque { background: #eceff1; border-color: #c8d0d6; color: #5c6b7a; }

/* ---------- Champ date « jj/mm/aaaa » + calendrier (remplace le sélecteur du navigateur) ---------- */
.dinput { font-variant-numeric: tabular-nums; }
.dinput.dinput-bad { outline: 2px solid #ef4444; background: #fef2f2; }
.dcal { position: fixed; z-index: 1200; background: #fff; border: 1px solid var(--line, #dfe3ea); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .18); padding: 8px; width: 252px; font-size: 13px; user-select: none; }
.dcal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dcal-head b { font-size: 13px; text-transform: capitalize; }
.dcal-nav { border: 0; background: transparent; font-size: 18px; cursor: pointer; padding: 0 8px; color: #334155; border-radius: 6px; }
.dcal-nav:hover { background: #f1f5f9; }
.dcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dcal-grid > span { font-weight: 700; color: #475569; font-size: 12px; padding: 2px 0; }
.dcal-d { border: 0; background: transparent; border-radius: 6px; padding: 5px 0; cursor: pointer; font-size: 13px; color: #1e293b; }
.dcal-d:hover { background: #e2e8f0; }
.dcal-d.other { color: #cbd5e1; }
.dcal-d.today { background: var(--blue, #2563eb); color: #fff; font-weight: 700; }
.dcal-d.sel { outline: 2px solid var(--blue, #2563eb); outline-offset: -2px; }
.dcal-foot { display: flex; justify-content: space-between; border-top: 1px solid #e2e8f0; margin-top: 6px; padding-top: 6px; }
.dcal-foot button { border: 0; background: transparent; cursor: pointer; color: #334155; padding: 4px 8px; border-radius: 6px; font-size: 13px; }
.dcal-foot button:hover { background: #f1f5f9; }

/* Type de RDV : automatique d'après les dates (RDV / Installation / Résignature / RDV 2) */
.type-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #e0e7ff; color: #3730a3; font-size: 11px; font-weight: 700; margin: 0 4px 4px 0; white-space: nowrap; }

/* ===== Téléphone (≤ 640 px) : filtres repliés, liste en cartes ===== */
.mob-toggle { display: none; }
@media (max-width: 640px) {
  .mob-toggle { display: inline-flex; }
  /* Groupes de dates du/au : sur toute la largeur, sans forcer la page à s'élargir */
  .fgroup { display: flex; flex: 1 1 100%; min-width: 0; }
  .fgroup .dinput { min-width: 0; flex: 1; width: 40px; }
  .filterbar #f_q { flex: 1 1 60%; min-width: 0 !important; }
  .filterbar #f_layout { display: none; }
  /* Repliée : seuls la recherche, la loupe et le bouton Filtres restent visibles */
  .filterbar.collapsed > :not(#f_q):not(#f_go):not(#f_more):not(#p_today):not(#p_prev):not(#p_next):not(#p_mode):not(#p_more) { display: none; }
  /* Liste des clients : chaque ligne devient une CARTE */
  table.list { min-width: 0; display: block; }
  table.list thead { display: none; }
  table.list tbody { display: block; }
  table.list tr { display: block; padding: 12px 12px 8px; margin: 8px 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
  table.list tr:nth-child(odd) td { background: transparent; }
  table.list td { display: block; padding: 3px 0; border: 0; font-size: 15px; }
  table.list td:nth-child(1), table.list td:nth-child(10), table.list td:nth-child(11) { display: none; }   /* case à cocher, historique, observations */
  table.list td:nth-child(2) { display: inline-block; color: var(--muted); font-size: 13px; margin-right: 8px; }  /* n° */
  table.list td:nth-child(3) { display: inline-block; font-size: 17px; }                                     /* nom */
  table.list td:nth-child(4) .tel-num { font-size: 17px; }
  table.list td .q-sel, table.list td select { max-width: 100%; }
  .adr-cell { min-width: 0; }
  .list-actions, .toolbar { flex-wrap: wrap; gap: 6px; }
}
.week.one-day { grid-template-columns: 1fr; }
.week.one-day .day-head { display: flex; align-items: baseline; gap: 8px; }

/* ===== Sélection multiple dans les filtres (⇊) : volet à gauche, comme l'ancien CRM ===== */
.msel-wrap { display: inline-flex; align-items: stretch; }
.msel-wrap select { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.msel-btn { border: 1px solid var(--line); border-left: 0; border-radius: 0 8px 8px 0; background: #fff; color: #16a34a; font-size: 15px; padding: 0 9px; cursor: pointer; line-height: 1; }
.msel-btn:hover { background: #f0fdf4; }
.msel-panel { position: fixed; top: 0; left: 0; bottom: 0; width: 272px; background: #fff; border-right: 1px solid var(--line); box-shadow: 4px 0 18px rgba(15,23,42,.08); z-index: 1300; display: flex; flex-direction: column; font-size: 14px; }
.msel-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #e9eef8; border-bottom: 1px solid var(--line); }
.msel-close { border: 0; background: transparent; cursor: pointer; font-size: 14px; color: #1e293b; padding: 4px 2px; }
.msel-head b { font-size: 13px; color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msel-list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.msel-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid #eef1f5; cursor: pointer; }
.msel-item:hover { background: #f8fafc; }
.msel-item input { width: 16px; height: 16px; margin: 0; flex: none; }
.msel-lab { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msel-count { flex: none; min-width: 34px; text-align: center; padding: 2px 8px; border-radius: 999px; background: #e2e8f0; color: #1e293b; font-size: 12px; font-weight: 700; }
body.msel-open { padding-left: 272px; }
@media (max-width: 640px) { .msel-panel { width: 88vw; } body.msel-open { padding-left: 0; } }

/* Liste déroulante à cocher (clic sur un filtre à liste) */
.msel-dd { position: fixed; z-index: 1350; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(15,23,42,.16); font-size: 14px; }
.msel-dd-head { display: flex; align-items: center; gap: 8px; padding: 8px; border-bottom: 1px solid var(--line); }
.msel-dd-ico { color: #94a3b8; font-size: 13px; }
.msel-dd-q { flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.msel-dd-all { width: 18px; height: 18px; margin: 0 4px; cursor: pointer; }
.msel-dd-list { max-height: 320px; overflow: auto; padding: 4px 0; }
.msel-dd-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 12px; cursor: pointer; }
.msel-dd-item:hover { background: #f1f5f9; }
.msel-dd-item .msel-dd-chk { visibility: hidden; color: #1e293b; font-weight: 700; }
.msel-dd-item.on .msel-dd-chk { visibility: visible; }
.msel-dd-item.on { background: #f8fafc; }
.msel-wrap select { max-width: 60vw; text-overflow: ellipsis; }

/* Adresse sur la ligne : zone auto-agrandie (adresse complète visible), n° de fiche collé à la case à cocher */
.adr-cell { min-width: 250px; }
.adr-ta { display: block; resize: none; overflow: hidden; white-space: pre-wrap; word-break: break-word; line-height: 1.4; min-height: 1.4em; }
table.list td:first-child { width: 1%; padding-right: 2px; }
table.list td:nth-child(2) { padding-left: 4px; white-space: nowrap; }
table.list th:first-child { padding-right: 2px; } table.list th:nth-child(2) { padding-left: 4px; }

/* ===== Mode « déplacement » de la barre de filtres (Réglages → Disposition des filtres) ===== */
.filterbar.fl-edit > [data-fk] { position: relative; cursor: grab; outline: 2px dashed #94a3b8; outline-offset: 3px; border-radius: 8px; padding-right: 52px; }
.filterbar.fl-edit > [data-fk] > *:not(.fl-ov) { pointer-events: none; }
.filterbar.fl-edit > [data-fk].fl-off { opacity: .4; }
.filterbar.fl-edit > [data-fk].dragging { opacity: .3; }
.filterbar.fl-edit > [data-fk].drop-before { box-shadow: -4px 0 0 0 var(--blue); }
.filterbar.fl-edit > [data-fk].drop-after { box-shadow: 4px 0 0 0 var(--blue); }
.fl-ov { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; gap: 2px; background: #fff; border-radius: 6px; padding: 0 2px; }
.fl-ov-grip { color: #94a3b8; font-size: 15px; cursor: grab; padding: 0 3px; }
.fl-ov-eye { border: 0; background: transparent; cursor: pointer; font-size: 15px; padding: 2px 3px; }
.fl-toolbar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 2600; background: #111827; color: #fff; padding: 12px 18px; border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35); display: flex; align-items: center; gap: 12px; font-size: 14px; max-width: 96vw; flex-wrap: wrap; }
.fl-toolbar .btn { padding: 8px 14px; }
.fl-wrap { display: inline-flex; align-items: stretch; }
.fl-zone-title { font-weight: 700; color: #334155; margin: 6px 0; font-size: 13.5px; }
.fl-bar-host .filterbar { border: 1px solid var(--line); border-radius: 10px; }
.fl-hidden { display: flex; flex-wrap: wrap; gap: 8px; min-height: 42px; padding: 8px; border: 1px dashed var(--line); border-radius: 10px; background: #f8fafc; }
.fl-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; background: #fff; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; }
.fl-chip-add { border: 0; background: #dcfce7; color: #15803d; border-radius: 999px; width: 24px; height: 24px; cursor: pointer; font-weight: 700; }
.fl-ov-x { border: 0; background: transparent; cursor: pointer; font-size: 13px; color: var(--red, #dc2626); padding: 2px 4px; }
option.opt-disabled { color: #94a3b8; font-style: italic; }

/* ===== Barre de filtres : HAUTEUR UNIFORME pour toutes les cases (demande de Paul), dates plus courtes ===== */
.filterbar > input, .filterbar > select, .filterbar > .fgroup, .filterbar > .msel-wrap, .filterbar > .btn,
.filterbar .msel-wrap > select, .filterbar .msel-btn { height: 38px; box-sizing: border-box; }
.filterbar > input, .filterbar > select, .filterbar .msel-wrap > select { padding-top: 0; padding-bottom: 0; }
.filterbar > .fgroup { padding: 0 6px; }
.filterbar .fgroup .dinput { height: 30px; min-width: 0; width: 92px; padding: 0 4px; }
.filterbar .fgroup .flabel { padding: 0 2px 0 0; }
.filterbar > .btn:not(.mob-toggle) { display: inline-flex; align-items: center; }
/* Bouton Waze sur les cartes du planning */
.p-waze { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: #33ccff; color: #0b2a3a; font-size: 11px; font-weight: 700; text-transform: none; text-decoration: none; vertical-align: middle; }
.p-waze:hover { background: #05c8f7; }
.dist-mode .p-waze { pointer-events: none; opacity: .5; }
/* Alerte Google Maps (clé réglée mais Google n'a pas répondu) */
.gmaps-alert { margin: 8px 0; padding: 8px 12px; border-radius: 8px; background: #fef2f2; border: 1px solid #fca5a5; color: #b91c1c; font-size: 13px; font-weight: 600; }
