/* ═══════════════════════════════════════════════════════════════════════
   CAMALARM CRM — DASHBOARD COCKPIT PREMIUM V2
   ═══════════════════════════════════════════════════════════════════════
   Référence : Webflow / Linear / Notion
   Scope : #tab-home-scope (n'affecte que le tableau de bord)
   
   Règles d'or :
   • Zéro jaune
   • Orange #E65100 = accent uniquement (icônes, bordures, barres)
   • Texte : Inter
   • Valeurs/montants : JetBrains Mono
   • Cartes : fond #FFFFFF, radius 12px, ombre douce, padding 20px
   • Gap entre widgets : 20px
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── IMPORT FONTS (sécurisé, fallback système si CDN bloqué) ─── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ─── VARIABLES ─── */
#tab-home-scope {
  --cp-orange: #E65100;
  --cp-orange-soft: #FFF3E0;
  --cp-orange-border: #FFCC80;
  --cp-text: #0F172A;
  --cp-text-2: #475569;
  --cp-text-3: #64748B;
  --cp-text-muted: #94A3B8;
  --cp-bg: #F8FAFC;
  --cp-card: #FFFFFF;
  --cp-card-soft: #FAFBFD;
  --cp-border: #E5E7EB;
  --cp-border-soft: #F1F5F9;
  --cp-success: #10B981;
  --cp-success-soft: #ECFDF5;
  --cp-success-text: #065F46;
  --cp-danger: #EF4444;
  --cp-danger-soft: #FEF2F2;
  --cp-danger-text: #991B1B;
  --cp-info: #3B82F6;
  --cp-info-soft: #EFF6FF;
  --cp-info-text: #1E40AF;
  --cp-purple: #8B5CF6;
  --cp-purple-soft: #F5F3FF;
  --cp-purple-text: #5B21B6;
  --cp-radius: 12px;
  --cp-radius-sm: 8px;
  --cp-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  --cp-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
  --cp-gap: 20px;
  --cp-pad: 20px;
  --cp-kpi-bg: #131F47;       /* Décision Mohammed : KPI sombre */
  --cp-kpi-accent: #F26522;
}

/* ═══ ROOT — RÉINITIALISATION DE TOUT CSS HÉRITÉ T187/T200 ═══════════ */
#tab-home-scope .cockpit-v2 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--cp-text);
  padding: 0;
  margin: 0;
}

#tab-home-scope .cockpit-v2 * {
  box-sizing: border-box;
}

/* ═══ HEADER ════════════════════════════════════════════════════════ */
#tab-home-scope .cockpit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--cp-gap);
  flex-wrap: wrap;
  gap: 12px;
}
#tab-home-scope .cockpit-greeting {
  font-size: 22px;
  font-weight: 700;
  color: var(--cp-text);
  letter-spacing: -0.02em;
  margin: 0;
}
#tab-home-scope .cockpit-greeting .cockpit-username {
  color: var(--cp-orange);
}
#tab-home-scope .cockpit-subtitle {
  font-size: 13px;
  color: var(--cp-text-3);
  margin: 4px 0 0 0;
}
#tab-home-scope .cockpit-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
#tab-home-scope .cockpit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  border: 1px solid var(--cp-border);
  background: var(--cp-card);
  color: var(--cp-text-2);
  border-radius: var(--cp-radius-sm);
  cursor: pointer;
  transition: all .15s ease;
}
#tab-home-scope .cockpit-btn:hover {
  background: var(--cp-card-soft);
  border-color: var(--cp-text-muted);
  color: var(--cp-text);
}
#tab-home-scope .cockpit-btn.is-accent {
  background: var(--cp-orange);
  color: #FFFFFF;
  border-color: var(--cp-orange);
}
#tab-home-scope .cockpit-btn.is-accent:hover {
  background: #C44400;
  border-color: #C44400;
}
#tab-home-scope .cockpit-btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

/* ═══ GRILLE PRINCIPALE ═════════════════════════════════════════════ */
#tab-home-scope .cockpit-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--cp-gap);
}

/* ═══════════════════════════════════════════════════════════════════
   1. KPI CARDS (4 en haut, fond sombre #131F47 — décision Mohammed)
   ═══════════════════════════════════════════════════════════════════ */
#tab-home-scope .cp-kpi {
  background: var(--cp-kpi-bg);
  border: 1px solid var(--cp-border);
  border-top: 2px solid var(--cp-kpi-accent);
  border-radius: var(--cp-radius);
  padding: var(--cp-pad);
  box-shadow: var(--cp-shadow);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 130px;
}
#tab-home-scope .cp-kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--cp-shadow-hover);
  border-top-color: #FF7A33;
}

#tab-home-scope .cp-kpi-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
#tab-home-scope .cp-kpi-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 122, 51, 0.15);
  color: #FFB48A;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#tab-home-scope .cp-kpi-icon-circle svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.75;
}
#tab-home-scope .cp-kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: #CBD5E1;
  letter-spacing: 0;
  font-family: 'Inter', sans-serif;
}
#tab-home-scope .cp-kpi-value {
  font-family: 'JetBrains Mono', 'Menlo', monospace;
  font-size: 28px;
  font-weight: 600;
  color: #FFFFFF;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 4px 0 0 0;
}
#tab-home-scope .cp-kpi-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #94A3B8;
  margin-top: auto;
}
#tab-home-scope .cp-kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.15);
  color: #6EE7B7;
}
#tab-home-scope .cp-kpi-trend.is-down {
  background: rgba(239, 68, 68, 0.15);
  color: #FCA5A5;
}
#tab-home-scope .cp-kpi-trend.is-neutral {
  background: rgba(148, 163, 184, 0.15);
  color: #CBD5E1;
}
#tab-home-scope .cp-kpi-trend svg {
  width: 10px;
  height: 10px;
  stroke-width: 2.5;
}

/* ═══════════════════════════════════════════════════════════════════
   GÉNÉRIQUE : CARTE WIDGET
   ═══════════════════════════════════════════════════════════════════ */
#tab-home-scope .cp-card {
  background: var(--cp-card);
  border: 1px solid var(--cp-border);
  border-radius: var(--cp-radius);
  box-shadow: var(--cp-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#tab-home-scope .cp-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--cp-border-soft);
  gap: 8px;
  flex-shrink: 0;
}
#tab-home-scope .cp-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--cp-text);
  letter-spacing: -0.01em;
  margin: 0;
}
#tab-home-scope .cp-card-title svg {
  width: 16px;
  height: 16px;
  color: var(--cp-text-3);
  stroke-width: 1.75;
}
#tab-home-scope .cp-card-count {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  background: var(--cp-orange-soft);
  color: var(--cp-orange);
  border-radius: 9999px;
}
#tab-home-scope .cp-card-link {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--cp-text-3);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}
#tab-home-scope .cp-card-link:hover {
  color: var(--cp-orange);
}

#tab-home-scope .cp-card-body {
  flex: 1;
  overflow-y: auto;
  max-height: 420px;
}
#tab-home-scope .cp-card-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--cp-text-muted);
  font-size: 12.5px;
}

/* ═══════════════════════════════════════════════════════════════════
   2. CHANTIERS À PRÉPARER (60%)
   ═══════════════════════════════════════════════════════════════════ */
#tab-home-scope .cp-chantiers {
  grid-column: span 3;  /* 60% sur 5 colonnes virtuelles ≈ 3/5 */
}

#tab-home-scope .cp-chantier-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--cp-border-soft);
  border-left: 4px solid var(--cp-border-soft);
  cursor: pointer;
  transition: background .12s ease;
  position: relative;
}
#tab-home-scope .cp-chantier-item:last-child {
  border-bottom: none;
}
#tab-home-scope .cp-chantier-item.is-urgent {
  border-left-color: var(--cp-orange);
}
#tab-home-scope .cp-chantier-item:hover {
  background: var(--cp-card-soft);
}

#tab-home-scope .cp-chantier-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--cp-orange-soft);
  color: var(--cp-orange);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#tab-home-scope .cp-chantier-icon svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.75;
}

#tab-home-scope .cp-chantier-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#tab-home-scope .cp-chantier-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
#tab-home-scope .cp-chantier-num {
  font-family: 'JetBrains Mono', 'Menlo', monospace;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--cp-text);
}
#tab-home-scope .cp-chantier-client {
  font-size: 13px;
  font-weight: 500;
  color: var(--cp-text);
  cursor: pointer;
  transition: color .12s ease;
}
#tab-home-scope .cp-chantier-client:hover {
  color: var(--cp-orange);
}
#tab-home-scope .cp-chantier-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-radius: 4px;
}
#tab-home-scope .cp-chantier-tag.is-pdf {
  background: var(--cp-border-soft);
  color: var(--cp-text-2);
}
#tab-home-scope .cp-chantier-tag.is-peppol {
  background: var(--cp-orange-soft);
  color: var(--cp-orange);
}

#tab-home-scope .cp-chantier-meta {
  font-size: 11.5px;
  color: var(--cp-text-3);
}

#tab-home-scope .cp-chantier-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
#tab-home-scope .cp-chantier-action {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 9999px;
  border: none;
  background: var(--cp-border-soft);
  color: var(--cp-text-2);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
  /* T204B : stabilité visuelle (pas de redimensionnement après rendu) */
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  min-height: 22px;
  line-height: 1;
  flex-shrink: 0;
}
#tab-home-scope .cp-chantier-action.is-urgent {
  background: var(--cp-orange-soft);
  color: var(--cp-orange);
}
#tab-home-scope .cp-chantier-action:hover {
  background: var(--cp-orange-soft);
  color: var(--cp-orange);
}
#tab-home-scope .cp-chantier-action.is-urgent:hover {
  background: #FFE0B2;
}

#tab-home-scope .cp-chantier-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
#tab-home-scope .cp-chantier-amount {
  font-family: 'JetBrains Mono', 'Menlo', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--cp-text);
  white-space: nowrap;
}
#tab-home-scope .cp-chantier-buttons {
  display: inline-flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s ease;
}
#tab-home-scope .cp-chantier-item:hover .cp-chantier-buttons,
#tab-home-scope .cp-chantier-item:focus-within .cp-chantier-buttons {
  opacity: 1;
}
@media (hover: none), (max-width: 768px) {
  #tab-home-scope .cp-chantier-buttons { opacity: 1; }
}
#tab-home-scope .cp-icon-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--cp-text-3);
  cursor: pointer;
  transition: all .12s ease;
  flex-shrink: 0;
}
#tab-home-scope .cp-icon-btn:hover {
  background: var(--cp-border-soft);
  border-color: var(--cp-border);
  color: var(--cp-text);
}
#tab-home-scope .cp-icon-btn.is-accent:hover {
  background: var(--cp-orange-soft);
  border-color: var(--cp-orange-border);
  color: var(--cp-orange);
}
#tab-home-scope .cp-icon-btn.is-danger:hover {
  background: var(--cp-danger-soft);
  border-color: #FECACA;
  color: var(--cp-danger-text);
}
#tab-home-scope .cp-icon-btn svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.75;
}

/* ═══════════════════════════════════════════════════════════════════
   3. PIPELINE DEVIS (40%)
   ═══════════════════════════════════════════════════════════════════ */
#tab-home-scope .cp-pipeline {
  grid-column: span 2;
}
#tab-home-scope .cp-pipeline-list {
  padding: 16px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#tab-home-scope .cp-pipeline-row {
  cursor: pointer;
  transition: opacity .12s ease;
}
#tab-home-scope .cp-pipeline-row:hover {
  opacity: 0.85;
}
#tab-home-scope .cp-pipeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 12px;
}
#tab-home-scope .cp-pipeline-name {
  font-weight: 500;
  color: var(--cp-text-2);
}
#tab-home-scope .cp-pipeline-count {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--cp-text);
  font-size: 12.5px;
}
#tab-home-scope .cp-pipeline-bar {
  height: 6px;
  background: var(--cp-border-soft);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}
#tab-home-scope .cp-pipeline-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width .35s ease;
}
#tab-home-scope .cp-pipeline-fill.color-draft    { background: #94A3B8; }
#tab-home-scope .cp-pipeline-fill.color-sent     { background: var(--cp-info); }
#tab-home-scope .cp-pipeline-fill.color-viewed   { background: var(--cp-purple); }
#tab-home-scope .cp-pipeline-fill.color-accepted { background: var(--cp-success); }
#tab-home-scope .cp-pipeline-fill.color-refused  { background: var(--cp-danger); }

/* ═══════════════════════════════════════════════════════════════════
   4. DEVIS RÉCENTS (50%)
   ═══════════════════════════════════════════════════════════════════ */
#tab-home-scope .cp-recents {
  grid-column: span 2;
}
#tab-home-scope .cp-recent-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--cp-border-soft);
  cursor: pointer;
  transition: background .12s ease;
}
#tab-home-scope .cp-recent-item:last-child {
  border-bottom: none;
}
#tab-home-scope .cp-recent-item:hover {
  background: var(--cp-card-soft);
}
#tab-home-scope .cp-recent-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
#tab-home-scope .cp-recent-line1 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--cp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#tab-home-scope .cp-recent-num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--cp-text-2);
}
#tab-home-scope .cp-recent-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--cp-text-3);
  flex-wrap: wrap;
}
#tab-home-scope .cp-recent-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--cp-text);
  white-space: nowrap;
}
#tab-home-scope .cp-recent-badges {
  display: flex;
  gap: 4px;
  align-items: center;
}
#tab-home-scope .cp-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
#tab-home-scope .cp-badge.is-status-draft    { background: var(--cp-border-soft); color: var(--cp-text-2); }
#tab-home-scope .cp-badge.is-status-sent     { background: var(--cp-info-soft); color: var(--cp-info-text); }
#tab-home-scope .cp-badge.is-status-viewed   { background: var(--cp-purple-soft); color: var(--cp-purple-text); }
#tab-home-scope .cp-badge.is-status-accepted { background: var(--cp-success-soft); color: var(--cp-success-text); }
#tab-home-scope .cp-badge.is-status-refused  { background: var(--cp-danger-soft); color: var(--cp-danger-text); }
#tab-home-scope .cp-badge.is-seen     { background: var(--cp-success-soft); color: var(--cp-success-text); }
#tab-home-scope .cp-badge.is-unseen   { background: var(--cp-border-soft); color: var(--cp-text-3); }
#tab-home-scope .cp-badge.is-relance  { background: var(--cp-orange-soft); color: var(--cp-orange); }
#tab-home-scope .cp-badge svg {
  width: 9px;
  height: 9px;
  stroke-width: 2.5;
}

/* ═══════════════════════════════════════════════════════════════════
   5. NOTIFICATIONS / COMPORTEMENT CLIENT (50%)
   ═══════════════════════════════════════════════════════════════════ */
#tab-home-scope .cp-notifs {
  grid-column: span 2;
}
#tab-home-scope .cp-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--cp-border-soft);
  cursor: pointer;
  transition: background .12s ease;
}
#tab-home-scope .cp-notif-item:last-child {
  border-bottom: none;
}
#tab-home-scope .cp-notif-item:hover {
  background: var(--cp-card-soft);
}
#tab-home-scope .cp-notif-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#tab-home-scope .cp-notif-icon.color-view { background: var(--cp-purple-soft); color: var(--cp-purple-text); }
#tab-home-scope .cp-notif-icon.color-download { background: var(--cp-info-soft); color: var(--cp-info-text); }
#tab-home-scope .cp-notif-icon.color-payment { background: var(--cp-success-soft); color: var(--cp-success-text); }
#tab-home-scope .cp-notif-icon.color-warn { background: var(--cp-orange-soft); color: var(--cp-orange); }
#tab-home-scope .cp-notif-icon svg {
  width: 13px;
  height: 13px;
  stroke-width: 2;
}
#tab-home-scope .cp-notif-content {
  flex: 1;
  min-width: 0;
}
#tab-home-scope .cp-notif-title {
  font-size: 12.5px;
  color: var(--cp-text);
  line-height: 1.4;
}
#tab-home-scope .cp-notif-title strong {
  font-weight: 600;
}
#tab-home-scope .cp-notif-time {
  font-size: 10.5px;
  color: var(--cp-text-3);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════
   6. PROCHAIN RENDEZ-VOUS (50%)
   ═══════════════════════════════════════════════════════════════════ */
#tab-home-scope .cp-events {
  grid-column: span 2;
}
#tab-home-scope .cp-event-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--cp-border-soft);
  cursor: pointer;
  transition: background .12s ease;
}
#tab-home-scope .cp-event-item:last-child {
  border-bottom: none;
}
#tab-home-scope .cp-event-item:hover {
  background: var(--cp-card-soft);
}
#tab-home-scope .cp-event-date {
  background: var(--cp-orange-soft);
  border-radius: 8px;
  padding: 6px 10px;
  text-align: center;
  min-width: 50px;
}
#tab-home-scope .cp-event-date-day {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--cp-orange);
  line-height: 1;
}
#tab-home-scope .cp-event-date-month {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--cp-orange);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 1px;
}
#tab-home-scope .cp-event-content {
  min-width: 0;
}
#tab-home-scope .cp-event-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--cp-text-3);
  font-weight: 500;
}
#tab-home-scope .cp-event-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--cp-text);
  margin: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#tab-home-scope .cp-event-meta {
  font-size: 11px;
  color: var(--cp-text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════════════════
   7. TÂCHES URGENTES (50%)
   ═══════════════════════════════════════════════════════════════════ */
#tab-home-scope .cp-tasks {
  grid-column: span 2;
}
#tab-home-scope .cp-task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  border-bottom: 1px solid var(--cp-border-soft);
  cursor: pointer;
  transition: background .12s ease;
}
#tab-home-scope .cp-task-item:last-child {
  border-bottom: none;
}
#tab-home-scope .cp-task-item:hover {
  background: var(--cp-card-soft);
}
#tab-home-scope .cp-task-priority {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  min-width: 50px;
  text-align: center;
}
#tab-home-scope .cp-task-priority.is-high   { background: var(--cp-danger-soft); color: var(--cp-danger-text); }
#tab-home-scope .cp-task-priority.is-medium { background: var(--cp-orange-soft); color: var(--cp-orange); }
#tab-home-scope .cp-task-priority.is-low    { background: var(--cp-info-soft); color: var(--cp-info-text); }
#tab-home-scope .cp-task-text {
  flex: 1;
  font-size: 12.5px;
  color: var(--cp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#tab-home-scope .cp-task-due {
  font-size: 10.5px;
  color: var(--cp-text-3);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   8. COMMANDES À SUIVRE (100%)
   ═══════════════════════════════════════════════════════════════════ */
#tab-home-scope .cp-orders {
  grid-column: span 4;
}
#tab-home-scope .cp-orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
#tab-home-scope .cp-orders-table th {
  text-align: left;
  padding: 10px 20px;
  background: var(--cp-card-soft);
  font-size: 11px;
  font-weight: 600;
  color: var(--cp-text-3);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--cp-border);
}
#tab-home-scope .cp-orders-table td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--cp-border-soft);
  color: var(--cp-text);
}
#tab-home-scope .cp-orders-table tr:last-child td {
  border-bottom: none;
}
#tab-home-scope .cp-orders-table tr {
  cursor: pointer;
  transition: background .12s ease;
}
#tab-home-scope .cp-orders-table tr:hover {
  background: var(--cp-card-soft);
}
#tab-home-scope .cp-orders-supplier {
  font-weight: 500;
}
#tab-home-scope .cp-orders-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--cp-text-2);
}
#tab-home-scope .cp-orders-late {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--cp-danger-text);
}
#tab-home-scope .cp-orders-on-time {
  color: var(--cp-text-muted);
  font-size: 11px;
}

/* ═══════════════════════════════════════════════════════════════════
   9. PAIEMENTS & FACTURES À VÉRIFIER (50%)
   ═══════════════════════════════════════════════════════════════════ */
#tab-home-scope .cp-payments {
  grid-column: span 2;
}
#tab-home-scope .cp-payment-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--cp-border-soft);
  cursor: pointer;
  transition: background .12s ease;
}
#tab-home-scope .cp-payment-item:last-child {
  border-bottom: none;
}
#tab-home-scope .cp-payment-item:hover {
  background: var(--cp-card-soft);
}
#tab-home-scope .cp-payment-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#tab-home-scope .cp-payment-icon.color-pending  { background: var(--cp-orange-soft); color: var(--cp-orange); }
#tab-home-scope .cp-payment-icon.color-overdue  { background: var(--cp-danger-soft); color: var(--cp-danger-text); }
#tab-home-scope .cp-payment-icon.color-declared { background: var(--cp-info-soft); color: var(--cp-info-text); }
#tab-home-scope .cp-payment-icon.color-todo     { background: var(--cp-purple-soft); color: var(--cp-purple-text); }
#tab-home-scope .cp-payment-icon svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.75;
}
#tab-home-scope .cp-payment-body {
  flex: 1;
  min-width: 0;
}
#tab-home-scope .cp-payment-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--cp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#tab-home-scope .cp-payment-meta {
  font-size: 11px;
  color: var(--cp-text-3);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
#tab-home-scope .cp-payment-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--cp-text);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════
   10. E-FACTURATION À COMPLÉTER (50%)
   ═══════════════════════════════════════════════════════════════════ */
#tab-home-scope .cp-einvoice {
  grid-column: span 2;
}
#tab-home-scope .cp-einvoice-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--cp-border-soft);
  cursor: pointer;
  transition: background .12s ease;
}
#tab-home-scope .cp-einvoice-row:last-child {
  border-bottom: none;
}
#tab-home-scope .cp-einvoice-row:hover {
  background: var(--cp-card-soft);
}
#tab-home-scope .cp-einvoice-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
#tab-home-scope .cp-einvoice-tag.is-peppol-required { background: var(--cp-orange-soft); color: var(--cp-orange); }
#tab-home-scope .cp-einvoice-tag.is-tva-missing     { background: var(--cp-danger-soft); color: var(--cp-danger-text); }
#tab-home-scope .cp-einvoice-tag.is-peppolid-missing{ background: #FCE7F3; color: #831843; }
#tab-home-scope .cp-einvoice-tag.is-pdf-only        { background: var(--cp-border-soft); color: var(--cp-text-2); }
#tab-home-scope .cp-einvoice-content {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: var(--cp-text);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#tab-home-scope .cp-einvoice-num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--cp-text-2);
}

/* ═══════════════════════════════════════════════════════════════════
   11. ACTION SUIVANTE (compact, max 3 actions)
   ═══════════════════════════════════════════════════════════════════ */
#tab-home-scope .cp-next {
  grid-column: span 2;
}
#tab-home-scope .cp-next-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 20px 16px;
}
#tab-home-scope .cp-next-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--cp-card-soft);
  border-left: 3px solid var(--cp-orange);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
#tab-home-scope .cp-next-item:hover {
  background: var(--cp-orange-soft);
}
#tab-home-scope .cp-next-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--cp-orange);
  background: var(--cp-card);
  padding: 2px 7px;
  border-radius: 4px;
  flex-shrink: 0;
}
#tab-home-scope .cp-next-text {
  flex: 1;
  font-size: 12.5px;
  color: var(--cp-text);
  font-weight: 500;
  line-height: 1.35;
}

/* ═══════════════════════════════════════════════════════════════════
   12. CLIENTS CHAUDS (intégré dans Notifs ou widget séparé)
   ═══════════════════════════════════════════════════════════════════ */
#tab-home-scope .cp-hotclients {
  grid-column: span 2;
}
#tab-home-scope .cp-hotclient-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--cp-border-soft);
  cursor: pointer;
  transition: background .12s ease;
}
#tab-home-scope .cp-hotclient-item:last-child {
  border-bottom: none;
}
#tab-home-scope .cp-hotclient-item:hover {
  background: var(--cp-card-soft);
}
#tab-home-scope .cp-hotclient-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cp-orange-soft);
  color: var(--cp-orange);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}
#tab-home-scope .cp-hotclient-body {
  flex: 1;
  min-width: 0;
}
#tab-home-scope .cp-hotclient-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--cp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#tab-home-scope .cp-hotclient-info {
  font-size: 11px;
  color: var(--cp-text-3);
  margin-top: 2px;
}
#tab-home-scope .cp-hotclient-action {
  font-size: 10.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 9999px;
  background: var(--cp-orange-soft);
  color: var(--cp-orange);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   PILLS BLOCAGE CHANTIER (raison de la priorité)
   ═══════════════════════════════════════════════════════════════════ */
#tab-home-scope .cp-blocker-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-right: 4px;
}
#tab-home-scope .cp-blocker-tag.is-install   { background: var(--cp-orange-soft); color: var(--cp-orange); }
#tab-home-scope .cp-blocker-tag.is-order     { background: var(--cp-purple-soft); color: var(--cp-purple-text); }
#tab-home-scope .cp-blocker-tag.is-acompte   { background: var(--cp-info-soft); color: var(--cp-info-text); }
/* T204B : is-invoice = à créer (orange action), is-invoice-done = créée (vert passif) */
#tab-home-scope .cp-blocker-tag.is-invoice      { background: var(--cp-orange-soft); color: var(--cp-orange); }
#tab-home-scope .cp-blocker-tag.is-invoice-done { background: var(--cp-success-soft); color: var(--cp-success-text); }
#tab-home-scope .cp-blocker-tag.is-einvoice  { background: #FCE7F3; color: #831843; }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 1280px) {
  #tab-home-scope .cp-chantiers,
  #tab-home-scope .cp-pipeline,
  #tab-home-scope .cp-recents,
  #tab-home-scope .cp-notifs,
  #tab-home-scope .cp-events,
  #tab-home-scope .cp-tasks,
  #tab-home-scope .cp-payments,
  #tab-home-scope .cp-einvoice,
  #tab-home-scope .cp-next,
  #tab-home-scope .cp-hotclients,
  #tab-home-scope .cp-mini-events {
    grid-column: span 4;
  }
}
@media (max-width: 768px) {
  #tab-home-scope .cockpit-grid {
    grid-template-columns: 1fr 1fr;
  }
  #tab-home-scope .cp-orders {
    grid-column: span 2;
  }
}
@media (max-width: 480px) {
  #tab-home-scope .cockpit-grid {
    grid-template-columns: 1fr;
  }
  #tab-home-scope .cp-orders,
  #tab-home-scope .cp-chantiers,
  #tab-home-scope .cp-pipeline,
  #tab-home-scope .cp-recents,
  #tab-home-scope .cp-notifs,
  #tab-home-scope .cp-events,
  #tab-home-scope .cp-tasks,
  #tab-home-scope .cp-payments,
  #tab-home-scope .cp-einvoice,
  #tab-home-scope .cp-next,
  #tab-home-scope .cp-hotclients,
  #tab-home-scope .cp-mini-events {
    grid-column: span 1;
  }
  #tab-home-scope .cp-chantier-right {
    flex-direction: row;
    align-items: center;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   MINI RENDEZ-VOUS (à droite des Chantiers, ~35%)
   ═══════════════════════════════════════════════════════════════════ */
#tab-home-scope .cp-mini-events {
  /* À droite de Chantiers (qui prend span 3 = 75%) → mini prend span 1 = 25%.
     Sur écran moyen on bascule en pleine largeur via media query. */
  grid-column: span 1;
  display: flex;
  flex-direction: column;
}

/* Note : Chantiers reste span 3, ce qui laisse 1 colonne libre pour le mini.
   Pour respecter le ratio ~65/35 demandé, on garde 3+1 = 4 colonnes,
   le mini occupe naturellement 25%, les Chantiers 75%. C'est plus lisible
   que des fractions exotiques. Pipeline descend en ligne 5. */

#tab-home-scope .cp-mini-events .cp-card-body {
  padding: 0;
  max-height: none;
}

#tab-home-scope .cp-mini-event-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--cp-border-soft);
  cursor: pointer;
  transition: background .12s ease;
}
#tab-home-scope .cp-mini-event-item:last-of-type {
  border-bottom: none;
}
#tab-home-scope .cp-mini-event-item:hover {
  background: var(--cp-card-soft);
}

/* Bloc date compact (rectangle vertical) */
#tab-home-scope .cp-mini-date {
  background: var(--cp-orange-soft);
  border-radius: 6px;
  padding: 4px 7px;
  text-align: center;
  min-width: 38px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
#tab-home-scope .cp-mini-date-day {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--cp-orange);
  line-height: 1;
}
#tab-home-scope .cp-mini-date-month {
  font-size: 8.5px;
  font-weight: 600;
  color: var(--cp-orange);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* Bloc info principal */
#tab-home-scope .cp-mini-event-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
#tab-home-scope .cp-mini-event-row1 {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
#tab-home-scope .cp-mini-event-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--cp-text-2);
}
#tab-home-scope .cp-mini-event-type {
  font-size: 10px;
  font-weight: 600;
  color: var(--cp-text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
#tab-home-scope .cp-mini-event-client {
  font-size: 12px;
  font-weight: 500;
  color: var(--cp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#tab-home-scope .cp-mini-event-loc {
  font-size: 10.5px;
  color: var(--cp-text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badge statut (sobre, compact) */
#tab-home-scope .cp-mini-status {
  display: inline-flex;
  align-items: center;
  font-size: 9.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  white-space: nowrap;
}
#tab-home-scope .cp-mini-status.is-planned    { background: var(--cp-info-soft); color: var(--cp-info-text); }
#tab-home-scope .cp-mini-status.is-toconfirm  { background: var(--cp-purple-soft); color: var(--cp-purple-text); }
#tab-home-scope .cp-mini-status.is-pending    { background: var(--cp-border-soft); color: var(--cp-text-2); }
#tab-home-scope .cp-mini-status.is-urgent     { background: var(--cp-orange-soft); color: var(--cp-orange); }

/* Footer du widget : actions + ligne info */
#tab-home-scope .cp-mini-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--cp-border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}
#tab-home-scope .cp-mini-footer-info {
  font-size: 10.5px;
  color: var(--cp-text-3);
  flex: 1;
  min-width: 0;
}
#tab-home-scope .cp-mini-footer-info strong {
  color: var(--cp-orange);
  font-weight: 600;
}
#tab-home-scope .cp-mini-actions {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
}
#tab-home-scope .cp-mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--cp-border);
  background: var(--cp-card);
  color: var(--cp-text-2);
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all .12s ease;
  white-space: nowrap;
}
#tab-home-scope .cp-mini-btn:hover {
  background: var(--cp-card-soft);
  border-color: var(--cp-text-muted);
  color: var(--cp-text);
}
#tab-home-scope .cp-mini-btn.is-accent {
  background: var(--cp-orange);
  color: #FFFFFF;
  border-color: var(--cp-orange);
}
#tab-home-scope .cp-mini-btn.is-accent:hover {
  background: #C44400;
  border-color: #C44400;
}
#tab-home-scope .cp-mini-btn svg {
  width: 11px;
  height: 11px;
  stroke-width: 2;
}

#tab-home-scope .cp-mini-empty {
  padding: 20px 14px;
  text-align: center;
  color: var(--cp-text-muted);
  font-size: 11.5px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════════
   SCOPE-KILL : neutralise TOUS les anciens blocs sur le dashboard
   ═══════════════════════════════════════════════════════════════════ */

/* === Anciens KPIs HTML statiques (pages/home.html) === */
#tab-home-scope .crm-page-header,
#tab-home-scope .crm-kpi-grid,
#tab-home-scope .crm-grid-3,
#tab-home-scope .crm-grid-2 {
  display: none !important;
}

/* === Anciens hosts T187 === */
#tab-home-scope #t187fChantiersHost,
#tab-home-scope #t187fNotifHost,
#tab-home-scope #t187fPipelineHost,
#tab-home-scope #t187fRelancesHost,
#tab-home-scope #t187fPaymentsHost,
#tab-home-scope #t187fRow3,
#tab-home-scope #t187fRowToday,
#tab-home-scope #t187fRow1,
#tab-home-scope #t187fRow2 {
  display: none !important;
}

/* === Hosts dashboard-fix-t170l (alimente home.html) === */
#tab-home-scope #dashDevis,
#tab-home-scope #dashFact,
#tab-home-scope #dashTasks,
#tab-home-scope #dashAgenda,
#tab-home-scope #dashOrders {
  /* Conservés en DOM mais cachés via leur container .crm-grid-3/2 */
  display: none !important;
}

/* === Anciens blocs T188 sur le dashboard === */
#tab-home-scope #t188eEinvoiceHost,
#tab-home-scope #t188cInvoiceHost,
#tab-home-scope #t188aPanelHost {
  display: none !important;
}

/* === Légende T190 PDF/Peppol qui flotte === */
#tab-home-scope .t190-legend,
#tab-home-scope .t190-legend-bar,
#tab-home-scope [class*="t190-legend"] {
  display: none !important;
}

/* === Sécurité : masquer toute injection T193/T194 hors cockpit === */
#tab-home-scope .crm-page > *:not(.cockpit-v2):not(#cockpit-v2-root) {
  display: none !important;
}
