/* ============================================
   BAZ - Composants partages : boutons, cartes, KPIs, badges, onglets,
   tableaux, formulaires, modales, toasts, etats vides, chargement.
   ============================================ */

/* ── Boutons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.92rem;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}
.btn i { font-size: 1.05rem; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:not(:disabled):hover { background: var(--accent-hover); box-shadow: 0 4px 14px var(--accent-glow); }
.btn-secondary { background: var(--bg-card); color: var(--text-secondary); border-color: var(--border); }
.btn-secondary:not(:disabled):hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--border-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:not(:disabled):hover { background: var(--danger-hover); }
.btn-ghost { background: none; color: var(--text-secondary); }
.btn-ghost:not(:disabled):hover { background: var(--bg-input); color: var(--text-primary); }
.btn-sm { padding: 0.38rem 0.75rem; font-size: 0.82rem; }
.btn-icon { padding: 0.45rem; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ── Cartes ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    min-width: 0;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    /* Hauteur fixe : deux cartes cote a cote alignent leur filet, quel que soit le
       contenu de l'en-tete (badge, pastilles de periode, bouton). */
    min-height: 3.9rem;
    padding: 0.7rem 1.2rem;
    border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 1rem; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 0.5rem; }
.card-header h3 i { color: var(--text-muted); }
.card-body { padding: 1.1rem 1.2rem; }
.card-body.p-0 { padding: 0; }
.card-footer { padding: 0.8rem 1.2rem; border-top: 1px solid var(--border); }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px)  { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ── KPI ── */
.kpi {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.1rem;
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    box-shadow: var(--shadow-sm);
}
.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 1.25rem;
}
.kpi-body { flex: 1; min-width: 0; }
.kpi-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.kpi-value { overflow-wrap: anywhere; font-size: 1.55rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }
.kpi-sub a { color: var(--accent); font-weight: 500; }
.kpi--warn .kpi-icon { background: rgba(217, 119, 6, 0.12); color: var(--orange); }
.kpi--ok .kpi-icon { background: rgba(22, 163, 74, 0.12); color: var(--green); }

/* ── Badges / chips ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.55rem;
    border-radius: 20px;
    font-size: 0.74rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-green  { background: rgba(22, 163, 74, 0.12);  color: var(--green); }
.badge-red    { background: rgba(220, 38, 38, 0.1);   color: var(--red); }
.badge-orange { background: rgba(217, 119, 6, 0.12);  color: var(--orange); }
.badge-blue   { background: rgba(37, 99, 235, 0.1);   color: var(--blue); }
.badge-gray   { background: var(--bg-tertiary);       color: var(--text-muted); }
.badge-accent { background: var(--accent-soft);       color: var(--accent); }
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.12rem 0.45rem;
    border-radius: 6px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    font-size: 0.74rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ── Onglets ── */
.tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.15rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.25rem;
}
.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 0.75rem;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}
.tab-btn i { font-size: 1.05rem; }
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-btn .tab-tag { font-size: 0.62rem; font-weight: 600; color: var(--text-muted); background: var(--bg-tertiary); border-radius: 20px; padding: 0.05rem 0.4rem; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade-in 0.18s ease; }

/* ── Tableaux ── */
/* Tableaux larges (produits d'un canal, journaux) : la barre de defilement horizontale est
   la seule indication honnete qu'il reste des colonnes a droite ; un peu plus haute que
   les 6 px de base.css pour qu'on la voie. */
.table-wrap { overflow-x: auto; }
.table-wrap::-webkit-scrollbar { height: 9px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.table th {
    padding: 0.65rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    white-space: nowrap;
}
.table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover { background: var(--bg-card-hover); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Formulaires ── */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-group { margin-bottom: 1rem; }
.form-grid .form-group { margin-bottom: 0; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.35rem; }
.form-hint { font-size: 0.76rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 0.8rem;
    color: var(--text-primary);
    font-size: 0.92rem;
    outline: none;
    transition: var(--transition);
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-input::placeholder { color: var(--text-muted); }
select.form-input { cursor: pointer; }
.form-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.1rem; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ── Champ de recherche (liste produits, tables marketplace) ── */
.search-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
}
.search-field:focus-within { background: var(--bg-card); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-field i { color: var(--text-muted); }
.search-field input { flex: 1; min-width: 0; border: none; background: none; outline: none; padding: 0.55rem 0; font-size: 0.9rem; color: var(--text-primary); }
.search-field input::-webkit-search-cancel-button { cursor: pointer; }

/* ── Callouts ── */
.callout {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    padding: 0.8rem 1rem;
    border-radius: var(--radius);
    background: var(--bg-input);
    border: 1px solid var(--border);
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}
.callout i { font-size: 1.15rem; margin-top: 0.05rem; }
.callout--info  { background: rgba(37, 99, 235, 0.06); border-color: rgba(37, 99, 235, 0.2); }
.callout--info i { color: var(--blue); }
.callout--warn  { background: rgba(217, 119, 6, 0.07); border-color: rgba(217, 119, 6, 0.25); }
.callout--warn i { color: var(--orange); }
.callout--ok    { background: rgba(22, 163, 74, 0.06); border-color: rgba(22, 163, 74, 0.22); }
.callout--ok i { color: var(--green); }

.error-card { width: 100%; max-width: 560px; margin: 3rem auto; }

/* ── Modales (ZBOX.modal / ZBOX.confirm) ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 40, 0.4);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.12s ease;
}
.modal-overlay.open { opacity: 1; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: translateY(8px) scale(0.98);
    transition: transform 0.14s cubic-bezier(.2, .9, .3, 1);
}
.modal-overlay.open .modal { transform: none; }
.modal-lg { max-width: 820px; }
/* Modale de travail (modification d'une fiche) : on occupe l'ecran large au lieu d'une
   colonne etroite au milieu, pour voir le formulaire, la galerie et l'aide en meme temps. */
.modal-xl { max-width: min(1480px, 96vw); max-height: 94vh; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.35rem; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1.05rem; color: var(--text-primary); display: flex; align-items: center; gap: 0.5rem; }
.modal-close { width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--bg-input); cursor: pointer; display: grid; place-items: center; color: var(--text-secondary); }
.modal-close:hover { background: var(--border); color: var(--text-primary); }
.modal-body { padding: 1.35rem; overflow-y: auto; }
.modal-footer { padding: 0.9rem 1.35rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 0.5rem; }

/* ── Toasts ── */
#zbox-toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: min(420px, calc(100vw - 2rem));
    pointer-events: none;
}
#zbox-toast-container .toast {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    background: var(--text-primary);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    cursor: pointer;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.2s, transform 0.2s;
}
#zbox-toast-container .toast.show { opacity: 1; transform: none; }
#zbox-toast-container .toast.success { background: var(--success); }
#zbox-toast-container .toast.error { background: var(--danger); }
#zbox-toast-container .toast.warning { background: var(--warning); }

/* ── Etat vide (RenderEmptyState / ZBOX.emptyState) ── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
}
.empty-state-icon {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent);
    margin-bottom: 1rem;
}
.empty-state-icon i { font-size: 2rem; }
.empty-state-title { font-size: 1.05rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.35rem; }
.empty-state-message { font-size: 0.9rem; color: var(--text-muted); max-width: 460px; margin-bottom: 1.1rem; line-height: 1.55; }
.empty-state.compact { padding: 1.5rem 1rem; }
.empty-state.compact .empty-state-icon { width: 52px; height: 52px; }
.empty-state.compact .empty-state-icon i { font-size: 1.4rem; }

/* ── Chargement ── */
.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 2rem auto;
}
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-tertiary) 37%, var(--bg-input) 63%);
    background-size: 400% 100%;
    animation: skeleton 1.3s ease infinite;
    border-radius: 6px;
}

/* ── Pagination ── */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.82rem; color: var(--text-muted); }
.pager-pos { padding: 0 0.4rem; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
/* align-items : sans lui, « 1 / 1 » restait collé en haut, plus haut que les boutons (01/10/2026). */
.pager-btns { display: flex; align-items: center; gap: 0.25rem; }
.pager button {
    min-width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    color: var(--text-secondary);
}
.pager button:disabled { opacity: 0.45; cursor: default; }
.pager button:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }

/* ── Grille "ajouter une marketplace" (modale) ── */
.mp-pick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.mp-pick {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    transition: var(--transition);
}
.mp-pick:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.mp-pick-logo { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; color: #fff; font-size: 1.35rem; }
.mp-pick-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.mp-pick-text strong { color: var(--text-primary); font-size: 0.95rem; }
.mp-pick-text small { color: var(--text-muted); font-size: 0.76rem; }
@media (max-width: 560px) { .mp-pick-grid { grid-template-columns: 1fr; } }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ── Mise en page liste + detail (Logistique, Messagerie) ── */
.pane-layout { display: grid; grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); gap: 1rem; height: calc(100vh - var(--topbar-height) - 15rem); min-height: 520px; }
.pane-list, .pane-detail { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-height: 0; }
.pane-list { display: flex; flex-direction: column; overflow: hidden; align-self: start; max-height: 100%; }
.pane-list-head { display: flex; flex-direction: column; gap: 0.55rem; padding: 0.85rem; border-bottom: 1px solid var(--border); }
.pane-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.pane-items { flex: 1; min-height: 0; overflow-y: auto; padding: 0.35rem; }
.pane-foot { padding: 0.55rem 0.8rem; border-top: 1px solid var(--border); }
.pane-item { display: flex; align-items: center; gap: 0.65rem; width: 100%; padding: 0.6rem; border: 1px solid transparent; border-radius: var(--radius); background: none; text-align: left; cursor: pointer; }
.pane-item:hover { background: var(--bg-card-hover); }
.pane-item.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 28%, transparent); }
.pane-item.is-unread .pane-item-title { font-weight: 700; }
.pane-item-main { flex: 1; min-width: 0; }
.pane-item-title { display: block; font-size: 0.86rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.pane-item-meta { display: block; font-size: 0.75rem; color: var(--text-muted); margin-top: 0.12rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pane-item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; flex-shrink: 0; }
.pane-item-side small { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; }
.pane-item-side small.is-late { color: var(--red); font-weight: 600; }
.pane-item-price { font-size: 0.84rem; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.pane-detail { overflow-y: auto; container-type: inline-size; }
.pane-detail > .empty-state { min-height: 100%; }
.pane-detail-inner { padding: 1.3rem 1.4rem 1.8rem; }
.msg-kpis .kpi, .log-kpis .kpi { padding: 0.7rem 0.9rem; box-shadow: none; }
.msg-kpis .kpi-value, .log-kpis .kpi-value { font-size: 1.35rem; }
.msg-kpis .kpi-body, .log-kpis .kpi-body { display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.8rem; align-items: center; }
.msg-kpis .kpi-sub, .log-kpis .kpi-sub { grid-column: 1 / -1; }
.pane-back { display: none; margin-bottom: 0.7rem; }
.ch-dot { width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 0.95rem; }
@media (max-width: 900px) {
    .pane-layout { grid-template-columns: 1fr; height: auto; }
    .pane-layout.has-selection .pane-list { display: none; }
    .pane-layout:not(.has-selection) .pane-detail { display: none; }
    .pane-back { display: inline-flex; }
    .pane-items { max-height: 70vh; }
}

/* ── Taches de fond : barre de progression, pastille de la topbar, panneau ── */
.progress { height: 6px; border-radius: 6px; background: var(--bg-input); overflow: hidden; position: relative; }
.progress > span { display: block; height: 100%; border-radius: 6px; background: var(--accent); transition: width 0.4s ease; }
.progress.is-done > span { background: var(--green); }
.progress.is-failed > span { background: var(--red); }
.progress.is-indeterminate > span { position: absolute; animation: progress-slide 1.2s ease-in-out infinite; }
@keyframes progress-slide { 0% { left: -35%; } 100% { left: 100%; } }

.jobs-chip {
    display: inline-flex; align-items: center; gap: 0.4rem; max-width: 280px;
    padding: 0.35rem 0.75rem; margin-right: 0.6rem; border-radius: 20px;
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    background: var(--accent-soft); color: var(--accent); font-size: 0.78rem; font-weight: 600; cursor: pointer;
}
.jobs-chip[hidden] { display: none; }
.jobs-chip i { animation: spin 1s linear infinite; }
.jobs-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jobs-panel { list-style: none; display: flex; flex-direction: column; gap: 0.9rem; }
.jobs-panel-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; font-size: 0.88rem; }
.jobs-panel-head strong { flex: 1; }
.jobs-panel p { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.35rem; line-height: 1.5; }

.tab-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 0.3rem; border-radius: 9px; background: var(--accent); color: #fff; font-size: 0.68rem; font-weight: 700; }
.radio-row { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; font-size: 0.86rem; }
.radio-row label, .check-row { display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; font-size: 0.86rem; color: var(--text-secondary); }
.check-row { margin: 0.35rem 0; }
.text-muted { color: var(--text-muted); }

/* ── Puces de filtre (ZBOX.filterChips) et libelle produit sur deux lignes ── */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}
.filter-chip:hover { border-color: var(--border-light); color: var(--text-primary); }
.filter-chip.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent); font-weight: 600; }
.filter-chip span { font-size: 0.74rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.bind-prod { display: flex; flex-direction: column; min-width: 200px; max-width: 320px; }
.bind-prod a { color: var(--text-primary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bind-prod a:hover { color: var(--accent); }
.bind-prod small, .bind-sub { font-size: 0.74rem; color: var(--text-muted); }

/* ── Liste clef / valeur ── */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.4rem 1rem; font-size: 0.85rem; }
.kv dt { color: var(--text-muted); }
.kv dd { color: var(--text-primary); font-weight: 500; overflow-wrap: anywhere; }

/* ============================================
   Briques d'ergonomie communes (refonte du 15/09/2026) : voir docs/patterns/ui.md
   ============================================ */

/* Barre d'outils : recherche + filtres compacts + une seule action principale */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.toolbar .search-field { flex: 1 1 200px; min-width: 160px; max-width: 380px; }
.toolbar-spacer { flex: 1 1 auto; }

/* Filtre compact : remplace une rangee de puces (libelle au-dessus, compteur dans l'option) */
.filter-select { display: inline-flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.filter-select-label { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.filter-select select {
    max-width: 15rem; padding: 0.35rem 1.7rem 0.35rem 0.6rem; font-size: 0.83rem; font-family: inherit;
    color: var(--text-primary); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3e%3cpath d='M6 9l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 0.45rem center; background-size: 0.85rem;
}
.filter-select select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.filter-select.is-active select { border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* Menu « … » des actions secondaires */
.menu-pop {
    position: fixed; z-index: 3500; min-width: min(12rem, calc(100vw - 16px)); max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; padding: 0.3rem; border: 1px solid var(--border);
    border-radius: var(--radius-lg); background: var(--bg-card); box-shadow: var(--shadow-lg, 0 12px 30px rgba(15, 23, 42, 0.14));
}
.menu-item {
    display: flex; align-items: center; gap: 0.55rem; width: 100%; padding: 0.5rem 0.6rem; border: none; border-radius: var(--radius);
    background: none; font: inherit; font-size: 0.85rem; color: var(--text-secondary); text-align: left; cursor: pointer;
}
.menu-item:hover:not(:disabled), .menu-item:focus-visible { background: var(--bg-input); color: var(--text-primary); }
.menu-item:disabled { opacity: 0.5; cursor: not-allowed; }
.menu-item.is-danger { color: var(--red); }
.menu-item.is-danger:hover { background: rgba(220, 38, 38, 0.08); }
.menu-item i { font-size: 1rem; }
.menu-sep { height: 1px; margin: 0.25rem 0; background: var(--border); }

/* Confirmation : recapitulatif, avertissement irreversible, verrou de saisie */
.confirm-body { font-size: 0.9rem; line-height: 1.55; color: var(--text-secondary); }
.confirm-body strong { color: var(--text-primary); }
.confirm-list { list-style: none; margin: 0.7rem 0 0; padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-input); }
.confirm-list li { display: flex; gap: 0.5rem; padding: 0.15rem 0; font-size: 0.84rem; }
.confirm-list li::before { content: "•"; color: var(--text-muted); }
.confirm-message { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 40vh; overflow-y: auto; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-input); }
.form-section { border: 1px solid var(--border); border-radius: var(--radius); margin: 0.8rem 0; }
.form-section > summary { padding: 0.7rem 0.9rem; cursor: pointer; font-weight: 600; color: var(--text-secondary); }
.form-section > .form-grid { padding: 0.5rem 0.9rem; }
.confirm-warn { display: flex; align-items: flex-start; gap: 0.5rem; margin-top: 0.8rem; padding: 0.6rem 0.75rem; border-radius: var(--radius);
    background: rgba(220, 38, 38, 0.07); border: 1px solid rgba(220, 38, 38, 0.25); color: var(--red); font-size: 0.85rem; font-weight: 500; }
.confirm-lock { margin-top: 0.9rem; }
.confirm-lock label { display: block; margin-bottom: 0.3rem; font-size: 0.83rem; color: var(--text-secondary); }
.confirm-lock .form-input { font-family: var(--font-mono, monospace); letter-spacing: 0.04em; }

/* Chiffre d'un indicateur qui appelle une action (a expedier en retard, erreurs...) */
.kpi-alert { color: var(--red); font-weight: 600; }

/* Langue : drapeau + libelle */
.lang-pick { display: inline-flex; align-items: center; gap: 0.35rem; }
.lang-flag { font-size: 1.05rem; line-height: 1; }

/* Drapeau dessine (ZBOX.flag) : Windows n'affiche pas les emoji drapeaux. */
.flag-ic {
    display: inline-block; width: 1.15em; height: 0.86em; vertical-align: -0.12em; border-radius: 2px; overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.18); background: var(--bg-input); flex-shrink: 0;
}
.flag-ic svg { display: block; width: 100%; height: 100%; }
.flag-ic--code {
    width: auto; min-width: 1.6em; height: auto; padding: 0 0.22em; font-size: 0.66em; font-weight: 700; line-height: 1.5;
    text-align: center; color: var(--text-secondary); letter-spacing: 0.02em;
}
.lang-badge { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.1rem 0.45rem; border-radius: 999px;
    background: var(--bg-input); border: 1px solid var(--border); font-size: 0.74rem; color: var(--text-secondary); }

@media (max-width: 760px) {
    .filter-select select { max-width: none; width: 100%; }
    .filter-select { flex: 1 1 8rem; }
}

/* ── Cellule produit : vignette + titre ──────────────────────────────────────
   Brique commune a toutes les listes de produits (catalogue, marketplaces,
   prix & stock, variantes, publication). La vignette vient du proxy d'images
   (ZBOX.img) ; .off-noimg est le meme glyphe neutre quand il n'y a pas d'image. */
.off-prod { display: flex; align-items: center; gap: 0.6rem; min-width: 220px; max-width: 290px; }
.off-prod img, .off-noimg { width: 36px; height: 36px; flex-shrink: 0; border-radius: 7px; border: 1px solid var(--border); background: #fff; object-fit: contain; }
.off-noimg { display: grid; place-items: center; color: var(--text-muted); }

@media (max-width: 640px) {
    .msg-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; }
    .log-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem; }
    .msg-kpis .kpi, .log-kpis .kpi { padding: 0.6rem; }
    .msg-kpis .kpi-icon, .log-kpis .kpi-icon, .msg-kpis .kpi-sub, .log-kpis .kpi-sub { display: none; }
    .msg-kpis .kpi-body, .log-kpis .kpi-body { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; }
    .msg-kpis .kpi-label, .log-kpis .kpi-label { font-size: 0.75rem; }
    .pane-detail-inner { padding: 1rem; }
    .btn, .filter-select select, .menu-item { min-height: 36px; }
}
/* Listes bornées et détails de ligne : les informations secondaires se déplient à la demande. */
.list-retry { display: flex; justify-content: center; padding: 0 1rem 1.25rem; }
.table-detail-action { width: 1%; white-space: nowrap; }
.table-detail-row > td { background: var(--bg-secondary); white-space: normal; }
.table-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 1rem; margin: 0; }
.table-detail-grid dt { color: var(--text-muted); font-size: .75rem; margin-bottom: .35rem; }
.table-detail-grid dd { margin: 0; overflow-wrap: anywhere; white-space: normal; }
.table-detail-grid .mp-log-payload { white-space: pre-wrap; max-width: none; overflow: visible; text-overflow: clip; }
.table-compact .bind-prod { min-width: 10rem; }

/* Fiche produit en fenetre (ZBOX.productModal) */
.modal-product .modal-body { padding: 0; overflow: hidden; }
.product-modal-frame { display: block; width: 100%; height: min(84vh, 980px); border: 0; background: var(--bg-card); }
.bind-sub.bind-refusal { color: var(--red); white-space: normal; max-width: 240px; line-height: 1.3; margin-top: 0.15rem; }

/* ── Exclusions de marques : liste unique et fenetre partagee (stock-exclusions.js, 05/10/2026) ── */
.sx-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.sx-head h4 { font-size: 0.9rem; display: flex; align-items: center; gap: 0.4rem; margin: 0; }
.sx-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.sx-chip { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 0.15rem 0.5rem; padding: 0.4rem 0.7rem; border: 1px solid var(--border);
           border-radius: var(--radius); background: var(--bg-card); color: var(--text-primary); font: inherit; font-size: 0.83rem; text-align: left; max-width: 100%; }
button.sx-chip { cursor: pointer; transition: var(--transition); }
button.sx-chip:hover, button.sx-chip:focus-visible { border-color: var(--accent-light); background: var(--accent-softer); }
.sx-chip strong { overflow-wrap: anywhere; }
.sx-chip-count { color: var(--text-secondary); font-size: 0.78rem; }
.sx-chip-tag { color: var(--text-muted); font-size: 0.74rem; }
.sx-chip.is-unknown { border-style: dashed; border-color: var(--orange); }
.sx-muted { color: var(--text-muted); font-size: 0.8rem; }
.sx-other { font-size: 0.82rem; color: var(--text-secondary); margin: 0.7rem 0 0; line-height: 1.6; }
.sx-empty { font-size: 0.84rem; color: var(--text-secondary); margin: 0.3rem 0; }
.sx-results { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow: auto; }
.sx-res { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.6rem; width: 100%; padding: 0.5rem 0.65rem; border: 1px solid var(--border);
          border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text-primary); font: inherit; font-size: 0.85rem; text-align: left; cursor: pointer; }
.sx-res:hover, .sx-res:focus-visible { border-color: var(--accent-light); background: var(--accent-softer); }
.sx-res span { color: var(--text-secondary); font-size: 0.79rem; }
.sx-res .badge { margin-left: auto; }
.sx-picked-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.7rem; }
.sx-channels { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem 0.8rem; margin: 0 0 0.6rem; }
.sx-channels legend { font-size: 0.85rem; font-weight: 600; padding: 0 0.3rem; }
.sx-channels .check-row { display: flex; align-items: baseline; gap: 0.5rem; }

/* ZBOX.categoryPicker (category-picker.js) : recherche dans l'arbre des categories du site. Liste dans le flux
   (pas en surimpression) : une modale qui defile ne la coupe pas. */
.cat-picker { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.cat-picker-list {
    list-style: none; margin: 0; padding: 0.25rem; max-height: 15rem; overflow-y: auto;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card);
}
.cat-picker-opt {
    display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem;
    padding: 0.4rem 0.55rem; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.84rem;
}
.cat-picker-opt small { flex-shrink: 0; color: var(--text-muted); font-size: 0.75rem; }
.cat-picker-opt:hover, .cat-picker-opt.is-active { background: var(--bg-input); }
.cat-picker-opt.is-selected { color: var(--accent); }
.cat-picker-opt.is-new { color: var(--accent); }
.cat-picker-path { min-width: 0; overflow-wrap: anywhere; }
.cat-picker-parent { color: var(--text-muted); }
.cat-picker-more { padding: 0.4rem 0.55rem; font-size: 0.78rem; color: var(--text-muted); }
.cat-picker-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.cat-picker-chips:empty { display: none; }
.cat-picker-chip { max-width: 100%; overflow-wrap: anywhere; }
.cat-picker-x { border: none; background: none; padding: 0; color: var(--text-muted); cursor: pointer; line-height: 1; }
.cat-picker-x:hover { color: var(--red); }
.cat-picker-state { color: var(--text-muted); font-size: 0.78rem; }
.cat-picker-state:empty { display: none; }
.cat-picker-warn { color: var(--orange); }

/* Courbes des produits en ligne par canal (08/10/2026, ChannelStats_Functions.php) : lignes en SVG etire (traits non
   deformes), points en pastilles HTML placees en % (toujours rondes), graduations a gauche. */
.cs-grid-row { margin-top: 16px; }
.cs-grid-one { grid-template-columns: 1fr; }
.cs-wrap { width: 100%; }
.cs-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; font-size: 13px; color: var(--text-secondary); }
.cs-leg strong { color: var(--text-primary); margin-left: 2px; }
.cs-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.cs-plot { position: relative; height: 180px; margin-left: 52px; }
.cs-chart { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.cs-grid { stroke: var(--border-light); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.cs-grid.cs-base { stroke: var(--border); stroke-dasharray: none; }
.cs-ylab { position: absolute; right: calc(100% + 8px); transform: translateY(-50%); font-size: 11px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cs-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.cs-area { stroke: none; opacity: .10; }
.cs-pt { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; border: 2px solid var(--bg-card); box-sizing: content-box; transform: translate(-2px, -2px); cursor: default; transition: transform .12s; }
.cs-pt:hover { transform: translate(-2px, -2px) scale(1.5); }
.cs-c1 { stroke: var(--accent); } .cs-pt.cs-c1, .cs-swatch.cs-c1 { background: var(--accent); } .cs-area.cs-c1 { fill: var(--accent); }
.cs-c2 { stroke: var(--success); } .cs-pt.cs-c2, .cs-swatch.cs-c2 { background: var(--success); } .cs-area.cs-c2 { fill: var(--success); }
.cs-c3 { stroke: var(--danger); } .cs-pt.cs-c3, .cs-swatch.cs-c3 { background: var(--danger); } .cs-area.cs-c3 { fill: var(--danger); }
.cs-c4 { stroke: var(--warning); } .cs-pt.cs-c4, .cs-swatch.cs-c4 { background: var(--warning); } .cs-area.cs-c4 { fill: var(--warning); }
.cs-c5 { stroke: var(--blue); } .cs-pt.cs-c5, .cs-swatch.cs-c5 { background: var(--blue); } .cs-area.cs-c5 { fill: var(--blue); }
.cs-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin: 6px 0 0 52px; }
.cs-single { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; padding: 14px 16px; border-radius: var(--radius); background: var(--bg-secondary); color: var(--text-secondary); font-size: 13px; }
