/* ==========================================================================
   CATALOG MODULE STYLES
   ========================================================================== */
   
.bar-piece {
    background: var(--gray-200);
}

.cutting-waste,
.border-cut-left,
.border-cut-right {
    background: var(--gray-300);
}

.bar-waste {
  background: repeating-linear-gradient(
    45deg,
    var(--gray-300) 0 5px,
    var(--gray-100) 5px 10px
  );
}

/* Catalog Grid View */
.catalog-grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.catalog-item-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
}

.catalog-item-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

/* Catalog Card Images - Centered and Contained */
.catalog-item-card .card-image {
  width: 100%;
  height: 200px;
  object-fit: contain;
  object-position: center;
  background-color: var(--gray-50);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  padding: 1rem;
}

.catalog-item-card .card-image-placeholder {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--gray-100);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  color: var(--text-muted);
}

/* Table Images - Centered and Contained */
.table-image {
  width: 60px;
  height: 60px;
  object-fit: contain;
  object-position: center;
  border-radius: var(--radius-sm);
  background-color: var(--gray-50);
  padding: 4px;
}

.table-image-placeholder {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--gray-100);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

/* Pack Cards Grid Layout - Responsive */
#packsContainer .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  max-width: 100%;
}

/* Component Editing */
.component-edit-row {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr auto;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.component-display-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  transition: all var(--transition);
}

.component-display-row:hover {
  background: var(--gray-50);
}

.component-info {
  flex: 1;
}

.component-actions {
  display: flex;
  gap: 0.5rem;
}

/* Variables */
.variable-item {
  padding: 0.5rem;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.variable-name {
  font-weight: 600;
  color: var(--primary);
}

.variable-type {
  color: var(--text-muted);
}

/* ==========================================================================
   DOCUMENT MANAGEMENT WITH CONDITIONS
   ========================================================================== */

.documents-folders {
  display: grid;
  gap: 1.5rem;
}

.document-folder {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.folder-title {
  background: var(--gray-50);
  padding: 0.75rem 1rem;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.folder-content {
  padding: 1rem;
}

/* Document card grid */
.document-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin-top: 1rem;
}

.document-item {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--gray-50);
  transition: all 0.2s;
  overflow: hidden;
}

.document-item:hover {
  background: var(--gray-100);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.document-item.new-document {
  border-color: var(--info);
  /* css-color-ok: blue-50 fond de selection historique, pas de token */
  background: #eff6ff;
}

/* Drag states */
.document-item.dragging {
  display: none;
}

.document-list .drop-placeholder {
  border: 2px dashed var(--primary);
  background: rgba(59, 130, 246, 0.06);
  border-radius: 8px;
}

/* Drag handle button */
.btn-document-drag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--gray-400);
  cursor: grab;
  transition: all 0.2s;
}

.btn-document-drag:hover {
  color: var(--text-muted);
  background: var(--gray-200);
  border-color: var(--gray-300);
}

.btn-document-drag:active {
  cursor: grabbing;
}

/* Card preview area */
.document-card-preview {
  position: relative;
  width: 100%;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.document-card-preview .document-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.document-card-preview .document-icon-large {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
}

/* Position badge */
.document-position-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  z-index: 1;
  line-height: 1;
}

.document-item.new-document .document-position-badge {
  background: rgba(59, 130, 246, 0.8);
}

/* Card body */
.document-card-body {
  padding: 8px 10px;
  flex: 1;
  min-width: 0;
}

.document-name {
  font-weight: 500;
  font-size: 12px;
  color: var(--text-primary);
  margin-bottom: 2px;
  word-break: break-word;
}

.document-meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.document-name-select-wrapper {
  margin-bottom: 4px;
}

.document-name-select-wrapper select {
  width: 100%;
  font-size: 11px;
  padding: 3px 6px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  background: white;
  color: var(--gray-700);
  cursor: pointer;
}

.document-condition-input {
  margin-top: 4px;
}

.document-condition-input input {
  width: 100%;
  font-size: 11px;
  padding: 4px 6px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  transition: border-color 0.2s;
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
}

.document-condition-input input:focus {
  outline: none;
  border-color: var(--info);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.document-condition-input input::placeholder {
  color: var(--gray-400);
  font-style: italic;
}

/* Card actions footer */
.document-card-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  background: var(--gray-50);
  box-sizing: border-box;
}

.document-card-actions .action-buttons {
  display: flex;
  gap: 2px;
}

.btn-document-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-document-action:hover {
  background: white;
  border-color: var(--gray-300);
  color: var(--gray-700);
}

.btn-document-action.text-error {
  color: var(--error);
}

.btn-document-action.text-error:hover {
  /* css-color-ok: red-50 fond d'erreur, plus clair que --state-red-bg */
  background: #fef2f2;
  /* css-color-ok: lisere red-200 historique, entre --state-red-bg et --error */
  border-color: #fecaca;
  color: var(--error-hover);
}

.btn-document-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Legacy class kept for compatibility */
.document-type-select-wrapper {
  margin-bottom: 4px;
}

.document-type-select {
  font-size: 11px;
  padding: 3px 6px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  background: white;
  color: var(--gray-700);
  cursor: pointer;
  transition: border-color 0.2s;
  max-width: 100%;
  width: 100%;
}

.document-type-select:hover {
  border-color: var(--gray-400);
}

.document-type-select:focus {
  outline: none;
  border-color: var(--info);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ==========================================================================
   COLLAPSIBLE DOCUMENT SECTIONS
   ========================================================================== */

.document-section-toggle {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.document-section-toggle:hover {
  color: var(--primary);
}

.document-section-toggle .toggle-icon {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.document-section-toggle .document-count {
  font-size: 12px;
  font-weight: normal;
  color: var(--text-muted);
  margin-left: auto;
}

.document-section-content {
  overflow: visible;
  transition: opacity 0.2s ease, padding 0.2s ease;
  opacity: 1;
}

.document-section-content.collapsed {
  display: none;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
}

/* ==========================================================================
   IMAGE GALLERY WITH CONDITIONS
   ========================================================================== */

.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  min-height: 50px;
}

.image-gallery-item {
  position: relative;
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: visible;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.image-gallery-item:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border-color: var(--gray-300);
}

.image-gallery-item.new-image {
  border-color: var(--info);
  /* css-color-ok: blue-50 fond de selection historique, pas de token */
  background: #eff6ff;
}

.image-gallery-item.dragging {
  opacity: 0.5;
}

.image-gallery-item img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  object-position: center;
  background: white;
  padding: 8px;
  border-radius: 8px 8px 0 0;
}

.image-gallery-item .primary-badge,
.image-gallery-item .new-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.image-gallery-item .new-badge {
  background: var(--success);
  color: white;
}

.image-gallery-item .primary-badge {
  background: var(--info);
  color: white;
  top: 36px;
}

.image-condition-input {
  padding: 8px;
  background: white;
  border-top: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
}

.image-condition-input input {
  width: 100%;
  font-size: 12px;
  padding: 6px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  transition: border-color 0.2s;
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
}

.image-condition-input input:focus {
  outline: none;
  border-color: var(--info);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.image-condition-input input::placeholder {
  color: var(--gray-400);
  font-style: italic;
}

.image-gallery-item .image-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  padding: 4px;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

.image-gallery-item .drag-handle {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.9);
  padding: 6px;
  border-radius: 4px;
  cursor: move;
  z-index: 11;
  opacity: 0;
  transition: opacity 0.2s;
}

.image-gallery-item:hover .drag-handle {
  opacity: 1;
}

/* Button Icon Styles */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-700);
}

.btn-icon:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-icon.text-error {
  color: var(--error);
}

.btn-icon.text-error:hover:not(:disabled) {
  /* css-color-ok: red-50 fond d'erreur, plus clair que --state-red-bg */
  background: #fef2f2;
  /* css-color-ok: lisere red-200 historique, entre --state-red-bg et --error */
  border-color: #fecaca;
  color: var(--error-hover);
}

/* Densité catalogue : seul écart assumé au .form-input-sm canonique (qui
   porte déjà padding 4/8 et min-height 28) — corps 12px pour les grilles
   denses. Réduit de 4 !important à une déclaration le 2026-08-27. */
.form-input-sm {
  font-size: 12px;
}

/* ==========================================================================
   SINGLE-ROW COMPONENT LAYOUT
   ========================================================================== */

.component-row {
  display: grid;
  grid-template-columns: 120px 1fr 200px 1fr auto;
  gap: 16px;
  padding: 20px;
  border: 2px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--gray-50) 100%);
  align-items: start;
  transition: all 0.3s ease;
  position: relative;
}

.component-row:hover {
  border-color: var(--gray-300);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* Component Type Indicators */
.component-row[data-type="product"]::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(to bottom, var(--accent), var(--accent-hover));
  border-radius: 12px 0 0 12px;
}

.component-row[data-type="pack"]::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  /* css-color-ok: violet-600 second arret du degrade, pas de token */
  background: linear-gradient(to bottom, var(--state-violet-dot), #7c3aed);
  border-radius: 12px 0 0 12px;
}

.component-row[data-type="custom"]::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(to bottom, var(--warning), var(--warning-hover));
  border-radius: 12px 0 0 12px;
}

.component-row[data-type="input"]::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  /* css-color-ok: blue-600 second arret du degrade, pas de token */
  background: linear-gradient(to bottom, var(--info), #2563eb);
  border-radius: 12px 0 0 12px;
}

/* Component Field Sizing */
.component-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.component-field:first-child {
  flex: 0 0 120px;
}

.component-field-flex {
  flex: 1;
  min-width: 150px;
}

.component-field:nth-child(3):not(.component-actions) {
  flex: 0 0 150px;
}

.component-field:nth-child(4):not(.component-actions) {
  flex: 0 0 180px;
}

.component-actions {
  flex: 0 0 auto;
  align-self: flex-end;
  padding-bottom: 0.25rem;
}

/* Component Input Styles */
.component-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.25rem;
  display: block;
}

.component-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: border-color 0.15s ease-in-out;
  background: white;
}

.component-input:focus {
  outline: none;
  border-color: var(--info);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Variant Form Styles */
.variant-row {
  /* css-color-ok: slate-50 fond historique, pas de token (--gray-50 est #f9fafb) */
  background-color: #f8fafc;
  border: 1px solid var(--state-graphite-bg);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
}

.variant-row:hover {
  /* css-color-ok: gris ardoise historique (palette pre-tokens), pas de token */
  border-color: #cbd5e0;
  /* css-color-ok: blanc casse ardoise historique, pas de token */
  background-color: #f7fafc;
}

/* ==========================================================================
   RESPONSIVE STYLES
   ========================================================================== */

@media (min-width: 640px) {
  #packsContainer .grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
  
  .image-gallery {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@media (min-width: 768px) {
  .catalog-grid-view {
    grid-template-columns: 1fr;
  }
  
  .image-gallery {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (min-width: 1024px) {
  #packsContainer .grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
  
  .image-gallery {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

@media (min-width: 1280px) {
  #packsContainer .grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }
  
  .image-gallery {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

@media (max-width: 1200px) {
  .component-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .component-actions {
    flex-direction: row;
    justify-content: flex-end;
    padding-top: 0;
    margin-top: 16px;
  }
}

@media (max-width: 768px) {
  .document-item {
    flex-direction: column;
    gap: 12px;
  }
  
  .document-actions {
    margin-left: 0;
    justify-content: flex-end;
    width: 100%;
  }
  
  .image-gallery {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  
  .image-gallery-item img {
    height: 150px;
  }
  
  .component-row {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .component-field,
  .component-field-flex,
  .component-field:first-child,
  .component-field:nth-child(3):not(.component-actions),
  .component-field:nth-child(4):not(.component-actions) {
    flex: none;
    width: 100%;
    min-width: 0;
  }
  
  .component-actions {
    align-self: stretch;
  }
  
  .component-edit-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

@media (max-width: 480px) {
  .image-gallery {
    grid-template-columns: 1fr;
  }

  .document-type-select {
    max-width: 100%;
  }
}

/* Tab styles moved to shared modals.css (app-core) */

/* Component Image Drop Zone */
.comp-img-dropzone {
    border: 2px dashed var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.comp-img-dropzone:hover,
.comp-img-dropzone.drag-over {
    border-color: var(--primary);
    background: var(--color-surface-2);
}

.comp-img-dropzone.drag-over {
    background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

.comp-img-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    pointer-events: none;
}

.comp-img-placeholder svg {
    opacity: 0.5;
}

.comp-img-placeholder-text {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
    margin: 0;
}

.comp-img-placeholder-hint {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0;
}

.comp-img-preview {
    width: 100%;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.comp-img-preview img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 4px;
}

/* Fix: section header/dropzone rows in variables table must not inherit sticky-right from td:last-child */
.table tr.var-section-header td:last-child,
.table tr.var-section-dropzone td:last-child {
  position: static;
  right: auto;
  width: auto;
  min-width: auto;
  max-width: none;
  background: inherit;
}

/* ===========================================================================
   Universal Import Page
   =========================================================================== */

/* File drop zone */
.file-drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    background: var(--gray-50);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
}
.file-drop-zone:hover,
.file-drop-zone.drag-over {
    border-color: var(--primary);
    background: var(--color-surface-2);
}
.file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}
.file-drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    pointer-events: none;
    text-align: center;
}
.file-drop-icon {
    color: var(--text-secondary);
    opacity: 0.6;
}
.file-drop-zone .file-selected {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
}
.file-drop-zone .file-selected img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.file-drop-zone .file-selected-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Mapping table — the main overflow fix */
.mapping-table-container {
    overflow-x: auto;
    max-width: 100%;
}
.mapping-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.mapping-table th,
.mapping-table td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    text-align: left;
}
.mapping-table th {
    background: var(--gray-50);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
/* Column widths: File Column | Sample Data | Map to Field | Variant | Actions */
.mapping-table th:nth-child(1),
.mapping-table td:nth-child(1) { width: 18%; }
.mapping-table th:nth-child(2),
.mapping-table td:nth-child(2) { width: 20%; }
.mapping-table th:nth-child(3),
.mapping-table td:nth-child(3) { width: auto; }
.mapping-table th:nth-child(4),
.mapping-table td:nth-child(4) { width: 80px; text-align: center; }
.mapping-table th:nth-child(5),
.mapping-table td:nth-child(5) { width: 90px; }

.sample-data {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}
.mapping-select {
    width: 100%;
    min-width: 0;
}
.mapping-select.mapped-field {
    border-color: var(--success);
    background-color: color-mix(in srgb, var(--success) 8%, transparent);
}
.mapping-select.required-field {
    border-color: var(--primary);
}

/* Form subsection */
.form-subsection {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.form-subsection-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* Quantity presets */
.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Sheet tabs */
.sheet-tabs {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

/* Page header: wrap buttons on narrow viewports */
.page-header-actions .flex {
    flex-wrap: wrap;
}

/* =====================================================
   Sub-pack accordion (expand/collapse in pack editor)
   ===================================================== */
.subpack-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    cursor: pointer;
    margin-right: 6px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
}
.subpack-toggle-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}
.subpack-toggle-btn.expanded {
    color: var(--primary);
}

.subpack-detail-row > td {
    padding: 0 !important;
    /* css-color-ok: gris tres clair historique (--bg-muted n'existe nulle part), pas de token */
    background: #f8f9fa;
    border-bottom: 2px solid var(--border);
}
.subpack-detail-container {
    padding: 10px 16px 10px 40px;
}
.subpack-detail-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.subpack-detail-table {
    width: 100%;
    font-size: 0.8rem;
    border-collapse: collapse;
}
.subpack-detail-table th {
    text-align: left;
    padding: 4px 8px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.subpack-detail-table td {
    padding: 3px 8px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.subpack-detail-table tbody tr:last-child td {
    border-bottom: none;
}
.subpack-type-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Constant formula fields (Z variables: Wz, Hz, HD) — always computed, not editable */
.dimension-constant {
    background: var(--gray-100);
    color: var(--text-secondary);
    cursor: not-allowed;
    border-style: dashed;
}


/* Résultats de « Importer depuis un pack » (constructeur de pack) — le
   survol était un couple onmouseover/onmouseout inline posé par
   catalog-packs.js (JS-12, 2026-09-06) ; c'est une règle de feuille. */
.import-pack-item {
    cursor: pointer;
    transition: background-color 0.15s;
}
.import-pack-item:hover {
    background-color: var(--gray-100);
}
