/*
 * Kit d'UI de GESTION du back-office boutique (réutilisable).
 * Scope   : conteneur .bm (commandes d'abord, puis dashboard/gammes).
 * Charge  : via {% block admin_head %}.
 * Langage : même univers que l'éditeur produit (.pe) — papier chaud neutre,
 *   données en JetBrains Mono, Poppins, aucun serif, dense et limpide.
 *   Les inputs globaux d'admin.css (serif crème !important) sont battus ici
 *   par .bm + !important.
 */

.bm {
    --bm-ground: #f6f2ea;
    --bm-surface: #fffdf9;
    --bm-ink: #211c17;
    --bm-ink-soft: #574e40;
    --bm-muted: #8f836c;
    --bm-line: #e8e1d3;
    --bm-line-soft: #f2ecde;
    --bm-field: #ffffff;
    --bm-accent: #926e3c;
    --bm-accent-ink: #6f5326;
    --bm-wash: #f7f1e6;
    --bm-radius: 12px;
    --bm-shadow: 0 1px 2px rgba(33, 28, 23, 0.04), 0 8px 24px rgba(33, 28, 23, 0.045);
    font-family: "Poppins", system-ui, sans-serif;
    color: var(--bm-ink);
    font-size: 0.85rem;
}
.bm-mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* En-tête */
.bm-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 1.15rem; }
.bm-back { font-size: 0.72rem; color: var(--bm-muted); text-decoration: none; display: inline-flex; align-items: center; gap: 0.35rem; }
.bm-back:hover { color: var(--bm-ink); }
.bm-eyebrow { font-size: 0.6rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--bm-accent-ink); }
.bm-h1 { font-size: 1.45rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.12; margin-top: 0.2rem; color: var(--bm-ink); }
.bm-h1.bm-mono { font-size: 1.3rem; }
.bm-sub { font-size: 0.78rem; color: var(--bm-muted); margin-top: 0.25rem; }
.bm-actions-inline { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* Barre d'outils */
.bm-toolbar { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.bm-spacer { flex: 1; }
.bm-search { position: relative; }
.bm-search input { width: 260px; box-sizing: border-box; padding: 0.5rem 0.7rem 0.5rem 2rem !important; font-family: "Poppins", sans-serif !important; font-size: 0.8rem !important; background: var(--bm-surface) !important; border: 1px solid var(--bm-line) !important; border-radius: 9px !important; color: var(--bm-ink) !important; outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.bm-search input:focus { border-color: var(--bm-accent) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--bm-accent) 15%, transparent) !important; }
.bm-search i { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); font-size: 0.72rem; color: var(--bm-muted); }
.bm-select { padding: 0.5rem 0.7rem !important; font-family: "Poppins", sans-serif !important; font-size: 0.8rem !important; background: var(--bm-surface) !important; border: 1px solid var(--bm-line) !important; border-radius: 9px !important; color: var(--bm-ink) !important; cursor: pointer; outline: none; }
.bm-select:focus { border-color: var(--bm-accent) !important; }
.bm-chip { padding: 0.35rem 0.7rem; font-size: 0.75rem; font-weight: 500; background: var(--bm-surface); border: 1px solid var(--bm-line); border-radius: 999px; color: var(--bm-ink-soft); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 0.35rem; transition: all 0.14s; white-space: nowrap; }
.bm-chip:hover { border-color: var(--bm-accent-line, #d8cdb6); }
.bm-chip .n { font-size: 0.66rem; color: var(--bm-muted); font-family: "JetBrains Mono", monospace; }
.bm-chip.active { background: var(--bm-ink); border-color: var(--bm-ink); color: #fff; }
.bm-chip.active .n { color: rgba(255,255,255,0.7); }

/* Panneau tableau */
.bm-panel { background: var(--bm-surface); border: 1px solid var(--bm-line); border-radius: var(--bm-radius); box-shadow: var(--bm-shadow); overflow: hidden; }
.bm-table { width: 100%; border-collapse: collapse; }
.bm-table th { text-align: left; font-size: 0.66rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--bm-muted); padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--bm-line); white-space: nowrap; }
.bm-table td { padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--bm-line-soft); font-size: 0.8rem; color: var(--bm-ink); vertical-align: middle; }
.bm-table tbody tr:last-child td { border-bottom: none; }
.bm-table tbody tr { transition: background 0.12s; }
.bm-table tbody tr:hover { background: var(--bm-wash); }
.bm-table .num { text-align: right; }
.bm-table .ctr { text-align: center; }
.bm-t-strong { font-weight: 600; color: var(--bm-ink); text-decoration: none; }
.bm-t-strong:hover { color: var(--bm-accent-ink); }
.bm-t-sub { font-size: 0.7rem; color: var(--bm-muted); }

.th-sort { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--bm-muted); text-decoration: none; }
.th-sort:hover { color: var(--bm-ink); }
.th-sort i { font-size: 0.6rem; opacity: 0.35; }
.th-sort.active { color: var(--bm-ink); }
.th-sort.active i { opacity: 1; color: var(--bm-accent); }

/* Pastilles de statut */
.bm-st { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.7rem; font-weight: 600; padding: 0.18rem 0.55rem 0.18rem 0.45rem; border-radius: 999px; white-space: nowrap; }
.bm-st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.bm-st-en_attente_paiement { color: #9a6a12; background: rgba(196, 140, 30, 0.12); }
.bm-st-payee { color: #2f7d4f; background: rgba(47, 125, 79, 0.12); }
.bm-st-en_preparation { color: #2563a8; background: rgba(37, 99, 168, 0.11); }
.bm-st-expediee { color: #5a49b8; background: rgba(90, 73, 184, 0.11); }
.bm-st-livree { color: #1f6b46; background: rgba(31, 107, 70, 0.13); }
.bm-st-annulee { color: #7a6f5c; background: rgba(122, 111, 92, 0.14); }
.bm-st-remboursee { color: #b0392b; background: rgba(176, 57, 43, 0.1); }
.bm-st-nouveau { color: #9a6a12; background: rgba(196, 140, 30, 0.12); }
.bm-st-en_cours { color: #2563a8; background: rgba(37, 99, 168, 0.11); }
.bm-st-resolu { color: #2f7d4f; background: rgba(47, 125, 79, 0.12); }

/* Ligne non lue (boîte support) */
.bm-table tr.unread td { background: color-mix(in srgb, var(--bm-accent) 5%, var(--bm-surface)); }
.bm-table tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--bm-accent); }

/* ── File de traitement (pipeline de commandes) ───────────────────────────── */
.bm-pipe { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.55rem; margin-bottom: 1rem; }
@media (max-width: 900px) { .bm-pipe { grid-template-columns: repeat(2, 1fr); } }
.bm-pipe-seg {
    position: relative; display: flex; flex-direction: column; gap: 0.1rem;
    padding: 0.6rem 0.8rem 0.55rem; background: var(--bm-surface);
    border: 1px solid var(--bm-line); border-top: 3px solid var(--seg, var(--bm-line));
    border-radius: 10px; text-decoration: none; box-shadow: var(--bm-shadow);
    transition: border-color 0.15s, transform 0.15s;
}
.bm-pipe-seg:hover { border-color: var(--seg, var(--bm-accent)); transform: translateY(-1px); }
.bm-pipe-seg .n { font-family: "JetBrains Mono", monospace; font-size: 1.15rem; font-weight: 700; color: var(--bm-ink); line-height: 1.1; }
.bm-pipe-seg .l { font-size: 0.64rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--bm-muted); }
.bm-pipe-seg .ic { position: absolute; top: 0.55rem; right: 0.7rem; font-size: 0.82rem; color: var(--seg, var(--bm-muted)); }
.bm-pipe-seg.active { background: var(--bm-ink); border-color: var(--bm-ink); border-top-color: var(--seg, var(--bm-ink)); }
.bm-pipe-seg.active .n { color: #fff; }
.bm-pipe-seg.active .l { color: rgba(255, 255, 255, 0.65); }
.bm-pipe-seg.active .ic { color: var(--seg, #fff); }
.bm-pipe-seg.empty .n { color: var(--bm-muted); font-weight: 500; }

/* Case de sélection de ligne */
.bm-rowcheck { appearance: none; -webkit-appearance: none; width: 16px !important; height: 16px !important; min-width: 16px; margin: 0 !important; padding: 0 !important; border: 1px solid var(--bm-line) !important; border-radius: 5px !important; background: #fff !important; position: relative; cursor: pointer; box-shadow: none !important; vertical-align: middle; transition: background 0.14s, border-color 0.14s; }
.bm-rowcheck::after { content: "\2713"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; opacity: 0; }
.bm-rowcheck:checked { background: var(--bm-accent) !important; border-color: var(--bm-accent) !important; }
.bm-rowcheck:checked::after { opacity: 1; }
.bm-table tr.selected td { background: color-mix(in srgb, var(--bm-accent) 7%, var(--bm-surface)); }

/* Bouton icône (avance rapide, ligne) */
.bm-iconbtn { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--bm-line); background: var(--bm-surface); color: var(--bm-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 0.74rem; text-decoration: none; transition: all 0.14s; }
.bm-iconbtn:hover { border-color: var(--bm-accent); color: var(--bm-accent-ink); background: var(--bm-wash); }

/* Indicateur de paiement */
.bm-pay { font-size: 0.76rem; }
.bm-pay.ok { color: #2f7d4f; }
.bm-pay.ko { color: #c48c1e; }

/* Cartes */
.bm-card { background: var(--bm-surface); border: 1px solid var(--bm-line); border-radius: var(--bm-radius); box-shadow: var(--bm-shadow); margin-bottom: 1rem; overflow: hidden; }
.bm-card-h { display: flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1rem; border-bottom: 1px solid var(--bm-line-soft); }
.bm-card-h i { color: var(--bm-accent); font-size: 0.8rem; }
.bm-card-title { font-size: 0.8rem; font-weight: 600; color: var(--bm-ink); }
.bm-card-b { padding: 0.9rem 1rem; }
.bm-card-b.flush { padding: 0; }

/* Clé / valeur */
.bm-kv { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; padding: 0.3rem 0; }
.bm-kv dt { font-size: 0.76rem; color: var(--bm-muted); }
.bm-kv dd { font-size: 0.82rem; color: var(--bm-ink); text-align: right; }
.bm-kv.total { border-top: 1px solid var(--bm-line); margin-top: 0.3rem; padding-top: 0.55rem; }
.bm-kv.total dt { font-weight: 600; color: var(--bm-ink); }
.bm-kv.total dd { font-weight: 700; font-size: 1rem; }
.bm-kv.faint dt, .bm-kv.faint dd { font-size: 0.72rem; color: var(--bm-muted); }
.bm-kv.discount dd { color: var(--bm-accent-ink); }

.bm-addr { font-size: 0.82rem; line-height: 1.55; color: var(--bm-ink-soft); }
.bm-addr b { color: var(--bm-ink); font-weight: 600; }

/* Timeline de statut */
.bm-timeline { list-style: none; margin: 0; padding: 0; }
.bm-tl { position: relative; padding: 0 0 0.9rem 1.5rem; }
.bm-tl:last-child { padding-bottom: 0; }
.bm-tl::before { content: ""; position: absolute; left: 5px; top: 3px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--bm-line); background: var(--bm-surface); }
.bm-tl::after { content: ""; position: absolute; left: 9px; top: 14px; bottom: 0; width: 1px; background: var(--bm-line); }
.bm-tl:last-child::after { display: none; }
.bm-tl.done::before { border-color: var(--bm-accent); background: var(--bm-accent); }
.bm-tl.current::before { border-color: var(--bm-accent); background: var(--bm-surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bm-accent) 20%, transparent); }
.bm-tl.cancel::before { border-color: #b0392b; background: #b0392b; }
.bm-tl-l { font-size: 0.8rem; font-weight: 500; color: var(--bm-ink); }
.bm-tl.pending .bm-tl-l { color: var(--bm-muted); font-weight: 400; }
.bm-tl-d { font-size: 0.7rem; color: var(--bm-muted); }

/* Champs (override serif global) */
.bm label { display: block; margin-bottom: 0.3rem; font-family: "Poppins", sans-serif !important; font-size: 0.72rem !important; font-weight: 500; letter-spacing: 0 !important; text-transform: none !important; color: var(--bm-ink-soft) !important; }
.bm input[type="text"], .bm input[type="url"], .bm input[type="email"], .bm input[type="number"], .bm textarea, .bm select {
    width: 100% !important; padding: 0.5rem 0.65rem !important; background: var(--bm-field) !important; border: 1px solid var(--bm-line) !important; border-radius: 8px !important; color: var(--bm-ink) !important; font-family: "Poppins", sans-serif !important; font-size: 0.82rem !important; line-height: 1.4 !important; box-shadow: none !important; transition: border-color 0.15s, box-shadow 0.15s !important;
}
.bm input:focus, .bm textarea:focus, .bm select:focus { border-color: var(--bm-accent) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--bm-accent) 15%, transparent) !important; }
.bm textarea { min-height: 4rem; resize: vertical; }
.bm small { display: block; margin-top: 0.25rem; font-family: "Poppins", sans-serif !important; font-size: 0.7rem !important; color: var(--bm-muted) !important; letter-spacing: 0; text-transform: none; }
.bm-field + .bm-field { margin-top: 0.7rem; }

.bm-check { display: inline-flex !important; align-items: center; gap: 0.5rem; margin-bottom: 0; font-size: 0.78rem !important; color: var(--bm-ink) !important; cursor: pointer; user-select: none; }
.bm-check input[type="checkbox"] { appearance: none; -webkit-appearance: none; flex: 0 0 auto; width: 16px !important; height: 16px !important; min-width: 16px; margin: 0 !important; padding: 0 !important; border: 1px solid var(--bm-line) !important; border-radius: 5px !important; background: #fff !important; position: relative; cursor: pointer; box-shadow: none !important; transition: background 0.14s, border-color 0.14s; }
.bm-check input[type="checkbox"]::after { content: "\2713"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; opacity: 0; transition: opacity 0.14s; }
.bm-check input[type="checkbox"]:checked { background: var(--bm-accent) !important; border-color: var(--bm-accent) !important; }
.bm-check input[type="checkbox"]:checked::after { opacity: 1; }

/* Boutons */
.bm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; padding: 0.55rem 0.95rem; border-radius: 9px; border: 1px solid transparent; font-family: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: all 0.15s; }
.bm-btn.w { width: 100%; }
.bm-btn i { font-size: 0.76rem; }
.bm-btn-accent { background: var(--bm-accent); color: #fff; box-shadow: 0 2px 8px color-mix(in srgb, var(--bm-accent) 30%, transparent); }
.bm-btn-accent:hover { filter: brightness(0.94); }
.bm-btn-dark { background: var(--bm-ink); color: #fff; }
.bm-btn-dark:hover { background: #000; }
.bm-btn-ghost { background: var(--bm-surface); color: var(--bm-ink-soft); border-color: var(--bm-line); }
.bm-btn-ghost:hover { border-color: var(--bm-accent); color: var(--bm-ink); }
.bm-btn-danger { background: var(--bm-surface); color: #b0392b; border-color: color-mix(in srgb, #b0392b 30%, var(--bm-line)); }
.bm-btn-danger:hover { background: #fdf3f1; border-color: #b0392b; }
.bm-btn-sm { padding: 0.4rem 0.7rem; font-size: 0.76rem; }

.bm-hint { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.7rem 0.85rem; margin-bottom: 1rem; background: var(--bm-wash); border: 1px solid color-mix(in srgb, var(--bm-accent) 22%, var(--bm-line)); border-radius: 10px; font-size: 0.78rem; color: var(--bm-accent-ink); line-height: 1.45; }
.bm-hint i { margin-top: 1px; }

.bm-empty { text-align: center; padding: 3.5rem 1rem; color: var(--bm-muted); }
.bm-empty-ic { display: block; margin: 0 auto 0.9rem; font-size: 1.6rem; color: #d8cdb6; }
.bm-pager { display: flex; align-items: center; justify-content: center; gap: 0.4rem; margin-top: 1rem; font-size: 0.78rem; color: var(--bm-muted); }
.bm-pager .pg { min-width: 30px; height: 30px; padding: 0 0.4rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid var(--bm-line); background: var(--bm-surface); color: var(--bm-ink-soft); text-decoration: none; font-size: 0.74rem; transition: all 0.14s; }
.bm-pager a.pg:hover { border-color: var(--bm-accent); color: var(--bm-ink); }
.bm-pager .pg.active { background: var(--bm-ink); border-color: var(--bm-ink); color: #fff; }
.bm-pager .gap { color: var(--bm-muted); padding: 0 0.15rem; }

.bm-cols { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 1.25rem; align-items: start; }
@media (max-width: 1024px) { .bm-cols { grid-template-columns: minmax(0, 1fr); } }

/* ══════════════════════════════════════════════════════════════════════════
   Poste de gestion des commandes — v2 (file chaînée, aperçu dépliable)
   ══════════════════════════════════════════════════════════════════════════ */

/* Figures du périmètre filtré (en-tête, à côté de l'export) */
.bm-figures { display: flex; align-items: stretch; gap: 0; border: 1px solid var(--bm-line); border-radius: 10px; background: var(--bm-surface); box-shadow: var(--bm-shadow); overflow: hidden; }
.bm-fig { display: flex; flex-direction: column; gap: 0.05rem; padding: 0.45rem 0.85rem; }
.bm-fig + .bm-fig { border-left: 1px solid var(--bm-line-soft); }
.bm-fig .v { font-size: 0.86rem; font-weight: 700; color: var(--bm-ink); line-height: 1.15; }
.bm-fig .k { font-size: 0.6rem; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; color: var(--bm-muted); }

/* File de traitement : chaînage visuel + âge d'attente + retard */
.bm-pipe-seg { padding-bottom: 0.5rem; }
.bm-pipe .bm-pipe-seg:not(:last-child)::after { content: "\203A"; position: absolute; right: -0.52rem; top: 50%; transform: translateY(-55%); font-size: 1rem; font-weight: 600; color: #c9bda4; z-index: 2; pointer-events: none; }
@media (max-width: 900px) { .bm-pipe .bm-pipe-seg:not(:last-child)::after { display: none; } }
.bm-pipe-seg .age { display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.25rem; font-size: 0.62rem; font-weight: 500; color: var(--bm-muted); }
.bm-pipe-seg .age i { font-size: 0.58rem; }
.bm-pipe-seg .age.hot { color: #b0392b; font-weight: 700; }
.bm-pipe-seg.late { border-color: color-mix(in srgb, #b0392b 30%, var(--bm-line)); }
.bm-pipe-seg.late .ic { animation: bm-late-pulse 2s ease-in-out infinite; }
.bm-pipe-seg.active .age { color: rgba(255, 255, 255, 0.55); }
.bm-pipe-seg.active .age.hot { color: #ff9d8f; }
@keyframes bm-late-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .bm-pipe-seg.late .ic { animation: none; } }

/* Barre d'outils : croix de recherche + plage de dates */
.bm-search-x { position: absolute; right: 0.45rem; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; border: none; border-radius: 6px; background: transparent; color: var(--bm-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.68rem; }
.bm-search-x:hover { background: var(--bm-wash); color: var(--bm-ink); }
.bm-dates { display: inline-flex; align-items: center; gap: 0.3rem; }
.bm-dates .sep { font-size: 0.7rem; color: var(--bm-muted); }
.bm input[type="date"].bm-date { width: auto !important; padding: 0.4rem 0.55rem !important; background: var(--bm-surface) !important; border: 1px solid var(--bm-line) !important; border-radius: 9px !important; color: var(--bm-ink) !important; font-family: "Poppins", sans-serif !important; font-size: 0.74rem !important; cursor: pointer; outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.bm input[type="date"].bm-date:focus { border-color: var(--bm-accent) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--bm-accent) 15%, transparent) !important; }

/* Tableau des commandes : lignes cliquables, retard, badges annexes */
.bm-table-cmd tbody tr.bm-row { cursor: pointer; }
.bm-table tr.bm-row.late td:first-child { box-shadow: inset 3px 0 0 #c48c1e; }
.bm-user-ic { font-size: 0.72rem; color: var(--bm-accent); vertical-align: baseline; }
.bm-remb { color: #b0392b; font-weight: 600; }
.bm-wait { display: inline-flex; align-items: center; gap: 0.28rem; font-size: 0.66rem; color: var(--bm-muted); }
.bm-wait i { font-size: 0.6rem; }
.bm-wait.hot { color: #b0392b; font-weight: 600; }
.bm-x-toggle i { transition: transform 0.18s ease; }
.bm-row.open .bm-x-toggle i { transform: rotate(180deg); }
.bm-row.open td { background: var(--bm-wash); border-bottom-color: transparent; }

/* Aperçu dépliable */
.bm-xrow td { padding: 0; background: color-mix(in srgb, var(--bm-wash) 60%, var(--bm-surface)); border-bottom: 1px solid var(--bm-line); cursor: default; }
.bm-xpanel { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; padding: 1rem 1.2rem 1.1rem; }
@media (max-width: 1024px) { .bm-xpanel { grid-template-columns: 1fr; gap: 1.1rem; } }
.bm-xh { display: flex; align-items: center; gap: 0.45rem; font-size: 0.64rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--bm-muted); margin-bottom: 0.55rem; }
.bm-xh i { color: var(--bm-accent); font-size: 0.7rem; }
.bm-line { display: flex; align-items: baseline; gap: 0.55rem; padding: 0.28rem 0; border-bottom: 1px dashed var(--bm-line-soft); }
.bm-line:last-of-type { border-bottom: none; }
.bm-line .q { flex: 0 0 auto; min-width: 1.9rem; font-size: 0.76rem; font-weight: 600; color: var(--bm-accent-ink); }
.bm-line .p { flex: 1; font-size: 0.8rem; color: var(--bm-ink); }
.bm-line .p .f { display: block; font-size: 0.68rem; color: var(--bm-muted); }
.bm-line .t { flex: 0 0 auto; font-size: 0.78rem; font-weight: 600; color: var(--bm-ink); }
.bm-xtotaux { margin: 0.5rem 0 0; }
.bm-xcontact { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.6rem; font-size: 0.76rem; }
.bm-xcontact a, .bm-xcontact span { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--bm-ink-soft); text-decoration: none; }
.bm-xcontact a:hover { color: var(--bm-accent-ink); }
.bm-xcontact i { font-size: 0.66rem; color: var(--bm-muted); }
.bm-xhist { margin-top: 0.6rem; padding-top: 0.55rem; border-top: 1px dashed var(--bm-line-soft); }
.bm-xhist .e { font-size: 0.7rem; color: var(--bm-ink-soft); padding: 0.12rem 0; }
.bm-xhist .d { color: var(--bm-muted); margin-right: 0.3rem; }
.bm-xhist .by { color: var(--bm-muted); }
.bm-xnote { display: flex; gap: 0.5rem; align-items: flex-start; margin-top: 0.6rem; padding: 0.5rem 0.65rem; background: var(--bm-wash); border: 1px solid color-mix(in srgb, var(--bm-accent) 22%, var(--bm-line)); border-radius: 8px; font-size: 0.72rem; color: var(--bm-accent-ink); line-height: 1.45; }
.bm-xnote i { margin-top: 1px; font-size: 0.68rem; }

/* Barre groupée : total € de la sélection */
.bulk-bar .bulk-total { color: rgba(246, 242, 234, 0.75); font-size: 0.76rem; }

/* Accessibilité : focus clavier visible sur tous les contrôles du kit */
.bm a:focus-visible, .bm button:focus-visible, .bm input:focus-visible {
    outline: 2px solid var(--bm-accent); outline-offset: 2px; border-radius: 6px;
}

/* Recherche : rebat la règle générique .bm input[type="text"] (plus spécifique
   et déclarée plus bas) qui écrasait le dégagement de la loupe et la largeur. */
.bm .bm-search input[type="text"] { width: 260px !important; padding: 0.5rem 0.7rem 0.5rem 2rem !important; }
.bm .bm-search input[type="text"]:has(+ .bm-search-x) { padding-right: 1.9rem !important; }

/* ══════════════════════════════════════════════════════════════════════════
   Poste de gestion des paiements — états financiers, copie d'ID
   ══════════════════════════════════════════════════════════════════════════ */

/* Barre des états financiers : mêmes tuiles que la file, SANS chevrons
   (les états ne sont pas une séquence), avec le montant en jeu par état. */
.bm-cash { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.55rem; margin-bottom: 1rem; }
@media (max-width: 900px) { .bm-cash { grid-template-columns: repeat(2, 1fr); } }
.bm-pipe-seg .eur { margin-top: 0.25rem; font-size: 0.66rem; font-weight: 600; color: var(--bm-ink-soft); }
.bm-pipe-seg.active .eur { color: rgba(255, 255, 255, 0.75); }
.bm-pipe-seg.empty .eur { color: var(--bm-muted); font-weight: 500; }

/* Bouton de copie d'un identifiant (PaymentIntent, Charge) */
.bm-copy { width: 22px; height: 22px; border: none; border-radius: 6px; background: transparent; color: var(--bm-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 0.66rem; vertical-align: middle; transition: all 0.14s; }
.bm-copy:hover { background: var(--bm-wash); color: var(--bm-accent-ink); }
.bm-copy .fa-check { color: #2f7d4f; }

/* Pastille remboursement partiel + variante d'alerte danger */
.bm-st-partiel { color: #2563a8; background: rgba(37, 99, 168, 0.11); }
.bm-hint.danger { border-color: color-mix(in srgb, #b0392b 35%, var(--bm-line)); background: #fdf3f1; color: #8e2e22; }

/* Pousse un élément à droite dans un en-tête de carte */
.bm-push { margin-left: auto; }

/* ── Fiche commande : carte Facturation (Facturation v2) ─────────────────── */
.bm-bar { height: 7px; border-radius: 999px; background: var(--bm-wash); border: 1px solid var(--bm-line-soft); overflow: hidden; margin: 0.5rem 0 0.2rem; }
.bm-bar > span { display: block; height: 100%; background: #2f7d4f; border-radius: 999px; transition: width 0.3s; }
.bm-bar.warn > span { background: #c48c1e; }
.bm-bar.late > span { background: #b0392b; }
.bm-docs { list-style: none; margin: 0; padding: 0; }
.bm-docs li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.15rem 0.6rem; padding: 0.5rem 0; border-bottom: 1px solid var(--bm-line-soft); font-size: 0.76rem; }
.bm-docs li:last-child { border-bottom: none; }
.bm-docs .bm-doc-num { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.bm-docs .bm-doc-num a { font-family: "JetBrains Mono", monospace; font-size: 0.78rem; color: var(--bm-ink); text-decoration: none; }
.bm-docs .bm-doc-num a:hover { color: var(--bm-accent); }
.bm-docs .bm-doc-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; color: var(--bm-muted); font-size: 0.7rem; }
.bm-docs .bm-doc-amt { font-family: "JetBrains Mono", monospace; font-size: 0.78rem; color: var(--bm-ink); text-align: right; white-space: nowrap; }
.bm-docs .bm-doc-amt.neg { color: #b0392b; }
.bm-type { display: inline-flex; align-items: center; padding: 0.1rem 0.45rem; border-radius: 5px; font-size: 0.62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; background: var(--bm-wash); color: var(--bm-ink-soft); border: 1px solid var(--bm-line-soft); }
.bm-type.acompte { color: #2563a8; background: rgba(37, 99, 168, 0.1); border-color: transparent; }
.bm-type.avoir { color: #b0392b; background: rgba(176, 57, 43, 0.1); border-color: transparent; }
.bm-type.solde { color: #5a49b8; background: rgba(90, 73, 184, 0.1); border-color: transparent; }
.bm-st-a_payer { color: #9a6a12; background: rgba(196, 140, 30, 0.12); }
.bm-st-partielle { color: #2563a8; background: rgba(37, 99, 168, 0.11); }
.bm-st-en_retard { color: #b0392b; background: rgba(176, 57, 43, 0.12); }
.bm-st-sans_objet { color: #7a6f5c; background: rgba(122, 111, 92, 0.14); }
.bm-fact-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem; margin-top: 0.7rem; }
.bm-fact-actions form { display: contents; }
.bm-fact-actions .bm-btn { width: 100%; }
.bm-fact-actions .span2 { grid-column: 1 / -1; }
.bm-term { display: flex; gap: 0.5rem; align-items: flex-start; margin-top: 0.6rem; padding: 0.5rem 0.65rem; border-radius: 8px; font-size: 0.72rem; line-height: 1.4; background: rgba(37, 99, 168, 0.08); color: #1d4f87; border: 1px solid rgba(37, 99, 168, 0.18); }
.bm-term i { margin-top: 2px; }
.bm-late-tag { color: #b0392b; font-weight: 600; }
.bm-modal-form .bm-field label { font-size: 0.72rem; font-weight: 600; color: var(--bm-muted); display: block; margin-bottom: 0.25rem; }
.bm-modal-form .bm-field input, .bm-modal-form .bm-field select, .bm-modal-form .bm-field textarea { width: 100%; font-family: "Poppins", sans-serif !important; font-size: 0.84rem !important; padding: 0.5rem 0.65rem !important; border: 1px solid var(--bm-line) !important; border-radius: 8px !important; background: #fff !important; color: var(--bm-ink) !important; }
.bm-modal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
.bm-modal-grid .span2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .bm-modal-grid { grid-template-columns: 1fr; } .bm-fact-actions { grid-template-columns: 1fr; } }

/* ══════════════════════════════════════════════════════════════════════════
   Facturation v2 — registre, fiche facture, encaissements, dashboard
   ══════════════════════════════════════════════════════════════════════════ */

/* Pastilles d'état de règlement (alias .bm-st-reg-*) : a_payer ambre, partielle
   bleu, payee vert, en_retard rouge, sans_objet gris, avoir violet. */
.bm-st-reg-a_payer { color: #9a6a12; background: rgba(196, 140, 30, 0.12); }
.bm-st-reg-partielle { color: #2563a8; background: rgba(37, 99, 168, 0.11); }
.bm-st-reg-payee { color: #2f7d4f; background: rgba(47, 125, 79, 0.12); }
.bm-st-reg-en_retard { color: #b0392b; background: rgba(176, 57, 43, 0.12); }
.bm-st-reg-sans_objet { color: #7a6f5c; background: rgba(122, 111, 92, 0.14); }
.bm-st-reg-avoir, .bm-st-avoir { color: #5a49b8; background: rgba(90, 73, 184, 0.11); }
/* Pastilles de type de document */
.bm-st-commande { color: #2f7d4f; background: rgba(47, 125, 79, 0.12); }
.bm-st-manuelle { color: #9a6a12; background: rgba(196, 140, 30, 0.12); }
.bm-st-acompte { color: #2563a8; background: rgba(37, 99, 168, 0.11); }
.bm-st-solde { color: #5a49b8; background: rgba(90, 73, 184, 0.11); }
.bm-st-emise { color: #1f6b46; background: rgba(31, 107, 70, 0.13); }

/* Échéance : date + « J+N » en retard */
.bm-due { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.76rem; color: var(--bm-ink-soft); white-space: nowrap; }
.bm-due i { font-size: 0.64rem; color: var(--bm-muted); }
.bm-due .j { font-family: "JetBrains Mono", monospace; font-size: 0.66rem; font-weight: 700; padding: 0.05rem 0.35rem; border-radius: 5px; background: var(--bm-wash); color: var(--bm-muted); }
.bm-due.late { color: #b0392b; font-weight: 600; }
.bm-due.late i { color: #b0392b; }
.bm-due.late .j { background: rgba(176, 57, 43, 0.12); color: #b0392b; }
.bm-due.soon .j { background: rgba(196, 140, 30, 0.14); color: #9a6a12; }

/* Réglé / reste dans le registre */
.bm-regle { font-size: 0.74rem; color: var(--bm-muted); }
.bm-regle b { color: var(--bm-ink); font-weight: 600; }
.bm-reste { font-weight: 700; color: var(--bm-ink); }
.bm-reste.zero { color: var(--bm-muted); font-weight: 500; }
.bm-reste.late { color: #b0392b; }

/* Badge « Pro » à côté du client */
.bm-pro { display: inline-flex; align-items: center; padding: 0.05rem 0.4rem; border-radius: 5px; font-size: 0.58rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; background: rgba(37, 99, 168, 0.1); color: #2563a8; vertical-align: middle; margin-left: 0.25rem; }

/* Ventilation TVA (fiche facture) */
.bm-tva-grid { display: grid; grid-template-columns: auto repeat(3, minmax(0, 1fr)); gap: 0.15rem 1rem; font-size: 0.76rem; }
.bm-tva-grid .h { font-size: 0.62rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--bm-muted); padding-bottom: 0.25rem; border-bottom: 1px solid var(--bm-line-soft); }
.bm-tva-grid .h.num, .bm-tva-grid .v.num { text-align: right; }
.bm-tva-grid .v { padding: 0.2rem 0; color: var(--bm-ink-soft); }
.bm-tva-grid .v.tot { border-top: 1px solid var(--bm-line); font-weight: 600; color: var(--bm-ink); padding-top: 0.35rem; }
.bm-tva-grid .v .port { font-size: 0.64rem; color: var(--bm-muted); }

/* Colonne droite collante (fiche) */
.bm-sticky { position: sticky; top: 1rem; }
@media (max-width: 1024px) { .bm-sticky { position: static; } }

/* Journal des encaissements : montants signés, lignes annulées barrées */
.bm-amt-in { color: #2f7d4f; font-weight: 700; }
.bm-amt-out { color: #b0392b; font-weight: 700; }
.bm-table tr.annule td { color: var(--bm-muted); }
.bm-table tr.annule .bm-strike { text-decoration: line-through; opacity: 0.6; }
.bm-annule-tag { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.64rem; font-weight: 600; color: #b0392b; }

/* Historique d'une facture */
.bm-hist { list-style: none; margin: 0; padding: 0; }
.bm-hist li { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 0.6rem; padding: 0.4rem 0; border-bottom: 1px dashed var(--bm-line-soft); font-size: 0.74rem; }
.bm-hist li:last-child { border-bottom: none; }
.bm-hist .d { font-family: "JetBrains Mono", monospace; font-size: 0.68rem; color: var(--bm-muted); white-space: nowrap; }
.bm-hist .e { color: var(--bm-ink); }
.bm-hist .e b { font-weight: 600; }
.bm-hist .by { color: var(--bm-muted); font-size: 0.68rem; }
@media (max-width: 560px) { .bm-hist li { grid-template-columns: 1fr; gap: 0.1rem; } }

/* Formulaire inline d'ajout d'encaissement (sous le tableau) */
.bm-inline-form { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(140px, 1.2fr) minmax(120px, 1.2fr) minmax(130px, 1fr) auto; gap: 0.5rem; align-items: end; padding: 0.8rem 1rem; background: color-mix(in srgb, var(--bm-wash) 60%, var(--bm-surface)); border-top: 1px solid var(--bm-line-soft); }
@media (max-width: 900px) { .bm-inline-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .bm-inline-form { grid-template-columns: 1fr; } }
.bm-inline-form label { margin-bottom: 0.2rem; font-size: 0.66rem !important; }

/* Tuiles facturation du dashboard : 4 colonnes */
.bm-cash.bm-cash-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .bm-cash.bm-cash-4 { grid-template-columns: repeat(2, 1fr); } }
.bm-pipe-seg .sub { font-size: 0.62rem; color: var(--bm-muted); margin-top: 0.1rem; }
.bm-pipe-seg.late .n { color: #b0392b; }

/* Formulaire avoir : lignes cochables */
.bm-avoir-lignes .bm-rowcheck { margin-right: 0.3rem !important; }
.bm-avoir-lignes input[type="number"] { width: 72px !important; display: inline-block; }
.bm-radio-stack { display: flex; flex-direction: column; gap: 0.4rem; }
.bm-radio-stack label { display: inline-flex !important; align-items: center; gap: 0.5rem; font-size: 0.8rem !important; color: var(--bm-ink) !important; cursor: pointer; margin: 0; }
.bm-radio-stack input[type="radio"] { width: 15px !important; height: 15px !important; margin: 0 !important; accent-color: var(--bm-accent); }
.bm-sub-block { margin-left: 1.55rem; margin-top: 0.35rem; }
/* Tuiles par mode de règlement (journal des encaissements) : 7 colonnes */
.bm-cash.bm-cash-7 { grid-template-columns: repeat(7, 1fr); }
@media (max-width: 1100px) { .bm-cash.bm-cash-7 { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 640px) { .bm-cash.bm-cash-7 { grid-template-columns: repeat(2, 1fr); } }

/* ══════════════════════════════════════════════════════════════════════════
   Tableau de bord (.bm-dash-*) — repasse kit .bm (2026-08-21)
   ══════════════════════════════════════════════════════════════════════════ */
.bm-dash-sec { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 0.9rem; flex-wrap: wrap; margin: 0.25rem 0 0.65rem; }
.bm-dash-sec-t { font-size: 0.92rem; font-weight: 600; color: var(--bm-ink); line-height: 1.2; margin-top: 0.1rem; }
.bm-dash-sec .bm-actions-inline { gap: 0.4rem; }
.bm-dash-block { margin-bottom: 1.6rem; }
.bm-dash-list { list-style: none; margin: 0; padding: 0; }
.bm-dash-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 0.65rem; align-items: center; padding: 0.55rem 1rem; border-bottom: 1px solid var(--bm-line-soft); text-decoration: none; color: inherit; transition: background 0.12s; }
.bm-dash-item:last-child { border-bottom: none; }
a.bm-dash-item:hover { background: var(--bm-wash); }
.bm-dash-item .ic { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 0.72rem; background: var(--bm-wash); color: var(--bm-accent); }
.bm-dash-item .ic.warn { background: rgba(196, 140, 30, 0.12); color: #9a6a12; }
.bm-dash-item .ic.info { background: rgba(37, 99, 168, 0.1); color: #2563a8; }
.bm-dash-item .tx { min-width: 0; }
.bm-dash-item .t { display: block; font-size: 0.8rem; font-weight: 500; color: var(--bm-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-dash-item .m { display: block; font-size: 0.7rem; color: var(--bm-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm-dash-item .r { font-size: 0.66rem; color: var(--bm-muted); white-space: nowrap; }
.bm-dash-empty { padding: 0.85rem 1rem; font-size: 0.76rem; color: var(--bm-muted); }
.bm-dash-kv { padding: 0.25rem 1rem 0.55rem; }
.bm-dash-kv .bm-kv dd.bm-mono { font-size: 0.78rem; }
.bm-dash-table td { white-space: nowrap; }
.bm-dash-card-foot { padding: 0.55rem 1rem 0.8rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.bm-dash-date { font-size: 0.74rem; color: var(--bm-muted); white-space: nowrap; }

/* ══════════════════════════════════════════════════════════════════════════
   Paramètres boutique (.bm-param-*) — repasse kit .bm (2026-08-21)
   ══════════════════════════════════════════════════════════════════════════ */
.bm-param-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1rem; align-items: start; }
.bm-param-cards .bm-card { margin-bottom: 0; }
.bm-param-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 0.85rem 1rem; }
.bm-param-grid .bm-field + .bm-field { margin-top: 0; }
.bm-param-save { display: flex; align-items: center; justify-content: flex-end; gap: 0.6rem; margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid var(--bm-line-soft); }
.bm-param-note { display: flex; gap: 0.5rem; align-items: flex-start; margin-top: 0.8rem; font-size: 0.72rem; color: var(--bm-muted); line-height: 1.5; }
.bm-param-note i { margin-top: 2px; color: var(--bm-accent); flex-shrink: 0; }
.bm-param-note a, .bm-param-cron a { color: var(--bm-accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.bm-param-err { margin: 0.25rem 0 0; font-size: 0.7rem; color: #b0392b; }
.bm-param-kv .bm-kv dd { min-width: 0; overflow-wrap: anywhere; }
.bm-param-kv .bm-kv dd.bm-mono { font-size: 0.76rem; }
.bm-param-code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.68rem; padding: 0.05rem 0.35rem; border-radius: 4px; background: var(--bm-wash); color: var(--bm-ink-soft); }
.bm-param-cmd { display: block; margin: 0.4rem 0 0; padding: 0.45rem 0.65rem; border-radius: 7px; background: var(--bm-ink); color: #f3eee3; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.68rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.bm-param-cron { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1rem 1.5rem; }
.bm-param-cron li { min-width: 0; }
.bm-param-cron .h { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 0.78rem; font-weight: 600; color: var(--bm-ink); }
.bm-param-cron .tag { margin-top: 0.3rem; }
.bm-param-cron .d { margin-top: 0.2rem; font-size: 0.72rem; color: var(--bm-muted); line-height: 1.45; }
.bm-param-status { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
