/* Styles propres au module purchases (recettes sur les jetons Cosmos uniquement). */

/* ── Liste : bandeau « analyse des achats » ─────────────────────── */
.po-summary { display: grid; grid-template-columns: minmax(12rem, 1fr) minmax(0, 1.4fr) minmax(0, 1.4fr); gap: var(--space-3); }
.po-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1-5); }
.po-bars li { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.po-bars .gauge-bar { flex: none; height: 4px; }
.po-bar-link { display: flex; justify-content: space-between; gap: var(--space-2); min-width: 0; padding: 0; border: 0; background: transparent; color: var(--text-body); font: inherit; font-size: var(--text-xs); text-align: left; cursor: pointer; }
.po-bar-link:hover span:first-child, .po-bar-link[aria-pressed="true"] span:first-child { color: var(--text-link); text-decoration: underline; }
.po-bar-link:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; border-radius: var(--radius-xs); }
.po-bar-link .num { color: var(--text-strong); font-weight: var(--weight-semibold); flex: none; }

/* Badges d'état (réception ET facturation, A8) et jauges reçu / facturé. */
.po-badges { display: inline-flex; flex-wrap: wrap; gap: var(--space-1); }
.po-gauges { display: flex; flex-direction: column; gap: var(--space-1); min-width: 8.5rem; }
.po-gauge { min-width: 0; }
.po-gauge-label { flex: none; width: 3.25rem; font-size: var(--text-2xs); color: var(--text-muted); }
.po-gauge .gauge-text { flex: none; width: 2.5rem; text-align: right; }

/* ── Fiche ──────────────────────────────────────────────────────── */
.po-progress { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); max-width: 40rem; }
.po-progress .po-gauge { flex: 1 1 14rem; }
.po-lines-legend .badge { margin-right: var(--space-1); }

/* A12 : la grille ne déborde jamais — colonnes resserrées, libellés repliés. */
.po-lines .lines-table { table-layout: auto; }
.po-lines .lines-table td.col-label { min-width: 9rem; overflow-wrap: anywhere; }
.po-lines .lines-grid.is-readonly .lines-table .col-product { width: auto; min-width: 8rem; max-width: 12rem; overflow-wrap: anywhere; }
.po-lines .lines-grid.is-readonly .lines-table th, .po-lines .lines-grid.is-readonly .lines-table td { padding-left: var(--space-1-5); padding-right: var(--space-1-5); }
.po-gap { display: inline-block; padding: 0 var(--space-1-5); border-radius: var(--radius-sm); background: var(--amber-50); color: var(--amber-700); font-weight: var(--weight-semibold); box-shadow: inset 0 0 0 1px var(--amber-100); }

.po-side .card-body { gap: var(--space-3); }
.po-notes { margin: var(--space-1) 0 0; white-space: pre-line; color: var(--text-body); }
.po-receipts, .po-invoices { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.po-receipts ul { list-style: none; margin: var(--space-1) 0 0; padding: 0; font-size: var(--text-sm); color: var(--text-body); }
.po-receipt-head { display: flex; justify-content: space-between; gap: var(--space-2); }
.po-receipts .num { display: inline-block; min-width: 2.5rem; font-weight: var(--weight-semibold); color: var(--text-strong); }
.po-receipts .num.text-danger { color: var(--rose-700); }
.po-invoices li { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.po-invoices li .num { margin-left: auto; font-weight: var(--weight-semibold); color: var(--text-strong); }
.po-history > summary { cursor: pointer; list-style: none; border-bottom: 0; }
.po-history > summary::-webkit-details-marker { display: none; }
.po-history[open] > summary { border-bottom: 1px solid var(--border-subtle); }

/* Panneau de réception */
.po-receive-table .po-receive-input { width: 6rem; margin-left: auto; }

@media (max-width: 1279px) {
  .po-summary { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .po-summary > .kpi:first-child { grid-column: 1 / -1; }
}

@media (max-width: 767px) {
  .po-summary { grid-template-columns: minmax(0, 1fr); }
  .po-gauges { min-width: 0; width: 60%; }
  .po-lines .lines-table td.col-label, .po-lines .lines-table .col-product { min-width: 0; width: 100%; max-width: none; }
  .po-receive-table .po-receive-input { width: 7rem; }
}

/* A12 (suite) : sur la fiche, colonne latérale plus étroite et colonnes
   numériques resserrées pour que la grille éditable tienne sans défilement. */
@media (min-width: 1280px) {
  .po-sheet { grid-template-columns: minmax(0, 1fr) 17rem; }
}
@media (min-width: 768px) {
  .po-lines .line-actions .hide-desktop { display: none; }
  .po-lines .lines-table .col-product { width: 9rem; }
  .po-lines .lines-table td.col-label { min-width: 7rem; }
  .po-lines .lines-table .col-qty { width: 4rem; }
  .po-lines .lines-table .col-price { width: 6rem; }
  .po-lines .lines-table .col-disc { width: 4rem; }
  .po-lines .lines-table .col-tax { width: 5.25rem; }
  .po-lines .lines-table .col-total { width: 6.5rem; }
}
.po-legend { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); justify-content: flex-end; }

/* Liste : colonnes secondaires repliées sur les largeurs intermédiaires. */
@media (max-width: 1279px) { .table .po-hide-lg { display: none; } }
@media (max-width: 1279px) { .table .po-hide-md { display: none; } }
