/* =============================================================================
   Étiquettes : écran de préparation (avec app.css) et planches imprimées (avec
   impressions.css). Les dimensions propres au format (grille, taille d'une
   étiquette, marges, corps du texte) viennent de la feuille calculée
   /etiquettes/planche.css?format=… ; ici, la mise en forme commune.
   ============================================================================= */

/* --- Écran de préparation ---------------------------------------------------- */
.etq-ajout, .etq-boutons { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.etq-ajout .btn-sm { margin-top: 0; }
.etq-boutons { justify-content: flex-end; border-top: 1px solid var(--line-2, #ECEEF2); }
.etq-depart { display: grid; gap: 3px; width: 100%; max-width: 220px; padding: 6px; border: 1px solid var(--line, #DCDFE5); border-radius: 6px; background: var(--surface-2, #F8F9FB); }
.etq-depart button { min-height: 16px; aspect-ratio: 2 / 1; padding: 0; border: 1px solid var(--field, #C5CAD3); border-radius: 2px; background: #FFFFFF; cursor: pointer; }
.etq-depart button:hover { border-color: var(--primary, #1E56C8); }
.etq-depart button.prise { background: var(--gray-bg, #ECEEF2); border-style: dashed; }
.etq-depart button.on { background: var(--primary, #1E56C8); border-color: var(--primary, #1E56C8); }
.etq-depart-c1 { grid-template-columns: repeat(1, 1fr); }
.etq-depart-c2 { grid-template-columns: repeat(2, 1fr); }
.etq-depart-c3 { grid-template-columns: repeat(3, 1fr); }
.etq-depart-c4 { grid-template-columns: repeat(4, 1fr); }
.etq-depart-c5 { grid-template-columns: repeat(5, 1fr); }
.etq-depart-c6 { grid-template-columns: repeat(6, 1fr); }
.etq-depart-c7 { grid-template-columns: repeat(7, 1fr); }
.etq-depart-c8 { grid-template-columns: repeat(8, 1fr); }
.etq-depart-c9 { grid-template-columns: repeat(9, 1fr); }
.etq-depart-c10 { grid-template-columns: repeat(10, 1fr); }
.etq-verif td.wrap { white-space: normal; min-width: 220px; max-width: 420px; overflow-wrap: anywhere; }
.etq-alerte { display: block; margin-top: 4px; font-size: 12.5px; color: var(--amber-ink, #7A4F00); }
.etq-alerte::before { content: '⚠ '; }
.etq-cb-apercu { white-space: nowrap; }
.etq-cb-apercu svg { display: block; max-width: 220px; height: auto; margin-bottom: 2px; }

/* --- Planches imprimées --------------------------------------------------------- */
.planches { overflow-x: auto; padding: 16px 0 24px; }
.planche { display: grid; align-content: start; justify-content: start; position: relative; overflow: hidden; margin: 0 auto 10mm;
  background: #FFFFFF; box-shadow: 0 8px 24px rgba(18,24,38,.15); }
.etq { display: flex; flex-direction: column; gap: 0.6mm; min-width: 0; overflow: hidden; color: #000000;
  font-family: 'IBM Plex Sans', Arial, Helvetica, sans-serif; line-height: 1.18; outline: 0.2mm dashed #C5CAD3; outline-offset: -0.1mm; }
.etq-vide { outline-color: #ECEEF2; background: repeating-linear-gradient(45deg, #FFFFFF 0 2mm, #F4F5F7 2mm 4mm); }
.etq-tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 2mm; }
.etq-ref { font-family: 'IBM Plex Mono', Consolas, monospace; font-weight: 600; font-size: 1.12em; overflow-wrap: anywhere; min-width: 0; }
.etq-prix { flex: none; font-weight: 700; font-size: 1.5em; line-height: 1.05; text-align: right; white-space: nowrap; }
.etq-prix small { display: block; font-size: 0.42em; font-weight: 500; letter-spacing: .02em; }
.etq-lib { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; min-height: 0; flex: 0 1 auto; }
.etq-lib-2 { font-style: italic; }
.etq-cot { font-size: 0.82em; }
.etq-cb { flex: none; margin-top: auto; display: flex; justify-content: center; align-items: flex-end; }
.etq-cb svg { display: block; max-width: 100%; }

/* Planche d'essai : cadres, croix, règles millimétrées */
.etq-essai { outline: 0.25mm solid #000000; outline-offset: -0.125mm; align-items: center; justify-content: center; position: relative; font-size: 8pt; }
.etq-num { font-weight: 700; font-size: 1.6em; }
.etq-taille { color: #5B616E; }
.etq-croix { position: absolute; left: 50%; top: 50%; width: 6mm; height: 6mm; margin: -3mm 0 0 -3mm; }
.etq-croix::before, .etq-croix::after { content: ''; position: absolute; background: #000000; }
.etq-croix::before { left: 50%; top: 0; bottom: 0; width: 0.2mm; }
.etq-croix::after { top: 50%; left: 0; right: 0; height: 0.2mm; }
.regle { position: absolute; left: 0; top: 0; display: flex; pointer-events: none; font: 5pt/1 'IBM Plex Mono', monospace; color: #B42318; }
.regle-h { height: 2.5mm; }
.regle-h span { flex: none; width: 10mm; border-right: 0.2mm solid #B42318; text-align: right; padding-right: 0.5mm; }
.regle-v { flex-direction: column; width: 4mm; }
.regle-v span { flex: none; height: 10mm; border-bottom: 0.2mm solid #B42318; display: flex; align-items: flex-end; }

@media print {
  .planches { overflow: visible; padding: 0; }
  .planche { margin: 0; box-shadow: none; break-after: page; }
  .planche:last-child { break-after: auto; }
  .etq { outline: none; }
  .etq-vide { background: none; }
  .etq-essai { outline: 0.25mm solid #000000; }
}

/* Groupes de cases de l'écran (fieldset sans retrait par défaut du navigateur) */
fieldset.fld { padding: 0; }
fieldset.fld legend { padding: 0; margin-bottom: 6px; }
