/* Page Mixage (php/pm/PM_get_mixage.php) et fenêtre « Lots à mixer » (PM-add-lotMixage.php).
   Compléments de la charte .ddd-achat (dist/css/achat-modal.css) : la saisie du Mixage est dans la page, pas dans une fenêtre. */

.ddd-mix {
  border: 1px solid var(--a-line);
  background: var(--a-card);
  margin: 16px 0;
}
.ddd-mix__header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--a-line);
}
.ddd-mix__body { background: var(--a-bg); padding: 18px 20px; }
.ddd-mix .ddd-achat__panel .ddd-achat__tile { margin-bottom: 0; }

/* Pesée du lot mixé : 3 champs sur toute la largeur + aperçu du résultat */
.ddd-mix__pesee { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ddd-mix__pesee .form-label { font-size: .78rem; font-weight: 600; color: var(--a-muted); margin-bottom: 4px; }
.ddd-mix__pesee .form-control { height: 42px; font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.ddd-mix__pesee .input-group-text { background: var(--a-bg); color: var(--a-muted); font-weight: 600; }
.ddd-mix__apercu {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-top: 12px; padding: 10px 12px;
  background: var(--a-accent-soft); border-radius: 10px;
}
.ddd-mix__apercu span { display: block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--a-accent); }
.ddd-mix__apercu strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; color: var(--a-text); }

/* Avant / après / écart : un tableau, une ligne par état, chiffres alignés à droite */
.ddd-mix__compare { margin-bottom: 0; }
.ddd-mix__table {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  border: 1px solid var(--a-line); border-radius: 12px; overflow: hidden;
  background: #fff;
  white-space: nowrap;
}
.ddd-mix__table thead th {
  background: var(--a-bg);
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--a-muted);
  padding: 10px 14px; text-align: right;
  border-bottom: 1px solid var(--a-line);
}
.ddd-mix__table td, .ddd-mix__table tbody th { padding: 12px 14px; vertical-align: middle; }
.ddd-mix__table td { text-align: right; }
.ddd-mix__table tbody tr + tr > * { border-top: 1px solid var(--a-line); }
.ddd-mix__table tbody th {
  text-align: left; width: 1%;
  font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  border-left: 4px solid transparent;
}
.ddd-mix__pastille { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: middle; background: currentColor; }
.ddd-mix__tr--avant th { color: #b45309; border-left-color: #f59e0b !important; }
.ddd-mix__tr--apres > * { background: var(--a-accent-soft); }
.ddd-mix__tr--apres th { color: var(--a-accent); border-left-color: var(--a-accent) !important; }
.ddd-mix__tr--ecart > * { background: #fafafa; }
.ddd-mix__tr--ecart th { color: var(--a-muted); border-left-color: #9ca3af !important; }
.ddd-mix__val {
  width: 100%; min-width: 80px;
  background: transparent; border: 0; padding: 0; outline: 0;
  text-align: right;
  font-size: 1rem; font-weight: 700;
  color: var(--a-text);
  font-variant-numeric: tabular-nums;
  -webkit-text-fill-color: currentColor; opacity: 1; /* champs désactivés : pas de gris */
}
.ddd-mix__val.ddd-mix--positif { color: var(--a-ok); }
.ddd-mix__val.ddd-mix--negatif { color: var(--a-ko); }
.ddd-mix__na { color: var(--a-muted); }
.ddd-mix__table .ddd-mix__resultat { margin-left: 8px; text-transform: none; letter-spacing: 0; }

/* Résultat du mixage (remplace le texte clignotant) */
.ddd-mix__resultat { display: inline-block; min-height: 1.6em; font-weight: 700; font-size: .9rem; }
.ddd-mix__resultat.is-profit, .ddd-mix__resultat.is-perte, .ddd-mix__resultat.is-neant { padding: 2px 12px; border-radius: 999px; }
.ddd-mix__resultat.is-profit { background: #d1fae5; color: var(--a-ok); }
.ddd-mix__resultat.is-perte { background: #fee2e2; color: var(--a-ko); }
.ddd-mix__resultat.is-neant { background: var(--a-line); color: var(--a-muted); }

/* Liste des mixages enregistrés */
.ddd-mix--liste .ddd-achat__lines { border: 0; border-radius: 0; }

/* Fenêtre « Lots à mixer » */
.ddd-mix__tiles { grid-template-columns: repeat(3, 1fr); }
.ddd-mix__search { max-width: 320px; }
#lot_table_contentMix2 tr { cursor: pointer; }

@media (max-width: 1199px) {
  .ddd-mix__table td, .ddd-mix__table tbody th, .ddd-mix__table thead th { padding-left: 8px; padding-right: 8px; }
  .ddd-mix__val { font-size: .9rem; min-width: 64px; }
}
@media (max-width: 991px) {
  .ddd-mix__apercu { grid-template-columns: repeat(2, 1fr); }
  .ddd-mix__tiles { grid-template-columns: 1fr; }
}
