/* ═══════════════════════════════════════════════════════════════════════
   CAMALARM CRM — T205B — Page PROJETS
   ═══════════════════════════════════════════════════════════════════════
   Styles : header, filtres, KPIs, cartes/liste, panneau détail
   Cohérence visuelle avec dashboard cockpit + agenda T203 + tasks T204
   Pas de jaune. Couleurs CAMALARM (orange #E65100, slate, success vert).
   ═══════════════════════════════════════════════════════════════════════ */

#tab-process-scope {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ═══ HEADER ═══════════════════════════════════════════════════════ */
.proj-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 4px 0;
}
.proj-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.proj-page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  color: #0F172A;
  margin: 0;
  letter-spacing: -0.02em;
}
.proj-page-title svg { color: #E65100; }
.proj-count {
  font-size: 12.5px;
  font-weight: 600;
  color: #64748B;
  background: #F1F5F9;
  padding: 4px 10px;
  border-radius: 9999px;
}
.proj-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ═══ TOGGLE VUE ═══════════════════════════════════════════════════ */
.proj-view-toggle {
  display: inline-flex;
  background: #F1F5F9;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 3px;
}
.proj-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: #64748B;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.12s ease;
}
.proj-view-btn svg { width: 14px; height: 14px; }
.proj-view-btn:hover { color: #0F172A; }
.proj-view-btn.is-active {
  background: #FFFFFF;
  color: #E65100;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

/* ═══ FILTRES ══════════════════════════════════════════════════════ */
.proj-filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: #FAFBFD;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
}
.proj-search-bar {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 380px;
}
.proj-search-bar svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: #94A3B8;
  pointer-events: none;
}
.proj-search-bar input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  background: #FFFFFF;
  color: #0F172A;
  box-sizing: border-box;
}
.proj-search-bar input:focus {
  outline: 0;
  border-color: #E65100;
  box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.10);
}
.proj-filter-select {
  padding: 8px 28px 8px 12px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  font-size: 12.5px;
  font-family: 'Inter', sans-serif;
  background: #FFFFFF;
  color: #475569;
  cursor: pointer;
  font-weight: 500;
}
.proj-filter-select:focus { outline: 0; border-color: #E65100; }
.proj-filter-clear {
  padding: 7px 9px;
  background: transparent;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  cursor: pointer;
  color: #94A3B8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.proj-filter-clear svg { width: 14px; height: 14px; }
.proj-filter-clear:hover { background: #F1F5F9; color: #0F172A; }

/* ═══ KPIs ═════════════════════════════════════════════════════════ */
.proj-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.proj-kpi {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 12px 16px;
}
.proj-kpi-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.proj-kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: #0F172A;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* ═══ CONTENT HOST ═════════════════════════════════════════════════ */
.proj-content {
  flex: 1;
  min-height: 200px;
}

/* ═══ VUE CARTES ═══════════════════════════════════════════════════ */
.proj-host-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.proj-card {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}
.proj-card:hover {
  border-color: #FFCC80;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}
.proj-card:focus-visible {
  outline: 2px solid #E65100;
  outline-offset: 2px;
}
.proj-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.proj-card-eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #64748B;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}
.proj-card-ref {
  font-family: 'JetBrains Mono', 'Menlo', monospace;
  font-weight: 700;
  color: #E65100;
  font-size: 11.5px;
}
.proj-card-ref-manual {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5B21B6;
  background: #F5F3FF;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: 'Inter', sans-serif;
}
.proj-card-sep { color: #CBD5E1; }
.proj-card-title {
  font-size: 15.5px;
  font-weight: 700;
  color: #0F172A;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.proj-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #64748B;
  flex-wrap: wrap;
}
.proj-card-amount {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #0F172A;
}
.proj-card-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  border-top: 1px dashed #F1F5F9;
}
.proj-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #64748B;
}
.proj-stat svg {
  width: 13px;
  height: 13px;
  color: #94A3B8;
}
.proj-card-progress {
  height: 4px;
  background: #F1F5F9;
  border-radius: 9999px;
  overflow: hidden;
}
.proj-card-progress-bar {
  height: 100%;
  background: linear-gradient(to right, #E65100, #FF8A00);
  border-radius: 9999px;
  transition: width 0.3s ease;
}
.proj-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  border-top: 1px solid #F1F5F9;
  padding-top: 10px;
}
.proj-card-action {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  color: #94A3B8;
  transition: all 0.12s ease;
}
.proj-card-action svg { width: 15px; height: 15px; }
.proj-card-action:hover {
  background: #FFF8F0;
  color: #E65100;
  border-color: #FFCC80;
}

/* ═══ STATUS BADGE ═════════════════════════════════════════════════ */
.proj-status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: 9999px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ═══ VUE LISTE ════════════════════════════════════════════════════ */
.proj-host-list {
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  overflow: hidden;
}
.proj-list-header {
  display: grid;
  grid-template-columns: 100px 1.2fr 2fr 100px 130px 80px 50px;
  gap: 14px;
  padding: 11px 16px;
  background: #FAFBFD;
  border-bottom: 1px solid #E5E7EB;
  font-size: 10.5px;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.proj-row {
  display: grid;
  grid-template-columns: 100px 1.2fr 2fr 100px 130px 80px 50px;
  gap: 14px;
  padding: 12px 16px;
  align-items: center;
  border-bottom: 1px solid #F1F5F9;
  cursor: pointer;
  transition: background 0.12s ease;
  font-size: 13px;
}
.proj-row:last-child { border-bottom: none; }
.proj-row:hover { background: #FAFBFD; }
.proj-row:focus-visible { outline: 2px solid #E65100; outline-offset: -2px; }
.proj-row-ref {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #E65100;
  font-size: 12px;
}
.proj-row-client { color: #0F172A; font-weight: 500; }
.proj-row-title {
  color: #0F172A;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proj-row-amount {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: #0F172A;
  text-align: right;
  font-size: 12.5px;
}
.proj-row-progress {
  height: 4px;
  background: #F1F5F9;
  border-radius: 9999px;
  overflow: hidden;
}
.proj-row-progress-bar {
  height: 100%;
  background: linear-gradient(to right, #E65100, #FF8A00);
}
.proj-row-actions {
  display: flex;
  justify-content: flex-end;
}

/* ═══ EMPTY STATE ══════════════════════════════════════════════════ */
.proj-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  gap: 12px;
}
.proj-empty svg {
  width: 48px;
  height: 48px;
  color: #CBD5E1;
}
.proj-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: #0F172A;
}
.proj-empty-text {
  font-size: 13px;
  color: #64748B;
  max-width: 420px;
  line-height: 1.5;
}
.proj-empty-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.proj-no-results {
  padding: 48px 24px;
  text-align: center;
  color: #94A3B8;
  font-size: 13px;
  font-style: italic;
}
.proj-link-btn {
  background: transparent;
  border: none;
  color: #E65100;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  padding: 0 4px;
  font-family: inherit;
}
.proj-link-btn:hover { color: #C44400; }

/* ═══ PANNEAU DÉTAIL (slide-in droite) ═════════════════════════════ */
.proj-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 9000;
  display: flex;
  justify-content: flex-end;
  animation: projOverlayFadeIn 0.2s ease;
}
@keyframes projOverlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.proj-detail-panel {
  width: 520px;
  max-width: 96vw;
  height: 100vh;
  background: #FFFFFF;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 24px rgba(15, 23, 42, 0.12);
  animation: projPanelSlideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
@keyframes projPanelSlideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.proj-detail-header {
  padding: 18px 22px;
  border-bottom: 1px solid #E5E7EB;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  background: #FAFBFD;
}
.proj-detail-header-text { flex: 1; min-width: 0; }
.proj-detail-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.proj-detail-ref-tag {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #E65100;
  font-size: 11.5px;
  background: #FFF8F0;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #FFE0B2;
}
.proj-detail-title {
  font-size: 17px;
  font-weight: 700;
  color: #0F172A;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  line-height: 1.3;
}
.proj-detail-subtitle {
  font-size: 12.5px;
  color: #64748B;
  line-height: 1.4;
}
.proj-detail-close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  color: #64748B;
  flex-shrink: 0;
}
.proj-detail-close svg { width: 16px; height: 16px; }
.proj-detail-close:hover {
  background: #F1F5F9;
  color: #0F172A;
}
.proj-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.proj-detail-section {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 14px 16px;
}
.proj-detail-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #0F172A;
  margin: 0 0 10px 0;
  letter-spacing: -0.01em;
}
.proj-detail-section-title svg {
  width: 14px;
  height: 14px;
  color: #E65100;
}
.proj-detail-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.proj-info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  font-size: 12.5px;
}
.proj-info-label {
  color: #64748B;
  font-weight: 500;
  flex-shrink: 0;
}
.proj-info-value {
  color: #0F172A;
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}
.proj-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #F1F5F9;
}
.proj-detail-row:last-child { border-bottom: none; }
.proj-detail-row-main { flex: 1; min-width: 0; }
.proj-detail-row-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #0F172A;
  line-height: 1.4;
}
.proj-detail-row-meta {
  font-size: 11.5px;
  color: #64748B;
  margin-top: 2px;
}
.proj-detail-row-side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.proj-detail-row-status {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 4px;
  background: #F1F5F9;
  color: #475569;
}
.proj-status-recue { background: #ECFDF5; color: #065F46; }
.proj-status-a_valider { background: #FFF7ED; color: #9A3412; }
.proj-status-a_commander, .proj-status-commandee { background: #EFF6FF; color: #1E40AF; }
.proj-status-en_transit, .proj-status-expediee { background: #F5F3FF; color: #5B21B6; }
.proj-status-paid { background: #ECFDF5; color: #065F46; }
.proj-status-unpaid { background: #FEF3C7; color: #92400E; }

.proj-detail-empty {
  text-align: center;
  font-size: 12.5px;
  color: #94A3B8;
  font-style: italic;
  padding: 16px 0;
}
.proj-detail-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* ═══ MODALE CRÉATION PROJET MANUEL ═══════════════════════════════ */
#projCreateModal.is-open {
  display: flex !important;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 9100;
  align-items: center;
  justify-content: center;
}

/* ═══ RESPONSIVE ═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .proj-host-cards {
    grid-template-columns: 1fr;
  }
  .proj-list-header,
  .proj-row {
    grid-template-columns: 90px 1fr 100px 50px;
    gap: 8px;
  }
  .proj-list-header > :nth-child(3),
  .proj-list-header > :nth-child(5),
  .proj-list-header > :nth-child(6),
  .proj-row-title,
  .proj-row-amount,
  .proj-row-progress {
    display: none;
  }
  .proj-detail-panel {
    width: 100vw;
  }
  .proj-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .proj-search-bar {
    max-width: none;
  }
  .proj-header {
    flex-direction: column;
    align-items: stretch;
  }
}
