/* =====================================================================
   CRM moncallcenter — habillage « application mobile » (Android / iPhone)
   Chargé uniquement sous 820 px de large ; l'ordinateur n'est pas touché.
   ===================================================================== */
:root{
  --tab-h:62px; --top-h:54px;
  --sb:env(safe-area-inset-bottom,0px); --st:env(safe-area-inset-top,0px);
  --sl:env(safe-area-inset-left,0px); --sr:env(safe-area-inset-right,0px);
  --r:16px;
}
html{-webkit-text-size-adjust:100%;scroll-padding-top:calc(var(--top-h) + var(--st) + 8px)}
body{-webkit-tap-highlight-color:transparent;overscroll-behavior-y:none;font-size:15px;background:#f2f4f8}
body.sheet-open{overflow:hidden}
a,button,summary,select,label{touch-action:manipulation}
a:hover{text-decoration:none}
button,.btn,.tabbar a,.chip,.tchip{-webkit-user-select:none;user-select:none}

/* ---------- Structure ---------- */
.layout{display:block}
.side{display:none}
main.main{padding:14px calc(14px + var(--sr)) calc(var(--tab-h) + var(--sb) + 28px) calc(14px + var(--sl))}
.topbar{margin-bottom:12px;gap:10px}
.topbar .search{display:none}
.ep-search_page .topbar .search{display:block;flex:1 1 100%}
h1{font-size:23px;letter-spacing:-.02em}
.topbar .grow h1{font-size:23px}
.topbar .grow .muted{font-size:15px !important}

/* ---------- En-tête de l'application ---------- */
.mobile-top{display:flex;align-items:center;gap:10px;position:sticky;top:0;z-index:40;
  padding:calc(var(--st) + 7px) calc(12px + var(--sr)) 7px calc(12px + var(--sl));min-height:calc(var(--top-h) + var(--st));
  background:rgba(20,27,41,.96);-webkit-backdrop-filter:saturate(1.4) blur(12px);backdrop-filter:saturate(1.4) blur(12px);color:#fff}
.mt-logo{display:flex;flex:0 0 auto}.mt-logo img{border-radius:8px;display:block}
.mt-title{flex:1;min-width:0;font-size:17px;font-weight:650;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mt-btn{flex:0 0 auto;width:42px;height:42px;border-radius:12px;display:flex;align-items:center;justify-content:center;color:#fff;background:rgba(255,255,255,.1)}
.mt-btn:active{background:rgba(255,255,255,.2)}
.mt-btn svg{width:21px;height:21px}
.mt-btn:hover{text-decoration:none}

/* ---------- Barre de navigation du bas ---------- */
.tabbar{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:45;
  padding:6px calc(6px + var(--sr)) calc(6px + var(--sb)) calc(6px + var(--sl));
  background:rgba(255,255,255,.94);-webkit-backdrop-filter:saturate(1.6) blur(16px);backdrop-filter:saturate(1.6) blur(16px);
  border-top:1px solid rgba(20,30,50,.1)}
.tabbar a,.tabbar button{position:relative;flex:1 1 0;min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  min-height:50px;border:0;background:none;color:#6b7385;font:inherit;font-size:11px;font-weight:600;border-radius:14px;cursor:pointer;padding:4px 2px}
.tabbar a:hover{text-decoration:none}
.tabbar svg{width:24px;height:24px;stroke-width:1.9;transition:transform .15s}
.tabbar .on{color:var(--brand)}
.tabbar .on svg{stroke-width:2.3}
.tabbar .on::before{content:"";position:absolute;top:0;width:34px;height:3px;border-radius:0 0 4px 4px;background:var(--brand)}
.tabbar a:active svg,.tabbar button:active svg{transform:scale(.88)}
.tabbar a:active,.tabbar button:active{background:var(--grey-soft)}
.tb-badge{position:absolute;top:1px;left:calc(50% + 6px);min-width:18px;height:18px;padding:0 5px;border-radius:999px;background:#e5484d;color:#fff;
  font-style:normal;font-size:11px;font-weight:700;line-height:18px;text-align:center;border:2px solid #fff;box-sizing:content-box}

/* ---------- Bouton d'action flottant ---------- */
.fab{display:flex;align-items:center;justify-content:center;position:fixed;z-index:44;right:calc(16px + var(--sr));bottom:calc(var(--tab-h) + var(--sb) + 14px);
  width:58px;height:58px;border-radius:20px;background:linear-gradient(135deg,#2e73e8,#1a4fb8);color:#fff;
  box-shadow:0 10px 24px rgba(31,95,214,.42),0 2px 6px rgba(0,0,0,.18)}
.fab svg{width:26px;height:26px;stroke-width:2.4}
.fab:hover{text-decoration:none}.fab:active{transform:scale(.93)}

/* ---------- Menu « Plus » (feuille du bas) ---------- */
.sheet-bg{display:block;position:fixed;inset:0;z-index:60;background:rgba(10,16,30,.5);animation:fade .2s}
.sheet-bg[hidden],.sheet[hidden]{display:none}
.sheet{display:block;position:fixed;left:0;right:0;bottom:0;z-index:61;max-height:88vh;overflow:auto;overscroll-behavior:contain;
  background:#fff;border-radius:24px 24px 0 0;padding:8px calc(18px + var(--sr)) calc(18px + var(--sb)) calc(18px + var(--sl));box-shadow:0 -12px 40px rgba(0,0,0,.25)}
.sheet.in{animation:up .28s cubic-bezier(.2,.9,.3,1)}
.sheet-grip{width:40px;height:5px;border-radius:3px;background:#d3d8e0;margin:4px auto 12px}
.sheet-me{display:flex;align-items:center;gap:12px;padding:6px 2px 14px}
.avatar{width:44px;height:44px;border-radius:50%;background:linear-gradient(135deg,#2e73e8,#1a4fb8);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:18px}
.sheet-list{display:grid;gap:6px;margin-bottom:12px}
.sheet-list a{display:flex;align-items:center;gap:14px;padding:0 14px;min-height:54px;border-radius:14px;background:#f4f6fa;color:var(--ink);font-weight:600;font-size:16px}
.sheet-list a:hover{text-decoration:none}.sheet-list a:active{background:#e6ebf4}
.sheet-list svg{width:22px;height:22px;color:var(--brand);flex:0 0 22px}
.install{display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:16px;background:var(--brand-soft);border:1px solid #c5d8fa;margin-bottom:12px}
.install[hidden]{display:none}.install img{border-radius:11px;flex:0 0 44px}.install > div{flex:1;min-width:0}
.install .btn{flex:0 0 auto}.ico-share{display:inline-block;padding:0 4px;color:var(--brand);font-weight:700}
.sheet-out{width:100%;min-height:52px;border:0;border-radius:14px;background:#fff;border:1.5px solid #efc9c9;color:var(--bad);font:inherit;font-size:16px;font-weight:650;cursor:pointer}
.sheet-out:active{background:var(--bad-soft)}
@keyframes up{from{transform:translateY(100%)}to{transform:none}}
@keyframes fade{from{opacity:0}to{opacity:1}}

/* ---------- Boutons, champs : faciles à toucher ---------- */
.btn{min-height:44px;padding:10px 16px;border-radius:12px;font-size:15px}
.btn.sm{min-height:40px;padding:8px 13px;font-size:14px;border-radius:11px}
.btn svg{width:17px;height:17px}
.btn:active{transform:scale(.97);background:#eef1f6}
.btn.primary:active{background:var(--brand-d)}
.btns{gap:10px}
input[type=text],input[type=email],input[type=date],input[type=password],input[type=number],input[type=search],input[type=tel],input[type=url],select,textarea{
  font-size:16px;min-height:48px;padding:11px 13px;border-radius:12px}
textarea{min-height:96px}
select{background-position:right 12px center}
input[type=checkbox],input[type=radio]{width:22px;height:22px}
.check{gap:10px;min-height:44px}
label{font-size:14px}
.form-grid{grid-template-columns:minmax(0,1fr)}
.field{margin-bottom:16px}
.filters{gap:10px}
.filters select,.filters input{flex:1 1 100%;min-height:48px}

/* ---------- Cartes ---------- */
.card{border-radius:var(--r);padding:16px;box-shadow:0 1px 3px rgba(20,30,50,.07)}
.card + .card{margin-top:12px}
.card.flush{padding:0;overflow:hidden}
.card-head{margin-bottom:12px}
.card-head h2{font-size:17px}
h2{font-size:17px}
.flash{border-radius:14px;padding:13px 15px}
.chips{flex-wrap:nowrap;overflow-x:auto;margin:0 -14px 14px;padding:2px 14px;scrollbar-width:none}
.chips::-webkit-scrollbar{display:none}
.chip,.tchip{white-space:nowrap;min-height:40px;display:inline-flex;align-items:center;padding:8px 14px;font-size:14px}
.tchips{margin:0 -14px;padding:2px 14px 6px;scrollbar-width:none}.tchips::-webkit-scrollbar{display:none}
.badge{font-size:12.5px;padding:3px 10px}

/* ---------- Barre d'outils des listes ---------- */
.toolbar{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;margin-bottom:12px}
.tb-search{grid-column:1/-1;flex:none;max-width:none}
.tb-search input{min-height:50px;border-radius:14px;padding-left:42px;font-size:16px;box-shadow:0 1px 2px rgba(20,30,50,.05)}
.tb-search svg{left:15px;width:19px;height:19px}
.tb-status{min-height:48px;border-radius:14px;font-size:15px;min-width:0;width:100%}
.toolbar > .tb-status:nth-of-type(n+2){grid-column:1/-1}
.toolbar > .btn,.toolbar > a.btn,.fpop > summary.btn{min-height:48px;border-radius:14px;justify-content:center}
.toolbar > a.btn.ghost{border:1px solid var(--line);background:#fff}
.ep-prospects .toolbar > a.btn.primary{display:none}
.toolbar .tb-grow{display:none}
.fpop{position:static}
.fpop .panel{position:fixed;left:0;right:0;top:auto;bottom:0;width:auto;max-height:80vh;overflow:auto;z-index:62;border-radius:24px 24px 0 0;
  padding:22px 18px calc(22px + var(--sb));box-shadow:0 -12px 40px rgba(0,0,0,.28);animation:up .26s cubic-bezier(.2,.9,.3,1)}
.fpop[open]::before{content:"";position:fixed;inset:0;z-index:61;background:rgba(10,16,30,.5)}
.fpills{margin:0 0 12px;gap:8px}.fpill{min-height:36px;font-size:14px;padding:6px 12px}

/* ---------- Listes en cartes (Prospects / Clients) ---------- */
.card.flush:has(table.lcards),.card.flush:has(table.mcards){background:none;border:0;box-shadow:none;overflow:visible}
table.lcards,table.mcards{display:block}
table.lcards thead,table.mcards thead{display:none}
table.lcards tbody,table.mcards tbody{display:grid;gap:10px}
table.lcards tr{position:relative;display:flex;flex-wrap:wrap;align-items:center;gap:8px 8px;background:#fff;border:1px solid var(--line);
  border-radius:var(--r);padding:14px 14px 13px;box-shadow:0 1px 3px rgba(20,30,50,.06);transition:transform .1s,background .1s}
table.lcards tr:active{transform:scale(.985);background:#f6f8fc}
table.lcards td{display:block;padding:0;border:0;background:none !important;order:5;white-space:normal}
table.lcards td.selcol{display:none}
table.lcards td.c-name{order:0;flex:1 1 100%;position:relative;padding-right:56px;min-height:44px}
table.lcards td.c-name a:not(.qcall){font-size:17px;font-weight:650;color:var(--ink);display:block;line-height:1.25}
table.lcards td.c-name .small{font-size:13.5px;margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.qcall{display:flex;position:absolute;right:0;top:0;width:46px;height:46px;border-radius:15px;align-items:center;justify-content:center;
  background:var(--ok-soft);color:var(--ok);box-shadow:inset 0 0 0 1px rgba(20,131,90,.15)}
.qcall svg{width:21px;height:21px}.qcall:hover{text-decoration:none}.qcall:active{background:#cdeedd}
table.lcards td.c-st{order:1}
table.lcards td.c-rel{order:2}
table.lcards td.c-own{order:3;margin-left:auto}
table.lcards td.c-src{order:4;font-size:13.5px;color:var(--ink2);font-weight:550}
table.lcards td.c-src[data-l="Source"]::before{content:"via ";color:var(--muted);font-weight:500}
table.lcards td.c-d{order:5;font-size:12.5px;color:var(--muted);flex:1 1 auto}
table.lcards td.c-d::before{content:attr(data-l) " ";font-weight:500}
table.lcards td.c-d:empty{display:none}
table.lcards td.c-start,table.lcards td.c-nb,table.lcards td.c-city{display:none}
table.lcards td.c-d + td.c-d{text-align:right}
td.c-rel:empty,td.c-src:empty{display:none}
.pager{flex-wrap:wrap;gap:8px}.pager .btn{min-width:44px;justify-content:center}
.empty{padding:34px 18px;text-align:center}

/* ---------- Autres tableaux en cartes (Outbound, Recherche, Journal, Fiche…) ---------- */
table.mcards tr{display:block;background:#fff;border:1px solid var(--line);border-radius:var(--r);padding:6px 14px;box-shadow:0 1px 3px rgba(20,30,50,.06)}
table.mcards td{display:flex;justify-content:space-between;align-items:center;gap:14px;padding:9px 0;border:0;border-bottom:1px solid var(--line2);text-align:right;white-space:normal;max-width:none !important}
table.mcards td:last-child{border-bottom:0}
table.mcards td::before{content:attr(data-l);flex:0 0 auto;color:var(--muted);font-size:13px;font-weight:550;text-align:left}
table.mcards td:not([data-l])::before{display:none}
table.mcards td:not([data-l]){justify-content:flex-end;flex-wrap:wrap}
table.mcards td.name{display:block;text-align:left;font-size:16px;padding:10px 0}
table.mcards td.name::before{display:none}
table.mcards td.hide-m{display:none}
table.mcards td .btn{flex:none}
.card.flush .table-wrap{overflow:visible}
.card.flush:has(table.mcards) > .table-wrap{overflow:visible}

/* ---------- Tableaux statistiques : défilement horizontal doux ---------- */
.table-wrap{-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
table.stat th:first-child,table.stat td:first-child{position:sticky;left:0;background:#fff;z-index:1;box-shadow:1px 0 0 var(--line2)}
table.stat tr.sel td:first-child{background:var(--brand-soft)}
table.stat tfoot td:first-child{background:#fafbfc}

/* ---------- Fiche ---------- */
.fiche-head{display:block}
.title-row{gap:8px}
.title-row h1{font-size:25px;line-height:1.15;word-break:break-word}
.fiche-head > .btns{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:14px}
.fiche-head > .btns .btn{justify-content:center;width:100%}
.fiche-head > .btns .btn.primary{grid-column:1/-1}
.qa{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;gap:10px;margin:14px 0 4px}
.qa-b{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;min-height:62px;border-radius:16px;background:#fff;border:1px solid var(--line);
  color:var(--brand);font-weight:650;font-size:13.5px;box-shadow:0 1px 3px rgba(20,30,50,.06)}
.qa-b svg{width:22px;height:22px}.qa-b:hover{text-decoration:none}.qa-b:active{background:#eef3fc}
.qa-b.call{background:var(--ok);border-color:var(--ok);color:#fff;box-shadow:0 6px 16px rgba(20,131,90,.3)}
.qa-b.call:active{background:#0f6b49}
dl.info{grid-template-columns:112px minmax(0,1fr);gap:10px 12px;font-size:15px}
dl.info dd{word-break:break-word}
.card-head .btns{width:100%}
.card-head .btns .btn{flex:1 1 auto;justify-content:center}

/* ---------- Boîtes de dialogue : feuilles qui montent du bas ---------- */
dialog.dlg{position:fixed;inset:auto 0 0 0;margin:0;width:100% !important;max-width:none;max-height:92vh;overflow:auto;overscroll-behavior:contain;
  border-radius:24px 24px 0 0;padding:22px calc(18px + var(--sr)) calc(20px + var(--sb)) calc(18px + var(--sl));animation:up .28s cubic-bezier(.2,.9,.3,1)}
dialog.dlg::backdrop{background:rgba(10,16,30,.55)}
dialog.dlg h3{font-size:19px;margin-bottom:14px;padding-top:6px}
dialog.dlg h3::before{content:"";display:block;width:40px;height:5px;border-radius:3px;background:#d3d8e0;margin:-14px auto 16px}
dialog.dlg .btns{display:grid;grid-template-columns:1fr;gap:10px;margin-top:16px}
dialog.dlg .btns .btn{width:100%;justify-content:center;min-height:50px;font-size:16px}
dialog.dlg .two-cols{grid-template-columns:1fr}

/* ---------- Alertes ---------- */
.al{padding:14px;border-radius:var(--r)}
.al .who{font-size:17px}
.al-actions .btn{flex:1 1 auto;justify-content:center}
.al-contact a{min-height:40px}
.bucket{margin-top:18px}
.al-bar .filters select{min-height:48px}

/* ---------- Tableau de bord ---------- */
.hero{border-radius:20px}
.seg{display:flex;overflow-x:auto;scrollbar-width:none}.seg::-webkit-scrollbar{display:none}
.seg a{white-space:nowrap;min-height:44px;display:inline-flex;align-items:center}
.an-card{border-radius:var(--r)}

/* ---------- Connexion ---------- */
.login-wrap{align-items:flex-start;padding:calc(28px + var(--st)) 18px calc(24px + var(--sb))}
.login{margin-top:6vh;padding:24px 20px;border-radius:22px}
.login .btn{min-height:52px;font-size:17px}

/* ---------- Mode application installée ---------- */
.is-app .mobile-top{padding-top:calc(var(--st) + 7px)}
@media (prefers-reduced-motion:reduce){*{animation:none !important;transition:none !important}}
@media (max-width:360px){.tabbar span{font-size:10px}.mt-title{font-size:16px}}

/* ---------- Ajustements ---------- */
.filters input[type=checkbox],.al-bar .check input{flex:none;min-height:0;width:22px;height:22px}
.al-bar .filters label.check{flex:1 1 100%;background:#fff;border:1px solid var(--line);border-radius:14px;padding:10px 14px;min-height:50px}
.toolbar > select.tb-status{grid-column:1/-1;min-width:0 !important;width:100%}
.ep-prospects .toolbar > select.tb-status:first-of-type,.ep-clients .toolbar > select.tb-status:first-of-type{grid-column:auto}
.ep-prospects .toolbar > a.btn.ghost,.ep-clients .toolbar > a.btn.ghost{display:none}
.ep-clients .toolbar > a.btn.primary{grid-column:1/-1}
form[action$="/outbound/ajouter"] > div > span{flex:1 1 100% !important}
form[action$="/outbound/ajouter"] .btn.primary{flex:1 1 100%;justify-content:center;min-height:52px}
.qa-b.call{grid-column:auto}
.fiche-head > .btns .btn.danger{grid-column:1/-1;min-height:40px;font-size:14px;opacity:.9}
.qa + .dup,.qa + .card,.qa + .grid{margin-top:14px}
.fiche-head > .btns{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}
.fiche-head > .btns .btn.dsk{display:none}
.fiche-head > .btns:not(:has(.btn:not(.dsk))){display:none}
.qa-b{font-family:inherit;cursor:pointer}
button.qa-b{font-size:13.5px}
.search svg{left:15px;top:50%;transform:translateY(-50%);width:19px;height:19px}
.search input[type=search]{padding-left:44px;min-height:50px;border-radius:14px}
.fpop .panel .btn,.fpop .panel button{width:100%;justify-content:center;min-height:50px;font-size:16px}
.fpop .panel::before{content:"Filtres";display:block;font-weight:700;font-size:19px;margin-bottom:2px}
.xlabels{font-size:10px}.xlabels span{overflow:hidden}
.mt-back{border:0;cursor:pointer;margin-left:-4px}
.mt-back svg{width:24px;height:24px;stroke-width:2.4}
table.lcards td.c-src{flex:1 1 40%}

/* catégories (mobile) */
.catswitch-m,.catswitch-s{display:block;margin:0 0 12px}
.catswitch-m>summary,.catswitch-s>summary{background:#fff;border:1px solid var(--line);color:var(--ink);box-shadow:0 1px 2px rgba(20,27,41,.06)}
.catswitch-m .ms-t small,.catswitch-s .ms-t small{color:var(--muted)}.catswitch-m .ms-ch,.catswitch-s .ms-ch{border-color:#7a879d}
.side .modsw{display:none}
