/* =========================================================================
   Lumisphere ERP — BC Fournisseur (liste + opérations)
   Scope: #panel-bc-liste, #panel-bc-ops
   Langage visuel aligné Mes Devis (dvl-*) — flux n8n inchangés
   ========================================================================= */

#panel-bc-liste,
#panel-bc-ops {
  /* Même palette / tokens que Mes Devis (dvl-*) */
  --dvl-orange: #f59e0b;
  --dvl-orange-light: #fbbf24;
  --dvl-orange-dim: rgba(245, 158, 11, 0.12);
  --dvl-orange-glow: rgba(245, 158, 11, 0.25);
  --dvl-surface: #14161e;
  --dvl-surface-2: #1a1d28;
  --dvl-surface-3: #222633;
  --dvl-border: rgba(255, 255, 255, 0.06);
  --dvl-border-accent: rgba(245, 158, 11, 0.2);
  --dvl-text: #e5e7eb;
  --dvl-muted: #9ca3af;
  --dvl-dim: #6b7280;
  --dvl-radius: 12px;
  --dvl-radius-sm: 8px;
  --dvl-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --dvl-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --bc-orange: var(--dvl-orange);
  --bc-orange-light: var(--dvl-orange-light);
  --bc-orange-dim: var(--dvl-orange-dim);
  --bc-orange-glow: var(--dvl-orange-glow);
  --bc-surface: var(--dvl-surface);
  --bc-surface-2: var(--dvl-surface-2);
  --bc-surface-3: var(--dvl-surface-3);
  --bc-border: var(--dvl-border);
  --bc-border-accent: var(--dvl-border-accent);
  --bc-text: var(--dvl-text);
  --bc-muted: var(--dvl-muted);
  --bc-dim: var(--dvl-dim);
  --bc-radius: var(--dvl-radius);
  --bc-radius-sm: var(--dvl-radius-sm);
  --bc-green: #34d399;
  --bc-blue: #60a5fa;
  --bc-amber: #fbbf24;
  --bc-red: #f87171;
  --bc-shadow: var(--dvl-shadow);
  --bc-transition: var(--dvl-transition);
  padding: 0 !important;
  background: transparent !important;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
}

/* KPI clicables BC + état actif (Mes Devis = non-boutons) */
#panel-bc-liste .bc-kpi {
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
}
#panel-bc-liste .dvl-kpi-prod .dvl-kpi-icon {
  color: #fcd34d;
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.28);
}
#panel-bc-liste .dvl-kpi-prod .dvl-kpi-badge {
  color: #fcd34d;
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.3);
}
#panel-bc-liste .dvl-kpi-prod .dvl-kpi-val { color: #fcd34d; }
/* Volume — mauve (pas or / orange) */
#panel-bc-liste .dvl-kpi-volume .dvl-kpi-icon {
  color: #c4b5fd;
  background: rgba(167, 139, 250, 0.12);
  border-color: rgba(167, 139, 250, 0.28);
}
#panel-bc-liste .dvl-kpi-volume .dvl-kpi-badge {
  color: #c4b5fd;
  background: rgba(167, 139, 250, 0.12);
  border-color: rgba(167, 139, 250, 0.3);
}
#panel-bc-liste .dvl-kpi-volume .dvl-kpi-val { color: #c4b5fd; }
#panel-bc-liste .bc-kpi.is-active.dvl-kpi-total {
  border-color: rgba(147, 197, 253, 0.55);
  box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.35), 0 0 0 1px rgba(147, 197, 253, 0.15);
}
#panel-bc-liste .bc-kpi.is-active.dvl-kpi-prod {
  border-color: rgba(251, 191, 36, 0.55);
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.35), 0 0 0 1px rgba(251, 191, 36, 0.15);
}
#panel-bc-liste .bc-kpi.is-active.dvl-kpi-sent {
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.35), 0 0 0 1px rgba(96, 165, 250, 0.15);
}
#panel-bc-liste .bc-kpi.is-active.dvl-kpi-accepted {
  border-color: rgba(52, 211, 153, 0.55);
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.35), 0 0 0 1px rgba(52, 211, 153, 0.15);
}
#panel-bc-liste .dvl-filters { z-index: 30; }
#panel-bc-liste .dvl-dd.is-open { z-index: 50; }
#panel-bc-liste .dvl-dd-panel { z-index: 60; }

/* Statuts BC — mêmes tons que Mes Devis (Expiré / Envoyé / Accepté) */
#panel-bc-liste .bc-st-prod {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.2);
  color: #fcd34d;
}
#panel-bc-liste .bc-st-prod::before { background: #fbbf24; }
#panel-bc-liste .bc-st-part {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}
#panel-bc-liste .bc-st-part::before { background: #60a5fa; }
#panel-bc-liste .bc-st-done {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.22);
  color: #86efac;
}
#panel-bc-liste .bc-st-done::before { background: #4ade80; }
#panel-bc-liste .bc-st-other {
  background: rgba(156, 163, 175, 0.12);
  border-color: rgba(156, 163, 175, 0.16);
  color: #d1d5db;
}
#panel-bc-liste .bc-st-other::before { background: #9ca3af; }

#panel-bc-liste .dvl-table tbody tr.is-selected {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 2px 0 0 #e5e7eb;
}

#panel-bc-liste .panel-header,
#panel-bc-liste .panel-desc,
#panel-bc-ops .panel-header,
#panel-bc-ops .panel-desc { display: none; }

@keyframes bcFadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes bcFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes bcLivePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}
@keyframes bcSpin { to { transform: rotate(360deg); } }

/* ---- Hero ---- */
.bc-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--bc-surface) 0%, var(--bc-surface-2) 100%);
  border: 1px solid var(--bc-border-accent);
  border-radius: var(--bc-radius);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.bc-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, var(--bc-orange-glow) 0%, transparent 70%);
  pointer-events: none;
}
.bc-hero-left {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 1;
}
.bc-hero-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bc-orange-dim);
  border: 1px solid var(--bc-border-accent);
  border-radius: var(--bc-radius-sm);
  color: var(--bc-orange);
}
.bc-hero-icon svg { width: 24px; height: 24px; }
.bc-hero-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--bc-text);
  letter-spacing: -0.02em;
  margin: 0;
}
.bc-hero-sub {
  font-size: 13px;
  color: var(--bc-muted);
  margin: 2px 0 0;
}
.bc-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.bc-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: #86efac;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.bc-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  animation: bcLivePulse 2s ease-in-out infinite;
}
.bc-live-badge.is-loading {
  color: var(--bc-orange-light);
  border-color: var(--bc-border-accent);
  background: var(--bc-orange-dim);
}
.bc-live-badge.is-loading .bc-live-dot {
  background: var(--bc-orange);
  animation: bcLivePulse 0.8s ease-in-out infinite;
}

.bc-btn-new {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--bc-orange) 0%, var(--bc-orange-light) 100%);
  border: none;
  border-radius: var(--bc-radius-sm);
  color: #111;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  transition: var(--bc-transition);
}
.bc-btn-new svg { width: 16px; height: 16px; }
.bc-btn-new:hover { filter: brightness(1.06); transform: translateY(-1px); }

.bc-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bc-surface-3);
  color: var(--bc-text);
  border: 1px solid var(--bc-border);
  border-radius: var(--bc-radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: var(--bc-transition);
}
.bc-btn-ghost svg { width: 16px; height: 16px; }
.bc-btn-ghost:hover {
  border-color: var(--bc-border-accent);
  color: var(--bc-orange-light);
}

/* Legacy btn aliases (detail / ops) */
.bc-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--bc-radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--bc-transition);
  font-family: inherit;
}
.bc-btn svg { width: 16px; height: 16px; }
.bc-btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #111;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}
.bc-btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.bc-btn.bc-btn-ghost {
  background: var(--bc-surface-3);
  color: var(--bc-text);
  border-color: var(--bc-border);
}
.bc-btn-sm { padding: 7px 12px; font-size: 12px; }

/* ---- KPI ---- */
.bc-kpi-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.bc-kpi {
  padding: 14px 16px 12px;
  background: var(--bc-surface);
  border: 1px solid var(--bc-border);
  border-radius: var(--bc-radius-sm);
  transition: var(--bc-transition);
  animation: bcFadeUp 0.4s ease both;
  min-width: 0;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
}
.bc-kpi:nth-child(2) { animation-delay: 0.05s; }
.bc-kpi:nth-child(3) { animation-delay: 0.1s; }
.bc-kpi:nth-child(4) { animation-delay: 0.15s; }
.bc-kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--bc-shadow);
}
.bc-kpi-total:hover { border-color: rgba(147, 197, 253, 0.4); }
.bc-kpi-prod:hover { border-color: rgba(251, 191, 36, 0.4); }
.bc-kpi-part:hover { border-color: rgba(96, 165, 250, 0.4); }
.bc-kpi-done:hover { border-color: rgba(52, 211, 153, 0.4); }
.bc-kpi.is-active {
  /* couleur définie par variante ci-dessous */
}
.bc-kpi-total.is-active {
  border-color: rgba(147, 197, 253, 0.55);
  box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.35), 0 0 0 1px rgba(147, 197, 253, 0.15);
}
.bc-kpi-prod.is-active {
  border-color: rgba(251, 191, 36, 0.55);
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.35), 0 0 0 1px rgba(251, 191, 36, 0.15);
}
.bc-kpi-part.is-active {
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.35), 0 0 0 1px rgba(96, 165, 250, 0.15);
}
.bc-kpi-done.is-active {
  border-color: rgba(52, 211, 153, 0.55);
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.35), 0 0 0 1px rgba(52, 211, 153, 0.15);
}
.bc-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.bc-kpi-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--bc-border);
  color: var(--bc-muted);
  flex-shrink: 0;
}
.bc-kpi-icon svg { width: 15px; height: 15px; }
.bc-kpi-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--bc-border);
  color: var(--bc-muted);
  flex-shrink: 0;
}
.bc-kpi-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--bc-text);
  letter-spacing: -0.02em;
  line-height: 1.15;
  white-space: nowrap;
}
.bc-kpi-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--bc-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-top: 6px;
  white-space: nowrap;
}
.bc-kpi-sub {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--bc-dim);
  margin-top: 3px;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bc-kpi-total .bc-kpi-icon { color: #93c5fd; background: rgba(147, 197, 253, 0.1); border-color: rgba(147, 197, 253, 0.2); }
.bc-kpi-total .bc-kpi-badge { color: #93c5fd; border-color: rgba(147, 197, 253, 0.25); }
.bc-kpi-volume .bc-kpi-icon { color: #a78bfa; background: rgba(167, 139, 250, 0.1); border-color: rgba(167, 139, 250, 0.22); }
.bc-kpi-volume .bc-kpi-badge { color: #c4b5fd; border-color: rgba(167, 139, 250, 0.28); }
.bc-kpi-volume .bc-kpi-val { color: #c4b5fd; }
.bc-kpi-prod .bc-kpi-icon { color: #fbbf24; background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.22); }
.bc-kpi-prod .bc-kpi-badge { color: #fbbf24; border-color: rgba(251, 191, 36, 0.28); }
.bc-kpi-prod .bc-kpi-val { color: #fbbf24; }
.bc-kpi-part .bc-kpi-icon { color: #60a5fa; background: rgba(96, 165, 250, 0.1); border-color: rgba(96, 165, 250, 0.22); }
.bc-kpi-part .bc-kpi-badge { color: #93c5fd; border-color: rgba(96, 165, 250, 0.28); }
.bc-kpi-part .bc-kpi-val { color: #60a5fa; }
.bc-kpi-done .bc-kpi-icon { color: #34d399; background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.22); }
.bc-kpi-done .bc-kpi-badge { color: #6ee7b7; border-color: rgba(52, 211, 153, 0.28); }
.bc-kpi-done .bc-kpi-val { color: #34d399; }

/* ---- Filters ---- */
.bc-filters {
  background: var(--bc-surface);
  border: 1px solid var(--bc-border);
  border-radius: var(--bc-radius-sm);
  margin-bottom: 14px;
  overflow: visible; /* laisse sortir les .dvl-dd-panel */
  position: relative;
  z-index: 30;
}
.bc-flt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--bc-border);
}
.bc-filters.is-collapsed .bc-flt-head { border-bottom-color: transparent; }
.bc-flt-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.bc-flt-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bc-orange-dim);
  border: 1px solid var(--bc-border-accent);
  color: var(--bc-orange);
  flex-shrink: 0;
}
.bc-flt-icon svg { width: 16px; height: 16px; }
.bc-flt-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--bc-text);
}
.bc-flt-sub {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--bc-dim);
}
.bc-flt-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.bc-active-filters {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--bc-border);
  font-size: 11px;
  font-weight: 600;
  color: var(--bc-dim);
}
.bc-active-filters.has-filters {
  background: var(--bc-orange-dim);
  border-color: var(--bc-border-accent);
  color: var(--bc-orange-light);
}
.bc-active-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bc-dim);
}
.bc-active-filters.has-filters .bc-active-dot { background: var(--bc-orange); }
.bc-btn-collapse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--bc-border);
  border-radius: var(--bc-radius-sm);
  color: var(--bc-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: var(--bc-transition);
}
.bc-btn-collapse svg {
  width: 14px;
  height: 14px;
  transition: transform 0.18s ease;
}
.bc-btn-collapse:hover {
  border-color: var(--bc-border-accent);
  color: var(--bc-orange-light);
}
.bc-filters.is-collapsed .bc-btn-collapse svg { transform: rotate(-180deg); }

.bc-filters-bottom {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.22s ease;
}
.bc-filters.is-collapsed .bc-filters-bottom {
  grid-template-rows: 0fr;
  overflow: hidden;
}
.bc-filters-bottom-inner {
  overflow: visible; /* panels dropdown au-dessus du tableau */
  min-height: 0;
}
.bc-filters.is-collapsed .bc-filters-bottom-inner {
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.bc-flt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}
.bc-search-box {
  flex: 1 1 220px;
  position: relative;
  min-width: 180px;
}
.bc-search-box input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px 10px 38px;
  border-radius: var(--bc-radius-sm);
  border: 1px solid var(--bc-border);
  background: var(--bc-surface-2);
  color: var(--bc-text);
  font-size: 13px;
  font-family: inherit;
}
.bc-search-box input:focus {
  outline: none;
  border-color: var(--bc-orange);
  box-shadow: 0 0 0 3px var(--bc-orange-dim);
}
.bc-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bc-dim);
  width: 16px;
  height: 16px;
  pointer-events: none;
}
.bc-statut-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.bc-statut-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--bc-border);
  background: transparent;
  color: var(--bc-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: var(--bc-transition);
}
.bc-statut-pill:hover { color: var(--bc-text); border-color: rgba(255, 255, 255, 0.12); }
.bc-statut-pill.is-active {
  background: var(--bc-orange-dim);
  border-color: var(--bc-border-accent);
  color: var(--bc-orange-light);
}
.bc-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.bc-dot-all { background: #9ca3af; }
.bc-dot-prod { background: #fbbf24; }
.bc-dot-part { background: #60a5fa; }
.bc-dot-done { background: #34d399; }

/* Dropdowns : stacking au-dessus du tableau (comme Mes Devis) */
#panel-bc-liste .dvl-dd.is-open { z-index: 50; }
#panel-bc-liste .dvl-dd-panel { z-index: 60; }

/* Dropdown statut tones (mêmes patterns que Mes Devis) */
#panel-bc-liste #bc-dd-statut-btn.tone-prod,
#panel-bc-liste #bc-dd-statut.is-open #bc-dd-statut-btn.tone-prod {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.14);
}
#panel-bc-liste #bc-dd-statut-btn.tone-part,
#panel-bc-liste #bc-dd-statut.is-open #bc-dd-statut-btn.tone-part {
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(96, 165, 250, 0.14);
}
#panel-bc-liste #bc-dd-statut-btn.tone-done,
#panel-bc-liste #bc-dd-statut.is-open #bc-dd-statut-btn.tone-done {
  color: #86efac;
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.14);
}
#panel-bc-liste #bc-dd-statut-btn.tone-multi,
#panel-bc-liste #bc-dd-statut.is-open #bc-dd-statut-btn.tone-multi {
  color: #e5e7eb;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}
#panel-bc-liste #bc-dd-statut.is-open .dvl-dd-chevron { color: inherit; }

#panel-bc-liste .dvl-dd-option[data-statut="prod"]:has(input:checked) {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.45);
  color: #fcd34d;
}
#panel-bc-liste .dvl-dd-option[data-statut="part"]:has(input:checked) {
  background: rgba(96, 165, 250, 0.14);
  border-color: rgba(96, 165, 250, 0.45);
  color: #93c5fd;
}
#panel-bc-liste .dvl-dd-option[data-statut="done"]:has(input:checked) {
  background: rgba(52, 211, 153, 0.14);
  border-color: rgba(52, 211, 153, 0.45);
  color: #86efac;
}
#panel-bc-liste .dvl-dd-option[data-statut="prod"]:has(input:checked) .dvl-pill-count {
  background: rgba(251, 191, 36, 0.22);
  color: inherit;
}
#panel-bc-liste .dvl-dd-option[data-statut="part"]:has(input:checked) .dvl-pill-count {
  background: rgba(96, 165, 250, 0.22);
  color: inherit;
}
#panel-bc-liste .dvl-dd-option[data-statut="done"]:has(input:checked) .dvl-pill-count {
  background: rgba(52, 211, 153, 0.22);
  color: inherit;
}
#panel-bc-liste .dvl-dd-dot.bc-dot-prod,
#panel-bc-liste .dvl-pill-dot.bc-dot-prod { background: #fbbf24; }
#panel-bc-liste .dvl-dd-dot.bc-dot-part,
#panel-bc-liste .dvl-pill-dot.bc-dot-part { background: #60a5fa; }
#panel-bc-liste .dvl-dd-dot.bc-dot-done,
#panel-bc-liste .dvl-pill-dot.bc-dot-done { background: #34d399; }

/* Tri dropdown — mêmes checkmarks que Mes Devis */
#panel-bc-liste .bc-sort-option {
  width: 100%;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 11px;
}
#panel-bc-liste .bc-sort-option .dvl-dd-check {
  opacity: 0;
  color: var(--bc-orange);
  font-size: 11px;
  font-weight: 700;
}
#panel-bc-liste .bc-sort-option.is-active {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.28);
  color: var(--bc-orange-light);
}
#panel-bc-liste .bc-sort-option.is-active .dvl-dd-check { opacity: 1; }

/* Tri : texte plus compact */
#panel-bc-liste #bc-dd-sort-btn {
  font-size: 11px;
  width: 148px;
  max-width: 148px;
  min-width: 148px;
  box-sizing: border-box;
}
#panel-bc-liste #bc-dd-sort-btn .dvl-dd-label {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
}
#panel-bc-liste #bc-dd-sort-panel .dvl-dd-panel-title { font-size: 9px; }
#panel-bc-liste #bc-dd-sort-panel .dvl-dd-option-txt { font-size: 11px; }

/* Statut : largeur fixe (ne bouge pas selon la valeur) */
#panel-bc-liste #bc-dd-statut-btn {
  width: 168px;
  max-width: 168px;
  min-width: 168px;
  box-sizing: border-box;
  justify-content: flex-start;
}
#panel-bc-liste #bc-dd-statut-btn .dvl-dd-label {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bc-dot-part { background: #60a5fa; }
.bc-dot-done { background: #34d399; }
.bc-btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--bc-border);
  border-radius: var(--bc-radius-sm);
  color: var(--bc-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: var(--bc-transition);
  margin-left: auto;
}
.bc-btn-reset svg { width: 14px; height: 14px; }
.bc-btn-reset:hover {
  border-color: rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}
.bc-flt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 12px;
}
.bc-flt-chips[hidden] { display: none !important; }
.bc-flt-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--bc-border);
  font-size: 11px;
  font-weight: 600;
  color: var(--bc-text);
}
.bc-flt-chip button {
  border: none;
  background: transparent;
  color: var(--bc-dim);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 14px;
}
.bc-flt-chip button:hover { color: #fca5a5; }

/* ---- Table ---- */
.bc-table-container {
  position: relative;
  background: var(--bc-surface);
  border: 1px solid var(--bc-border);
  border-radius: var(--bc-radius-sm);
  overflow: hidden;
  width: 100%;
}
.bc-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 12.5px;
}
.bc-col-num { width: 14%; }
.bc-col-fourn { width: 22%; }
.bc-col-par { width: 140px; }
.bc-col-statut { width: 15%; }
.bc-col-vol { width: 11%; }
.bc-col-date { width: 120px; }
.bc-col-actions { width: 100px; }

.bc-th-right { text-align: right !important; }

.bc-vol-chip {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  box-sizing: border-box;
  padding: 2px 6px 2px 4px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.15;
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.22);
  color: #ddd6fe;
}
#panel-bc-liste .dvl-amount-chip.bc-vol-chip {
  background: rgba(167, 139, 250, 0.1);
  border-color: rgba(167, 139, 250, 0.22);
  color: #ddd6fe;
}
.bc-td-right { text-align: right; }

/* Overlay legacy désactivé — loader = ligne tbody comme Mes Devis */
#bc-liste-loading { display: none !important; }

.bc-table thead th {
  background: rgba(255, 255, 255, 0.03);
  color: #8b929e;
  text-align: left;
  padding: 11px 10px;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.65px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  white-space: nowrap;
}
.bc-th-actions { text-align: right !important; padding-right: 12px !important; }

.bc-table tbody td {
  padding: 12px 10px;
  vertical-align: middle;
  color: var(--bc-text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.bc-table tbody tr {
  cursor: pointer;
  transition: background 0.16s ease;
  animation: bcFadeUp 0.3s ease both;
}
.bc-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.018); }
.bc-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.28);
}
.bc-table tbody tr.is-selected {
  background: rgba(245, 158, 11, 0.08);
  box-shadow: inset 2px 0 0 var(--bc-orange);
}
.bc-table tbody tr:last-child td { border-bottom: none; }

.bc-num {
  font-weight: 650;
  color: #f3f4f6;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: inline-block;
  vertical-align: middle;
}
.bc-table tbody tr:hover .bc-num {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.bc-fourn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.bc-fourn-ico {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--bc-border);
  color: var(--bc-muted);
  flex-shrink: 0;
}
.bc-fourn-ico svg { width: 12px; height: 12px; }
.bc-fourn-txt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 12.5px;
  color: #e5e7eb;
}

.bc-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid transparent;
  line-height: 1.25;
}
.bc-status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.bc-status-prod {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}
.bc-status-prod::before { background: #fbbf24; }
.bc-status-part {
  background: rgba(96, 165, 250, 0.12);
  border-color: rgba(96, 165, 250, 0.22);
  color: #93c5fd;
}
.bc-status-part::before { background: #60a5fa; }
.bc-status-done {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.22);
  color: #6ee7b7;
}
.bc-status-done::before { background: #34d399; }
.bc-status-other {
  background: rgba(156, 163, 175, 0.12);
  border-color: rgba(156, 163, 175, 0.16);
  color: #d1d5db;
}
.bc-status-other::before { background: #9ca3af; }

/* legacy class names still used in detail */
.bc-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  border: 1px solid transparent;
  line-height: 1.25;
}
.bc-badge-prod { background: rgba(251, 191, 36, 0.12); border-color: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.bc-badge-part { background: rgba(96, 165, 250, 0.12); border-color: rgba(96, 165, 250, 0.22); color: #93c5fd; }
.bc-badge-done { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.22); color: #6ee7b7; }
.bc-badge-other { background: rgba(156, 163, 175, 0.12); border-color: rgba(156, 163, 175, 0.16); color: #d1d5db; }

.bc-date-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: max-content;
  max-width: none;
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 2px 6px 2px 4px;
  border-radius: 5px;
  background: rgba(96, 165, 250, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.22);
  color: #bfdbfe;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.bc-date-ico {
  display: inline-flex;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  opacity: 0.85;
}
.bc-date-ico svg { width: 10px; height: 10px; }

.bc-td-actions { text-align: right; }
.bc-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}
.bc-btn-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #c4c9d4;
  cursor: pointer;
  transition: var(--bc-transition);
  padding: 0;
}
.bc-btn-icon svg { width: 14px; height: 14px; }
.bc-btn-icon:hover {
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}
.bc-btn-icon.bc-btn-recv:hover {
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--bc-orange-light);
  background: var(--bc-orange-dim);
}

.bc-empty, .bc-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 20px;
  color: var(--bc-dim);
  font-size: 13px;
  text-align: center;
}
.bc-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: #9ca3af;
  border-radius: 50%;
  animation: bcSpin 0.7s linear infinite;
  flex-shrink: 0;
}

.bc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px 0;
  font-size: 12px;
  color: var(--bc-dim);
  font-weight: 500;
}

/* ---- Detail drawer ---- */
.bc-detail {
  margin-top: 14px;
  background: var(--bc-surface);
  border: 1px solid var(--bc-border-accent);
  border-radius: var(--bc-radius);
  padding: 18px 20px;
  display: none;
}
.bc-detail.is-open { display: block; animation: bcFadeIn 0.25s ease; }
.bc-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.bc-detail-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--bc-text);
}
.bc-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.bc-meta-item {
  background: var(--bc-surface-2);
  border: 1px solid var(--bc-border);
  border-radius: var(--bc-radius-sm);
  padding: 10px 12px;
}
.bc-meta-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--bc-dim);
  margin-bottom: 4px;
}
.bc-meta-val { font-size: 13px; font-weight: 600; color: var(--bc-text); }
.bc-lines-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--bc-orange-light);
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bc-table-wrap {
  background: var(--bc-surface-2);
  border: 1px solid var(--bc-border);
  border-radius: var(--bc-radius-sm);
  overflow: hidden;
}
.bc-detail .bc-table { table-layout: auto; }
.bc-actions-cell { display: flex; gap: 6px; justify-content: flex-end; }

/* ---- Ops tabs ---- */
.bc-tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--bc-surface);
  border: 1px solid var(--bc-border);
  border-radius: var(--bc-radius);
  margin-bottom: 16px;
  width: fit-content;
  max-width: 100%;
}
.bc-tab {
  padding: 10px 18px;
  border: none;
  border-radius: var(--bc-radius-sm);
  background: transparent;
  color: var(--bc-muted);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  font-family: inherit;
  transition: var(--bc-transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.bc-tab svg { width: 16px; height: 16px; }
.bc-tab:hover { color: var(--bc-text); }
.bc-tab.is-active {
  background: linear-gradient(135deg, rgba(245,158,11,0.2), rgba(217,119,6,0.12));
  color: var(--bc-orange-light);
  box-shadow: inset 0 0 0 1px var(--bc-border-accent);
}
.bc-tab-panel { display: none; }
.bc-tab-panel.is-active { display: block; animation: bcFadeIn 0.22s ease; }

#panel-bc-ops .form-card {
  background: var(--bc-surface);
  border: 1px solid var(--bc-border);
  border-radius: var(--bc-radius);
  padding: 20px 22px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.25);
}
#panel-bc-ops .form-card + .form-card { margin-top: 14px; }
#panel-bc-ops .form-group label {
  color: var(--bc-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
#panel-bc-ops input[type="text"],
#panel-bc-ops input[type="date"],
#panel-bc-ops input[type="number"],
#panel-bc-ops select,
#panel-bc-ops textarea {
  background: var(--bc-surface-2) !important;
  border: 1px solid var(--bc-border) !important;
  color: var(--bc-text) !important;
  border-radius: var(--bc-radius-sm) !important;
}
#panel-bc-ops input:focus,
#panel-bc-ops select:focus,
#panel-bc-ops textarea:focus {
  border-color: var(--bc-orange) !important;
  box-shadow: 0 0 0 3px var(--bc-orange-dim) !important;
  outline: none;
}
#panel-bc-ops .drop-zone {
  border: 1.5px dashed rgba(245,158,11,0.35) !important;
  background: rgba(245,158,11,0.05) !important;
  border-radius: var(--bc-radius) !important;
  transition: var(--bc-transition);
}
#panel-bc-ops .drop-zone:hover {
  border-color: var(--bc-orange) !important;
  background: rgba(245,158,11,0.09) !important;
}
#panel-bc-ops .btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #111 !important;
  border: none !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 14px rgba(245,158,11,0.3);
}
#panel-bc-ops .btn-secondary {
  background: var(--bc-surface-3) !important;
  border: 1px solid var(--bc-border) !important;
  color: var(--bc-text) !important;
}
#panel-bc-ops #rec-bc-detail {
  background: var(--bc-surface-2) !important;
  border: 1px solid var(--bc-border) !important;
}
#panel-bc-ops .csv-help,
#panel-bc-ops .panel-hint {
  color: var(--bc-dim);
  font-size: 12px;
}
.bc-ops-hint {
  margin: -6px 0 14px;
  font-size: 13px;
  color: var(--bc-muted);
}

@media (max-width: 1200px) {
  .bc-kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .bc-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .bc-hero { flex-direction: column; align-items: flex-start; }
  .bc-flt-toolbar { flex-direction: column; align-items: stretch; }
  .bc-btn-reset { margin-left: 0; }
}
@media (max-width: 640px) {
  .bc-kpi-row { grid-template-columns: 1fr; }
  .bc-table-container { overflow-x: auto; }
  .bc-col-date { width: 120px; }
}

/* ============================================================
   Nouveau BC — layout compact + cards + IA
   ============================================================ */
.nbc-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.nbc-side { position: sticky; top: 12px; }
.nbc-meta-card, .nbc-ai, .nbc-lines-sec {
  background: var(--bc-surface);
  border: 1px solid var(--bc-border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
}
.nbc-meta-head, .nbc-ai-head, .nbc-lines-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.nbc-meta-ico, .nbc-ai-badge {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(245,158,11,0.12);
  color: #fbbf24;
  flex-shrink: 0;
}
.nbc-meta-ico svg { width: 18px; height: 18px; }
.nbc-meta-title, .nbc-ai-title, .nbc-lines-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--bc-text);
}
.nbc-meta-sub, .nbc-ai-sub, .nbc-lines-sub {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--bc-dim);
  line-height: 1.35;
}
.nbc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nbc-fields .nbc-full { grid-column: 1 / -1; }
.nbc-chip-auto {
  display: inline-block;
  margin-left: 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #86efac;
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: 999px;
  padding: 1px 6px;
  vertical-align: middle;
}
#panel-bc-ops #bc-date[readonly] {
  opacity: 0.85;
  cursor: default;
}
.nbc-csv-hidden {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  opacity: 0 !important; pointer-events: none !important;
  overflow: hidden !important;
}
.nbc-actions { display: flex; gap: 8px; margin-top: 12px; }
.nbc-btn-create { flex: 1; }
.nbc-search-results { margin-top: 6px; }
.nbc-frns-hit { cursor: pointer; }
.nbc-frns-meta { display: block; font-size: 11px; color: var(--bc-dim); margin-top: 2px; }
.nbc-frns-ok { color: #86efac; font-size: 12px; font-weight: 600; }
.nbc-muted { color: var(--bc-dim); font-size: 12px; }
.nbc-err { color: #fca5a5; font-size: 12px; }

.nbc-ai-head-left { display: flex; gap: 10px; align-items: flex-start; }
.nbc-ai-badge {
  font-size: 11px; font-weight: 800; letter-spacing: 0.06em;
}
.nbc-ai-clear {
  border: 1px solid var(--bc-border);
  background: transparent;
  color: var(--bc-muted);
  border-radius: 8px;
  font-size: 11px;
  padding: 5px 9px;
  cursor: pointer;
}
.nbc-ai-clear:hover { color: var(--bc-text); border-color: rgba(255,255,255,0.2); }

.nbc-drop {
  position: relative;
  min-height: 112px !important;
  padding: 0 !important;
  overflow: hidden;
}
.nbc-drop-inner {
  padding: 22px 16px;
  text-align: center;
}
.nbc-drop-ico {
  width: 40px; height: 40px; margin: 0 auto 8px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(245,158,11,0.1);
  color: #fbbf24;
}
.nbc-drop-ico svg { width: 22px; height: 22px; }
.nbc-drop-text { font-size: 13px; color: var(--bc-muted); }
.nbc-drop-formats { margin-top: 4px; font-size: 11px; color: var(--bc-dim); }

.nbc-ai-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  background: rgba(12, 14, 18, 0.88);
  backdrop-filter: blur(6px);
  z-index: 2;
  padding: 16px;
}
.nbc-ai-loading[hidden] { display: none !important; }
.nbc-drop.is-analyzing .nbc-drop-inner { opacity: 0.15; }
.nbc-ai-orbit {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(245,158,11,0.2);
  border-top-color: #f59e0b;
  animation: nbcSpin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes nbcSpin { to { transform: rotate(360deg); } }
.nbc-ai-loading-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nbc-ai-loading-copy strong { font-size: 13px; color: #fde68a; }
.nbc-ai-loading-copy span { font-size: 11px; color: var(--bc-dim); }
.nbc-ai-status { margin-top: 8px; font-size: 12px; }
.nbc-ok-inline { color: #86efac; }
.nbc-miss-inline { color: #fca5a5; font-weight: 600; }

.nbc-lines-head { margin-bottom: 10px; }
.nbc-count {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(245,158,11,0.15);
  color: #fbbf24;
  vertical-align: middle;
  margin-left: 4px;
}
.nbc-btn-add {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px dashed rgba(245,158,11,0.4);
  background: rgba(245,158,11,0.06);
  color: #fbbf24;
  border-radius: 9px;
  font-size: 12px; font-weight: 650;
  padding: 6px 10px;
  cursor: pointer;
}
.nbc-btn-add svg { width: 14px; height: 14px; }
.nbc-btn-add:hover { background: rgba(245,158,11,0.12); }
.nbc-empty {
  text-align: center;
  padding: 28px 12px;
  font-size: 13px;
  color: var(--bc-dim);
  border: 1px dashed var(--bc-border);
  border-radius: 12px;
}
.nbc-empty[hidden] { display: none !important; }

.nbc-lines { display: flex; flex-direction: column; gap: 8px; }
.nbc-card {
  border: 1px solid var(--bc-border);
  background: var(--bc-surface-2);
  border-radius: 12px;
  padding: 10px 12px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.nbc-card.is-missing {
  border-color: rgba(239,68,68,0.55);
  background: rgba(127,29,29,0.22);
  box-shadow: inset 0 0 0 1px rgba(239,68,68,0.15);
}
.nbc-card-top { display: flex; gap: 10px; }
.nbc-card-photo {
  width: 48px; height: 48px; border-radius: 9px;
  object-fit: cover; background: #0b0d10; flex-shrink: 0;
}
.nbc-card-photo.is-empty {
  background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px dashed var(--bc-border);
}
.nbc-card-main { flex: 1; min-width: 0; }
.nbc-card-row1 { display: flex; align-items: center; gap: 8px; }
.nbc-card-code { font-size: 13px; color: #fde68a; }
.nbc-card-x {
  margin-left: auto;
  border: none; background: transparent;
  color: var(--bc-dim); font-size: 18px; line-height: 1;
  cursor: pointer; padding: 0 4px;
}
.nbc-card-x:hover { color: #fca5a5; }
.nbc-card-desig {
  font-size: 12px; color: var(--bc-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.nbc-card-meta {
  display: flex; flex-wrap: wrap; gap: 6px 10px;
  margin-top: 6px; font-size: 11px; color: var(--bc-dim);
}
.nbc-badge {
  font-size: 9px; font-weight: 800; letter-spacing: 0.04em;
  text-transform: uppercase; border-radius: 999px; padding: 2px 7px;
}
.nbc-badge-ok { background: rgba(34,197,94,0.12); color: #86efac; border: 1px solid rgba(34,197,94,0.25); }
.nbc-badge-miss { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.35); }
.nbc-price { font-weight: 700; }
.nbc-price-ai { color: #93c5fd; }
.nbc-price-cat { color: #c4b5fd; }
.nbc-price-dim { color: var(--bc-dim); font-weight: 500; }
.nbc-stock { color: var(--bc-muted); }

.nbc-card-controls {
  display: flex; gap: 8px; align-items: flex-end;
  margin-top: 8px;
}
.nbc-ctl { display: flex; flex-direction: column; gap: 3px; font-size: 10px; color: var(--bc-dim); }
.nbc-ctl input {
  width: 72px;
  padding: 6px 8px !important;
  font-size: 13px !important;
}
.nbc-ctl-grow { flex: 1; min-width: 0; }
.nbc-ctl-grow input { width: 100%; }
.nbc-ctl-btn {
  border: 1px solid var(--bc-border);
  background: transparent;
  color: var(--bc-muted);
  border-radius: 8px;
  font-size: 11px;
  padding: 7px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.nbc-results { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.nbc-hit {
  display: flex; gap: 8px; align-items: center;
  text-align: left; width: 100%;
  border: 1px solid var(--bc-border);
  background: rgba(0,0,0,0.2);
  border-radius: 9px;
  padding: 6px 8px;
  cursor: pointer;
  color: inherit;
}
.nbc-hit:hover { border-color: rgba(245,158,11,0.45); background: rgba(245,158,11,0.06); }
.nbc-hit-thumb { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; }
.nbc-hit-ph { width: 32px; height: 32px; border-radius: 6px; background: rgba(255,255,255,0.05); }
.nbc-hit-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 12px; }
.nbc-hit-body strong { color: #fde68a; }
.nbc-hit-meta { font-size: 10px; color: var(--bc-dim); }

@media (max-width: 960px) {
  .nbc-layout { grid-template-columns: 1fr; }
  .nbc-side { position: static; }
}
.nbc-rec-detail {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bc-surface-2);
  border: 1px solid var(--bc-border);
  font-size: 12px;
}
.nbc-rec-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  color: var(--bc-muted);
  font-size: 13px;
}
#panel-bc-ops #rec-lines-container .data-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}
#panel-bc-ops #rec-lines-container .data-table th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bc-dim);
  padding: 8px 6px;
  border-bottom: 1px solid var(--bc-border);
}
#panel-bc-ops #rec-lines-container .data-table td {
  padding: 8px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
/* NBC layout swap + observations toggle */
.nbc-layout-swap {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
}
.nbc-actions { display: flex; gap: 8px; margin-top: 12px; }
.nbc-btn-create { flex: 1; justify-content: center; font-weight: 600; }
.nbc-btn-create svg { display: none; }
.nbc-obs-block { margin-top: 2px; }
.nbc-tog {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--bc-border);
  background: rgba(255,255,255,0.02); cursor: pointer; user-select: none; box-sizing: border-box;
}
.nbc-tog input { position: absolute; opacity: 0; pointer-events: none; }
.nbc-tog-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.nbc-tog-name { font-size: 13px; font-weight: 600; color: var(--bc-text); }
.nbc-tog-desc { font-size: 11px; color: var(--bc-dim); }
.nbc-tog-switch {
  width: 36px; height: 20px; border-radius: 999px; background: rgba(255,255,255,0.12);
  position: relative; flex-shrink: 0; transition: background .15s ease;
}
.nbc-tog-switch i {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #e5e7eb; transition: transform .15s ease;
}
.nbc-tog.is-on { border-color: rgba(245,158,11,0.45); background: rgba(245,158,11,0.08); }
.nbc-tog.is-on .nbc-tog-switch { background: rgba(245,158,11,0.85); }
.nbc-tog.is-on .nbc-tog-switch i { transform: translateX(16px); background: #fff; }
.nbc-opt-panel { margin-top: 8px; }
.nbc-obs-editor { border: 1px solid var(--bc-border); border-radius: 10px; overflow: hidden; background: #0d1117; }
.nbc-obs-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 10px; border-bottom: 1px solid rgba(255,255,255,0.06); background: rgba(255,255,255,0.03);
}
.nbc-obs-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #fbbf24; background: rgba(245,158,11,0.12); padding: 2px 6px; border-radius: 4px;
}
.nbc-obs-hint { font-size: 11px; color: var(--bc-dim); }
.nbc-obs-editor textarea {
  display: block; width: 100%; box-sizing: border-box; border: none !important; border-radius: 0 !important;
  min-height: 88px; margin: 0; padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.55; color: #e5e7eb; background: #0d1117 !important;
  resize: vertical; box-shadow: none !important;
}
.nbc-obs-editor textarea:focus { outline: none !important; border: none !important; box-shadow: none !important; }
.bc-fourn-obs, .dvl-client-obs {
  margin-top: 2px; font-size: 11px; line-height: 1.35; color: var(--bc-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
.bc-fourn-obs strong, .dvl-client-obs strong { font-weight: 700; color: #c4c9d4; }


/* ==== BC table chips alignés nouveau système 20260722-2320 ==== */
#panel-bc-liste .dvl-table tbody td {
  padding: 8px 10px !important;
  vertical-align: middle;
}
#panel-bc-liste .dvl-date-chip {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 2px 6px 2px 4px !important;
  border-radius: 5px !important;
  --dvl-m-h: 220; --dvl-m-s: 12%; --dvl-day-t: 0.5; --dvl-day-n: 15;
  background: hsl(calc(var(--dvl-m-h) + (var(--dvl-day-n) - 1) * 1.6) calc(42% + var(--dvl-day-t) * 28%) calc(62% + var(--dvl-day-t) * 16%) / calc(0.16 + var(--dvl-day-t) * 0.14)) !important;
  border: 1px solid hsl(calc(var(--dvl-m-h) + (var(--dvl-day-n) - 1) * 1.6) calc(48% + var(--dvl-day-t) * 22%) calc(68% + var(--dvl-day-t) * 14%) / calc(0.35 + var(--dvl-day-t) * 0.25)) !important;
  color: hsl(calc(var(--dvl-m-h) + (var(--dvl-day-n) - 1) * 1.6) calc(55% + var(--dvl-day-t) * 20%) calc(82% + var(--dvl-day-t) * 10%)) !important;
  font-size: 10.5px !important;
  font-weight: 600 !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
}
#panel-bc-liste .dvl-date-ico {
  width: 10px !important;
  height: 10px !important;
  max-width: 10px !important;
  max-height: 10px !important;
  display: inline-flex !important;
  overflow: hidden;
  flex-shrink: 0 !important;
  color: #94a3b8;
}
#panel-bc-liste .dvl-date-ico svg {
  width: 10px !important;
  height: 10px !important;
  display: block !important;
}
#panel-bc-liste .dvl-amount-chip.bc-vol-chip {
  padding: 2px 7px !important;
  border-radius: 5px !important;
  font-size: 10.5px !important;
  line-height: 1.15 !important;
}
#panel-bc-liste .bc-status,
#panel-bc-liste .dvl-status {
  padding: 2px 8px !important;
  font-size: 9.5px !important;
  line-height: 1.25 !important;
}
