/* Module « Apports commerciaux » — styles propres, alignés sur le design system Marcel. */

.apports-tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 4px 0 18px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.apports-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border: 1px solid var(--border, #e2e8f0);
  background: #fff; color: var(--text-muted, #64748b);
  border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .12s ease;
}
.apports-tab:hover { background: #f8fafc; color: var(--text, #0f172a); }
.apports-tab.active {
  background: var(--primary, #4f46e5); color: #fff;
  border-color: var(--primary, #4f46e5);
}
.apports-tab svg { opacity: .9; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }

.apo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px 22px; }
.apo-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 2px; }
.apo-field label { font-size: 12px; font-weight: 600; color: var(--text, #334155); line-height: 1.35; min-height: 17px; }
.apo-field textarea { resize: vertical; }
.apo-field .form-control { padding: 9px 11px; }

.apo-sep {
  margin: 18px 0 10px; font-size: 13px; font-weight: 700; color: var(--text, #0f172a);
  border-top: 1px dashed var(--border, #e2e8f0); padding-top: 12px;
}
.apo-sep span { font-weight: 400; font-size: 11.5px; color: var(--text-muted, #64748b); }

.apo-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; padding: 4px 0; }
.apo-sum-item { background: #f8fafc; border: 1px solid var(--border, #e2e8f0); border-radius: 9px; padding: 10px 12px; }
.apo-sum-label { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted, #94a3b8); font-weight: 600; }
.apo-sum-value { font-size: 15px; font-weight: 700; color: var(--text, #0f172a); margin-top: 3px; }

.apo-detail-cout { margin-top: 12px; font-size: 12px; color: var(--text-muted, #64748b); }

.apo-mode-note {
  margin-top: 12px; padding: 9px 12px; background: #f1f5f9; border-radius: 8px;
  font-size: 12px; color: var(--text-muted, #64748b); display: flex; align-items: center; gap: 7px;
}
.apo-mode-note svg { flex-shrink: 0; opacity: .7; }

.apo-calc-result { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border, #e2e8f0); }

.apo-filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 12px; }
.apo-filters select { width: auto; min-width: 150px; font-size: 12.5px; }

/* Sélection multiple + actions groupées */
.apo-bulk { padding: 0; }
.apo-bulkbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 9px;
  padding: 8px 12px; margin: 0 0 10px;
}
.apo-bulkbar span { font-weight: 700; font-size: 13px; color: var(--primary, #4f46e5); margin-right: auto; }
.apo-bulkbar select { width: auto; font-size: 12.5px; }
.apo-rowact { white-space: nowrap; }
.apo-rowact .btn { padding: 4px 7px; }
.apo-check { width: 16px; height: 16px; cursor: pointer; }

.apo-regles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.apo-regle { border: 1px solid var(--border, #e2e8f0); border-radius: 10px; padding: 12px 14px; background: #fff; }
.apo-regle-t { font-size: 13px; font-weight: 700; color: var(--text, #0f172a); margin-bottom: 5px; }
.apo-regle-b { font-size: 12.5px; color: var(--text-muted, #475569); line-height: 1.5; }

/* Modale du module */
.apo-modal-back {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center; z-index: 9999; padding: 20px;
}
.apo-modal {
  background: #fff; border-radius: 14px; width: 100%; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.apo-modal-h { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border, #e2e8f0); }
.apo-modal-t { font-size: 15px; font-weight: 700; color: var(--text, #0f172a); }
.apo-modal-x { margin-left: auto; border: none; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-muted, #94a3b8); }
.apo-modal-b { padding: 18px; overflow-y: auto; }
.apo-modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border, #e2e8f0); }

/* ---- Respiration générale du module ---- */

/* Plus d'air dans les cartes du module. */
#apports-body .card { padding: 20px 22px; margin-bottom: 18px; }
#apports-body .card-header { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border, #eef2f6); gap: 12px; }
#apports-body .card-title { font-size: 15px; }

/* Tables plus aérées et lisibles dans tout le module. */
#apports-body .table { border-collapse: separate; border-spacing: 0; }
#apports-body .table th {
  padding: 10px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-muted, #64748b); white-space: nowrap;
  border-bottom: 1px solid var(--border, #e2e8f0); vertical-align: middle;
}
#apports-body .table td { padding: 12px 14px; vertical-align: middle; }
#apports-body .table tbody tr { border-bottom: 1px solid var(--border, #f1f5f9); }
#apports-body .table tbody tr:hover { background: #f8fafc; }

/* Espacement des cartes-résumé. */
.apo-summary { gap: 14px; }
.apo-sum-item { padding: 12px 14px; }
.apo-sep { margin: 24px 0 14px; }

/* Tableau « Taux par catégorie » : colonnes équilibrées et valeurs alignées. */
.apo-cat-table { table-layout: fixed; width: 100%; }
.apo-cat-table th:first-child, .apo-cat-table td:first-child { width: 28%; text-align: left; }
.apo-cat-table th:not(:first-child) { text-align: right; }
.apo-cat-table td.apo-cat-name { font-weight: 600; color: var(--text, #0f172a); }
.apo-cat-table td:not(:first-child) { padding: 8px 14px; }
.apo-num { width: 100%; text-align: right; }

@media (max-width: 640px) {
  .apports-tab span { display: none; }
  .apports-tab { padding: 9px 11px; }
  #apports-body .card { padding: 16px 14px; }
}
