/* ── 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(--blue); }
.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(--blue); }
/* 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: var(--shadow-lg);
    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;
}

