/* ==========================================================================
   QALIS NOVA — Composants partagés des modules ERP (planning, devis, factures)
   S'appuie sur les jetons de theme-light.css.
   ========================================================================== */

/* La zone principale est un élément flex : sans min-width: 0, un tableau large
   l'élargit au-delà de l'écran au lieu de défiler dans son panneau */
.main-content {
  min-width: 0;
}

.erp-num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.erp-muted {
  color: var(--text-muted);
}

/* Statuts --------------------------------------------------------------- */
.erp-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.5;
  white-space: nowrap;
  color: var(--erp-status-color, #566074);
  background: var(--erp-status-bg, #eef1f5);
  box-shadow: inset 0 0 0 1px var(--erp-status-ring, rgba(86, 96, 116, 0.18));
}

.erp-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.erp-status--DRAFT     { --erp-status-color: #566074; --erp-status-bg: #f1f3f6; --erp-status-ring: rgba(86, 96, 116, 0.2); }
.erp-status--SENT      { --erp-status-color: #1d5fa8; --erp-status-bg: #eaf2fb; --erp-status-ring: rgba(29, 95, 168, 0.22); }
.erp-status--SIGNED    { --erp-status-color: #0f7a52; --erp-status-bg: #e8f6ef; --erp-status-ring: rgba(15, 122, 82, 0.22); }
.erp-status--INVOICED  { --erp-status-color: #5b3fb3; --erp-status-bg: #f1edfb; --erp-status-ring: rgba(91, 63, 179, 0.2); }
.erp-status--REFUSED   { --erp-status-color: #b42318; --erp-status-bg: #fdeeec; --erp-status-ring: rgba(180, 35, 24, 0.2); }
.erp-status--EXPIRED   { --erp-status-color: #8a5a00; --erp-status-bg: #fdf4e3; --erp-status-ring: rgba(138, 90, 0, 0.22); }
.erp-status--PAID      { --erp-status-color: #0f7a52; --erp-status-bg: #e8f6ef; --erp-status-ring: rgba(15, 122, 82, 0.22); }
.erp-status--OVERDUE   { --erp-status-color: #b42318; --erp-status-bg: #fdeeec; --erp-status-ring: rgba(180, 35, 24, 0.22); }
.erp-status--PLANNED   { --erp-status-color: #8a5a00; --erp-status-bg: #fdf4e3; --erp-status-ring: rgba(138, 90, 0, 0.22); }
.erp-status--CONFIRMED { --erp-status-color: #1d5fa8; --erp-status-bg: #eaf2fb; --erp-status-ring: rgba(29, 95, 168, 0.22); }
.erp-status--DONE      { --erp-status-color: #0f7a52; --erp-status-bg: #e8f6ef; --erp-status-ring: rgba(15, 122, 82, 0.22); }

/* Contrôle segmenté ------------------------------------------------------ */
.erp-segmented {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  border-radius: 10px;
  background: #eef1f5;
  box-shadow: inset 0 1px 2px rgba(24, 32, 47, 0.08);
}

.erp-segmented button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 0;
  border-radius: 7px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.erp-segmented button:hover {
  color: var(--qn-ink);
}

.erp-segmented button.active {
  color: var(--qn-ink);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(24, 32, 47, 0.1), 0 2px 8px -2px rgba(24, 32, 47, 0.12);
}

.erp-segmented .erp-count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  color: var(--text-secondary);
  background: rgba(24, 32, 47, 0.07);
}

.erp-segmented button.active .erp-count {
  color: #fff;
  background: var(--qn-ink);
}

/* Filtres en pastilles ---------------------------------------------------- */
.erp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.erp-chip {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: #ffffff;
  cursor: pointer;
  transition: all 0.16s ease;
}

.erp-chip:hover {
  border-color: var(--border-highlight);
  color: var(--qn-ink);
}

.erp-chip.active {
  color: var(--qn-ink);
  border-color: rgba(196, 138, 38, 0.55);
  background: var(--qn-gold-soft);
  box-shadow: 0 0 0 3px rgba(196, 138, 38, 0.12);
}

/* Recherche ------------------------------------------------------------- */
.erp-search {
  position: relative;
  min-width: 240px;
}

.erp-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.erp-search .input-field {
  width: 100%;
  padding-left: 36px;
}

/* Avatar coloré d'une ressource ------------------------------------------ */
.erp-avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--res-color, #566074);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12), 0 4px 10px -4px var(--res-color, #566074);
}

/* État vide --------------------------------------------------------------- */
.erp-empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--text-muted);
}

.erp-empty i {
  display: block;
  margin-bottom: 8px;
  font-size: 30px;
  color: var(--border-highlight);
}

/* Bandeau d'information de phase 1 --------------------------------------- */
.erp-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #6b4a0f;
  background: var(--qn-gold-soft);
  box-shadow: inset 0 0 0 1px rgba(196, 138, 38, 0.25);
}

.erp-notice i {
  margin-top: 1px;
  font-size: 16px;
  color: var(--qn-gold);
}
