/* =========================================================
   Mise en page : volet gauche, barre du haut, « Ma journée », légende
   La carte occupe tout l'écran ; tout le reste flotte par-dessus.
   ========================================================= */
.app{position:relative;height:100vh;overflow:hidden;}
.workspace{position:absolute;inset:0;}

/* ---------- Volet gauche (1/5 de l'écran) ---------- */
.sidebar{position:absolute;top:var(--gap);left:var(--gap);bottom:var(--gap);width:var(--side);z-index:1000;
  display:flex;flex-direction:column;padding:20px 14px 12px;background:var(--card);border-radius:var(--r-lg);box-shadow:var(--shadow);}
.sidebar-brand{display:flex;align-items:center;gap:10px;padding:2px 10px 18px;border:0;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer;}
.brand-mark{width:40px;flex:0 0 40px;color:var(--blue);}                 /* logo.svg en ligne, sans fond : bleu sur fond clair */
.brand-mark svg{display:block;width:100%;height:auto;}
:root[data-theme="dark"] .brand-mark{color:var(--blue-d);}               /* lavande sur fond sombre : le blanc contraste trop */
.brand-name{font-family:"Bricolage Grotesque",var(--font);font-weight:800;font-size:21px;letter-spacing:-.02em;}

/* recherche */
.search{position:relative;margin:0 0 4px;}
.search-box{display:flex;align-items:center;gap:10px;height:42px;padding:0 12px;background:var(--bg);border:1px solid var(--line);
  border-radius:var(--r-sm);color:var(--gray-l);transition:border-color .15s;}
.search-box:focus-within{border-color:var(--blue);}
.search-input{flex:1;min-width:0;height:100%;border:0;outline:0;background:none;font:inherit;font-size:14px;color:var(--ink);}
.search-input::placeholder{color:var(--gray-l);}
.search-results{position:absolute;left:0;right:0;top:48px;z-index:5;display:none;max-height:420px;overflow:auto;padding:6px;
  background:var(--card);border:1px solid var(--line);border-radius:var(--r-sm);box-shadow:var(--shadow);}
.search-results.is-open{display:block;}
.search-result{display:flex;gap:10px;width:100%;padding:9px 10px;border:0;background:none;text-align:left;border-radius:10px;transition:background-color .15s;}
.search-result:hover,.search-result.is-active{background:var(--lav-2);}
.search-result .dot{margin-top:5px;}
.search-result-name{font-weight:500;line-height:1.3;}
.search-result-meta{font-size:12px;color:var(--gray-l);}
.search-empty{padding:12px;color:var(--gray-l);font-size:13px;}

/* filtres de vue */
.view-filters{display:flex;flex-direction:column;gap:6px;padding:6px 0 8px;margin-bottom:6px;border-bottom:1px solid var(--line);}
.toggle-chips{display:flex;gap:6px;}
.toggle-chip{flex:1;display:flex;align-items:center;justify-content:center;gap:6px;height:34px;padding:0 6px;border:0;border-radius:10px;
  background:var(--bg);font-size:13px;font-weight:500;color:var(--gray);white-space:nowrap;transition:background-color .15s,color .15s;}
.toggle-chip:hover{background:var(--lav-2);}
.toggle-chip-count{font-size:12px;color:var(--gray-l);}
.toggle-chip.is-off{color:var(--gray-l);}
.toggle-chip.is-off .dot{background:var(--line)!important;}

/* navigation */
.nav{display:flex;flex-direction:column;gap:1px;}
.nav-item{display:flex;align-items:center;gap:12px;width:100%;padding:8px 12px;border:0;background:none;text-align:left;
  border-radius:var(--r-sm);color:var(--gray);font-weight:500;transition:background-color .15s,color .15s;}
.nav-item:hover{background:var(--lav-2);color:var(--ink);}
.nav-item.is-active{background:var(--lav);color:var(--blue-d);}
.nav-sub{display:flex;flex-direction:column;gap:1px;margin:1px 0 4px 23px;padding-left:10px;border-left:1px solid var(--line);}
.nav-sub[hidden]{display:none;}
.nav-sub-item{width:100%;padding:6px 10px;border:0;background:none;text-align:left;border-radius:var(--r-sm);color:var(--gray);font-size:13px;font-weight:500;transition:background-color .15s,color .15s;}
.nav-sub-item:hover{background:var(--lav-2);color:var(--ink);}
.nav-sub-item.is-active{color:var(--blue-d);font-weight:600;}
.nav-soon{margin-left:auto;font-size:10px;font-weight:500;color:var(--gray-l);background:var(--bg);border:1px solid var(--line);padding:2px 6px;border-radius:6px;}

/* agenda du jour */
.agenda{flex:1;min-height:0;overflow:auto;scrollbar-width:none;margin:6px -4px 0;padding:0 4px;border-top:1px solid var(--line);}
.agenda::-webkit-scrollbar{display:none;}
.agenda-item{display:flex;gap:10px;width:100%;padding:8px 10px;border:0;background:none;text-align:left;border-radius:10px;transition:background-color .15s;}
.agenda-item:hover{background:var(--lav-2);}
.agenda-icon{width:28px;height:28px;flex:0 0 28px;border-radius:9px;display:grid;place-items:center;}
.agenda-icon--late{background:var(--red-l);color:var(--red);}
.agenda-icon--today{background:var(--peach);color:var(--orange-d);}
.agenda-icon--rdv{background:var(--lav);color:var(--blue-d);}
.agenda-title{font-weight:500;font-size:13px;line-height:1.3;}
.agenda-meta{font-size:12px;color:var(--gray-l);margin-top:1px;}
.agenda-meta.is-late{color:var(--red);}
.agenda-more{padding:4px 10px 8px;border:0;background:none;font-size:12px;font-weight:500;color:var(--blue-d);}
.agenda-empty{padding:4px 12px 8px;font-size:12.5px;color:var(--gray-l);}

/* ---------- Barre du haut : filtre actif + profil ---------- */
.topbar{position:absolute;z-index:1020;top:var(--gap);left:calc(var(--side) + 2 * var(--gap));right:var(--gap);
  display:flex;gap:12px;align-items:flex-start;pointer-events:none;}
.topbar > *{pointer-events:auto;}
.filter-chips{display:flex;gap:8px;flex-wrap:wrap;}
.focus-chip{display:none;align-items:center;gap:8px;height:46px;padding:0 8px 0 14px;border-radius:var(--r);box-shadow:var(--shadow);
  background:var(--inv-bg);color:var(--inv-fg);font-weight:500;white-space:nowrap;}
.focus-chip.is-on{display:flex;}
.focus-chip-close{width:30px;height:30px;border:0;border-radius:9px;background:none;color:var(--inv-fg);display:grid;place-items:center;transition:background-color .15s;}
.focus-chip-close:hover{background:rgba(128,128,128,.2);}

.quick-log{display:flex;gap:8px;margin-left:auto;}
.app:not([data-view="map"]) .quick-log{display:none;}
.quick-log-btn{display:flex;align-items:center;gap:8px;height:46px;padding:0 16px;border:0;border-radius:var(--r-sm);background:var(--card);box-shadow:var(--shadow);
  color:var(--ink);font-weight:500;transition:background-color .15s;}
.quick-log-btn:hover{background:var(--lav-2);}
.quick-log-btn .icon{color:var(--blue-d);}
.profile{position:relative;margin-left:auto;}
.quick-log + .profile{margin-left:0;}
.app:not([data-view="map"]) .quick-log + .profile{margin-left:auto;}   /* list screens hide Appel / Rendez-vous: the profile stays on the right */
.profile-btn{display:flex;align-items:center;gap:10px;height:46px;padding:0 14px 0 6px;border:0;border-radius:999px;   /* pilule voulue */
  background:var(--card);box-shadow:var(--shadow);white-space:nowrap;transition:background-color .15s;}
.profile-btn:hover{background:var(--lav-2);}
.profile-name{font-weight:500;}
.profile-btn .icon{width:16px;height:16px;flex-basis:16px;color:var(--gray-l);}
.profile-menu{position:absolute;right:0;top:54px;width:270px;display:none;padding:6px;background:var(--card);border-radius:var(--r);box-shadow:var(--shadow);}
.profile-menu.is-open{display:block;}
.menu-label{padding:8px 10px 6px;font-size:11px;font-weight:500;color:var(--gray-l);text-transform:uppercase;letter-spacing:.08em;}
.menu-item{display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;border:0;background:none;text-align:left;border-radius:10px;transition:background-color .15s;}
.menu-item:hover{background:var(--lav-2);}
.menu-item.is-on{background:var(--lav);}
.menu-item-meta{font-size:12px;color:var(--gray-l);}
.menu-item .icon{width:16px;height:16px;flex-basis:16px;color:var(--gray);}
.menu-item .switch{margin-left:auto;}
.menu-sep{height:1px;margin:6px 4px;background:var(--line);}

/* ---------- Ma journée (bas gauche) ---------- */
.daybar{left:calc(var(--side) + 2 * var(--gap));bottom:var(--gap);display:flex;gap:2px;padding:6px;}
.kpi{padding:8px 14px;border:0;background:none;text-align:left;border-radius:var(--r-sm);transition:background-color .15s;}
.kpi:hover{background:var(--lav-2);}
.kpi.is-on{background:var(--lav);}
.kpi-value{font-size:21px;font-weight:700;letter-spacing:-.01em;}
.kpi-value--alert{color:var(--red);}
.kpi-label{margin-top:2px;font-size:12px;color:var(--gray);white-space:nowrap;}
.kpi-label em{font-style:normal;color:var(--red);}

/* ---------- Légende des étapes (bas droite, le zoom + / − juste à sa gauche) ---------- */
.legend{right:var(--gap);bottom:20px;width:196px;padding:4px 4px 6px;}
.legend .section-label{padding:8px 10px 4px;}
.legend-item{display:flex;align-items:center;gap:10px;width:100%;padding:5px 10px;border:0;background:none;text-align:left;border-radius:10px;
  transition:background-color .15s,color .15s;}
.legend-item:hover{background:var(--lav-2);}
.legend-glyph{width:18px;flex:0 0 18px;display:grid;place-items:center;}
.legend-glyph .pin{width:14px;height:14px;}
.legend-modes{margin:4px 4px 0;}
.legend-modes .segmented-btn{height:28px;font-size:12px;}
.legend-glyph .logo{width:18px;height:18px;}
.legend-glyph .logo--none{width:12px;height:12px;}
.legend-glyph .logo--unknown{width:8px;height:8px;}
.legend-row{position:relative;display:flex;align-items:center;}
.legend-row .legend-item{flex:1;min-width:0;}
.legend-more{flex:0 0 24px;width:24px;height:24px;margin-right:4px;display:grid;place-items:center;border:1px solid var(--line);border-radius:50%;
  padding:0;background:none;color:var(--gray);font-size:14px;line-height:1;}
.legend-more:hover{background:var(--lav-2);}
.legend-more.is-filtered,.legend-more.is-open{border-color:var(--blue);color:var(--blue-d);}
.legend.has-pop{z-index:1005;}   /* above the Leaflet zoom (1000) while the pop-up is open, below the sheet (1010) */
.legend-pop{right:calc(100% + 12px);bottom:-6px;width:220px;padding:6px 4px 8px;box-shadow:none;border:1px solid var(--line);}
.legend-pop-title{padding:6px 10px 0;font-weight:700;}
.legend-check{display:flex;align-items:center;gap:8px;padding:4px 10px;border-radius:10px;cursor:pointer;}
.legend-check:hover{background:var(--lav-2);}
.legend-check input{margin:0;accent-color:var(--blue);}
.legend-check-label{flex:1;}
/* one choice among several (« En contact » by interest): a button with a round mark */
.legend-choice{width:100%;border:0;background:none;color:inherit;font:inherit;text-align:left;}
.legend-dot{flex:none;width:12px;height:12px;border:1.5px solid var(--gray-l);border-radius:50%;}
.legend-choice.is-on .legend-dot{border:4px solid var(--blue);}
.legend-label small{font-size:11px;color:var(--gray);}
.legend-pop-reset{margin:6px 10px 0;padding:0;border:0;background:none;color:var(--blue-d);font-size:12px;font-weight:500;}
.legend-label{flex:1;}
.legend-count{font-size:12px;color:var(--gray-l);}
.legend-item.is-off{color:var(--gray-l);}
.legend-item.is-off .legend-glyph{opacity:.35;}

/* ---------- Écrans moyens ---------- */
@media (max-width:1180px){
  .profile-name{display:none;}
  .profile-btn{padding:0 10px 0 6px;}
}

/* ---------- Téléphone : recherche + filtres en haut, menu en bas ---------- */
@media (max-width:820px){
  .sidebar{top:auto;left:12px;right:12px;bottom:12px;width:auto;height:62px;flex-direction:row;padding:6px 10px;border-radius:var(--r);}
  .sidebar-brand,.agenda,.nav-soon,.nav-label,.nav-sub{display:none;}
  .nav{flex-direction:row;justify-content:space-around;width:100%;}
  .nav-item{justify-content:center;width:auto;}
  .search{position:fixed;top:16px;left:16px;right:74px;margin:0;}
  /* profil : pastille ronde à droite de la recherche (vendeur, mode sombre, Réglages restent accessibles) */
  .profile{position:fixed;top:16px;right:16px;z-index:1030;margin:0;}
  .profile-btn{width:46px;padding:0;justify-content:center;}
  .profile-btn > .icon{display:none;}
  .search-box{height:46px;border:0;background:var(--card);box-shadow:var(--shadow);}
  .view-filters{position:fixed;top:70px;left:16px;right:16px;flex-direction:row;gap:6px;padding:6px;margin:0;border:0;
    background:var(--card);border-radius:var(--r);box-shadow:var(--shadow);overflow-x:auto;scrollbar-width:none;}
  .view-filters > *{flex:0 0 auto;}
  .toggle-chip{flex:0 0 auto;padding:0 10px;}
  .topbar{top:128px;left:16px;flex-wrap:wrap;}
  .quick-log-btn{width:46px;padding:0;justify-content:center;}
  .quick-log-btn span{display:none;}
  .daybar,.legend{display:none;}
}

/* Bell (top bar, js/ui/topbar.js): my emails opened, a count of the new ones; same round look as the profile */
.bell{position:relative;margin-left:auto;}
.quick-log + .bell{margin-left:0;}
.app:not([data-view="map"]) .quick-log + .bell{margin-left:auto;}
.bell + .profile,.quick-log + .bell + .profile{margin-left:0;}
.bell-btn{position:relative;display:grid;place-items:center;width:46px;height:46px;padding:0;border:0;border-radius:50%;background:var(--card);box-shadow:var(--shadow);
  color:var(--ink);transition:background-color .15s;}
.bell-btn:hover,.bell-btn.is-open{background:var(--lav-2);}
.bell-btn .icon{width:19px;height:19px;flex-basis:19px;}
.bell-count{position:absolute;top:-3px;right:-3px;min-width:17px;height:17px;padding:0 4px;border:2px solid var(--card);border-radius:999px;box-sizing:content-box;
  background:var(--red, #EF4A68);color:#fff;font-size:10.5px;font-weight:700;line-height:17px;text-align:center;}
.bell-menu{position:absolute;right:0;top:54px;z-index:1020;width:340px;max-height:min(480px, 70vh);overflow:auto;display:none;padding:6px;
  background:var(--card);border-radius:var(--r);box-shadow:var(--shadow);}
.bell-menu.is-open{display:block;}
.bell-item{display:flex;align-items:flex-start;gap:10px;width:100%;padding:9px 10px;border:0;border-radius:10px;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer;}
.bell-item:hover{background:var(--lav-2);}
.bell-item.is-new{background:color-mix(in srgb, var(--blue) 8%, transparent);}
.bell-item.is-new .bell-item-title::after{content:"";display:inline-block;width:7px;height:7px;margin-left:6px;border-radius:50%;background:var(--blue);vertical-align:middle;}
.bell-item-icon{flex:none;display:grid;place-items:center;width:30px;height:30px;border-radius:50%;background:var(--lav-2);color:var(--blue-d);}
.bell-item-title{display:block;font-size:13px;font-weight:500;line-height:1.35;}
.bell-item-meta{display:block;margin-top:2px;font-size:12px;color:var(--gray-l);}
.bell-empty{margin:4px 10px 10px;font-size:13px;line-height:1.45;color:var(--gray);}
@media (max-width:820px){
  /* phone: the bell next to the profile, at the right of the search */
  .search{right:128px;}
  .bell{position:fixed;top:16px;right:70px;z-index:1030;margin:0;}
  .bell-menu{position:fixed;top:70px;left:16px;right:16px;width:auto;}
}
