/* ============================================================
   caisse.css — Module Caisse matériel (préfixe .cm-)
   Charte ERP : navy #1a3a8f / gold #c9a84c. Police Exo 2 / DM Sans.
   Réutilise les cards/segments Topage (.tp-*) et boutons ERP (.btn-*).
   N'ajoute que ce qui n'existe pas ailleurs : switch on/off, liste
   d'articles, feuille d'impression A5.
   ============================================================ */

/* ── Indice ampleur non choisie ── */
.cm-ampleur-hint {
  margin-top: 10px;
  padding: 9px 13px; border-radius: 8px; font-size: 12.5px;
  background: #fef3c7; color: #92400e; border: 1px solid #fde68a;
}

/* ── Liste des articles — tableau strict (calqué .pt-table-wrap) ── */
.cm-list { margin-top: 4px; }
.cm-table-wrap {
  background: #fff; border: 1.5px solid var(--border); border-radius: 14px;
  overflow: hidden; box-shadow: 0 2px 8px rgba(26,58,143,.06);
}
.cm-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }

/* En-tête navy/gold identique au Plan de tir */
.cm-table thead tr { background: var(--navy); }
.cm-table thead th {
  font-family: 'Exo 2', sans-serif; font-size: 9px; font-weight: 700; color: var(--gold);
  text-transform: uppercase; letter-spacing: .8px; padding: 10px 12px; text-align: left;
  border-right: 1px solid rgba(201,168,76,.2); white-space: nowrap;
}
.cm-table thead th:last-child { border-right: none; }

/* Corps : alternance pt-ra/pt-rb (réutilise les classes Plan de tir) */
.cm-table tbody td {
  padding: 9px 12px; font-family: 'DM Sans', sans-serif; font-size: 12.5px; color: var(--text);
  border-bottom: 1px solid var(--border-light, #eef0f6); border-right: 1px solid var(--border-light, #eef0f6);
  vertical-align: middle;
}
.cm-table tbody td:last-child { border-right: none; }
.cm-table tbody tr:last-child td { border-bottom: none; }
.cm-table tbody tr.pt-ra { background: #fff; }
.cm-table tbody tr.pt-rb { background: #f8f9fe; }
.cm-table tbody tr:hover { background: var(--navy-light) !important; }
.cm-table tbody tr.cm-inactive { opacity: .42; }
.cm-table tbody tr.cm-inactive:hover { background: inherit !important; }

/* Colonnes à largeur fixe pour un alignement strict */
.cm-table .cm-c-tg   { width: 64px;  text-align: center; }
.cm-table .cm-c-art  { width: auto;  font-weight: 600; color: #1f2937; }
.cm-table .cm-c-badge{ width: 90px;  text-align: center; }
.cm-table .cm-c-edit { width: 78px;  text-align: center; white-space: nowrap; }
.cm-table .cm-c-qty  { width: 90px;  text-align: right; }
.cm-table .cm-c-unit { width: 110px; color: #6b7280; }
.cm-table tbody .cm-c-tg { line-height: 0; }
.cm-table tbody .cm-c-edit > .cm-pencil + .cm-pencil,
.cm-table tbody .cm-c-edit > .cm-del { margin-left: 4px; }

.cm-val { font-weight: 800; font-family: 'Exo 2', sans-serif; font-size: 14px; color: var(--navy); }

/* ── Badges AUTO / MODIFIÉ / MANUEL ── */
.cm-badge {
  display: inline-flex; align-items: center;
  font-size: 9.5px; font-weight: 700; letter-spacing: .4px;
  padding: 2px 7px; border-radius: 999px; text-transform: uppercase;
}
.cm-badge-auto { background: #eef2ff; color: var(--navy, #1a3a8f); border: 1px solid #c7d2fe; }
.cm-badge-mod  { background: var(--gold, #c9a84c); color: #fff; }
.cm-badge-manu { background: #1a3a8f; color: #fff; }

/* ── Indices secondaires ── */
.cm-amp-hint {
  font-size: 10px; font-weight: 600; color: #b45309;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px;
  padding: 1px 6px; text-transform: uppercase; letter-spacing: .3px;
}
.cm-amp-hint.cm-opt { color: #6b7280; background: #f3f4f6; border-color: #e5e7eb; }

/* ── Crayon d'édition + revert + suppression ── */
.cm-pencil, .cm-del {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0;
  background: #fff; color: var(--navy, #1a3a8f);
  border: 1px solid var(--border, #d6d9e0); border-radius: 7px; cursor: pointer;
  transition: all .15s;
}
.cm-pencil:hover { background: #f0f4ff; border-color: var(--navy, #1a3a8f); }
.cm-revert { color: var(--gold, #c9a84c); }
.cm-revert:hover { background: #fdf6e3; border-color: var(--gold, #c9a84c); }
.cm-del { color: #d93025; }
.cm-del:hover { background: #fdecea; border-color: #d93025; }

/* ── Champ quantité éditable ── */
.cm-qty-input {
  width: 100%; max-width: 80px; padding: 6px 8px; font-family: 'Exo 2', sans-serif; font-size: 13px;
  font-weight: 700; text-align: right; border: 1px solid var(--navy, #1a3a8f); border-radius: 7px;
  background: #fff; color: #1f2937; box-sizing: border-box;
}
.cm-qty-input:focus { outline: none; box-shadow: 0 0 0 3px rgba(26,58,143,.12); }
.cm-qty-input:disabled { border-color: var(--border, #d6d9e0); background: #f9fafb; color: #9ca3af; }

/* Switch on/off : réutilise .toggle-switch ERP (style.css:193) — navy via
   override #s-caisse-materiel dans style-erp.css. Pas de style local ici. */

/* ── Zone ajout manuel ── */
.cm-add-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.cm-add-row .tp-field { margin-bottom: 0; }
.cm-add-qty { max-width: 130px; }

/* ════════════════════════════════════════════════════════════
   FEUILLE D'IMPRESSION A5 PORTRAIT (zone #cm-print-area, masquée écran)
   Finition calquée sur le Plan de tir : bandeau navy starburst, table
   navy/gold, alternance pt-ra/pt-rb. Unités en pt comme pt-styles.css.
   ════════════════════════════════════════════════════════════ */
#cm-print-area { display: none; }

/* ── Bandeau (copie .pt-ph-inner) ── */
.cm-ph-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 10pt;
  background: var(--navy, #1a3a8f); padding: 7pt 11pt; border-radius: 6pt; margin-bottom: 9pt;
}
.cm-ph-brand { display: flex; align-items: center; flex: 0 0 auto; }
.cm-topbar-brand { display: flex; align-items: center; gap: 7pt; }
.cm-topbar-sep { width: 1px; height: 26pt; background: rgba(255,255,255,.25); }
.cm-topbar-brand-name { font-family: 'Exo 2', sans-serif; font-size: 13pt; font-weight: 800; color: #fff; letter-spacing: .5pt; }
.cm-topbar-brand-module { display: flex; align-items: center; gap: 3pt; font-family: 'DM Sans', sans-serif; font-size: 7.5pt; color: rgba(255,255,255,.7); margin-top: 1pt; }
.cm-ph-center { flex: 1; text-align: center; }
.cm-ph-title { font-family: 'Exo 2', sans-serif; font-size: 13pt; font-weight: 800; color: #fff; letter-spacing: 1pt; line-height: 1.1; }
.cm-ph-meta { font-family: 'DM Sans', sans-serif; font-size: 8pt; color: rgba(255,255,255,.75); margin-top: 2pt; }
.cm-ph-right { display: flex; flex-direction: column; justify-content: center; align-items: flex-end; flex: 0 0 auto; min-width: 50pt; }
.cm-ph-num { font-family: 'Exo 2', sans-serif; font-size: 10pt; font-weight: 700; color: var(--gold, #c9a84c); }
.cm-ph-sub { font-family: 'DM Sans', sans-serif; font-size: 6.5pt; color: rgba(255,255,255,.55); text-transform: uppercase; letter-spacing: .5pt; margin-top: 1pt; }

/* ── Table d'impression ── */
.cm-print-table { width: 100%; border-collapse: collapse; font-size: 9pt; }
.cm-print-table thead tr { background: var(--navy, #1a3a8f); }
.cm-print-table thead th {
  font-family: 'Exo 2', sans-serif; font-size: 7pt; font-weight: 700; color: var(--gold, #c9a84c);
  text-transform: uppercase; letter-spacing: .6pt; padding: 5pt 7pt; text-align: left;
  border-right: 0.5pt solid rgba(201,168,76,.25);
}
.cm-print-table thead th:last-child { border-right: none; }
.cm-print-table tbody td {
  padding: 4pt 7pt; font-family: 'DM Sans', sans-serif; color: #1f2937;
  border-bottom: 0.5pt solid #e3e7f2;
}
.cm-print-table tbody tr.pt-ra { background: #fff; }
.cm-print-table tbody tr.pt-rb { background: #edf1fb; }
.cm-print-table tbody tr:last-child td { border-bottom: none; }
.cm-print-table tbody tr { page-break-inside: avoid; break-inside: avoid; }

.cm-pt-art  { font-weight: 600; }
.cm-pt-qty  { width: 38pt; text-align: right; white-space: nowrap; font-family: 'Exo 2', sans-serif; font-weight: 800; color: var(--navy, #1a3a8f); }
.cm-pt-unit { width: 70pt; color: #6b7280; font-size: 8pt; }
.cm-pt-chk  { width: 22pt; text-align: center; }
.cm-print-table thead .cm-pt-qty,
.cm-print-table thead .cm-pt-chk { text-align: center; }
.cm-pt-box {
  display: inline-block; width: 11pt; height: 11pt;
  border: 1pt solid var(--navy, #1a3a8f); border-radius: 2pt; vertical-align: middle;
}
.cm-pt-empty { text-align: center; color: #9ca3af; font-style: italic; padding: 10pt; }

/* ── Pied de tableau (récap ampleur) ── */
.cm-print-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 7pt; padding-top: 4pt; border-top: 1pt solid var(--gold, #c9a84c);
  font-family: 'DM Sans', sans-serif; font-size: 7.5pt; color: #555;
}
.cm-print-foot b { font-family: 'Exo 2', sans-serif; color: var(--navy, #1a3a8f); }
