/* Comic Neue : remplaçant moderne de Comic Sans, auto-hébergé (OFL) → rendu
   identique sur mobile/desktop et disponible offline (cf. PRECACHE sw.js).
   Évite le fallback `cursive` système (immonde) quand Comic Sans est absent. */
@font-face {
    font-family: 'Comic Neue';
    font-style: normal; font-weight: 400; font-display: swap;
    src: url('/assets/fonts/comic-neue-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Comic Neue';
    font-style: normal; font-weight: 700; font-display: swap;
    src: url('/assets/fonts/comic-neue-700.woff2') format('woff2');
}

:root {
    /* Polices : --font-ui = données/texte (sans propre, lisible partout) ;
       --font-brand = logo + titres (Comic Neue, identité ludique BlitzPAL). */
    --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-brand: 'Comic Neue', 'Comic Sans MS', system-ui, sans-serif;

    --red:     #C41E3A;
    --red-dim: #8B1228;
    --red-glow:#C41E3A44;
    --teal:       var(--teal);
    --teal-dim:   var(--teal-dim);
    --teal-glow:  var(--teal)20;
    --blue:       #4A90D9;
    --purple:     #BB6BD9;
    --bg:      #0D0D0F;
    --bg2:     #141418;
    --bg3:     #1C1C22;
    --bg4:     #242430;
    --border:  #2A2A35;
    --text:    #E8E8F0;
    --muted:   #7878A0;
    --green:   #2ECC71;
    --orange:  #F39C12;
    --white:   #FFFFFF;

    /* Typography */
    --font-xs:   0.65rem;
    --font-sm:   0.72rem;
    --font-base: 0.82rem;
    --font-md:   0.9rem;

    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Spacing */
    --gap-sm: 8px;
    --gap-md: 14px;
    --gap-lg: 24px;
}
body.light {
    --bg:     #F5F0EB;
    --bg2:    #FFFFFF;
    --bg3:    #EDE8E3;
    --bg4:    #E0DBD6;
    --border: #D0C8C0;
    --text:   #1A1A1A;
    --muted:  #7A6F68;
    --white:  #1A1A1A;
}
body.light .login-bg { background: radial-gradient(ellipse at 20% 50%, #C41E3A12 0%, transparent 60%); }
body.light .login-grid { opacity: 0.08; }
body.light .login-box { box-shadow: 0 8px 40px rgba(196,30,58,0.12); }
body.light .hdr { box-shadow: 0 1px 8px rgba(0,0,0,0.08); }

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-ui); background: var(--bg); color: var(--text); min-height: 100vh; transition: background 0.2s, color 0.2s; }

#loginScreen { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.login-bg { position: absolute; inset: 0; overflow: hidden; background: radial-gradient(ellipse at 20% 50%, #C41E3A18 0%, transparent 60%), radial-gradient(ellipse at 80% 50%, #C41E3A08 0%, transparent 60%); }
.login-grid { position: absolute; inset: 0; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 40px 40px; opacity: 0.3; }
.login-box { position: relative; width: 420px; background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 48px 40px; box-shadow: 0 0 60px var(--red-glow), 0 0 120px #C41E3A11; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo svg { width: 64px; height: 64px; margin-bottom: 12px; }
.login-logo h1 { font-family: var(--font-brand); font-size: 2rem; font-weight: 700; color: var(--text); letter-spacing: 0.5px; }
.login-logo p { color: var(--muted); font-size: 0.8rem; letter-spacing: 2px; text-transform: uppercase; margin-top: 4px; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 0.72rem; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 6px; }
.login-field input { width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 16px; color: var(--text); font-size: 0.9rem; transition: border-color 0.2s; }
.login-field input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-glow); }
.login-btn { width: 100%; padding: 13px; background: var(--red); color: white; border: none; border-radius: var(--radius-md); font-family: var(--font-brand); font-size: 1rem; font-weight: 700; letter-spacing: 2px; cursor: pointer; margin-top: 8px; transition: all 0.2s; }
.login-btn:hover { background: var(--red-dim); box-shadow: 0 0 20px var(--red-glow); }
.login-error { color: var(--red); font-size: 0.82rem; text-align: center; margin-top: 12px; display: none; }

#app { display: none; flex-direction: column; min-height: 100vh; }
.hdr { background: var(--bg2); border-bottom: 1px solid var(--border); padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.hdr-left { display: flex; align-items: center; gap: 16px; flex: 1; }
.hdr-logo { display: flex; align-items: center; gap: 10px; }
.hdr-logo svg { width: 32px; height: 32px; }
.hdr-logo span { font-family: var(--font-brand); font-size: 1.4rem; font-weight: 700; color: var(--text); letter-spacing: 3px; }
.nav-tabs { display: flex; gap: 4px; margin-left: 24px; flex: 1; align-items: center; }
.nav-tab { padding: 6px 16px; border-radius: var(--radius-sm); font-size: 0.82rem; font-weight: 500; color: var(--muted); cursor: pointer; transition: all 0.15s; border: 1px solid transparent; }
.nav-tab:hover { color: var(--text); background: var(--bg3); }
.nav-tab.active { color: var(--red); background: var(--bg3); border-color: var(--border); }
.nav-tab.nav-more { margin-left: auto; position: relative; }
.nav-dropdown { display: none; position: absolute; top: calc(100% + 6px); right: 0; min-width: 180px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 4px 16px rgba(0,0,0,0.25); z-index: 200; padding: 4px; }
.nav-dropdown.open { display: block; }
.nav-dropdown-item { padding: 8px 14px; border-radius: var(--radius-sm); color: var(--text); font-size: 0.85rem; cursor: pointer; transition: background 0.15s; }
.nav-dropdown-item:hover { background: var(--bg3); color: var(--red); }
.hdr-right { display: flex; align-items: center; gap: 10px; }
.user-badge { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--muted); }
.user-dot { width: 8px; height: 8px; background: var(--green); border-radius: 50%; }
.theme-btn { background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 5px 10px; cursor: pointer; font-size: 0.9rem; transition: all 0.15s; }
.theme-btn:hover { border-color: var(--red); }
.logout-btn { padding: 6px 14px; background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted); font-size: 0.78rem; cursor: pointer; transition: all 0.15s; }
.logout-btn:hover { border-color: var(--red); color: var(--red); }

/* BlitzML géoloc widget (commercial home) */
.geo-widget {
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #4A148C 0%, #6A1B9A 50%, #8E24AA 100%);
    color: #fff;
    margin-bottom: 18px;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(74,20,140,0.30);
}
.geo-widget-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 14px 20px;
    flex-wrap: wrap;
}
.geo-widget-title { display: flex; align-items: center; gap: 14px; }
.geo-widget-robot { font-size: 2.4rem; line-height: 1; filter: drop-shadow(0 3px 8px rgba(0,0,0,0.35)); }
.geo-widget-h1 { font-family: var(--font-brand); font-size: 1.15rem; font-weight: 700; letter-spacing: 0.5px; }
.geo-widget-h2 { font-size: 0.78rem; color: rgba(255,255,255,0.78); margin-top: 2px; }
.geo-widget-actions { display: flex; align-items: center; gap: 10px; }
.geo-widget-btn {
    padding: 8px 16px; border-radius: var(--radius-sm);
    background: #fff; color: #4A148C; border: none; cursor: pointer;
    font-family: var(--font-brand); font-size: 0.85rem; font-weight: 700;
    letter-spacing: 0.5px; transition: transform 0.15s, box-shadow 0.15s;
}
.geo-widget-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.25); }
.geo-widget-content {
    display: flex;
    flex-direction: column;
    background: rgba(0,0,0,0.18);
    border-top: 1px solid rgba(255,255,255,0.10);
}
.geo-map-panel {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.10);
    display: flex; flex-direction: column; gap: 10px;
    position: relative;
}
.geo-map-title {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    font-family: var(--font-brand);
    font-size: 0.82rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.5px;
    color: rgba(255,255,255,0.92);
}
.geo-map-legend-inline {
    display: flex; gap: 14px; flex-wrap: wrap;
    font-size: 0.68rem; font-weight: 600;
    text-transform: none; letter-spacing: 0.5px;
    color: rgba(255,255,255,0.78);
}
.geo-map-legend-inline > span { display: inline-flex; align-items: center; gap: 5px; }
.geo-map-legend-inline > span.legend-chip {
    cursor: pointer; user-select: none;
    padding: 2px 6px; border-radius: 10px;
    transition: opacity .15s, background .15s;
}
.geo-map-legend-inline > span.legend-chip:hover { background: rgba(255,255,255,0.12); }
.geo-map-legend-inline > span.legend-chip.off { opacity: .38; text-decoration: line-through; }
.geo-dot {
    width: 10px; height: 10px; border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 1.5px rgba(0,0,0,0.30);
}
.geo-dot.bucket-cur   { background: #2ECC71; }
.geo-dot.bucket-prev  { background: #F1C40F; }
.geo-dot.bucket-older { background: #E67E22; }
.geo-dot.bucket-never { background: #95A5A6; }
.geo-dot.bucket-user  { background: #2980B9; box-shadow: 0 0 0 2px #fff; }
.geo-dot.bucket-tour  { background: #E67E22; box-shadow: 0 0 0 2px #fff; }

/* ─── Panneau Tournée du jour ─────────────────────────────── */
.tournee-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 16px;
    padding: 14px 18px;
}
@media (max-width: 960px) {
    .tournee-grid { grid-template-columns: 1fr; }
}
.tournee-panel {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-left: 4px solid #E67E22;
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex; flex-direction: column; gap: 10px;
    color: #fff;
    align-self: flex-start;
    position: sticky; top: 70px;
}
.tournee-panel-header {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.tournee-panel-title {
    font-family: var(--font-brand);
    font-size: 1rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.5px;
}
.tournee-panel-sub { font-size: 0.74rem; color: rgba(255,255,255,0.72); margin-top: 2px; }

.tournee-progress-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; min-width: 80px; }
.tournee-progress { width: 80px; height: 6px; background: rgba(255,255,255,0.15); border-radius: 3px; overflow: hidden; }
.tournee-progress-bar { height: 100%; background: linear-gradient(90deg, #2ECC71 0%, #58D68D 100%); transition: width 0.3s; }
.tournee-progress-label { font-size: 0.7rem; font-weight: 700; }

.tournee-empty {
    padding: 24px 8px; text-align: center;
    color: rgba(255,255,255,0.55);
    font-size: 0.78rem; line-height: 1.5;
    border: 1px dashed rgba(255,255,255,0.18); border-radius: 6px;
}

/* Recherche magasin → ajout direct tournée */
.tournee-search { position: relative; }
.tournee-search-input {
    width: 100%; box-sizing: border-box;
    padding: 8px 10px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 6px;
    color: #fff; font-size: 0.82rem;
}
.tournee-search-input::placeholder { color: rgba(255,255,255,0.5); }
.tournee-search-input:focus { outline: none; border-color: rgba(230,126,34,0.7); }
.tournee-search-results {
    display: flex; flex-direction: column; gap: 4px;
    margin-top: 6px;
    max-height: 280px; overflow-y: auto;
}
.tournee-search-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px;
    background: rgba(0,0,0,0.20);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 6px;
}
.tournee-search-item-name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tournee-search-item-loc { font-size: 0.72rem; color: rgba(255,255,255,0.68); }
.tournee-search-add {
    flex-shrink: 0;
    padding: 5px 9px;
    background: rgba(230,126,34,0.30); border: 1px solid rgba(230,126,34,0.55);
    border-radius: 5px; color: #fff; font-size: 0.74rem; font-weight: 700;
    cursor: pointer; white-space: nowrap;
}
.tournee-search-add:hover { background: rgba(230,126,34,0.5); }
.tournee-search-add.in-tour { background: rgba(46,204,113,0.25); border-color: rgba(46,204,113,0.5); cursor: default; }
.tournee-search-empty {
    padding: 12px 8px; text-align: center;
    color: rgba(255,255,255,0.55); font-size: 0.76rem;
}

.tournee-list { display: flex; flex-direction: column; gap: 6px; }
.tournee-step {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    gap: 8px; align-items: center;
    padding: 8px 10px;
    background: rgba(0,0,0,0.20);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 6px;
    transition: opacity 0.2s, background 0.2s;
}
.tournee-step.visited {
    opacity: 0.55;
    background: rgba(46,204,113,0.10);
    border-color: rgba(46,204,113,0.40);
}
.tournee-step.visited .tournee-step-name { text-decoration: line-through; }
.tournee-step-num {
    background: #E67E22; color: #fff;
    width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-brand);
    font-size: 0.9rem; font-weight: 700;
}
.tournee-step.visited .tournee-step-num { background: #27AE60; }
.tournee-step-arrows {
    display: flex; flex-direction: column; gap: 1px;
}
.tournee-step-arrows button {
    width: 22px; height: 14px;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18);
    color: #fff; cursor: pointer;
    font-size: 0.6rem; line-height: 1;
    padding: 0; border-radius: 3px;
}
.tournee-step-arrows button:hover:not(:disabled) { background: rgba(255,255,255,0.18); }
.tournee-step-arrows button:disabled { opacity: 0.3; cursor: not-allowed; }
.tournee-step-body { min-width: 0; }
.tournee-step-name {
    font-size: 0.82rem; font-weight: 700;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tournee-step-meta { font-size: 0.66rem; color: rgba(255,255,255,0.65); margin-top: 1px; }
.tournee-step-actions { display: flex; flex-direction: column; gap: 3px; }
.tournee-step-actions button {
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.18);
    color: #fff; cursor: pointer;
    font-size: 0.62rem; font-weight: 600;
    padding: 3px 8px; border-radius: 4px;
    white-space: nowrap;
}
.tournee-step-actions button.visit-btn:hover { background: rgba(46,204,113,0.50); border-color: #2ECC71; }
.tournee-step-actions button.remove-btn:hover { background: rgba(196,30,58,0.50); border-color: var(--red); }
.tournee-step.visited .visit-btn { background: rgba(46,204,113,0.30); }

.tournee-actions {
    display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px;
    padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.10);
}
.tournee-btn {
    flex: 1; min-width: 110px;
    padding: 7px 10px;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.20);
    color: #fff; cursor: pointer;
    font-size: 0.72rem; font-weight: 600;
    border-radius: 5px;
}
.tournee-btn:hover { background: rgba(255,255,255,0.18); }
.tournee-btn.primary {
    background: linear-gradient(135deg, #E67E22, #D35400);
    border-color: #D35400;
}
.tournee-btn.primary:hover { background: linear-gradient(135deg, #F39C12, #E67E22); }
.tournee-btn.danger { background: rgba(196,30,58,0.25); border-color: rgba(196,30,58,0.50); }
.tournee-btn.danger:hover { background: rgba(196,30,58,0.45); }

/* Bouton "+ Ajouter" sur cards proximité */
.add-tour-btn {
    background: #E67E22 !important; color: #fff !important;
    border-color: #D35400 !important;
}
.add-tour-btn.in-tour { background: #27AE60 !important; border-color: #1E8449 !important; }

/* Marker client (pastille couleur + badge robot BlitzML si suggestions) */
.map-marker {
    position: relative;
    width: 18px; height: 18px;
    pointer-events: auto;
}
.map-marker-dot {
    position: absolute; inset: 2px;
    border-radius: 50%;
    border: 1.5px solid #1a1a1a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}
.map-marker.has-prio .map-marker-dot {
    box-shadow: 0 0 0 2px rgba(196,30,58,0.45), 0 1px 4px rgba(0,0,0,0.35);
}
/* Marker logo enseigne : tuile logo cerclée par la couleur du bucket (récence) */
.map-marker-logo {
    width: 22px; height: 22px;
    border-radius: 6px;
    box-shadow: 0 0 0 2px var(--ring, #95A5A6), 0 1px 3px rgba(0,0,0,0.4);
}
.map-marker-logo .ens-logo-wrap {
    width: 22px !important; height: 22px !important;
    border-radius: 6px;
    box-shadow: none;
}
/* Leaflet force `max-width:none !important` sur toutes les img du marker-pane
   (cf. leaflet.css) → l'inline max-width de enseigneLogo est écrasé et le logo
   s'affiche à sa taille naturelle (carré "vide"/rogné). On re-contraint avec une
   spécificité supérieure + !important. */
.leaflet-marker-pane .map-marker-logo .ens-logo-wrap img {
    max-width: 18px !important;
    max-height: 18px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
}
.map-marker-logo.has-prio {
    box-shadow: 0 0 0 2px var(--ring, #95A5A6), 0 0 0 4px rgba(196,30,58,0.45), 0 1px 3px rgba(0,0,0,0.4);
}
.map-marker-bot {
    position: absolute;
    top: -8px; right: -10px;
    width: 18px; height: 18px;
    background: #8E24AA;
    border: 1.5px solid #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.45);
    pointer-events: none;
}
.map-marker-bot.prio {
    background: #C41E3A;
    animation: ml-bot-pulse 1.8s ease-in-out infinite;
}
@keyframes ml-bot-pulse {
    0%, 100% { transform: scale(1);   box-shadow: 0 1px 3px rgba(0,0,0,0.45), 0 0 0 0   rgba(196,30,58,0.65); }
    50%      { transform: scale(1.1); box-shadow: 0 1px 3px rgba(0,0,0,0.45), 0 0 0 6px rgba(196,30,58,0); }
}

/* Marker numéroté tournée sur la carte */
.tour-marker-icon {
    background: #E67E22; color: #fff;
    border: 3px solid #fff;
    border-radius: 50%;
    width: 32px !important; height: 32px !important;
    margin-left: -16px !important; margin-top: -16px !important;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-brand); font-size: 1.05rem; font-weight: 800;
    box-shadow: 0 2px 8px rgba(0,0,0,0.45);
}
.tour-marker-icon.visited { background: #27AE60; opacity: 0.7; }

.leaflet-host {
    height: 460px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0,0,0,0.30);
}
.leaflet-host .leaflet-control-attribution { background: rgba(255,255,255,0.85); }
/* Popups Leaflet : on garde le thème clair par défaut, lisible */
.leaflet-popup-content { font-size: 0.78rem; line-height: 1.4; }
.leaflet-popup-content strong { color: #4A148C; }
.france-map .dep {
    fill: rgba(255,255,255,0.10);
    stroke: rgba(255,255,255,0.35);
    stroke-width: 0.6;
    transition: fill 0.15s, stroke 0.15s;
    cursor: default;
}
.france-map .dep.active { stroke: rgba(255,255,255,0.95); stroke-width: 1.1; cursor: pointer; }
.france-map .dep:hover { fill: #fff !important; stroke: #fff; }
.france-map .dep.lvl-1 { fill: rgba(255,255,255,0.18); }
.france-map .dep.lvl-2 { fill: rgba(255,234,138,0.55); }
.france-map .dep.lvl-3 { fill: rgba(255,179,71,0.75); }
.france-map .dep.lvl-4 { fill: rgba(255,107,71,0.90); }
.france-map .dep.lvl-5 { fill: #ff3d3d; }
.france-map .client-marker { transition: transform 0.12s; transform-origin: center; transform-box: fill-box; }
.france-map .client-marker:hover { transform: scale(1.7); filter: drop-shadow(0 0 3px rgba(255,255,255,0.6)); }

.ens-logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.35);
    vertical-align: middle;
}
.ens-logo-wrap svg { display: block; }
.ens-logo-wrap.ens-logo-img {
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.20), inset 0 0 0 1px rgba(0,0,0,0.04);
}
.ens-logo-wrap.ens-logo-img img { display: block; }

.geo-map-tooltip {
    position: absolute;
    background: rgba(0,0,0,0.92);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
    white-space: nowrap;
    min-width: 140px;
}
.geo-map-tooltip-name { font-weight: 700; margin-bottom: 4px; font-family: var(--font-brand); }
.geo-map-tooltip-row { font-size: 0.72rem; color: rgba(255,255,255,0.78); display: flex; justify-content: space-between; gap: 12px; }
.geo-map-tooltip-row strong { color: #fff; }

.geo-map-legend {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.66rem; color: rgba(255,255,255,0.7);
    text-transform: uppercase; letter-spacing: 1px;
    margin-top: 4px;
}
.geo-map-legend-bar {
    flex: 1; height: 8px; border-radius: 4px;
    background: linear-gradient(90deg, rgba(255,255,255,0.18), #FFEA8A, #FFB347, #ff6B47, #ff3d3d);
}

.geo-widget-body {
    padding: 14px 20px 18px;
}

.geo-client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}
.geo-client {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    color: #fff;
}
.geo-client:hover { background: rgba(255,255,255,0.13); }
.geo-client.is-dormant { background: rgba(255,255,255,0.04); opacity: 0.82; }
.geo-client.is-dormant:hover { opacity: 1; }

/* Buckets d'anciennete d'activite (Tournee du jour) */
.geo-bucket { margin-bottom: 16px; }
.geo-bucket:last-child { margin-bottom: 0; }
.geo-bucket-header {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-brand);
    font-size: 0.85rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.5px;
    color: rgba(255,255,255,0.92);
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.08);
    border-left: 4px solid rgba(255,255,255,0.6);
}
.geo-bucket-count {
    margin-left: auto;
    background: rgba(255,255,255,0.18);
    color: #fff;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}
.geo-bucket.bucket-cur   .geo-bucket-header { border-left-color: #2ECC71; background: rgba(46,204,113,0.18); }
.geo-bucket.bucket-prev  .geo-bucket-header { border-left-color: #F1C40F; background: rgba(241,196,15,0.16); }
.geo-bucket.bucket-older .geo-bucket-header { border-left-color: #E67E22; background: rgba(230,126,34,0.16); }
.geo-bucket.bucket-never .geo-bucket-header { border-left-color: rgba(255,255,255,0.45); background: rgba(0,0,0,0.25); }
/* Cards plus discretes pour les buckets "plus anciens" */
.geo-bucket.bucket-older .geo-client,
.geo-bucket.bucket-never .geo-client { opacity: 0.82; }
.geo-bucket.bucket-older .geo-client:hover,
.geo-bucket.bucket-never .geo-client:hover { opacity: 1; }

.geo-status {
    display: inline-block;
    font-size: 0.66rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    padding: 3px 8px; border-radius: 999px;
    margin-bottom: 6px; white-space: nowrap;
}
.geo-status-inactif { background: rgba(0,0,0,0.45); color: rgba(255,255,255,0.78); border: 1px solid rgba(255,255,255,0.15); }
.geo-status-dormant { background: rgba(255,255,255,0.10); color: rgba(255,255,255,0.85); border: 1px dashed rgba(255,255,255,0.30); }
.geo-status-risk    { background: rgba(196,30,58,0.30); color: #fff; border: 1px solid rgba(196,30,58,0.65); }
.geo-client-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.geo-client-name { font-family: var(--font-brand); font-size: 1rem; font-weight: 700; line-height: 1.15; }
.geo-client-loc { font-size: 0.7rem; color: rgba(255,255,255,0.7); margin-top: 2px; }
.geo-client-dist {
    background: #fff; color: #4A148C;
    padding: 4px 10px; border-radius: 999px;
    font-family: var(--font-brand); font-size: 0.85rem; font-weight: 700;
    white-space: nowrap; line-height: 1;
}
.geo-client-stats {
    display: flex; gap: 14px; font-size: 0.72rem;
    color: rgba(255,255,255,0.78);
    border-top: 1px solid rgba(255,255,255,0.12);
    padding-top: 6px; margin-top: 6px;
}
.geo-client-stats strong { color: #fff; font-weight: 700; }
.geo-sugg { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.geo-sugg-title { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,0.7); }
.geo-sugg-item {
    background: rgba(0,0,0,0.25);
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 0.78rem;
    display: flex; justify-content: space-between; gap: 8px; align-items: center;
}
.geo-sugg-item.prioritaire { border-left: 3px solid var(--red); }
.geo-sugg-item.surveiller  { border-left: 3px solid #00BFA5; }
.geo-sugg-ref { font-family: var(--font-brand); font-weight: 700; }
.geo-sugg-desig { color: rgba(255,255,255,0.82); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.geo-sugg-pill {
    font-size: 0.62rem; padding: 2px 7px; border-radius: 999px;
    font-weight: 700; white-space: nowrap;
}
.geo-sugg-pill.prioritaire { background: var(--red); color: #fff; }
.geo-sugg-pill.surveiller  { background: transparent; color: #00BFA5; border: 1px solid #00BFA5; }

.geo-action {
    display: inline-flex; align-items: center; gap: 4px;
    margin-top: 8px; padding: 5px 10px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    color: #fff; text-decoration: none;
    font-size: 0.72rem; font-weight: 600;
    cursor: pointer;
}
.geo-action:hover { background: rgba(255,255,255,0.25); }

/* BlitzML suggestions block */
.ml-card { padding: 0; overflow: hidden; }
.ml-hero {
    display: flex; align-items: center; gap: 16px;
    padding: 18px 22px;
    background: linear-gradient(135deg, #4A148C 0%, #6A1B9A 50%, #8E24AA 100%);
    color: #fff;
    border-bottom: 1px solid #4A148C;
    cursor: pointer; user-select: none;
}
/* Repli de l'encart BlitzML : chevron + masquage du corps. Replié de base. */
.ml-hero-chevron {
    font-size: 1.4rem; line-height: 1; color: rgba(255,255,255,0.85);
    transition: transform 0.2s ease; flex: 0 0 auto;
}
.ml-card.ml-collapsed .ml-hero-chevron { transform: rotate(-90deg); }
.ml-card.ml-collapsed .ml-hero { border-bottom: none; }
.ml-card.ml-collapsed .ml-card-body { display: none; }
.ml-robot {
    font-size: 3.4rem; line-height: 1;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.35));
    animation: ml-robot-float 4s ease-in-out infinite;
}
@keyframes ml-robot-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}
.ml-hero-body { flex: 1; min-width: 0; }
.ml-hero-title {
    font-family: var(--font-brand);
    font-size: 1.4rem; font-weight: 700; line-height: 1.1;
    letter-spacing: 0.5px;
}
.ml-brand {
    background: linear-gradient(90deg, #FFEB3B 0%, #FF9800 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}
.ml-hero-sub {
    font-size: 0.82rem; color: rgba(255,255,255,0.78); margin-top: 4px;
}
.ml-count {
    display: flex; flex-direction: column; align-items: center;
    padding: 8px 14px; background: rgba(255,255,255,0.12);
    border-radius: var(--radius-md); min-width: 80px;
}
.ml-count-num {
    font-family: var(--font-brand);
    font-size: 1.8rem; font-weight: 700; line-height: 1;
}
.ml-count-lbl {
    font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1px;
    color: rgba(255,255,255,0.85); margin-top: 2px;
}

.ml-list { display: flex; flex-direction: column; }

/* Sous-titres de section dans l'encart BlitzML unique (météo / relance / découverte). */
.ml-subhead {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 22px; font-weight: 700; font-size: 0.78rem;
    text-transform: uppercase; letter-spacing: 0.6px;
    color: var(--muted);
    background: var(--bg3);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.ml-subhead-n {
    margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700;
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 999px; padding: 0 9px; font-size: 0.76rem;
}
.ml-subhead-meteo { color: #4A90D9; }
.ml-subhead-relance { color: #C41E3A; }
.ml-subhead-deco { color: #7C5CFC; }
.ml-block-meteo .meteo-trigger:last-child { border-bottom: none; }
.ml-item {
    display: grid;
    grid-template-columns: 140px 1fr auto;
    gap: 18px; align-items: center;
    padding: 14px 22px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.ml-item:last-child { border-bottom: none; }
.ml-item:hover { background: var(--bg3); }
.ml-niveau-prioritaire { border-left: 4px solid var(--red); background: linear-gradient(90deg, #C41E3A0A 0%, transparent 30%); }
.ml-niveau-surveiller  { border-left: 4px solid #00BFA5; }
.ml-niveau-info        { border-left: 4px solid #4A90D9; }

.ml-item-left {
    display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
}
.ml-item-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-family: var(--font-brand);
    font-size: 0.78rem; font-weight: 700;
    padding: 5px 12px; border-radius: 999px;
    letter-spacing: 0.5px;
    white-space: nowrap; line-height: 1;
    text-transform: uppercase;
}
/* PRIORITAIRE : badge plein rouge + pulse + ombre */
.ml-niveau-prioritaire .ml-item-badge {
    background: linear-gradient(135deg, #C41E3A 0%, #8B0000 100%);
    color: #ffffff;
    border: 1px solid #8B0000;
    box-shadow: 0 0 12px rgba(196,30,58,0.45), 0 2px 4px rgba(0,0,0,0.18);
    animation: ml-prio-pulse 1.8s ease-in-out infinite;
}
@keyframes ml-prio-pulse {
    0%, 100% { box-shadow: 0 0 12px rgba(196,30,58,0.45), 0 2px 4px rgba(0,0,0,0.18); }
    50%      { box-shadow: 0 0 22px rgba(196,30,58,0.75), 0 2px 4px rgba(0,0,0,0.18); }
}
/* A SURVEILLER : badge outline cyan, plat, sans animation */
.ml-niveau-surveiller .ml-item-badge {
    background: transparent;
    color: #00BFA5;
    border: 1.5px dashed #00BFA5;
}
body.light .ml-niveau-surveiller .ml-item-badge { color: #00897B; border-color: #00897B; }
.ml-niveau-info .ml-item-badge {
    background: #4A90D922; color: #4A90D9; border: 1px solid #4A90D955;
}

/* ── Couche DÉCOUVERTE : palette indigo distincte de la relance (rouge/cyan).
   Opportunité, pas urgence → ton calme, pas d'animation pulse. */
.deco-card .ml-robot { filter: hue-rotate(40deg); }
.deco-item { border-left: 4px solid #7C5CFC; background: linear-gradient(90deg, #7C5CFC0A 0%, transparent 30%); }
/* COMMANDE = ancré sur un réachat imminent → ton actionnable (vert-cart), accent fort */
.deco-item:has(.deco-motif-commande) { border-left-color: #1FA67A; background: linear-gradient(90deg, #1FA67A12 0%, transparent 30%); }
.deco-motif-commande {
    background: linear-gradient(135deg, #1FA67A 0%, #0E8A63 100%);
    color: #fff; border: 1px solid #0E8A63;
}
.deco-motif-enseigne {
    background: #7C5CFC1f; color: #7C5CFC; border: 1px solid #7C5CFC55;
}
.deco-motif-affinite {
    background: transparent; color: #9B7BFF; border: 1.5px dashed #9B7BFF88;
}
/* COUVERTURE = plancher cold-start (gap d'assortiment cohorte) → ton ambre distinct
   du bleu-indigo découverte, signale « à référencer » plutôt que « complément » */
.deco-item:has(.deco-motif-couverture) { border-left-color: #C98A2B; background: linear-gradient(90deg, #C98A2B12 0%, transparent 30%); }
.deco-motif-couverture {
    background: #C98A2B1f; color: #C98A2B; border: 1px solid #C98A2B66;
}
body.light .deco-motif-enseigne { color: #5B3FD9; border-color: #5B3FD9; }
body.light .deco-motif-affinite { color: #5B3FD9; border-color: #5B3FD988; }
body.light .deco-motif-couverture { color: #9A6816; border-color: #9A6816; }
.deco-why {
    margin-top: 4px; font-size: 0.78rem; color: var(--muted);
    line-height: 1.3;
}
.deco-why strong { color: var(--text); font-weight: 600; }
.deco-lift {
    font-variant-numeric: tabular-nums; font-weight: 700; color: #7C5CFC;
}

/* Compléments DÉCOUVERTE (motif COMMANDE) imbriqués sous une ligne de relance.
   4e enfant du grid .ml-item → pleine largeur sur une nouvelle rangée. */
.ml-complements {
    grid-column: 1 / -1;
    margin-top: 4px; padding: 8px 0 2px;
    border-top: 1px dashed var(--border);
}
.ml-complements-title {
    display: flex; align-items: center; gap: 5px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.4px;
    text-transform: uppercase; color: #1FA67A; margin-bottom: 6px;
}
body.light .ml-complements-title { color: #0E8A63; }
.ml-complement {
    display: flex; align-items: baseline; gap: 10px;
    padding: 3px 0 3px 8px; border-left: 2px solid #1FA67A55;
}
.ml-complement-ref {
    font-variant-numeric: tabular-nums; font-weight: 700;
    font-size: 0.8rem; min-width: 56px; color: var(--text);
}
.ml-complement-desig { flex: 1; min-width: 0; font-size: 0.82rem; color: var(--muted); }
.ml-complement-tx { font-size: 0.74rem; font-weight: 700; color: #1FA67A; white-space: nowrap; }

/* ── Boost MÉTÉO : bannière d'anticipation en haut du drawer client. */
.meteo-card { margin-top: 14px; padding: 0; overflow: hidden; }
.meteo-card-h {
    padding: 12px 18px; font-weight: 700; font-size: 0.9rem;
    background: var(--bg3); border-bottom: 1px solid var(--border);
}
.meteo-trigger { padding: 12px 18px; border-bottom: 1px solid var(--border); border-left: 4px solid var(--border); }
.meteo-trigger:last-child { border-bottom: none; }
.meteo-gel     { border-left-color: #4A90D9; background: linear-gradient(90deg, #4A90D90c 0%, transparent 35%); }
.meteo-chaleur { border-left-color: #E8833A; background: linear-gradient(90deg, #E8833A0c 0%, transparent 35%); }
.meteo-pluie   { border-left-color: #5C8FB0; background: linear-gradient(90deg, #5C8FB00c 0%, transparent 35%); }
.meteo-trigger-h { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; margin-bottom: 8px; }
.meteo-trigger-icon { font-size: 1.1rem; }
.meteo-refs { display: flex; flex-direction: column; gap: 2px; padding-left: 28px; }
.meteo-ref { display: flex; align-items: baseline; gap: 10px; padding: 3px 0; }
.meteo-ref-code {
    font-variant-numeric: tabular-nums; font-weight: 700;
    font-size: 0.8rem; min-width: 56px; color: var(--text);
}
.meteo-ref-desig { flex: 1; min-width: 0; font-size: 0.82rem; color: var(--muted); }
.meteo-ref-qte { font-size: 0.74rem; font-weight: 700; color: var(--text); white-space: nowrap; opacity: 0.75; }

.trend-arrow {
    display: inline-block; font-size: 0.7rem; font-weight: 700;
    padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.trend-up      { background: #2ECC7122; color: var(--green); border: 1px solid #2ECC7155; }
.trend-down    { background: #C41E3A22; color: var(--red);   border: 1px solid #C41E3A55; }
.trend-stable  { background: var(--bg3); color: var(--muted); border: 1px solid var(--border); }
.trend-unknown { background: transparent; color: var(--border); border: 1px solid var(--border); }

.ml-item-main { min-width: 0; }
.ml-item-ref {
    font-family: var(--font-brand);
    font-size: 0.95rem; font-weight: 700; color: var(--red);
}
.ml-item-desig {
    font-size: 0.88rem; color: var(--text); margin-top: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ml-item-meta {
    font-size: 0.72rem; color: var(--muted); margin-top: 3px;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.ml-item-stats {
    display: flex; gap: 18px; align-items: center;
}
.ml-stat {
    display: flex; flex-direction: column; align-items: center;
    min-width: 60px;
}
.ml-stat-val {
    font-family: var(--font-brand);
    font-size: 1.4rem; font-weight: 700; line-height: 1;
    color: var(--text); font-variant-numeric: tabular-nums;
}
.ml-stat-lbl {
    font-size: 0.62rem; color: var(--muted); margin-top: 3px;
    text-transform: uppercase; letter-spacing: 0.5px; text-align: center;
}
.ml-stat-alert .ml-stat-val { color: var(--red); }

/* Potentiel de CA — badge doré proéminent, aligné à droite/centré dans le hero */
.ml-hero-pot {
    display: flex; flex-direction: column; align-items: center;
    gap: 2px; margin-left: auto;
    padding: 10px 18px;
    background: rgba(0,0,0,0.22);
    border: 1px solid rgba(255,235,59,0.45);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
    white-space: nowrap;
}
.ml-hero-pot-icon { font-size: 1.6rem; line-height: 1; }
.ml-hero-pot-lbl {
    font-size: 0.62rem; text-transform: uppercase; letter-spacing: 1px;
    color: rgba(255,255,255,0.85); font-weight: 600;
}
.ml-hero-pot strong {
    font-family: var(--font-brand);
    font-size: 1.7rem; line-height: 1; font-weight: 700;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(90deg, #FFEB3B 0%, #FF9800 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}
.ml-stat-pot { min-width: 86px; }
.ml-stat-pot .ml-stat-val { color: #FF9800; font-size: 1.15rem; }

/* Quantité à proposer — bloc mis en évidence (le geste commercial à faire) */
.ml-qte-propose {
    display: flex; flex-direction: column; align-items: center;
    min-width: 92px; padding: 8px 14px; border-radius: 14px;
    background: linear-gradient(135deg, #6A1B9A 0%, #8E24AA 100%);
    box-shadow: 0 3px 10px rgba(106,27,154,0.35);
    border: 1px solid rgba(255,255,255,0.12);
}
.ml-qte-propose.ml-qte-gonfle {
    background: linear-gradient(135deg, #2E7D32 0%, #43A047 100%);
    box-shadow: 0 3px 12px rgba(46,125,50,0.45);
}
.ml-qte-num {
    font-family: var(--font-brand);
    font-size: 1.9rem; font-weight: 700; line-height: 1; color: #fff;
    font-variant-numeric: tabular-nums;
}
.ml-qte-u { font-size: 0.85rem; margin-left: 2px; opacity: 0.8; }
.ml-qte-lbl {
    font-size: 0.62rem; margin-top: 4px; color: rgba(255,255,255,0.9);
    text-transform: uppercase; letter-spacing: 0.5px; text-align: center;
    white-space: nowrap;
}
.ml-qte-inc { color: #B9F6CA; font-weight: 700; }

/* Macaron sous-référence (code marque/gamme) — réutilisé carte + header + filtre */
.ml-sref-macaron {
    display: inline-block;
    color: #fff; border-radius: 4px;
    padding: 1px 7px; font-size: 0.7rem; font-weight: 700;
    letter-spacing: 0.5px; white-space: nowrap;
    vertical-align: middle;
    /* Certaines sous-références sont des libellés longs (pas un code court) :
       on borne le macaron pour qu'il ne déborde pas sur le texte voisin. */
    max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
/* Dans la ligne (meta) la largeur est plus contrainte qu'en header/filtre. */
.ml-item-meta .ml-sref-macaron { max-width: 220px; }
.ml-item-meta .ml-sref-macaron { font-size: 0.72rem; }

/* Potentiel par sous-référence — sous le total dans le hero */
.ml-hero-pot-srefs {
    display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px;
}
.ml-sref-pot {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.8rem; color: rgba(255,255,255,0.92);
}
.ml-sref-pot strong {
    font-weight: 700; font-variant-numeric: tabular-nums;
    color: #FFE082;
}

/* Barre de filtre par sous-référence */
.ml-sref-filter {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 12px 22px;
    border-bottom: 1px solid var(--border);
    background: var(--bg2);
}
.ml-sref-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--bg3);
    color: var(--text); font-size: 0.76rem; font-weight: 600;
    cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.ml-sref-chip:hover { border-color: var(--accent, #8E24AA); }
.ml-sref-chip.active {
    border-color: #8E24AA;
    background: rgba(142, 36, 170, 0.14);
    box-shadow: 0 0 0 1px #8E24AA inset;
}
.ml-sref-chip-n {
    font-variant-numeric: tabular-nums;
    font-size: 0.68rem; color: var(--muted);
    background: var(--bg2); border-radius: 999px;
    padding: 0 6px; min-width: 18px; text-align: center;
}
.ml-sref-chip.active .ml-sref-chip-n { color: var(--text); }

/* Source badge (ML vs Regle) — distingue l'origine d'une suggestion */
.ml-item-source {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    white-space: nowrap;
}
.ml-source-ml {
    background: rgba(74, 20, 140, 0.12);
    color: #8E24AA;
    border: 1px solid rgba(142, 36, 170, 0.3);
}
.ml-source-regle {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
body.light .ml-source-ml    { background: rgba(74, 20, 140, 0.08); }
body.light .ml-source-regle { background: rgba(245, 158, 11, 0.08); }

.ml-explain {
    display: flex; gap: 14px;
    margin-top: 12px; padding: 14px 18px;
    background: linear-gradient(135deg, #4A148C12 0%, #8E24AA08 100%);
    border: 1px dashed #8E24AA66;
    border-radius: var(--radius-md);
}
.ml-explain-icon { font-size: 1.6rem; line-height: 1.2; }
.ml-explain-title {
    font-family: var(--font-brand);
    font-size: 0.92rem; font-weight: 700; color: var(--text);
    margin-bottom: 4px;
}
.ml-explain-text {
    font-size: 0.82rem; color: var(--muted); line-height: 1.55;
}
body.light .ml-explain { background: linear-gradient(135deg, #4A148C08 0%, #8E24AA05 100%); }

/* Activite 6 mois — tableau detaille en complement (ou remplacement)
   des suggestions ML. Affiche cycle moyen + ratio_retard live pour
   chaque ref achetee sur la fenetre 6m. */
.ml-activity {
    padding: 14px 18px 18px;
    border-top: 1px solid var(--border);
}
.ml-activity-title {
    font-size: 0.85rem; font-weight: 600;
    margin-bottom: 10px;
}
.ml-activity-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-height: 480px;
    overflow-y: auto;
}
.ml-activity-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}
.ml-activity-table thead th {
    position: sticky; top: 0; z-index: 1;
    background: var(--bg2);
    text-align: left;
    padding: 8px 10px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.ml-activity-table tbody td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.ml-activity-table tbody tr:last-child td { border-bottom: 0; }
.ml-activity-table tbody tr:hover { background: var(--bg2); }

@media (max-width: 720px) {
    /* ── Préco BlitzML : carte lisible sur mobile (plus de débordement) ──────── */
    .ml-hero { flex-wrap: wrap; padding: 14px 16px; gap: 10px 12px; }
    .ml-robot { font-size: 2.2rem; }
    .ml-hero-title { font-size: 1.15rem; }
    .ml-hero-pot { margin-left: 0; flex-direction: row; align-items: center; gap: 8px; padding: 8px 14px; }
    .ml-hero-pot strong { font-size: 1.25rem; }
    .ml-hero-pot-icon { font-size: 1.2rem; }

    .ml-item { grid-template-columns: 1fr; gap: 10px; padding: 12px 14px; }
    .ml-item-desig { white-space: normal; }   /* désignation complète, pas tronquée */

    /* 1) Chips « prioritaire · tendance · masquer » sur UNE seule ligne (masquer poussé
          à droite), au lieu de la colonne verticale qui mangeait 3 lignes. */
    .ml-item-left { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; width: 100%; }
    .ml-item-left .ml-mask-btn { margin-top: 0 !important; margin-left: auto; }

    /* 2) Chiffres hiérarchisés : rangée 1 = les 3 chiffres d'ACTION mis en avant
          (à proposer · retard · CA potentiel), en tiles ; rangée 2 = le contexte
          discret et grisé (j sans achat · cycle moy). Ordre via `order` (la qté est
          conditionnelle → on ne peut pas se fier à la position dans le DOM). */
    .ml-item-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; align-items: stretch; }
    .ml-item-stats > * { min-width: 0; }
    .ml-stat { min-width: 0; }
    .ml-qte-propose { order: 1; min-width: 0; padding: 8px 6px; }
    .ml-stat-retard { order: 2; }
    .ml-stat-pot    { order: 3; min-width: 0; }
    .ml-ctx         { order: 4; }

    /* Tiles hero : fond léger + gros chiffres. Contexte : petit et grisé. */
    .ml-stat-retard, .ml-stat-pot {
        background: var(--bg3); border-radius: 12px; padding: 8px 6px; justify-content: center;
    }
    .ml-qte-num { font-size: 1.5rem; }
    .ml-stat-pot .ml-stat-val,
    .ml-stat-retard .ml-stat-val { font-size: 1.35rem; }
    .ml-ctx .ml-stat-val { font-size: 1rem; color: var(--muted); }

    /* Filtre sous-réf : puces qui s'enroulent proprement. */
    .ml-sref-filter { flex-wrap: wrap; }

    /* Historique mensuel : on masque « N fact » → la barre + le CA respirent. */
    .histo-fact { display: none !important; }
    .histo-ca { width: 82px !important; }

    /* « Créer une commande » : pleine largeur de l'écran sur mobile. Le conteneur
       #clientDetailAction (flex:0 0 auto en inline) doit prendre toute la ligne quand
       il s'enroule sous le nom, sinon « width:100% » du bouton = largeur du contenu. */
    .client-detail-cmd { justify-content: stretch; }
    #clientDetailAction { flex: 1 1 100% !important; }
    .client-cmd-btn { width: 100% !important; }
}

/* Brand logos (enseignes magasins) */
.brand-logo {
    width: auto;
    object-fit: contain;
    background: #ffffff;
    border-radius: 6px;
    padding: 3px 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.10);
    flex-shrink: 0;
}
.brand-logo-lg {
    width: auto;
    object-fit: contain;
    background: #ffffff;
    border-radius: 8px;
    padding: 6px 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

/* Client portfolio cards (commercial view) */
button.nav-tab {
    background: transparent; font-family: inherit;
}
.client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.client-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    display: flex; flex-direction: column; gap: 8px;
    position: relative;
}
.client-card:hover {
    transform: translateY(-2px);
    border-color: var(--red);
    box-shadow: 0 6px 18px rgba(196,30,58,0.18);
}
.client-card.has-alert { border-left: 3px solid var(--red); }
.client-card.has-retard { border-top: 2px solid var(--orange); }
.client-card-name {
    font-family: var(--font-brand);
    font-size: 1.05rem; font-weight: 700; color: var(--text);
    line-height: 1.2;
    overflow: hidden; text-overflow: ellipsis;
}
.client-card-tiers {
    font-size: 0.7rem; color: var(--muted); letter-spacing: 1px;
    font-family: var(--font-brand);
}
/* Séparateurs internes de card. La variante --push absorbe l'espace libre
   (margin-top:auto) pour coller le groupe « suggestions + CA potentiel » en bas
   sans laisser un trait flottant — c'est elle qui porte le margin-top:auto, plus
   .ml-footer. */
.client-card-sep { height: 0; border-top: 1px solid var(--border); margin: 2px 0; }
.client-card-sep--push { margin-top: auto; }

/* Macaron « CA POTENTIEL » : CA à aller chercher (suggestions BlitzML), en bas de
   card. Bandeau pleine largeur, accent ambre. */
.client-card-potentiel {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 7px 11px; border-radius: 999px;
    background: linear-gradient(90deg, rgba(245,158,11,.18) 0%, rgba(245,158,11,.06) 100%);
    border: 1px solid rgba(245,158,11,.45);
}
.client-card-potentiel .ccp-tag {
    font-size: 0.6rem; font-weight: 800; letter-spacing: 0.6px;
    color: #b45309; text-transform: uppercase; white-space: nowrap;
}
body.dark .client-card-potentiel .ccp-tag { color: #fbbf24; }
.client-card-potentiel .ccp-val {
    font-size: 0.92rem; font-weight: 800; color: var(--text);
    font-variant-numeric: tabular-nums;
}
/* KPI 24 mois en tuiles : chaque stat est un pavé lisible (fond + bord) au lieu
   d'une paire label/valeur à plat — hiérarchie portée par la tuile héro (CA). */
.client-card-stats {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px;
    font-size: 0.78rem;
}
.client-card-stat--wide { grid-column: 1 / -1; }
/* Valeur + flèche de tendance alignées sur une ligne dans la card compacte */
.client-card-stats .val { display: inline-flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.client-card-stats .trend-arrow { padding: 1px 6px; font-size: 0.6rem; align-self: center; }
.client-card-stat {
    display: flex; flex-direction: column; gap: 2px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 7px 9px;
}
.client-card-stat .lbl {
    display: flex; align-items: center; gap: 4px;
    font-size: 0.6rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px;
}
.client-card-stat .val { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); font-size: 0.9rem; }
/* Tuile héro « CA facturé » : métrique phare de la card, pleine largeur + accent rouge. */
.client-card-stat--hero {
    grid-column: 1 / -1;
    background: linear-gradient(90deg, rgba(196,30,58,.12) 0%, rgba(196,30,58,.03) 100%);
    border-color: rgba(196,30,58,.32);
}
.client-card-stat--hero .val { font-size: 1.3rem; }
/* Tuile « Dernière commande » : ligne d'info, moins chargée que les KPI chiffrés. */
.client-card-stat--wide .val { font-weight: 600; }
.client-card-badges { display: flex; gap: 4px; flex-wrap: wrap; }
/* Macaron « OP » : client à 1 seule commande, créé pour une opération */
.client-card-op {
    display: inline-block; vertical-align: middle; margin-left: 6px;
    background: rgba(168, 85, 247, .15); color: #a855f7;
    font-size: 0.6rem; font-weight: 700; letter-spacing: 0.5px;
    padding: 1px 6px; border-radius: 999px;
}

/* Pastille « contact renseigné » (coin haut-droit de la card) : signale qu'au moins
   un contact actif existe (contact_client) → proforma par mail possible. */
.client-card-contact {
    flex: 0 0 auto; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 999px;
    background: rgba(59, 130, 246, .14);
    border: 1px solid rgba(59, 130, 246, .40);
    font-size: 0.85rem;
}

/* Zone d'action de la carte (bouton Commander + devis en cours) : isolée du clic
   « ouvrir la fiche » (stopPropagation sur le conteneur) pour éviter les missclicks. */
.client-card-actions {
    margin-top: 10px;
    display: flex; flex-direction: column; gap: 8px;
    cursor: default;
}
.client-cmd-btn {
    width: 100%; background: var(--red); color: #fff; border: none;
    padding: 11px; border-radius: 8px; cursor: pointer;
    font-weight: 600; font-size: 0.86rem;
    transition: filter 0.15s;
}
.client-cmd-btn:hover { filter: brightness(1.1); }
/* Pastille « N devis en cours » sous le bouton Commander */
.client-devis-badge {
    align-self: flex-start;
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
    padding: 4px 11px; cursor: pointer; font-family: inherit;
    font-size: 0.72rem; font-weight: 600; color: var(--muted);
    transition: border-color 0.15s, color 0.15s;
}
.client-devis-badge:hover { border-color: var(--red); color: var(--text); }

/* Client inactif (sans commande simulee) */
.client-card.is-inactive {
    background: var(--bg3);
    opacity: 0.85;
}
.client-card.is-inactive .client-card-name { color: var(--muted); }
.client-card.is-inactive:hover { opacity: 1; }
.inactive-banner {
    font-size: 0.65rem; font-weight: 600;
    color: var(--muted);
    text-transform: uppercase; letter-spacing: 1.5px;
    background: var(--bg2);
    border: 1px dashed var(--border);
    border-radius: 4px;
    padding: 3px 8px; text-align: center;
}

/* Segmented filter (actifs / tous / dormants) */
.seg-filter {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg2);
}
.seg-btn {
    background: transparent;
    border: none;
    padding: 7px 14px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    border-right: 1px solid var(--border);
}
.seg-btn:last-child { border-right: none; }
.seg-btn:hover { color: var(--text); background: var(--bg3); }
.seg-btn.active {
    background: var(--red);
    color: #fff;
}

/* Fiche client détaillée : colonne centrée et lisible dans la page (qui monte
   à 1600px). Sans ça, header + onglets + préco s'étirent bord à bord sur grand
   écran et l'ensemble paraît décalé. On centre le bloc entier (header d'action
   inclus) pour qu'il reste aligné avec le contenu. */
#portefeuilleDetail {
    max-width: 1120px;
    margin: 0 auto;
}

/* Onglets de la fiche client détaillée (portefeuille → détail card).
   flex + wrap : 4 onglets sur une ligne en desktop, se replient sans scroll
   horizontal en dessous de ~520px. min-height 44px = cible tactile. */
.client-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}
.client-tab {
    flex: 1 1 auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.client-tab:hover { color: var(--text); background: var(--bg3); }
.client-tab.active {
    color: #fff;
    background: var(--red);
    border-color: var(--red);
}
.client-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--red);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.client-tab.active .client-tab-badge {
    background: #fff;
    color: var(--red);
}

/* Chip toggle "Filtrer par CA alertes" — sous le titre du portefeuille */
.ca-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg2);
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.ca-filter-chip:hover { color: var(--text); border-color: var(--text); }
.ca-filter-chip.active {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

/* Footer "BlitzML suggestion" sur les cards portefeuille */
.ml-footer {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.74rem; line-height: 1.25;
    border: 1px solid;
}
.ml-footer-icon { font-size: 1.05rem; line-height: 1; }
.ml-footer-bot {
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.30));
    flex-shrink: 0;
}
.ml-footer-prio .ml-footer-bot {
    filter: drop-shadow(0 0 4px rgba(196,30,58,0.55));
    animation: ml-footer-bot-pulse 2.4s ease-in-out infinite;
}
@keyframes ml-footer-bot-pulse {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-2px); }
}
.ml-footer-text { flex: 1; min-width: 0; }
.ml-footer-text strong { font-weight: 700; }
.ml-footer-extra { font-size: 0.68rem; opacity: 0.85; }

.ml-footer-prio {
    background: linear-gradient(90deg, #C41E3A22 0%, #C41E3A0A 100%);
    color: var(--red);
    border-color: #C41E3A55;
}
.ml-footer-surv {
    background: rgba(0,191,165,0.10);
    color: #00897B;
    border-color: rgba(0,191,165,0.45);
    border-style: dashed;
}
.ml-footer-none {
    background: var(--bg3);
    color: var(--muted);
    border-color: var(--border);
}
/* Découverte / COUVERTURE : opportunité (pas urgence) → ton indigo, discret */
.ml-footer-deco {
    background: rgba(124,92,252,0.10);
    color: #6A4BE0;
    border-color: rgba(124,92,252,0.40);
    border-style: dashed;
}

body.dark .ml-footer-surv { color: #4DD0C2; }
body.dark .ml-footer-deco { color: #A98BFF; }

/* Hero KPI tiles (commercial view) */
.hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}
.hero-tile {
    display: flex; align-items: center; gap: 16px;
    padding: 18px 22px;
    border-radius: var(--radius-md);
    color: #ffffff;
    box-shadow: 0 6px 24px rgba(0,0,0,0.15);
    position: relative; overflow: hidden;
}
.hero-tile::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.10) 0%, transparent 60%);
    pointer-events: none;
}
.hero-tile-icon {
    font-size: 2.4rem; line-height: 1;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
}
.hero-tile-body { flex: 1; min-width: 0; position: relative; z-index: 1; }
.hero-tile-label {
    font-family: var(--font-brand);
    font-size: 0.74rem; font-weight: 600;
    color: rgba(255,255,255,0.85);
    text-transform: uppercase; letter-spacing: 2px;
    margin-bottom: 4px;
}
.hero-tile-value {
    font-family: var(--font-ui);
    font-size: 2.4rem; font-weight: 700;
    line-height: 1.1; letter-spacing: 0.5px;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.25);
    font-variant-numeric: tabular-nums;
}
.hero-tile-sub {
    font-size: 0.78rem; color: rgba(255,255,255,0.80); margin-top: 4px;
}
.hero-tile-commission {
    background: linear-gradient(135deg, #1E8449 0%, #27AE60 60%, #2ECC71 100%);
    border: 1px solid #1E8449;
}
.hero-tile-commandes {
    background: linear-gradient(135deg, #1A4A8A 0%, #2980B9 60%, #4A90D9 100%);
    border: 1px solid #1A4A8A;
}
.hero-tile-retours {
    background: linear-gradient(135deg, #8B0000 0%, #C41E3A 60%, #E74C3C 100%);
    border: 1px solid #8B0000;
}

/* CA facturé — comparaison période courante vs période précédente équivalente
   (mois / semaine / année). Cartes neutres (thème-aware), plus sobres que les
   hero-tiles : la donnée porte l'attention via le delta coloré, pas le fond.
   Grille fluide (auto-fit) : 3 col → 1 sans media-query (cf. règle responsive). */
.ca-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}
.ca-kpi {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    min-width: 0;
}
.ca-kpi-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; margin-bottom: 8px;
}
.ca-kpi-title {
    font-size: 0.72rem; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: 1px;
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ca-kpi-delta {
    font-size: 0.78rem; font-weight: 700; white-space: nowrap;
    padding: 2px 8px; border-radius: 999px;
    background: color-mix(in srgb, var(--muted) 15%, transparent);
    color: var(--muted);
}
.ca-kpi-delta.up   { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.ca-kpi-delta.down { background: color-mix(in srgb, var(--red) 18%, transparent);   color: var(--red);   }
.ca-kpi-value {
    font-size: 1.6rem; font-weight: 700; line-height: 1.15;
    color: var(--text); font-variant-numeric: tabular-nums;
}
.ca-kpi-sub {
    font-size: 0.74rem; color: var(--muted); margin-top: 4px;
}

/* Role badge — désormais utilisé uniquement par /pipeline/ comme titre de page
   (fond défini en inline sur le span). Les macarons de rôle des shells
   commercial/dirco/dirigeant ont été retirés. */
.role-badge {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 4px 11px; border-radius: 6px;
    font-family: var(--font-brand);
    font-size: 0.72rem; font-weight: 600;
    letter-spacing: 0.3px; line-height: 1;
    border: 1px solid rgba(157, 180, 255, 0.22);
}

.page { display: none; padding: 20px 24px; flex: 1; }
.page.active { display: block; animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Vue Commercial — bandeau & layout (scopé .view-commercial) ───────────── */
/* Header : barre plus aérée + dégradé subtil + nav en pilule centrée. */
.view-commercial .hdr {
    height: 64px;
    padding: 0 28px;
    background: linear-gradient(180deg, var(--bg2) 0%, color-mix(in srgb, var(--bg2) 88%, var(--bg)) 100%);
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.20);
}
.view-commercial .hdr-left,
.view-commercial .hdr-right { flex: 1; }
.view-commercial .hdr-right { justify-content: flex-end; }
.view-commercial .hdr-logo span { letter-spacing: 1.5px; }

/* Conteneur nav : pilule encadrée, ne s'étire pas (reste centrée). */
.view-commercial .hdr-center {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 1 auto;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.14);
}
.view-commercial .nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 600;
    white-space: nowrap;
}
/* Déconnexion : présente dans la barre flottante mobile uniquement. */
.view-commercial .nav-logout-m { display: none; }
.view-commercial .nav-tab:hover { color: var(--text); background: var(--bg3); }
.view-commercial .nav-tab.active {
    color: #fff;
    background: var(--red);
    border-color: transparent;
    box-shadow: 0 2px 10px var(--red-glow);
}

/* Pages : contenu centré avec une largeur max généreuse (occupe l'espace
   sur grand écran sans s'étaler bord à bord). */
.view-commercial .page {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px 28px;
}

/* ── Vue Commercial — tout ce qui n'est PAS desktop (tablette + téléphone) ────
   Le menu quitte le header et devient une barre HORIZONTALE collée en BAS de
   l'écran (bottom nav), pleine largeur. Header épuré : logo + badge rôle. */
@media (max-width: 1100px) {
    /* IMPORTANT : on retire le backdrop-filter du header (.hdr a un
       `backdrop-filter: blur(10px)` global). Un backdrop-filter crée un bloc
       englobant : sinon la barre `position:fixed` ci-dessous se cale sur le bas
       du HEADER (donc en haut de page) au lieu du bas de l'écran. */
    .view-commercial .hdr { padding: 8px 14px; gap: 8px; backdrop-filter: none; -webkit-backdrop-filter: none; }
    .view-commercial .hdr-left { display: flex; flex: 1 1 auto; }
    .view-commercial .hdr-right { display: none; }
    /* La déconnexion du header est masquée : elle vit en bout de la barre du bas. */
    .view-commercial .hdr-logout-m { display: none; }

    /* Menu = barre horizontale pleine largeur, fixée en bas de l'écran. */
    .view-commercial .hdr-center {
        position: fixed;
        left: 0; right: 0;
        bottom: 0;
        z-index: 200;
        display: flex;
        gap: 0;
        width: 100%;
        max-width: none;
        padding: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        border: none;
        border-top: 1px solid var(--border);
        border-radius: 0;
        background: var(--bg2);
        box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.32);
    }
    .view-commercial .nav-tab {
        flex: 1 1 0;
        justify-content: center;
        width: auto; height: 56px;
        padding: 0;
        border-radius: 0;
        gap: 0;
    }
    /* Onglet actif : fond discret + liseré rouge en haut (l'emoji ne se teinte
       pas, le liseré fait le repère — pas de pilule rouge ici). */
    .view-commercial .nav-tab.active {
        background: var(--bg3);
        color: var(--text);
        box-shadow: inset 0 2px 0 var(--red);
    }
    /* Icône bien visible, titre retiré. */
    .view-commercial .nav-ico { font-size: 1.45rem; line-height: 1; }
    .view-commercial .nav-lbl { display: none; }
    /* Déconnexion en bout de barre : révélée + nuance visuelle. */
    .view-commercial .nav-logout-m { display: inline-flex; }
    .view-commercial .nav-logout-m .nav-ico { color: var(--red); }

    /* Marge basse des pages pour ne pas passer sous la barre. */
    .view-commercial .page { padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
}

/* Conteneur scrollable autour des tableaux denses (.cmd-table) : évite que le
   tableau déborde la page sur petit écran — on scrolle dans le tableau, pas
   dans toute la mise en page. Inoffensif sur desktop (tableau en 100%). */
.cmd-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Vue Commercial — affinages spécifiques téléphone (la bottom-nav, elle, est
   gérée plus haut dès ≤1100px) ─────────────────────────────────────────────── */
@media (max-width: 760px) {
    /* Pages : marges latérales réduites (la marge basse vient du bloc ≤1100). */
    .view-commercial .page { padding-left: 12px; padding-right: 12px; padding-top: 14px; }

    /* KPI hero empilés, valeurs un peu plus petites. */
    .view-commercial .hero-grid { grid-template-columns: 1fr; gap: 10px; }
    .view-commercial .hero-tile { padding: 14px 16px; gap: 12px; }
    .view-commercial .hero-tile-icon { font-size: 1.9rem; }
    .view-commercial .hero-tile-value { font-size: 1.9rem; }

    /* KPI factures : 2 colonnes au lieu de 4 (override du grid inline). */
    #facturesKpis { grid-template-columns: repeat(2, 1fr) !important; }

    /* Tableaux denses : largeur mini pour rester lisibles, le wrap scrolle. */
    .view-commercial .cmd-table { min-width: 640px; }
    /* …sauf l'historique commandes du détail client : on masque Lignes + Poids
       (secondaires) → 4 colonnes (N° · Date · CA · Palette) qui tiennent sans scroll. */
    #clientDetailContent .cmd-table { min-width: 0; }
    #clientDetailContent .cmd-table th:nth-child(3), #clientDetailContent .cmd-table td:nth-child(3),
    #clientDetailContent .cmd-table th:nth-child(4), #clientDetailContent .cmd-table td:nth-child(4) { display: none; }

    /* Calendrier : pastilles + petites pour tenir 7 colonnes sans déborder. */
    .view-commercial #calendarGrid { gap: 4px !important; }
    .view-commercial .calendar-day { width: 36px; height: 36px; margin-right: 0; margin-bottom: 0; }
    .view-commercial .calendar-day-num { font-size: 0.72rem; }
    .view-commercial .calendar-day-count { font-size: 0.55rem; }

    /* Tournée : carte plus basse + actions geo sur toute la largeur. */
    .leaflet-host { height: 320px; }
    .geo-widget-header { padding: 12px 14px; }
    .geo-widget-h1 { font-size: 1rem; }
    .geo-widget-robot { font-size: 1.8rem; }
    .geo-widget-actions { width: 100%; justify-content: space-between; }
    .tournee-panel { position: static; }
}

@media (max-width: 480px) {
    /* Très petits écrans : on masque le nom (déjà visible dans le menu rôle). */
    .view-commercial .user-badge { display: none; }
    /* Barre horizontale un poil plus basse sur très petit écran. */
    .view-commercial .nav-tab { height: 52px; padding: 0; }
    .view-commercial .nav-ico { font-size: 1.35rem; }
    .view-commercial .hero-tile-value { font-size: 1.7rem; }
}

/* ── « Mes pièces » — table dense repliée en cartes sur mobile ────────────────
   Desktop / tablette (≥861px) : vraie table, scroll horizontal maîtrisé par
   min-width. Mobile (≤860px) : chaque <tr> devient une carte empilée → zéro
   scroll horizontal.

   Les libellés et masquages ciblent les colonnes PAR POSITION (nth-child) —
   même pattern que l'historique client plus haut. L'ordre DOIT rester aligné
   sur renderFacturesTable() dans commercial.js :
     1 N°Cmd · 2 BL · 3 Facture · 4 Date · 5 Client · 6 Lignes · 7 Sous-réfs ·
     8 CA · 9 Commission · 10 Score · 11 Statut · 12 Origine · 13 Export
   Si l'ordre change là-bas, mettre à jour les nth-child ci-dessous. */
.factures-table { min-width: 820px; }

/* ── Mes pièces : actions de la colonne « Export » ──────────────────────────
   Proforma / Mail / Masquer / Recommander / Ouvrir-convertir partagent une
   seule primitive : elles s'empilent et s'étirent à la largeur de la cellule.
   min-height 38px = cible tactile atteignable au doigt (le gabarit précédent,
   0.78rem + 4px de padding, tombait à ~26px). Toute nouvelle action de pièce
   passe par .piece-act — ne pas réintroduire de style inline par bouton. */
.piece-act-col { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.piece-act {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    min-height: 38px; padding: 9px 12px;
    font-size: 0.84rem; font-weight: 600; white-space: nowrap;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg2); color: var(--text); cursor: pointer;
    transition: background .12s, filter .12s;
}
.piece-act:hover:not(:disabled) { background: var(--bg3); }
.piece-act:disabled { opacity: 0.5; cursor: not-allowed; }
/* Masquer : action de retrait — volontairement en retrait visuel. */
.piece-act.is-muted { background: var(--bg); color: var(--muted); }
.piece-act.is-muted:hover:not(:disabled) { background: var(--bg3); color: var(--text); }
/* Ouvrir / convertir : action principale d'un devis émis. */
.piece-act.is-primary { background: var(--red); border-color: var(--red); color: #fff; }
.piece-act.is-primary:hover:not(:disabled) { filter: brightness(1.08); }
/* Supprimer : action destructive et définitive — contour rouge au repos (se
   distingue du is-primary plein), bascule en plein au survol pour l'intention. */
.piece-act.is-danger { background: transparent; border-color: var(--red-dim); color: var(--red); }
.piece-act.is-danger:hover:not(:disabled) { background: var(--red); border-color: var(--red); color: #fff; }
/* Le <select> proforma (pièces Divalto) suit le même gabarit — display:block
   car inline-flex n'est pas fiable sur un select. */
select.piece-act { display: block; width: 100%; text-align: center; }

@media (max-width: 860px) {
    .factures-table { min-width: 0; width: 100%; }
    .factures-table thead { display: none; }
    .factures-table, .factures-table tbody { display: block; width: 100%; }

    .factures-table tr {
        display: flex; flex-direction: column; gap: 2px;
        border: 1px solid var(--border) !important; border-radius: 10px;
        background: var(--bg2); padding: 10px 12px; margin-bottom: 10px;
    }
    .factures-table td {
        display: flex; align-items: center; justify-content: space-between;
        gap: 12px; text-align: right !important;
        padding: 5px 0 !important; border: none !important;
        white-space: normal !important; max-width: none !important;
    }
    /* Libellé de colonne (à gauche), injecté par position. */
    .factures-table td::before {
        flex: 0 0 auto; text-align: left;
        font-size: 0.66rem; font-weight: 700; text-transform: uppercase;
        letter-spacing: 0.03em; color: var(--muted);
    }
    .factures-table td:nth-child(1)::before  { content: "N° Cmd"; }
    .factures-table td:nth-child(4)::before  { content: "Date"; }
    .factures-table td:nth-child(6)::before  { content: "Lignes"; }
    .factures-table td:nth-child(8)::before  { content: "CA"; }
    .factures-table td:nth-child(9)::before  { content: "Commission"; }
    .factures-table td:nth-child(11)::before { content: "Suivi"; }
    .factures-table td:nth-child(12)::before { content: "Origine"; }

    /* Client (5) = en-tête de carte : pleine largeur, en haut, sans libellé. */
    .factures-table td:nth-child(5) {
        order: -1; justify-content: flex-start;
        font-size: 0.95rem !important; font-weight: 700;
        padding-bottom: 8px !important; margin-bottom: 4px;
        border-bottom: 1px solid var(--border) !important;
    }
    /* Export (13) = actions en pleine largeur, en bas de carte. */
    .factures-table td:nth-child(13) { display: block; padding-top: 8px !important; }
    .factures-table td:nth-child(13)::before { content: none; }

    /* Colonnes secondaires masquées sur mobile (info déjà portée par la carte
       ou par la colonne Suivi). */
    .factures-table td:nth-child(2),   /* BL */
    .factures-table td:nth-child(3),   /* Facture */
    .factures-table td:nth-child(7),   /* Sous-réfs */
    .factures-table td:nth-child(10) { /* Score palette */
        display: none !important;
    }
}

/* ── Header sticky sous le bandeau hors-ligne (fixed top:0) ────────────────
   offline.js publie la hauteur du bandeau dans --bp-ban-h ; le header collant
   se cale juste en dessous → plus de chevauchement quand on scrolle. */
.hdr { top: var(--bp-ban-h, 0px); }

/* Bandeau hors-ligne : compact sur mobile (sinon trop haut quand coupé). */
@media (max-width: 600px) {
    #bp-offline-banner {
        gap: 8px !important; padding: 5px 10px !important;
        flex-wrap: wrap !important; row-gap: 6px !important;
        font-size: 11px !important; line-height: 1.2 !important;
    }
    #bp-offline-banner a {
        min-height: 30px !important; padding: 5px 12px !important;
        font-size: 12px !important; border-width: 1px !important;
    }
}

.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; }
.card-title { font-family: var(--font-brand); font-size: 0.85rem; font-weight: 600; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.card-a { border-top: 2px solid var(--red); }
.card-b { border-top: 2px solid var(--teal); }

.top-row  { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.main-row { display: grid; grid-template-columns: 280px 1fr 1fr; gap: 14px; margin-bottom: 14px; }

input[type=text], input[type=password] { width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; color: var(--text); font-size: 0.85rem; margin-bottom: 8px; transition: border-color 0.2s; }
input:focus { outline: none; border-color: var(--red); }

.client-wrap { position: relative; }
#clientDropdown { display:none; border:1px solid var(--border); border-radius:var(--radius-md); max-height:220px; overflow-y:auto; background:var(--bg3); position:absolute; width:100%; z-index:200; box-shadow: 0 8px 32px #00000060; }
.client-opt { padding:9px 13px; cursor:pointer; border-bottom:1px solid var(--border); font-size:0.82rem; }
.client-opt:hover { background: var(--bg4); }
.client-opt strong { color: var(--red); }
#clientInfo { display:none; font-size:0.75rem; color:var(--muted); background:var(--bg3); padding:6px 10px; border-radius:var(--radius-sm); margin-bottom:0; border-left: 2px solid var(--red); }

.pal-opts { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.pal-opt { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 6px; text-align: center; cursor: pointer; transition: all 0.15s; background: var(--bg3); }
.pal-opt:hover { border-color: var(--muted); }
.pal-opt.sel-a { border-color: var(--red); background: var(--bg4); box-shadow: 0 0 12px var(--red-glow); }
.pal-opt.sel-b { border-color: var(--teal); background: var(--bg4); box-shadow: 0 0 12px var(--teal)20; }
.pal-opt .pname { font-size: 0.78rem; font-weight: 600; color: var(--text); }
.pal-opt .pdet  { font-size: 0.68rem; color: var(--muted); margin: 2px 0; }
.pal-opt .pprix { font-size: 0.75rem; font-weight: 700; }
.pal-opt.sel-a .pprix { color: var(--red); }
.pal-opt.sel-b .pprix { color: var(--teal); }

.refs-container { max-height: 480px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.ref-row { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-bottom: 1px solid var(--border); }
.ref-row:hover { background: var(--bg3); }
.ref-name { flex: 1; min-width: 0; }
.ref-name strong { color: var(--red); font-size: 0.82rem; }
.ref-name .meta { font-size: 0.66rem; color: var(--muted); }
.qty-grp { display: flex; align-items: center; gap: 3px; }
.qbtn { width: 20px; height: 20px; border-radius: 4px; border: 1px solid; font-size: 0.8rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; transition: all 0.1s; }
.qbtn-a { border-color: var(--red-dim); background: var(--bg3); color: var(--red); }
.qbtn-a:hover { background: var(--red); color: white; }
.qbtn-b { border-color: var(--teal-dim); background: var(--bg3); color: var(--teal); }
.qbtn-b:hover { background: var(--teal-dim); color: white; }
.qval { min-width: 22px; text-align: center; font-size: 0.82rem; font-weight: 700; }
.qval-a { color: var(--red); } .qval-b { color: var(--teal); }
.sep { color: var(--border); }

.pal-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.pal-table th { padding: 6px 8px; text-align: right; font-size: 0.68rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); letter-spacing: 1px; text-transform: uppercase; }
.pal-table th:first-child { text-align: left; }
.pal-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); text-align: right; color: var(--text); }
.pal-table td:first-child { text-align: left; }
.pal-table tr:hover td { background: var(--bg3); }
.pal-table .total-row td { font-weight: 700; background: var(--bg3); border-top: 1px solid var(--border); color: var(--text); }
.pal-table .pal-row td { color: var(--muted); font-style: italic; }
.btn-rm { background: none; border: none; color: var(--border); cursor: pointer; font-size: 0.85rem; padding: 0 2px; transition: color 0.1s; }
.btn-rm:hover { color: var(--red); }
.vert { color: var(--green); font-weight: 600; } .rouge { color: var(--red); font-weight: 600; }

.sbar { border-radius: var(--radius-sm); padding: 7px 12px; font-size: 0.75rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px; margin-top: 10px; background: var(--bg3); border: 1px solid var(--border); }
.sbar-a span { color: var(--red); font-weight: 700; }
.sbar-b span { color: var(--teal); font-weight: 700; }

.sim-btn { display: block; width: 100%; padding: 14px; background: var(--red); color: white; border: none; border-radius: var(--radius-md); font-family: var(--font-brand); font-size: 1.1rem; font-weight: 700; letter-spacing: 2px; cursor: pointer; transition: all 0.2s; box-shadow: 0 0 20px var(--red-glow); }
.sim-btn:hover { background: var(--red-dim); box-shadow: 0 0 40px var(--red-glow); }
.sim-btn:disabled { background: var(--bg4); color: var(--muted); box-shadow: none; cursor: not-allowed; }

.results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.res-col { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; background: var(--bg2); }
.res-col.rc-a { border-top: 2px solid var(--red); }
.res-col.rc-b { border-top: 2px solid var(--teal); }
.res-col.alert-col { border-color: var(--red); background: #C41E3A08; }
.res-col h3 { font-family: var(--font-brand); font-size: 1rem; font-weight: 700; letter-spacing: 2px; margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.rc-a h3 { color: var(--red); } .rc-b h3 { color: var(--teal); }

.compte { width: 100%; border-collapse: collapse; font-size: 0.82rem; margin-bottom: 14px; }
.compte td { padding: 7px 10px; border-bottom: 1px solid var(--border); color: var(--text); }
.compte td:nth-child(2) { text-align: right; color: var(--muted); font-size: 0.72rem; }
.compte td:last-child { text-align: right; font-weight: 600; white-space: nowrap; }
.compte .row-sep td { border-top: 1px solid var(--border); padding-top: 8px; }
.compte .row-final td { font-weight: 700; font-size: 0.9rem; background: var(--bg3); }

.seuil-alert { background: #C41E3A18; border: 1px solid var(--red); border-radius: var(--radius-md); padding: 10px 14px; margin-bottom: 12px; font-size: 0.82rem; color: #FF6B6B; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.seuil-ok    { background: #2ECC7118; border: 1px solid var(--green); border-radius: var(--radius-md); padding: 10px 14px; margin-bottom: 12px; font-size: 0.82rem; color: var(--green); font-weight: 600; display: flex; align-items: center; gap: 8px; }

.tarif-card { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 12px; margin-bottom: 8px; background: var(--bg3); }
.tarif-card.best { border-color: var(--green); }
.tc-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 5px; }
.tc-name { font-weight: 700; font-size: 0.85rem; color: var(--text); }
.tc-svc  { font-size: 0.72rem; color: var(--muted); }
.tc-amt  { font-size: 1.1rem; font-weight: 700; }
.rc-a .tc-amt { color: var(--red); } .rc-b .tc-amt { color: var(--teal); }
.tc-marge { font-size: 0.78rem; display: flex; justify-content: space-between; background: var(--bg4); padding: 5px 8px; border-radius: var(--radius-sm); margin-bottom: 5px; color: var(--muted); }
.tc-det { font-size: 0.7rem; color: var(--muted); }
.det-r  { display: flex; justify-content: space-between; padding: 1px 0; }

.taux-pill { display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 2px 7px; border-radius: var(--radius-lg); margin-left: 4px; }
.pill-green  { background: #2ECC7122; color: var(--green); border: 1px solid #2ECC7144; }
.pill-orange { background: #F39C1222; color: var(--orange); border: 1px solid #F39C1244; }
.pill-red    { background: #C41E3A22; color: #FF6B6B;      border: 1px solid var(--red-dim); }
.pill-grey   { background: rgba(150,150,150,0.12); color: var(--muted); border: 1px solid var(--border); }

/* Delta pills (variations vs M-1 / N-1 dans la vue dirco) */
.delta-pill { display: inline-block; font-size: 0.7rem; font-weight: 600; padding: 1px 6px; border-radius: 4px; font-variant-numeric: tabular-nums; }
.delta-up   { background: #2ECC7122; color: #2ECC71; border: 1px solid #2ECC7144; }
.delta-down { background: #C41E3A22; color: #FF6B6B; border: 1px solid var(--red-dim); }
.delta-flat { background: rgba(150,150,150,0.12); color: var(--muted); border: 1px solid var(--border); }

.badge { display:inline-block; color:white; font-size:var(--font-xs); padding:2px 7px; border-radius:var(--radius-md); margin-left:4px; font-weight:600; }

/* Badge « code OP détecté » (temps réel, sous le sélecteur de code OP). */
.codeop-hint { margin-bottom:4px; font-size:0.76rem; line-height:1.3; color:var(--muted); }
.codeop-hint:empty { margin-bottom:0; }
.codeop-hint--ok   { color:var(--green); }
.codeop-hint--lock { color:var(--orange); }
.codeop-hint--warn { color:var(--red); font-weight:600; }
.codeop-hint strong { font-weight:700; }
.b-red  { background: var(--red); } .b-teal { background: var(--teal-dim); }
.b-green{ background: #1E8449; }    .b-warn { background: var(--red); } .b-ok { background: #1E8449; }

.cmp-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.cmp-table th { background: var(--bg3); color: var(--muted); padding: 8px 12px; text-align: center; font-size: 0.72rem; font-weight: 600; border-bottom: 1px solid var(--border); letter-spacing: 1px; text-transform: uppercase; }
.cmp-table th:first-child { text-align: left; }
.cmp-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: center; color: var(--text); }
.cmp-table td:first-child { text-align: left; color: var(--muted); font-size: 0.8rem; }
.cmp-table .win { background: #2ECC7110; }
.cmp-table .big { font-size: 0.92rem; font-weight: 700; }

.export-btn { padding: 8px 16px; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted); font-size: 0.82rem; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.15s; white-space: nowrap; }
.export-btn:hover { border-color: var(--text); color: var(--text); }
#btnToggleCalendar { color: var(--muted); }
#btnToggleCalendar:hover { border-color: var(--red); color: var(--red); }

.histo-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.histo-table th { background: var(--bg3); color: var(--muted); padding: 10px 14px; text-align: left; font-size: 0.72rem; font-weight: 600; border-bottom: 1px solid var(--border); letter-spacing: 1px; text-transform: uppercase; }
.histo-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.histo-table tr:hover td { background: var(--bg3); }
.histo-link { color: var(--red); cursor: pointer; text-decoration: underline; font-size: 0.78rem; }

.loading { text-align:center; padding:32px; color:var(--muted); }
.empty   { text-align:center; padding:32px; color:var(--border); font-size:0.88rem; }
.kpi-src { position:relative; display:inline-flex; align-items:center; }
.kpi-src-icon { display:inline-flex; align-items:center; justify-content:center; width:13px; height:13px; border-radius:50%; border:1px solid var(--muted); color:var(--muted); font-size:0.55rem; font-weight:700; cursor:default; margin-left:4px; line-height:1; flex-shrink:0; }
.kpi-src-icon:hover { border-color:var(--text); color:var(--text); }
.kpi-src-tip { display:none; position:absolute; bottom:calc(100% + 6px); left:50%; transform:translateX(-50%); background:var(--bg4); border:1px solid var(--border); border-radius:6px; padding:6px 10px; font-size:0.68rem; color:var(--muted); white-space:nowrap; z-index:200; pointer-events:none; box-shadow:0 4px 12px rgba(0,0,0,0.4); }
.kpi-src-tip strong { color:var(--text); }
.kpi-src-tip::after { content:''; position:absolute; top:100%; left:50%; transform:translateX(-50%); border:5px solid transparent; border-top-color:var(--border); }
.kpi-src-icon:hover + .kpi-src-tip,
.kpi-src:hover .kpi-src-tip { display:block; }
details summary { cursor: pointer; font-size: 0.72rem; color: var(--muted); margin-top: 4px; }
details summary:hover { color: var(--text); }

/* ── Contacts client (destinataires proforma) ─────────────────────────── */
.contacts-head { display:flex; align-items:center; flex-wrap:wrap; gap:8px; font-family:var(--font-brand); font-size:0.8rem; font-weight:600; letter-spacing:1.5px; text-transform:uppercase; color:var(--text); margin-bottom:14px; padding-bottom:10px; border-bottom:1px solid var(--border); }
.contacts-head .sub { text-transform:none; letter-spacing:0; font-weight:400; font-size:0.75rem; color:var(--muted); }

.contacts-list { display:flex; flex-direction:column; gap:8px; margin-bottom:16px; }

.contact-card { display:flex; align-items:center; gap:12px; padding:10px 12px; background:var(--bg3); border:1px solid var(--border); border-radius:var(--radius-md); transition:border-color .15s, box-shadow .15s; }
.contact-card:hover { border-color:var(--blue); box-shadow:0 0 0 1px rgba(74,144,217,0.25); }

.contact-avatar { flex:0 0 auto; width:38px; height:38px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:0.85rem; color:#fff; background:linear-gradient(135deg, var(--blue), #2f6fb0); text-transform:uppercase; letter-spacing:.5px; }

.contact-main { flex:1 1 auto; min-width:0; display:flex; flex-direction:column; gap:1px; }
.contact-name { font-weight:600; font-size:0.9rem; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.contact-email { font-size:0.8rem; color:var(--blue); text-decoration:none; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.contact-email:hover { text-decoration:underline; }

.contact-role { flex:0 0 auto; font-size:0.66rem; font-weight:700; letter-spacing:.5px; text-transform:uppercase; color:var(--blue); background:rgba(74,144,217,0.12); border:1px solid rgba(74,144,217,0.35); padding:3px 9px; border-radius:999px; white-space:nowrap; }

.contact-del { flex:0 0 auto; width:32px; height:32px; display:flex; align-items:center; justify-content:center; background:none; border:1px solid transparent; border-radius:var(--radius-sm); color:var(--muted); cursor:pointer; font-size:0.9rem; transition:all .15s; }
.contact-del:hover { color:var(--red); border-color:var(--red-dim); background:var(--red-glow); }

.contacts-empty { display:flex; align-items:center; gap:10px; padding:16px; background:var(--bg3); border:1px dashed var(--border); border-radius:var(--radius-md); color:var(--muted); font-size:0.85rem; line-height:1.4; margin-bottom:16px; }
.contacts-empty .ico { font-size:1.4rem; opacity:.75; flex:0 0 auto; }

.contact-form { background:var(--bg3); border:1px solid var(--border); border-radius:var(--radius-md); padding:14px; }
.contact-form-title { font-size:0.72rem; font-weight:600; letter-spacing:1px; text-transform:uppercase; color:var(--muted); margin-bottom:10px; }
.contact-form-grid { display:grid; grid-template-columns:minmax(140px,.8fr) 1fr 1fr auto; gap:10px; align-items:end; }
.contact-field { display:flex; flex-direction:column; gap:4px; min-width:0; }
.contact-field label { font-size:0.68rem; color:var(--muted); font-weight:500; }
.contact-field select, .contact-field input { width:100%; min-height:40px; background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:8px 10px; color:var(--text); font-size:0.85rem; margin:0; transition:border-color .15s; }
.contact-field select:focus, .contact-field input:focus { border-color:var(--blue); outline:none; }

.contact-submit { min-height:40px; padding:0 20px; background:var(--red); color:#fff; border:none; border-radius:var(--radius-sm); font-weight:600; font-size:0.85rem; cursor:pointer; transition:background .15s; white-space:nowrap; }
.contact-submit:hover { background:var(--red-dim); }

@media (max-width:640px) {
    .contact-form-grid { grid-template-columns:1fr 1fr; }
    .contact-form-grid .f-email, .contact-form-grid .contact-submit { grid-column:1 / -1; }
}
@media (max-width:420px) {
    .contact-form-grid { grid-template-columns:1fr; }
}

/* Commercial badges */
.vrp-badge { display:inline-block; font-size:0.68rem; font-weight:700; padding:2px 7px; border-radius:var(--radius-lg); white-space:nowrap; }

/* Commandes */
#commandesContent { max-width: 100%; margin: 0 auto; }
.cmd-table { width:100%; border-collapse:collapse; font-size:0.82rem; margin: 0 auto; }
.cmd-table th { background:var(--bg3); color:var(--muted); padding:8px 12px; text-align:center; font-size:0.72rem; font-weight:600; border-bottom:1px solid var(--border); border-right:1px solid rgba(42,42,53,0.3); letter-spacing:1px; text-transform:uppercase; }
.cmd-table th:last-child { border-right:none; }
.cmd-table td { padding:9px 12px; border-bottom:1px solid var(--border); border-right:1px solid rgba(42,42,53,0.3); color:var(--text); vertical-align:middle; text-align:center; }
.cmd-table td:last-child { border-right:none; }
.cmd-table td:nth-child(1) { text-align:center; }
.cmd-table td:nth-child(2) { text-align:left; }
.cmd-table td:nth-child(3) { text-align:left; }
.cmd-table tr:hover td { background:var(--bg3); cursor:pointer; }
.cmd-table tr.alerte td { background:#C41E3A08; }
.cmd-table tr.alerte:hover td { background:#C41E3A15; }
.alerte-badge { display:inline-block; background:var(--red); color:white; font-size:var(--font-xs); padding:2px 7px; border-radius:var(--radius-md); font-weight:700; }
.ok-badge { display:inline-block; background:#1E8449; color:white; font-size:var(--font-xs); padding:2px 7px; border-radius:var(--radius-md); font-weight:700; }
.grp-badge { display:inline-block; background:#1A4A8A; color:var(--blue); border:1px solid var(--blue); font-size:var(--font-xs); padding:2px 7px; border-radius:var(--radius-md); font-weight:700; }
.cmd-table tr.groupage td { background:#4A90D908; border-left: 3px solid #4A90D9; }
.cmd-table tr.groupage:hover td { background:#4A90D915; }
.cmd-table tr.selected td { background: rgba(196,30,58,0.25) !important; font-weight: 600; }
.cmd-table tr.selected td:first-child { border-left: 4px solid var(--red); padding-left: 8px; }
.cmd-table tr.selected:hover td { background: rgba(196,30,58,0.32) !important; }
.jour-btn { padding:5px 12px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--bg3); color:var(--muted); font-size:0.75rem; cursor:pointer; transition:all 0.15s; }
.jour-btn:hover { border-color:var(--red); color:var(--red); }
.jour-btn.active { border-color:var(--red); background:var(--red); color:white; }
.kpi-mini { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin-bottom:14px; }
.kpi-mini-box { background:var(--bg3); border-radius:var(--radius-md); padding:10px; text-align:center; border-left: 2px solid var(--border); }
.kpi-mini-box:first-child { border-left: none; }
.kpi-mini-box .lbl { font-size:0.68rem; color:var(--muted); margin-bottom:3px; }
.kpi-mini-box .val { font-size:1rem; font-weight:700; }

#statsMois { border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 20px !important; }

#calendarGrid {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    gap: 8px !important;
    grid-auto-rows: auto;
}
.health-bar-wrap { flex:1; background:var(--bg3); border-radius:3px; height:14px; overflow:hidden; }
.health-bar-fill { height:100%; border-radius:3px; opacity:0.8; }

/* Utility text classes */
.text-muted  { color: var(--muted) !important; }
.text-red    { color: var(--red) !important; }
.text-green  { color: var(--green) !important; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* Primary button */
.btn-primary {
    background: var(--red);
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    color: white;
    cursor: pointer;
    font-size: var(--font-base);
    font-weight: 600;
    transition: background 0.15s;
}
.btn-primary:hover { background: var(--red-dim); }

/* Filter buttons */
.btn-filter {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 12px;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-filter:hover {
    border-color: var(--text);
    color: var(--text);
}
.btn-filter.active {
    background: var(--red);
    border-color: var(--red);
    color: white;
}

/* Ghost button */
.btn-ghost {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    color: var(--muted);
    cursor: pointer;
    font-size: var(--font-base);
    transition: all 0.15s;
}
.btn-ghost:hover { border-color: var(--text); color: var(--text); }

/* Sync badge */
.sync-badge {
    font-size: 0.8rem;
    color: var(--muted);
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Status dot */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    background: var(--muted);
}
.status-dot.online { background: var(--green); }

/* Green export button variant */
.export-btn.green {
    border-color: var(--green);
    color: var(--green);
}

/* Fix .b-warn to be orange not red */
.b-warn { background: var(--orange) !important; }

/* Global scrollbar styling */
*::-webkit-scrollbar { width: 12px; height: 12px; }
*::-webkit-scrollbar-track { background: var(--bg3); border-radius: 6px; }
*::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 6px; border: 3px solid var(--bg3); background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--red); border: 2px solid var(--bg3); background-clip: padding-box; }
/* Firefox */
* { scrollbar-width: auto; scrollbar-color: var(--muted) var(--bg3); }

/* Page title styling */
.page-title {
    font-family: var(--font-brand);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

/* Glassmorphism header */
.hdr {
    backdrop-filter: blur(10px);
}

/* Subtle card shadow */
.card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Responsive grid - tablet view (1024px and below) */
@media (max-width: 1024px) {
    .top-row { grid-template-columns: 1fr 1fr; }
    .main-row { grid-template-columns: 1fr 1fr; }
    .results-grid { grid-template-columns: 1fr; }
    #statsMois { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Flash button (gros �clair) */
.btn-flash {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--red);
    border: none;
    color: white;
    font-size: 2.2rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 0 0 var(--red-glow);
    animation: flashGlow 2s infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.btn-flash:hover {
    background: var(--red-dim);
    transform: scale(1.1);
    box-shadow: 0 0 24px var(--red-glow);
}
@keyframes flashGlow {
    0% { box-shadow: 0 0 0 0 var(--red-glow); }
    50% { box-shadow: 0 0 0 8px rgba(196, 30, 58, 0); }
    100% { box-shadow: 0 0 0 0 rgba(196, 30, 58, 0); }
}

/* Calendar styling - Compact circle days */
#calendarContainer {
    width: 100%;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
}
#calendarGrid {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    gap: 8px !important;
    align-items: center;
    justify-items: center;
}
.calendar-day {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--muted);
    padding: 0;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg3);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    border-right: 1px solid rgba(120, 120, 160, 0.2);
    border-bottom: 1px solid rgba(120, 120, 160, 0.15);
    margin-right: 7px;
    margin-bottom: 7px;
}
.calendar-day:nth-child(7n) {
    border-right: none;
    margin-right: 0;
}
.calendar-day:nth-last-child(-n+7) {
    border-bottom: none;
    margin-bottom: 0;
}
.calendar-day:hover {
    border-color: var(--red);
    background: var(--bg4);
    transform: scale(1.15);
    box-shadow: 0 0 12px rgba(196, 30, 58, 0.3);
}
.calendar-day.today {
    border-color: var(--red);
    border-width: 2.5px;
    background: rgba(196, 30, 58, 0.25);
}
.calendar-day.active {
    background: var(--red);
    color: white;
    border-color: var(--red);
    box-shadow: 0 0 16px rgba(196, 30, 58, 0.5);
}
.calendar-day.has-cmd {
    border-color: var(--orange);
    border-width: 2.5px;
    background: rgba(243, 156, 18, 0.25);
}
.calendar-day.has-cmd.today {
    background: rgba(196, 30, 58, 0.35);
    border-color: var(--red);
}
.calendar-day.has-cmd.active {
    background: var(--red);
    border-color: var(--red);
}
.calendar-day-num {
    font-weight: 700;
    font-size: 0.7rem;
    line-height: 1;
}
.calendar-day-count {
    font-size: 0.5rem;
    color: var(--muted);
    line-height: 1;
    margin-top: 0;
}
.calendar-day.active .calendar-day-count,
.calendar-day.active .calendar-day-num {
    color: white;
}
.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 12px;
    padding: 0 0 8px 0;
    border-bottom: 0.5px solid var(--border);
}
.calendar-header-day {
    text-align: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 4px 0;
}

/* Calendar navigation */
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.calendar-nav-btn {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s;
}
.calendar-nav-btn:hover {
    border-color: var(--red);
    color: var(--red);
}
.calendar-nav-title {
    font-weight: 600;
    color: var(--text);
    font-size: 0.85rem;
    text-transform: capitalize;
}

/* Responsive grid - tablet view (1024px and below) */
@media (max-width: 1024px) {
    .top-row { grid-template-columns: 1fr 1fr; }
    .main-row { grid-template-columns: 1fr 1fr; }
    .results-grid { grid-template-columns: 1fr; }
    #statsMois { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Responsive grid - mobile view (768px and below) */
@media (max-width: 768px) {
    .top-row { grid-template-columns: 1fr; }
    .main-row { grid-template-columns: 1fr; }
    .hdr { flex-wrap: wrap; height: auto; padding: 10px; }
    .nav-tabs { gap: 4px; flex-wrap: wrap; }
    #statsMois { grid-template-columns: repeat(2, 1fr) !important; }
    .page { padding: 14px; }
    .btn-flash { width: 48px; height: 48px; font-size: 1.4rem; }
    #btnToggleCalendar { font-size: 0.75rem; }
}

/* ── Tracking panel ──────────────────────────────────────────────────────── */
.trk-input-tab {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--muted);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 14px;
    transition: all 0.15s;
}
.trk-input-tab:hover { color: var(--text); border-color: var(--muted); }
.trk-input-tab--active { background: var(--red); color: #fff; border-color: var(--red); }

.trk-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    overflow: hidden;
}
.trk-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 8px;
}
.trk-card-id { display: flex; align-items: center; gap: 8px; }
.trk-uuid { font-family: var(--font-brand); font-size: 0.78rem; color: var(--muted); }
.trk-card-meta { padding: 6px 14px; font-size: 0.75rem; color: var(--muted); border-bottom: 1px solid var(--border); }
.trk-link { font-size: 0.72rem; color: var(--blue); text-decoration: none; }
.trk-link:hover { text-decoration: underline; }

.trk-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
}
.trk-badge--critical { background: #C41E3A22; color: var(--red); border: 1px solid #C41E3A44; }
.trk-badge--warning  { background: #F39C1222; color: var(--orange); border: 1px solid #F39C1244; }
.trk-badge--info     { background: #4A90D922; color: var(--blue); border: 1px solid #4A90D944; }
.trk-badge--ok       { background: #2ECC7122; color: var(--green); border: 1px solid #2ECC7144; }

.trk-anomalies { padding: 10px 14px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.trk-anomaly-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}
.trk-anomaly-row--critical { background: #C41E3A14; border: 1px solid #C41E3A33; }
.trk-anomaly-row--warning  { background: #F39C1214; border: 1px solid #F39C1233; }
.trk-anomaly-row--info     { background: #4A90D914; border: 1px solid #4A90D933; }
.trk-anomaly-icon { font-size: 1rem; flex-shrink: 0; line-height: 1.4; }
.trk-anomaly-desc { font-weight: 600; color: var(--text); margin-bottom: 2px; }
.trk-anomaly-meta { font-size: 0.7rem; color: var(--muted); }
.trk-anomaly-meta code { background: var(--bg4); padding: 1px 4px; border-radius: 3px; font-size: 0.68rem; }

.trk-events-details { }
.trk-events-summary {
    padding: 8px 14px;
    font-size: 0.75rem;
    color: var(--muted);
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.trk-events-summary:hover { color: var(--text); }
.trk-events-summary::-webkit-details-marker { display: none; }

.trk-timeline { padding: 4px 14px 12px 14px; display: flex; flex-direction: column; gap: 0; }
.trk-timeline-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    border-left: 2px solid var(--border);
    padding-left: 12px;
    position: relative;
}
.trk-timeline-row--anom { border-left-color: var(--orange); }
.trk-timeline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    margin-top: 4px;
    position: absolute;
    left: -5px;
}
.trk-timeline-dot--anom { background: var(--orange); box-shadow: 0 0 6px var(--orange); }
.trk-timeline-body { padding-left: 4px; }
.trk-timeline-label { font-size: 0.8rem; color: var(--text); font-weight: 500; }
.trk-timeline-meta { font-size: 0.68rem; color: var(--muted); margin-top: 1px; }
.trk-timeline-meta code { background: var(--bg4); padding: 1px 4px; border-radius: 3px; font-size: 0.65rem; }

/* ─── Rupture ML ─────────────────────────────────────────────────────────── */
.stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}
.stat-card--red    { border-color: var(--red); }
.stat-card--orange { border-color: #f59e0b; }
.stat-val { font-size: 1.8rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-lbl { font-size: 0.72rem; color: var(--muted); margin-top: 6px; }

.com-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    min-width: 140px;
}
.com-card:hover       { border-color: var(--text); }
.com-card--active     { border-color: var(--blue, #3b82f6); background: var(--bg3); }
.com-name  { font-weight: 600; font-size: 0.85rem; margin-bottom: 4px; }
.com-stats { display: flex; gap: 8px; }
.badge-red    { font-size: 0.75rem; color: var(--red); }
.badge-orange { font-size: 0.75rem; color: #f59e0b; }

.alerte-badge         { font-size: 0.72rem; padding: 2px 8px; border-radius: 20px; font-weight: 600; display: inline-block; }
.alerte-badge--red    { background: rgba(239,68,68,.15); color: var(--red); }
.alerte-badge--orange { background: rgba(245,158,11,.15); color: #f59e0b; }

.sousref-kpi-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    min-width: 210px;
    flex: 0 0 auto;
}
.sousref-kpi-card:hover        { border-color: var(--text); }
.sousref-kpi-card--active      { border-color: var(--blue, #3b82f6); background: var(--bg3); }
.sousref-kpi-code              { font-weight: 700; font-size: 1rem; letter-spacing: .04em; }
.sousref-kpi-grid              { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 8px; }
.sousref-kpi-stat              { text-align: center; }
.sousref-kpi-val               { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.sousref-kpi-lbl               { font-size: 0.62rem; color: var(--muted); margin-top: 1px; }
.sousref-funnel                { display: flex; flex-direction: column; gap: 3px; }
.sousref-funnel-row            { display: flex; justify-content: space-between; align-items: baseline; }
.sousref-funnel-lbl            { font-size: 0.72rem; color: var(--text); }
.sousref-funnel-val            { font-size: 0.78rem; }
.sousref-funnel-exclu .sousref-funnel-lbl { color: var(--muted); }

.ref-tag { background: var(--bg3); border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; font-size: 0.78rem; font-family: var(--font-brand); }

#ruptureTableBody tr:hover { background: var(--bg2); }
#ruptureTableBody td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }

.val-danger { color: var(--red); font-weight: 600; }
.val-warn   { color: #f59e0b;   font-weight: 500; }
.val-ok     { color: var(--green, #22c55e); }

.niveau-btn.active { background: var(--bg3) !important; }

.mode-btn { transition: background 0.15s, color 0.15s; }
.mode-btn:hover:not(.mode-btn--active) { background: var(--bg3); color: var(--text); }
.mode-btn--active { background: var(--red) !important; color: #fff !important; }
.mode-btn--active span { color: rgba(255,255,255,0.75) !important; }

/* ─── Rupture — cards client ─────────────────────────────────────────────── */
.client-rupture-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--red);
    border-radius: 10px;
    overflow: hidden;
}
.client-rupture-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--bg3);
}
.client-rupture-name { font-weight: 600; font-size: 0.95rem; }
.client-rupture-meta { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }

.ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.ref-table thead tr {
    background: var(--bg2);
}
.ref-table th {
    padding: 7px 12px;
    text-align: left;
    font-weight: 500;
    color: var(--muted);
    font-size: 0.72rem;
    border-bottom: 1px solid var(--border);
}
.ref-table th.rc { text-align: center !important; }
.ref-table th.rl { text-align: left !important; }
.ref-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.ref-table td.rc { text-align: center !important; }
.ref-table td.rl { text-align: left !important; }
.ref-table tbody tr:last-child td { border-bottom: none; }
.ref-table tbody tr:hover { background: var(--bg3); }

/* ── Tooltip infobulles colonnes ──────────────────────────────────────────── */
.th-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: default;
}
.th-tip .tip-icon {
    font-size: 0.68rem;
    color: var(--muted);
    opacity: 0.6;
    line-height: 1;
}
.th-tip .tip-box {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e2230;
    color: #e2e8f0;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    width: 220px;
    font-size: 0.72rem;
    line-height: 1.5;
    z-index: 200;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    text-align: left;
    font-weight: 400;
    white-space: normal;
    pointer-events: none;
}
.th-tip .tip-box::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--border);
}
.th-tip:hover .tip-box { display: block; }
.tip-formula {
    font-family: var(--font-brand);
    background: rgba(255,255,255,0.07);
    border-radius: 3px;
    padding: 2px 4px;
    margin: 3px 0;
    display: block;
    font-size: 0.68rem;
}
.tip-source {
    margin-top: 5px;
    color: #94a3b8;
    font-size: 0.67rem;
}

/* ── Bouton « Changer de vue » (remplace le macaron de role) ──────────────
   Icone seule (⇄, sans libelle) posee a cote des autres boutons du header. Bascule
   directe vers l'autre vue (jamais plus de 2). En vue commerciale, le bouton porte
   la classe .hdr-iconbtn (pastille ronde, voir plus bas). Dans les vues sans menu
   (dirco/dirigeant) il reprend le gabarit du bouton theme via .view-switch. */
.view-switch {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 5px 10px; border-radius: var(--radius-sm);
    background: none; color: var(--text);
    border: 1px solid var(--border); cursor: pointer;
    font-family: inherit; line-height: 1;
    transition: background 0.12s, border-color 0.12s;
}
.view-switch:hover { border-color: var(--red); }
.view-switch-ico { font-size: 1.05rem; line-height: 1; }

/* Déconnexion mobile (vue commerciale) : presente dans le header mais masquee
   en desktop (le logout vit dans .hdr-right) ; revelee ≤760px ou .hdr-right
   passe en display:none. Voir le bloc @media (max-width: 760px) plus bas. */
.hdr-logout-m { display: none; }

/* ── BlitzScore card (score seul — le feed a migré vers le drawer global) ──── */
.blitz-score-grid {
    display: block;
}
.blitz-score-left {
    padding: 22px 26px 18px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 14px;
}

/* ── Boutons ronds du header (vue commerciale) ────────────────────────────────
   Cloche événements, robot BlitzML, thème (lune/soleil), déconnexion : tous en
   pastille ronde 38px homogène. Scopé .view-commercial pour ne pas toucher les
   headers dirco/dirigeant (logout texte). Les boutons cloche + robot portent un
   compteur de nouveautés (.hdr-badge) et sont masqués en Mode Vente. */
.view-commercial .hdr-iconbtn {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; padding: 0;
    border-radius: 999px;
    background: var(--bg2); color: var(--text);
    border: 1px solid var(--border); cursor: pointer;
    font-size: 1.05rem; line-height: 1;
    transition: background 0.12s, border-color 0.12s;
}
.view-commercial .hdr-iconbtn:hover { background: var(--bg3); border-color: var(--red); }
/* Déconnexion : icône SVG (log-out) dimensionnée en dur → nette, taille homogène
   avec les emojis voisins (un glyphe texte ⎋ restait chétif). */
.view-commercial .logout-btn.hdr-iconbtn svg { width: 20px; height: 20px; display: block; }
.view-commercial .logout-btn.hdr-iconbtn:hover { color: var(--red); }

/* Compteur de nouveautés (pastille rouge en haut-droite du bouton). */
.hdr-badge {
    position: absolute; top: -5px; right: -5px;
    min-width: 17px; height: 17px; padding: 0 4px;
    border-radius: 999px;
    background: var(--red); color: #fff;
    font-size: 0.62rem; font-weight: 800; line-height: 17px;
    text-align: center; font-variant-numeric: tabular-nums;
    box-shadow: 0 0 0 2px var(--bg2);
    pointer-events: none;
}

/* Instances mobiles (cloche + robot) : enfants directs de .hdr, révélées ≤1100px
   (où .hdr-right passe en display:none). Cachées en desktop. NB : sélecteur composé
   .hdr-iconbtn.hdr-icon-m obligatoire — sinon la règle .hdr-iconbtn (plus spécifique)
   les ré-affiche en desktop → doublon de boutons/badges. */
.view-commercial .hdr-iconbtn.hdr-icon-m { display: none; }
@media (max-width: 1100px) { .view-commercial .hdr-iconbtn.hdr-icon-m { display: inline-flex; } }

/* ── Drawer « Derniers événements » (panneau glissant, au-dessus de tout) ──── */
.feed-drawer { position: fixed; inset: 0; z-index: 300; display: none; }
.feed-drawer.open { display: block; }
.feed-drawer-backdrop {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.45);
    animation: fd-fade 0.15s ease;
}
.feed-drawer-panel {
    position: absolute; top: 0; right: 0; height: 100%;
    width: min(420px, 92vw);
    display: flex; flex-direction: column;
    background: var(--bg2);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 28px rgba(0, 0, 0, 0.35);
    animation: fd-slide 0.18s ease;
}
.feed-drawer-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.feed-drawer-title {
    display: flex; align-items: center; gap: 8px;
    font-weight: 800; font-size: 0.92rem;
    text-transform: uppercase; letter-spacing: 0.06em; color: var(--text);
}
.feed-drawer-close {
    background: none; border: none; color: var(--muted);
    font-size: 1.05rem; cursor: pointer; padding: 4px 9px; border-radius: 6px;
    line-height: 1;
}
.feed-drawer-close:hover { background: var(--bg3); color: var(--text); }
body.feed-drawer-lock { overflow: hidden; }
@keyframes fd-fade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fd-slide { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* ── Live feed ──────────────────────────────────────────────────────────── */
.feed-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
}
.feed-row {
    display: grid;
    grid-template-columns: 40px 44px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 5px;
    font-size: 0.78rem;
    flex: 0 0 auto;               /* pas de compression en flex colonne (cf. .ml-group) */
    transition: background 0.12s;
}
.feed-row:hover { background: var(--bg3); }
.feed-code {
    display: inline-block;
    color: #fff;
    font-weight: 800;
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    padding: 3px 0;
    border-radius: 3px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.feed-time {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-size: 0.72rem;
    white-space: nowrap;
}
.feed-label {
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}
.feed-meta {
    color: var(--muted);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.feed-empty {
    color: var(--muted);
    font-size: 0.82rem;
    text-align: center;
    padding: 24px 0;
    font-style: italic;
}
.feed-live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34a853;
    box-shadow: 0 0 0 0 rgba(52, 168, 83, 0.6);
}
.feed-live-dot.pulse {
    animation: feed-pulse 1.4s ease-out 1;
}
@keyframes feed-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(52, 168, 83, 0.6); }
    100% { box-shadow: 0 0 0 10px rgba(52, 168, 83, 0); }
}

/* ── Précos BlitzML (drawer robot) : groupées par client, clic → fiche client ── */
.ml-list { gap: 10px; }
.ml-group {
    flex: 0 0 auto;               /* ne pas se laisser compresser par le flex colonne */
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    overflow: hidden;
}
.ml-group-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%; padding: 9px 11px;
    background: none; border: none; cursor: pointer; text-align: left;
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
}
.ml-group-head:hover { background: var(--bg3); }
.ml-group-client {
    color: var(--text); font-weight: 700; font-size: 0.82rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.ml-group-counts { display: flex; gap: 5px; flex: 0 0 auto; }
.ml-chip {
    font-size: 0.62rem; font-weight: 800; letter-spacing: 0.04em;
    padding: 2px 7px; border-radius: 999px; color: #fff; white-space: nowrap;
}
.ml-chip.prio { background: #c0392b; }
.ml-chip.surv { background: #e67e22; }
.ml-group-items { padding: 6px 11px 8px; display: flex; flex-direction: column; gap: 4px; }
/* Scopé au drawer : ces classes génériques (.ml-item / .ml-item-ref) sont aussi
   utilisées par la card détaillée (grid) et les précos compactes. Sans le préfixe
   .ml-group-items, ces règles fuitent et cassent le layout du détail (le display:flex
   écrasait le display:grid → chevauchement sur mobile). */
.ml-group-items .ml-item { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ml-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.ml-dot.prio { background: #c0392b; }
.ml-dot.surv { background: #e67e22; }
.ml-group-items .ml-item-ref {
    color: var(--text); font-size: 0.76rem; font-family: inherit; font-weight: 400;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ml-group-items .ml-item-more { color: var(--muted); font-size: 0.72rem; font-style: italic; padding-left: 15px; }

/* ── Temporalités BlitzML : tuiles cliquables + tableau inline par magasin ──── */
.blitzml-seg.is-clickable { cursor: pointer; transition: filter 0.12s, box-shadow 0.12s; }
.blitzml-seg.is-clickable:hover,
.blitzml-seg.is-clickable:focus-visible {
    filter: brightness(1.06);
    box-shadow: inset 0 0 0 2px var(--accent, #2563eb);
    outline: none;
}
.blitzml-seg.is-active { box-shadow: inset 0 0 0 2px var(--accent, #2563eb); filter: brightness(1.04); }
.blitzml-seg-more { color: var(--accent, #2563eb); font-weight: 800; }
.ml-chip.conv { background: #34a853; }

/* Panneau déplié sous la barre de maturité. Liste FLEX fluide (pas de <table> :
   se replie proprement sur mobile, aucun scroll horizontal). */
.maturite-inline {
    margin-top: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg2);
    overflow: hidden;
}
.maturite-inline-head {
    display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
    padding: 9px 12px; border-bottom: 1px solid var(--border);
    font-size: 0.82rem; background: var(--bg);
}
.maturite-inline-title { min-width: 0; }              /* autorise le retour à la ligne du résumé */
.maturite-inline-head b { font-size: 0.92rem; }
.maturite-inline-close {
    flex: 0 0 auto; background: none; border: none; color: var(--muted);
    font-size: 1rem; cursor: pointer; padding: 2px 8px; border-radius: 6px; line-height: 1;
}
.maturite-inline-close:hover { background: var(--bg3); color: var(--text); }

.mat-list { display: flex; flex-direction: column; }
.mat-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 0.8rem; }

/* En-tête magasin (groupe) — nom cliquable + chips, se replie si trop étroit. */
.mat-group + .mat-group { border-top: 4px solid var(--bg2); }
.mat-group-head {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    width: 100%; padding: 8px 12px; background: var(--bg);
    border: none; border-bottom: 1px solid var(--border);
    cursor: pointer; text-align: left;
}
.mat-group-head:hover { background: var(--bg3); }
.mat-magname {
    flex: 1 1 auto; min-width: 0; color: var(--text); font-weight: 800; font-size: 0.82rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mat-magchips { flex: 0 0 auto; display: inline-flex; gap: 5px; }

.mat-group-body { display: flex; flex-direction: column; }

/* Une alerte = ligne flex qui WRAP : sur mobile, la méta passe sous la désignation. */
.mat-item {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
    padding: 8px 12px 8px 18px;
}
.mat-item + .mat-item { border-top: 1px solid var(--border); }
.mat-item:hover { background: var(--bg3); }
.mat-item-desc {
    flex: 1 1 220px; min-width: 0;
    display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
}
.mat-desc {
    color: var(--text); font-size: 0.8rem; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.mat-cref { color: var(--muted); font-size: 0.7rem; font-variant-numeric: tabular-nums; }
.mat-csrc { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }
.mat-item-meta { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; }
.mat-cdelai { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; font-size: 0.75rem; }
.mat-stat { font-size: 0.68rem; font-weight: 700; white-space: nowrap; }
.mat-stat.open { color: #c0392b; }
.mat-stat.conv { color: #34a853; }
/* Bouton masquer (mêmes codes que les cards produit). */
.mat-maskbtn {
    background: none; border: 1px solid transparent; border-radius: 6px;
    cursor: pointer; font-size: 0.9rem; line-height: 1; padding: 3px 6px;
    opacity: 0.55; transition: opacity 0.12s, background 0.12s, border-color 0.12s;
}
.mat-maskbtn:hover { opacity: 1; background: var(--bg2); border-color: var(--border); }
.mat-maskbtn:disabled { cursor: default; opacity: 0.4; }

/* ── BlitzML mini-panel (sous le feed) ──────────────────────────────────── */
.blitz-score-sep-h {
    height: 1px;
    margin: 12px 0;
    background: linear-gradient(90deg, transparent 0%, var(--border) 15%, var(--border) 85%, transparent 100%);
}
/* Panel violet — même identité que la préco BlitzML du portefeuille (.ml-hero) */
.blitzml-panel {
    background: linear-gradient(135deg, #4A148C 0%, #6A1B9A 50%, #8E24AA 100%);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    box-shadow: 0 2px 10px rgba(74, 20, 140, 0.28);
}
.blitzml-panel-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.blitzml-icon {
    font-size: 1.1rem;
}
.blitzml-title {
    font-size: 0.92rem;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
}
.blitzml-panel-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.blitzml-stat {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 8px 10px;
    text-align: center;
}
.blitzml-stat-val {
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    color: #fff;
}
.blitzml-stat-lbl {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.78);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 3px;
    font-weight: 600;
}

/* ── Météo (tableau de bord commercial) ───────────────────────────────────── */
.weather-card {
    display: flex; align-items: stretch; gap: 18px;
    padding: 16px 20px; flex-wrap: wrap;
}
.weather-empty, .weather-cta {
    flex: 1; display: flex; align-items: center; gap: 14px;
    color: var(--muted); font-size: 0.88rem;
}
.weather-cta { justify-content: space-between; flex-wrap: wrap; }
.weather-btn {
    border: 1px solid var(--red); background: var(--red); color: #fff;
    border-radius: var(--radius-md); padding: 8px 16px;
    font-size: 0.82rem; font-weight: 600; cursor: pointer; white-space: nowrap;
    transition: opacity 0.2s;
}
.weather-btn:hover { opacity: 0.88; }

.weather-now {
    display: flex; align-items: center; gap: 14px;
    padding-right: 18px; border-right: 1px solid var(--border);
    min-width: 180px;
}
.weather-now-icon { font-size: 3rem; line-height: 1; }
.weather-now-temp {
    font-size: 2.2rem; font-weight: 800; line-height: 1;
    font-variant-numeric: tabular-nums; color: var(--text);
}
.weather-now-label { font-size: 0.82rem; color: var(--muted); margin-top: 3px; }
.weather-now-city { font-size: 0.78rem; color: var(--text); margin-top: 4px; font-weight: 600; }

.weather-days {
    flex: 1; display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px;
}
.weather-day {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 4px; border-radius: var(--radius-md);
    background: var(--bg3); text-align: center;
}
.weather-day.is-today { background: var(--bg3); border: 1px solid var(--red); }
.weather-day-dow {
    font-size: 0.68rem; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0.04em;
}
.weather-day.is-today .weather-day-dow { color: var(--red); }
.weather-day-icon { font-size: 1.5rem; line-height: 1; }
.weather-day-temps {
    display: flex; gap: 5px; font-size: 0.78rem; font-variant-numeric: tabular-nums;
}
.weather-day-temps .tmax { font-weight: 700; color: var(--text); }
.weather-day-temps .tmin { color: var(--muted); }
.weather-day-pop { font-size: 0.66rem; color: #4A90D9; min-height: 0.9em; }

@media (max-width: 720px) {
    .weather-now { border-right: none; border-bottom: 1px solid var(--border); padding-right: 0; padding-bottom: 12px; width: 100%; }
    .weather-days { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ============================================================
   Utilitaires RESPONSIVE (réutilisables — cf. CLAUDE.md § Responsive).
   Objectif : layout fluide PAR DÉFAUT, media-queries réservées aux exceptions.
   ============================================================ */
/* Grille de cards qui s'adapte seule au nombre de colonnes selon la largeur. */
.u-cards { display: grid; gap: var(--u-gap, 12px);
    grid-template-columns: repeat(auto-fill, minmax(var(--u-card-min, 208px), 1fr)); }
/* Rangée fluide : les éléments passent à la ligne plutôt que de déborder. */
.u-row { display: flex; flex-wrap: wrap; gap: var(--u-gap, 12px); }
.u-row > * { min-width: 0; }              /* anti « grid/flex blowout » */
/* Élément qui prend la place dispo mais peut rétrécir sans déborder. */
.u-grow { flex: 1 1 var(--u-grow-basis, 280px); min-width: 0; }
/* À coller sur tout enfant flex/grid contenant un texte long ou une table. */
.u-min0 { min-width: 0; }
/* Empêche une image/un média de déborder de son conteneur. */
.u-img { max-width: 100%; height: auto; display: block; }

/* ═══════════ Mode Vente — présentation client ═══════════
   Masque les infos internes du tableau de bord commercial (commissions,
   BlitzScore, feed d'événements, conversion ML par maturité) en floutant le
   bloc sensible et en posant un voile cliquable. Activé par défaut.
   Logique : commercial.js (_SALES_MODE_KEY / toggleSalesMode). */
.sales-toolbar { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.sales-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px; border-radius: 8px; cursor: pointer;
    border: 1px solid var(--border); background: var(--bg2); color: var(--muted);
    font-size: 0.82rem; font-weight: 700; letter-spacing: 0.02em;
    transition: color .15s, border-color .15s, background .15s;
}
.sales-toggle:hover { color: var(--text); border-color: var(--muted); }
.sales-toggle.is-active { border-color: var(--red); color: var(--red); background: var(--red-glow); }
.sales-toggle-state { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.85; }

/* « Mes pièces » : en mode Vente, masque les colonnes commission + score palette
   (th + td portent .sales-hide). display:none sur la cellule garde le tableau
   aligné (th et td disparaissent ensemble). */
body.sales-mode-on .sales-hide { display: none; }

.sales-shield { position: relative; }
.sales-shield-content.is-blurred { filter: blur(9px); pointer-events: none; user-select: none; transition: filter .2s ease; }
.sales-shield-overlay {
    position: absolute; inset: 0; z-index: 5;
    display: flex; align-items: center; justify-content: center; padding: 18px;
}
.sales-overlay-card {
    text-align: center; max-width: 380px; padding: 26px 28px; border-radius: 14px;
    background: var(--bg2); border: 1px solid var(--border);
    box-shadow: 0 10px 40px rgba(0,0,0,0.28);
}
.sales-overlay-icon { font-size: 2.2rem; margin-bottom: 6px; }
.sales-overlay-title {
    font-size: 1.1rem; font-weight: 800; color: var(--text);
    text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px;
}
.sales-overlay-sub { font-size: 0.85rem; color: var(--muted); margin-bottom: 18px; line-height: 1.45; }
.sales-overlay-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 22px; border-radius: 9px; cursor: pointer;
    border: none; background: var(--red); color: #fff;
    font-size: 0.9rem; font-weight: 800; letter-spacing: 0.02em;
    transition: filter .15s ease;
}
.sales-overlay-btn:hover { filter: brightness(1.08); }

/* ═══════════════════════════════════════════════════════════════════════════
   Calendrier de visites (vue commerciale) — planning hebdo perso.
   Layout FLUIDE : grille auto-fit → 6 colonnes-jour sur desktop, se replie
   toute seule (3 → 1) sur tablette/mobile. Aucune largeur fixe en px.
   ═══════════════════════════════════════════════════════════════════════════ */
.cal-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.cal-nav-btn {
    width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
    border: 1px solid var(--border); background: var(--bg2); color: var(--text);
    font-size: 1.2rem; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.cal-nav-btn:hover { border-color: var(--blue); }
.cal-today-btn {
    padding: 7px 14px; border-radius: 8px; cursor: pointer;
    border: 1px solid var(--border); background: var(--bg2); color: var(--text);
    font-size: 0.82rem; font-weight: 600;
}
.cal-today-btn:hover { border-color: var(--blue); }
.cal-week-label { font-size: 1.05rem; font-weight: 700; margin-left: 6px; min-width: 0; }
.cal-add-btn {
    padding: 9px 16px; border-radius: 8px; cursor: pointer; border: none;
    background: var(--red); color: #fff; font-size: 0.86rem; font-weight: 700;
    transition: filter .15s ease;
}
.cal-add-btn:hover { filter: brightness(1.08); }

/* Agenda horaire. #calGrid = conteneur scrollable (bloque le débordement d'une
   grille horaire qui ne se replie pas) ; en-tête de jours + colonne d'heures
   figées via position:sticky. Les traits de grille = fond commun + gap 1px. */
.cal-grid { overflow: auto; max-height: 76vh; border: 1px solid var(--border); border-radius: 12px; }
.cal-agenda {
    display: grid;
    grid-template-columns: 54px repeat(6, minmax(132px, 1fr));
    min-width: 780px; gap: 1px; background: var(--border);
}
.cal-ag-corner, .cal-ag-colhead, .cal-ag-hour, .cal-ag-cell { background: var(--bg2); }
.cal-ag-corner { position: sticky; top: 0; left: 0; z-index: 4; }
.cal-ag-colhead {
    position: sticky; top: 0; z-index: 3;
    padding: 8px 10px; text-align: center;
    display: flex; flex-direction: column; gap: 1px;
}
.cal-ag-colhead.is-today { background: rgba(74, 144, 217, 0.18); }
.cal-ag-dayname { font-weight: 700; font-size: 0.86rem; }
.cal-ag-daydate { color: var(--muted); font-size: 0.72rem; }
.cal-ag-hour {
    position: sticky; left: 0; z-index: 2;
    padding: 6px; text-align: right; color: var(--muted); font-size: 0.74rem; font-weight: 600;
}
.cal-ag-hour-none { font-size: 0.62rem; line-height: 1.1; text-transform: uppercase; letter-spacing: .02em; }
.cal-ag-cell {
    min-height: 58px; padding: 5px; cursor: pointer;
    display: flex; flex-direction: column; gap: 5px;
}
.cal-ag-cell:hover { background: rgba(74, 144, 217, 0.07); }
.cal-ag-cell.is-today { background: rgba(74, 144, 217, 0.05); }
.cal-ag-cell.is-today:hover { background: rgba(74, 144, 217, 0.11); }

.cal-chip {
    display: flex; align-items: center; gap: 6px; min-width: 0;
    padding: 5px 6px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg);
}
.cal-chip-logo, .cal-pick-logo {
    flex: 0 0 auto; width: 24px; height: 24px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
    background: var(--bg2);
}
.cal-chip-logo img, .cal-pick-logo img { max-width: 22px; max-height: 22px; object-fit: contain; }
.cal-chip-ini { font-weight: 800; font-size: 0.8rem; color: var(--blue); }
.cal-chip-body { min-width: 0; flex: 1; }
.cal-chip-name {
    font-size: 0.78rem; font-weight: 600; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.cal-chip-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cal-chip-hr { font-size: 0.7rem; color: var(--blue); font-weight: 700; }
.cal-chip-ca { font-size: 0.7rem; color: var(--green); font-weight: 700; }
.cal-chip-del {
    flex: 0 0 auto; width: 22px; height: 22px; border-radius: 5px; cursor: pointer;
    border: none; background: transparent; color: var(--muted); font-size: 0.85rem; line-height: 1;
}
.cal-chip-del:hover { background: rgba(196, 30, 58, 0.14); color: var(--red); }

/* Modale d'ajout */
.cal-modal-backdrop {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 120;
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.cal-modal {
    width: min(520px, 96vw); max-height: 90vh; display: flex; flex-direction: column;
    background: var(--bg2); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4); overflow: hidden;
}
.cal-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.cal-modal-title { font-weight: 700; font-size: 1.05rem; }
.cal-modal-close {
    width: 30px; height: 30px; border-radius: 7px; cursor: pointer;
    border: 1px solid var(--border); background: transparent; color: var(--text); font-size: 0.9rem;
}
.cal-modal-body { padding: 16px 18px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.cal-field-lbl { font-size: 0.78rem; color: var(--muted); font-weight: 600; margin-top: 6px; }
.cal-range-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.cal-date-input, .cal-search-input {
    padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg); color: var(--text); font-size: 0.86rem; min-width: 0; flex: 1 1 140px;
}
.cal-client-list {
    display: flex; flex-direction: column; gap: 6px; margin-top: 4px;
    max-height: 46vh; overflow: auto;
}
.cal-pick {
    display: flex; align-items: center; gap: 10px; min-width: 0; text-align: left;
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px;
    background: var(--bg); color: var(--text); cursor: pointer;
}
.cal-pick:hover { border-color: var(--blue); }
.cal-pick-body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.cal-pick-name {
    font-size: 0.86rem; font-weight: 600; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.cal-pick-tiers { font-size: 0.72rem; color: var(--muted); }
.cal-pick-ca { flex: 0 0 auto; font-size: 0.76rem; color: var(--green); font-weight: 700; }
