/* stock : styles propres à ce module (chargé après style.css) */

/* ---------- filtre par catégorie ---------- */
.stock-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.stock-cats .segbtn { padding: 6px 12px; min-height: 40px; }
.tgt [hidden] { display: none !important; }

/* ---------- quantité à commander : le chiffre que la direction et les salariés cherchent ---------- */
.order-qty { display: inline-flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.order-num { font-size: 1.9rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.order-unit { color: var(--muted); font-size: .9rem; font-weight: 600; }
.order-qty.lv-low .order-num { color: var(--warn); }
.order-qty.lv-out .order-num { color: var(--bad); }
.order-qty.idle .order-num, .order-qty.none .order-num { color: var(--muted); font-size: 1.3rem; font-weight: 650; }
.order-num-sm { font-size: 1.15rem; }
.order-sum { font-weight: 650; }
.stock-table tr.lv-row.lv-low td.order-td, .order-table tr.lv-low td.order-td { background: var(--warn-bg); }
.stock-table tr.lv-row.lv-out td.order-td, .order-table tr.lv-out td.order-td { background: var(--bad-bg); }
.stock-table td.order-td, .order-table td.order-td { vertical-align: middle; }

/* ---------- liste de la direction ---------- */
.cell-stack { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.cell-stack .badge { justify-self: start; }
@media (max-width: 760px) { .cell-stack { justify-items: end; text-align: right; } .cell-stack .badge { justify-self: end; } .urgent-line { justify-items: end; } }
.cat-list + .row { margin-top: 12px; }
.cat-unlisted { margin-top: 16px; }
.urgent-line { margin-top: 6px; display: grid; gap: 6px; justify-items: start; }
.stock-table td .thresholds { display: block; white-space: normal; }
@media (min-width: 761px) {
  .stock-table { table-layout: auto; }
  .stock-table td { overflow-wrap: break-word; }
  .stock-table td[data-label="Article"] { min-width: 8.5rem; }
  .stock-table td .qty-cell { min-width: 96px; }
  .stock-table td.actions-td .actions-cell { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 6px; }
  .stock-table td.order-td { min-width: 110px; }
  .stock-table td[data-label="Cible et seuils"] { min-width: 9rem; }
  .urgent-line { max-width: 15rem; }
  .order-table { table-layout: fixed; }
  .order-table th:nth-child(1) { width: 26%; }
  .order-table th:nth-child(2) { width: 20%; }
  .order-table th:nth-child(3) { width: 38%; }
  .order-table th:nth-child(4) { width: 16%; }
  .order-table td { overflow-wrap: anywhere; vertical-align: top; }
}

/* ---------- Besoins réseau ---------- */
.net-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 12px; }
.net-card { text-align: left; display: grid; gap: 4px; align-content: start; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-left: 6px solid var(--ok);
  border-radius: 14px; padding: 14px; font: inherit; cursor: pointer; min-height: 44px; }
.net-card.lv-low { border-left-color: var(--honey-strong); }
.net-card.lv-out { border-left-color: var(--bad); }
.net-card.lv-none { border-left-color: var(--line-strong, var(--line)); }
.net-card:hover { box-shadow: 0 0 0 2px var(--line-strong, var(--line)); }
.net-card:focus-visible { outline: 3px solid var(--focus, var(--honey)); outline-offset: 2px; }
.net-name { overflow-wrap: anywhere; }
.net-big { font-size: 1.9rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.net-unit { font-size: .9rem; font-weight: 600; color: var(--muted); }
.net-card.lv-out .net-big { color: var(--bad); }
.net-card.lv-low .net-big { color: var(--warn); }
.net-urgent { color: var(--bad); font-weight: 700; }

/* ---------- Commandes à préparer ---------- */
.order-sites { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.order-sites li { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; }
.order-sites .os-name { font-weight: 650; }
.order-sites .os-qty { font-weight: 800; font-variant-numeric: tabular-nums; }
.order-sites li.is-urgent .os-qty { color: var(--bad); }
.order-sites .os-note { flex-basis: 100%; }
@media (max-width: 760px) { .order-sites li { justify-content: flex-end; } }
.print-sheet .order-print { width: 100%; border-collapse: collapse; }
.print-sheet .order-print th, .print-sheet .order-print td { border: 1px solid #999; padding: 3px 6px; text-align: left; vertical-align: top; }
.print-sheet .order-print th { background: #eef0ea; }

/* ---------- carte d'article du salarié ---------- */
.stock-card { grid-template-columns: minmax(0, 1fr); }
.stock-figures { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: flex-end; }
.stock-figures .fig-k { display: block; color: var(--muted); font-size: .8rem; font-weight: 650; }
.stock-figures .stock-qty { text-align: left; justify-items: start; }
.stock-order .order-num { font-size: 1.9rem; }
.stock-card .stock-actions { grid-column: 1 / -1; }
@media (min-width: 560px) {
  .stock-card { grid-template-columns: minmax(0, 1fr) auto; }
  .stock-figures { justify-content: flex-end; }
  .stock-card .stock-actions { grid-column: 1 / -1; flex-wrap: wrap; }
}

/* ---------- catégories ---------- */
.cat-list { display: grid; }
.cat-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cat-row .cat-move { display: flex; gap: 4px; }
.cat-row .cat-name { flex: 1 1 180px; min-width: 0; }
.cat-row .cat-name-static { flex: 1 1 180px; overflow-wrap: anywhere; }
.cat-row .cat-count { white-space: nowrap; }
.cat-row select { flex: 1 1 160px; width: auto; min-height: 40px; }
.cat-row.is-hidden .cat-name { opacity: .6; }
.order-table th { white-space: normal; }
