/* ============================================
   LUZE VINTAGE MANAGER - Styles
   ============================================ */

:root {
  --bg: #f5f5f0;
  --white: #ffffff;
  --black: #1a1a1a;
  --gray-100: #f7f7f5;
  --gray-200: #eeece8;
  --gray-300: #d4d1cb;
  --gray-400: #a8a49c;
  --gray-500: #7a766e;
  --gray-600: #5c5850;
  --accent: #1a1a1a;
  --accent-light: #333;
  --green: #2e7d32;
  --green-bg: #e8f5e9;
  --blue: #1565c0;
  --blue-bg: #e3f2fd;
  --orange: #e65100;
  --orange-bg: #fff3e0;
  --red: #c62828;
  --red-bg: #ffebee;
  --sidebar-width: 240px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--black);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--black);
  color: white;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-header { padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 24px; }
.sidebar-header h1 { font-size: 20px; font-weight: 700; letter-spacing: 2px; }
.sidebar-header h1 span { font-weight: 300; }
.sidebar-header .subtitle { font-size: 11px; color: var(--gray-400); letter-spacing: 4px; text-transform: uppercase; margin-top: 2px; }

.nav-menu { list-style: none; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--gray-400);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 4px;
}
.nav-item:hover { color: white; background: rgba(255,255,255,0.08); }
.nav-item.active { color: white; background: rgba(255,255,255,0.12); }

.sidebar-footer { padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.1); }
.status-indicator { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--gray-400); padding: 6px 8px; }
.btn-logout { width: 100%; margin-top: 12px; padding: 8px 12px; border: 1px solid rgba(255,255,255,0.15); border-radius: 8px; background: rgba(255,255,255,0.05); color: var(--gray-400); font-size: 12px; cursor: pointer; transition: all 0.2s; }
.btn-logout:hover { background: rgba(255,255,255,0.12); color: white; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-green { background: #4caf50; }
.dot-orange { background: #ff9800; }
.dot-red { background: #f44336; }

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 32px;
  max-width: 1400px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 { font-size: 24px; font-weight: 700; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card.highlight { background: var(--black); color: white; }
.stat-card.highlight .stat-label { color: var(--gray-400); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--gray-500); font-weight: 500; margin-top: 2px; }

/* ===== CARDS ===== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

/* Bouton déconnexion mobile — masqué sur desktop */
.mobile-logout { display: none; }
.mobile-more-btn { display: none; }
.mobile-more-menu { display: none; }
.mobile-more-overlay { display: none; }
/* Raccourcis mobile — masqués sur desktop */
.mobile-shortcuts { display: none; }
@media (max-width: 600px) { .mobile-shortcuts { display: block !important; } }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ===== TABLE ===== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px; font-size: 12px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--gray-200); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--gray-200); font-size: 13px; }
tr:hover td { background: var(--gray-100); }

/* Table complète (inventaire) */
.table-full { width: 100%; table-layout: fixed; }
.table-full th { padding: 8px 5px; font-size: 11px; position: sticky; top: 0; background: var(--white); z-index: 1; }
.table-full td { padding: 6px 5px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.table-full .actions-cell { white-space: nowrap; position: relative; overflow: visible; }
.piece-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 0; }
.table-full .badge { padding: 2px 6px; font-size: 10px; letter-spacing: 0; }

/* Action dropdown menu */
.action-dropdown { position: relative; display: inline-block; }
.action-dropdown-toggle { font-size: 16px !important; font-weight: bold; padding: 4px 10px !important; cursor: pointer; letter-spacing: 2px; }
.action-dropdown-menu {
  display: none;
  position: fixed;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 9999;
  min-width: 160px;
  padding: 6px 0;
  overflow: hidden;
}
.action-dropdown-menu.visible { display: block; }
.action-menu-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: none;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
  color: var(--gray-700);
  white-space: nowrap;
  transition: background 0.15s;
}
.action-menu-item:hover { background: var(--gray-100); }
.action-menu-commande:hover { background: #e3f2fd; color: #1565c0; }
.action-menu-vendu:hover { background: #e8f5e9; color: #2e7d32; }
.action-menu-perso:hover { background: #fff3e0; color: #e65100; }
.action-menu-shopify-sale:hover { background: #c8e6c9; color: #1b5e20; }
.action-menu-shopify-vitrine:hover { background: #fff9c4; color: #f57f17; }
.action-menu-supprimer { color: var(--red); }
.action-menu-supprimer:hover { background: #ffebee; color: #b71c1c; }
.action-menu-divider { height: 1px; background: var(--gray-200); margin: 4px 0; }
.row-vendu { background: #f1f8e9; }
.row-vendu:hover td { background: #e8f5e9; }
.row-offert { background: #fce4ec30; }
.row-offert:hover td { background: #fce4ec50; }
.inv-row { cursor: pointer; }
.inv-row:hover td { background: var(--gray-100); }

/* Inventory toolbar */
.inv-toolbar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.inv-search-box { flex: 1; min-width: 280px; position: relative; }
.inv-search-icon { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 16px; pointer-events: none; color: var(--gray-400); }
.inv-search { width: 100%; padding: 12px 42px 12px 14px; border: 2px solid var(--gray-200); border-radius: var(--radius-sm); font-size: 15px; background: var(--white); transition: border-color 0.2s; }
.inv-search:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(26,26,26,0.08); }
.inv-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.inv-count-badge { font-size: 14px; color: var(--gray-500); font-weight: 400; margin-left: 12px; }

/* Sortable columns */
.sortable, .sortable-sale { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable:hover, .sortable-sale:hover { background: var(--gray-100) !important; }
.sort-arrow { font-size: 10px; opacity: 0.3; margin-left: 2px; }
.sort-arrow::after { content: '⇅'; }
.sort-asc .sort-arrow { opacity: 1; }
.sort-asc .sort-arrow::after { content: '↑'; }
.sort-desc .sort-arrow { opacity: 1; }
.sort-desc .sort-arrow::after { content: '↓'; }

/* Modal */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: center; }
.modal-overlay.visible { display: flex; }
.modal-box { background: #fff; padding: 32px; border-radius: 16px; width: 90%; box-shadow: var(--shadow-lg); animation: modalIn 0.2s ease; }
.modal-input { width: 100%; padding: 10px 12px; border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 14px; }
.modal-input:focus { border-color: var(--accent); outline: none; }
@keyframes modalIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

/* ===== SELECTION DE LA SEMAINE ===== */
.selection-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--gray-100); transition: background 0.15s; }
.selection-item:hover { background: var(--gray-50); }
.selection-item:last-child { border-bottom: none; }
.selection-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; border: 1px solid var(--gray-200); background: var(--gray-100); flex-shrink: 0; }
.selection-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.selection-info strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== PHOTOS GRID ===== */
.photos-grid { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 0; }
.photo-thumb { position: relative; width: 110px; height: 110px; border-radius: 10px; overflow: hidden; border: 2px solid var(--gray-200); background: var(--gray-100); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb-remove { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff; border: none; cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center; line-height: 1; }
.photo-thumb-remove:hover { background: var(--red); }
.photo-thumb-badge { position: absolute; bottom: 4px; left: 4px; background: rgba(0,0,0,0.6); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 10px; }
.photo-thumb.main { border-color: var(--green); }
.photo-thumb-add { display: flex; align-items: center; justify-content: center; cursor: pointer; border: 2px dashed var(--gray-300); background: transparent; font-size: 28px; color: var(--gray-400); }
.photo-thumb-add:hover { border-color: var(--accent); color: var(--accent); }

/* ===== TOGGLE SWITCH ===== */
.switch { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: var(--gray-300); border-radius: 26px; transition: 0.3s; }
.switch-slider:before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
.switch input:checked + .switch-slider { background: var(--green); }
.switch input:checked + .switch-slider:before { transform: translateX(22px); }

/* ===== MICROPHONE BUTTON ===== */
.btn-micro { position: absolute; right: 8px; top: 8px; width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--gray-100); cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.btn-micro:hover { background: var(--gray-200); transform: scale(1.1); }
.btn-micro.recording { background: var(--red); animation: pulse-rec 1.2s infinite; }
@keyframes pulse-rec { 0%, 100% { box-shadow: 0 0 0 0 rgba(198,40,40,0.4); } 50% { box-shadow: 0 0 0 10px rgba(198,40,40,0); } }

/* ===== STATUS BADGES ===== */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-vendu { background: var(--green-bg); color: var(--green); }
.badge-enligne { background: var(--blue-bg); color: var(--blue); }
.badge-enstock { background: var(--orange-bg); color: var(--orange); }
.badge-encours { background: var(--gray-200); color: var(--gray-600); }
.badge-perso { background: #f3e5f5; color: #7b1fa2; }
.badge-transit { background: #fff3e0; color: #e65100; border: 1px dashed #e65100; }
.badge-recu { background: #e8f5e9; color: #2e7d32; border: 1px dashed #2e7d32; }
.badge-offert { background: #fce4ec; color: #c62828; }
.badge-commande { background: #e8eaf6; color: #283593; }
.badge-livre { background: #e0f2f1; color: #00695c; }
.badge-supprime { background: var(--gray-200); color: var(--gray-400); text-decoration: line-through; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--gray-600); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

input[type="text"], input[type="number"], input[type="email"],
textarea, select, .search-input, .select-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--white);
  transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--black); }
.search-input { width: 240px; }
.select-input { width: auto; min-width: 150px; }

/* ===== MULTISELECT DROPDOWN ===== */
.multiselect-dropdown { position: relative; display: inline-block; }
.multiselect-toggle { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; text-align: left; white-space: nowrap; }
.multiselect-arrow { font-size: 11px; color: var(--gray-500); }
.multiselect-menu {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 100;
  background: var(--white); border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1); min-width: 200px; padding: 6px 0;
}
.multiselect-dropdown.open .multiselect-menu { display: block; }
.multiselect-option {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  cursor: pointer; font-size: 14px; transition: background 0.15s;
}
.multiselect-option:hover { background: var(--gray-100); }
.multiselect-option input[type="checkbox"] { accent-color: var(--black); width: 16px; height: 16px; cursor: pointer; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn-primary { background: var(--black); color: white; }
.btn-primary:hover { background: var(--accent-light); }
.btn-outline { background: transparent; border: 1.5px solid var(--gray-300); color: var(--black); }
.btn-outline:hover { border-color: var(--black); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11px; min-width: 28px; border-radius: 6px; }
.btn-lg { padding: 14px 28px; font-size: 15px; width: 100%; justify-content: center; }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #b71c1c; }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #1b5e20; }
.form-actions { margin-top: 24px; }

/* ===== PHOTO UPLOAD ===== */
.dropzone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 48px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--gray-400);
}
.dropzone:hover { border-color: var(--black); color: var(--black); }
.dropzone p { margin-top: 12px; font-size: 14px; }

.photo-preview { margin-top: 16px; }
.photo-preview img { width: 100%; max-height: 400px; object-fit: contain; border-radius: var(--radius-sm); background: var(--gray-100); }
.photo-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ===== CHART ===== */
.chart-container { min-height: 200px; }
.bar-chart { display: flex; align-items: flex-end; gap: 12px; height: 180px; padding-top: 20px; }
.bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar { width: 100%; border-radius: 6px 6px 0 0; transition: height 0.6s ease; min-height: 4px; }
.bar-label { font-size: 11px; color: var(--gray-500); font-weight: 500; }
.bar-value { font-size: 13px; font-weight: 700; }

/* ===== BANNER ===== */
.banner {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
}
.banner-warning { background: var(--orange-bg); color: var(--orange); }
.banner-success { background: var(--green-bg); color: var(--green); }

/* ===== LIST ===== */
.list-container { max-height: 300px; overflow-y: auto; }
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-200);
}
.list-item:last-child { border-bottom: none; }
.list-item-title { font-weight: 600; font-size: 13px; }
.list-item-sub { font-size: 12px; color: var(--gray-500); }
.list-item-value { font-weight: 700; font-size: 14px; }

/* Nom produit : nom_original = source de verite operationnelle (gros).
   Suggestion IA = relegue en petit/italique/gris. Jamais d'inversion. */
.product-name-block { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.product-name-original {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  line-height: 1.25;
  word-break: break-word;
}
.product-name-ai-suggestion {
  font-weight: 400;
  font-size: 11px;
  font-style: italic;
  color: var(--gray-500);
  line-height: 1.2;
  word-break: break-word;
  opacity: 0.85;
}

/* ===== TAB CONTENT ===== */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== TOAST ===== */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}
.toast-success { background: var(--green); color: white; }
.toast-error { background: var(--red); color: white; }
.toast-info { background: var(--black); color: white; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== MISC ===== */
.text-muted { color: var(--gray-400); text-align: center; padding: 24px; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.mt-8 { margin-top: 8px; }

/* ===== SEO SCORE BAR ===== */
.seo-score-bar {
  width: 60px;
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}
.seo-score-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

/* ===== PERIOD SELECTOR ===== */
.period-selector {
  display: flex;
  gap: 4px;
  background: var(--gray-100);
  padding: 4px;
  border-radius: var(--radius-sm);
}
.period-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: transparent;
  color: var(--gray-500);
  transition: all 0.2s;
}
.period-btn:hover { color: var(--black); }
.period-btn.active { background: var(--white); color: var(--black); box-shadow: var(--shadow); }

/* ===== DATE RANGE PICKER ===== */
.date-range-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gray-100);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  animation: slideDown 0.2s ease;
}
.date-range-picker input[type="date"] {
  padding: 6px 10px;
  border: 1.5px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: var(--white);
  width: auto;
  cursor: pointer;
}
.date-range-picker input[type="date"]:focus {
  border-color: var(--black);
  outline: none;
}
.date-sep { color: var(--gray-400); font-size: 14px; font-weight: 600; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== KPI GRID ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-card.kpi-highlight { background: var(--black); color: white; }
.kpi-card.kpi-highlight .kpi-label { color: var(--gray-400); }
.kpi-icon { font-size: 24px; line-height: 1; flex-shrink: 0; margin-top: 2px; }
.kpi-content { flex: 1; min-width: 0; }
.kpi-label { font-size: 11px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 22px; font-weight: 700; line-height: 1.3; margin-top: 2px; }
.kpi-compare { margin-top: 4px; font-size: 12px; font-weight: 600; }
.cmp-up { color: var(--green); }
.cmp-down { color: var(--red); }
.cmp-neutral { color: var(--gray-400); }

/* ===== QUICK STATS BAR ===== */
.quick-stats-bar {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  background: var(--white);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--gray-500);
}
.quick-stats-bar strong { color: var(--black); }

/* ===== CHART TOGGLE ===== */
.chart-toggle {
  display: flex;
  gap: 2px;
  background: var(--gray-100);
  padding: 2px;
  border-radius: 6px;
}
.chart-toggle-btn {
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: transparent;
  color: var(--gray-500);
  transition: all 0.2s;
}
.chart-toggle-btn.active { background: var(--white); color: var(--black); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

/* ===== HORIZONTAL BAR CHART ===== */
.hbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}
.hbar-row:last-child { border-bottom: none; }
.hbar-label { min-width: 80px; flex-shrink: 0; }
.hbar-track {
  flex: 1;
  height: 24px;
  background: var(--gray-100);
  border-radius: 6px;
  overflow: hidden;
}
.hbar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s ease;
  min-width: 4px;
}
.hbar-stats {
  min-width: 140px;
  text-align: right;
  flex-shrink: 0;
}
.hbar-stats strong { font-size: 14px; display: block; }
.hbar-stats span { font-size: 11px; color: var(--gray-500); }

/* ===== MINI TABLE ===== */
.mini-table { font-size: 13px; }
.mini-table-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr;
  gap: 8px;
  padding: 8px 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--gray-200);
}
.mini-table-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  align-items: center;
}
.mini-table-row:last-child { border-bottom: none; }

/* ===== RANK BADGE ===== */
.rank-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-600);
  flex-shrink: 0;
}

/* ===== AGING DOT ===== */
.aging-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.aging-ok { background: var(--green); }
.aging-warning { background: #ff9800; }
.aging-danger { background: var(--red); animation: pulse 2s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== WHATNOT BATCH GRID ===== */
.batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.batch-card {
  background: white;
  border: 1.5px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.2s;
}
.batch-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.batch-card.batch-success { border-color: var(--green); background: #f0fdf4; }
.batch-card.batch-error { border-color: var(--red); background: #fef2f2; }
.batch-card.batch-publishing { border-color: var(--primary); }
.batch-card.batch-identifying { border-color: #ff9800; }
.batch-card-img { width: 100%; height: 160px; object-fit: cover; display: block; }
.batch-card-body { padding: 10px 12px; }
.batch-card-body input { width: 100%; padding: 6px 8px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: 12px; margin-top: 4px; }
.batch-card-body .batch-row { display: flex; gap: 6px; margin-top: 4px; }
.batch-card-body .batch-row input { flex: 1; }
.batch-card-status { padding: 8px 12px; font-size: 12px; font-weight: 600; text-align: center; background: var(--gray-50); }
.batch-card-remove { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.6); color: white; border: none; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.batch-result-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--gray-100); }
.btn-identify-single { background: none; border: 1px solid var(--gray-200); border-radius: 6px; padding: 2px 6px; cursor: pointer; font-size: 14px; }
.sub-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px; }
.sub-tab { padding: 10px 20px; border: none; background: none; font-weight: 500; font-size: 14px; cursor: pointer; color: var(--gray-400); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.sub-tab.active { border-bottom: 2px solid var(--primary); color: var(--primary); font-weight: 600; }
.whatnot-subtab.active { border-bottom: 2px solid var(--primary) !important; color: var(--primary) !important; font-weight: 600 !important; }
.whatnot-history-card { cursor: pointer; transition: all 0.2s; }
.whatnot-history-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.whatnot-kpi-card { text-align: center; padding: 20px 16px; }
.whatnot-kpi-icon { font-size: 28px; margin-bottom: 8px; }
.whatnot-kpi-value { font-size: 28px; font-weight: 700; }
.whatnot-kpi-label { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

/* ===== MODAL EDIT — 2 colonnes avec photos ===== */
.edit-two-columns {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 24px;
  max-height: 65vh;
  overflow-y: auto;
}
.edit-col-left {
  position: sticky;
  top: 0;
}
.edit-photos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  min-height: 80px;
}
.edit-photo-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--gray-200);
  aspect-ratio: 1;
}
.edit-photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.edit-photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(220, 38, 38, 0.85);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
}
.edit-photo-item:hover .edit-photo-remove { opacity: 1; }
.new-photo-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: var(--green);
  color: #fff;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

/* ===== RESPONSIVE TABLETTE ===== */
@media (min-width: 901px) and (max-width: 1400px) {
  .main-content { padding: 24px 20px; }
}

@media (max-width: 900px) {
  .edit-two-columns { grid-template-columns: 1fr; }
  .edit-col-left { position: static; }
  .edit-photos-grid { grid-template-columns: repeat(3, 1fr); }
  .sidebar { width: 60px; padding: 16px 8px; }
  .sidebar-header h1, .sidebar-header .subtitle, .nav-item span, .sidebar-footer { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .nav-item svg { margin: 0; }
  .main-content { margin-left: 60px; padding: 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .period-selector { flex-wrap: wrap; }
  .hbar-stats { min-width: 100px; }
  .mini-table-header, .mini-table-row { grid-template-columns: 2fr repeat(5, 1fr); font-size: 11px; }
  .quick-stats-bar { gap: 12px; font-size: 12px; }
}

/* ===== RESPONSIVE MOBILE ===== */
@media (max-width: 600px) {
  /* ============================================
     BOTTOM NAVBAR — 5 onglets principaux
     ============================================ */
  .sidebar {
    width: 100%;
    height: auto;
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    flex-direction: row;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 1000;
    border-top: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
    overflow: visible;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
  .sidebar-header { display: none; }
  .sidebar-footer {
    display: none;
  }
  /* Bouton déconnexion flottant sur mobile */
  .mobile-logout {
    display: flex !important;
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1001;
    background: var(--black);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 16px;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    cursor: pointer;
  }
  .nav-menu {
    display: flex;
    flex-direction: row;
    gap: 0;
    width: 100%;
    padding: 6px 4px 2px;
    justify-content: space-around;
    overflow-x: visible;
  }
  .nav-item {
    flex: 1;
    flex-direction: column;
    gap: 3px;
    padding: 6px 4px 4px;
    font-size: 10px;
    min-width: 0;
    text-align: center;
    justify-content: center;
    align-items: center;
    margin-bottom: 0;
    border-radius: 0;
    position: relative;
  }
  /* Onglets secondaires masqués sur mobile */
  .nav-item.mobile-hidden { display: none; }
  .nav-item.mobile-secondary { display: none; }
  /* Bouton "Plus" visible uniquement sur mobile */
  .mobile-more-btn { display: flex !important; position: relative; }
  /* Menu popup "Plus" — place hors .sidebar pour echapper a son transform:translateZ.
     position:fixed fonctionne car son parent (body) n'a pas de transform/filter/perspective. */
  .mobile-more-menu {
    display: none;
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 64px);
    right: 8px;
    background: var(--black);
    border-radius: 12px;
    padding: 8px 0;
    min-width: 200px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    z-index: 1100;
  }
  .mobile-more-menu.visible { display: block; }
  .mobile-more-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
  }
  .mobile-more-menu-item:hover,
  .mobile-more-menu-item:active { background: rgba(255,255,255,0.1); }
  .mobile-more-menu-item svg { width: 18px; height: 18px; flex-shrink: 0; }
  .mobile-more-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1001;
    background: rgba(0,0,0,0.3);
  }
  .mobile-more-overlay.visible { display: block; }
  .nav-item svg { width: 22px; height: 22px; }
  .nav-item span { display: block; font-size: 10px; white-space: nowrap; font-weight: 500; }
  .nav-item.active { background: rgba(255,255,255,0.12); }
  .nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 2.5px;
    background: white;
    border-radius: 0 0 2px 2px;
  }

  /* ============================================
     CONTENU PRINCIPAL
     ============================================ */
  .main-content {
    margin-left: 0;
    padding: 12px 14px calc(72px + env(safe-area-inset-bottom, 0px)) 14px;
    max-width: 100%;
  }

  /* ============================================
     HEADER PAGES — sticky
     ============================================ */
  .page-header {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 40;
    padding: 8px 0;
    margin-top: -8px;
  }
  .page-header h2 { font-size: 20px; }

  /* ============================================
     KPI & STATS — 2 colonnes compactes
     ============================================ */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; overflow: hidden; }
  .kpi-card { overflow: hidden; }
  .kpi-label { font-size: 9px !important; letter-spacing: 0.3px; }
  .kpi-value { font-size: 20px !important; }
  .kpi-icon { font-size: 20px; }
  .stat-card { padding: 12px 10px; gap: 8px; }
  .stat-card .stat-icon { width: 32px; height: 32px; font-size: 16px; }
  .stat-card .stat-label { font-size: 10px; letter-spacing: 0.3px; }
  .stat-card .stat-value { font-size: 18px; }

  /* Period selector compact */
  .period-selector { gap: 2px; padding: 3px; }
  .period-selector .period-btn { padding: 7px 10px; font-size: 12px; }

  /* ============================================
     GRILLES & CARDS
     ============================================ */
  .grid-2 { grid-template-columns: 1fr !important; }
  .card { padding: 14px !important; margin-bottom: 12px; }

  /* ============================================
     INPUTS — 16px pour empêcher le zoom Safari
     ============================================ */
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  textarea,
  select,
  .search-input,
  .select-input,
  .inv-search,
  .form-input {
    font-size: 16px !important;
  }

  /* ============================================
     BOUTONS — Touch targets 44px minimum
     ============================================ */
  .btn-sm { min-height: 40px; padding: 8px 14px; font-size: 13px; }
  .btn-xs { min-height: 36px; padding: 6px 12px; font-size: 12px; }
  .action-menu-item { padding: 12px 16px; font-size: 14px; min-height: 44px; }

  /* ============================================
     TOOLBAR RECHERCHE INVENTAIRE
     ============================================ */
  .inv-toolbar { flex-direction: column; gap: 8px; }
  .inv-search-box { width: 100%; }
  .inv-search { width: 100%; padding: 12px 42px 12px 14px; }
  .inv-filters { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; }
  .inv-filters .select-input { flex: 1; min-width: 0; }
  .multiselect-dropdown { flex: 1; }
  .multiselect-toggle { font-size: 13px; }

  /* ============================================
     BULK ACTIONS BAR
     ============================================ */
  .bulk-actions-bar {
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .bulk-actions-left, .bulk-actions-right {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
  }
  .bulk-actions-bar button { font-size: 13px; padding: 8px 12px; min-height: 40px; }
  .bulk-actions-bar select { font-size: 13px; }

  /* ============================================
     CARDS ACHATS (Pièces en attente) — see bottom section
     ============================================ */
  .achats-mini-stat { padding: 8px 10px; }
  .achats-mini-value { font-size: 16px; }

  /* ============================================
     TABLEAUX — zebra + scroll fluide
     ============================================ */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
  }
  .table-full { table-layout: auto; min-width: 600px; font-size: 12px; }
  .table-full tbody tr:nth-child(even) td { background: var(--gray-100); }
  .table-full td { padding: 10px 8px; }
  .table-full th { padding: 10px 8px; }
  /* Nom de pièce : autoriser le wrap sur mobile pour qu'il soit lisible */
  .piece-cell {
    max-width: none;
    white-space: normal;
    overflow: visible;
    min-width: 170px;
  }
  .piece-cell strong {
    display: block;
    white-space: normal;
    word-break: break-word;
    line-height: 1.25;
  }

  /* ============================================
     INVENTAIRE — refonte cards sur mobile
     (la table devient une pile de cartes empilées
      au lieu d'un tableau qui scrolle horizontalement)
     ============================================ */
  #tab-inventaire .table-wrapper {
    overflow-x: visible;
    border: none;
    border-radius: 0;
    background: transparent;
  }
  #inventory-table { display: block; min-width: 0; }
  #inventory-table thead { display: none; }
  #inventory-table tbody { display: block; }
  #inventory-table tbody tr:nth-child(even) td { background: transparent; }

  .inv-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 4px 8px;
    padding: 12px 44px 12px 40px;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    margin-bottom: 8px;
    background: var(--white) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    position: relative;
  }
  .inv-row td {
    display: block;
    padding: 0;
    border: none;
    background: transparent;
  }
  .inv-row .idx-cell,
  .inv-row .source-cell,
  .inv-row .prix-achat-cell,
  .inv-row .marge-cell,
  .inv-row .date-cell { display: none; }

  .inv-row .select-cell {
    position: absolute;
    top: 14px;
    left: 10px;
  }
  .inv-row .actions-cell {
    position: absolute;
    top: 8px;
    right: 6px;
  }
  .inv-row .piece-cell { flex: 1 1 100%; }
  .inv-row .cat-cell,
  .inv-row .statut-cell,
  .inv-row .etat-cell { flex: 0 0 auto; }
  .inv-row .prix-vente-cell {
    flex: 0 0 100%;
    text-align: right;
    font-size: 16px !important;
    font-weight: 700;
  }

  /* ============================================
     TOAST — en haut sur mobile (navbar masque le bas)
     ============================================ */
  #toast-container {
    bottom: auto !important;
    top: 12px !important;
    right: 12px !important;
    left: 12px !important;
  }
  .toast {
    max-width: 100%;
    font-size: 15px;
    padding: 18px 22px;
    border-radius: 14px;
    line-height: 1.4;
  }

  /* ============================================
     FORMULAIRES
     ============================================ */
  .form-grid { flex-direction: column !important; }
  .form-grid > div { min-width: 100% !important; }
  .form-row { grid-template-columns: 1fr; }

  /* ============================================
     MODALS — plein écran mobile
     ============================================ */
  .modal-box {
    padding: 20px 16px;
    width: 96%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 12px;
  }
  .modal-box h3 { font-size: 18px; }

  /* Sélection modal */
  .selection-item { padding: 10px 12px; gap: 10px; min-height: 44px; }
  .selection-thumb { width: 44px; height: 44px; }

  /* ============================================
     APERÇU PUBLICATION
     ============================================ */
  #publish-options { flex-direction: column; gap: 10px; align-items: flex-start !important; }

  /* ============================================
     QUICK STATS BAR
     ============================================ */
  .quick-stats-bar { flex-wrap: wrap; gap: 6px; font-size: 11px; padding: 10px 0; }
  .quick-stats-bar span { background: var(--gray-100); padding: 4px 8px; border-radius: 6px; }

  /* ============================================
     RÉFÉRENCER — mode switcher
     ============================================ */
  .ref-mode-switcher { flex-direction: column; gap: 8px; }
  .ref-mode-btn { padding: 14px 16px; }
  .ref-mode-btn .ref-mode-icon { font-size: 22px; }

  /* ============================================
     PHOTOS GRID — plus grande sur mobile
     ============================================ */
  .photo-thumb { width: 90px; height: 90px; }
  .batch-card-img { height: 140px; }

  /* ============================================
     WHATNOT — cards compactes
     ============================================ */
  .whatnot-sale-header { flex-direction: column; gap: 8px; }
}

/* === Bandeau Achats → Référencer === */
.achat-ref-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border: 2px solid #42a5f5;
  color: #1565c0;
  padding: 12px 20px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  animation: slideDown 0.3s ease;
}
.achat-ref-banner .achat-ref-titre {
  color: #0d47a1;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === Référencer — Mode switcher === */
.ref-mode-switcher {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.ref-mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.ref-mode-btn:hover {
  border-color: var(--primary);
  background: var(--gray-50, #fafaf8);
}
.ref-mode-btn.active {
  border-color: var(--primary);
  background: #f0ebe3;
  box-shadow: 0 0 0 1px var(--primary);
}
.ref-mode-btn .ref-mode-icon {
  font-size: 28px;
  flex-shrink: 0;
}
.ref-mode-btn strong {
  display: block;
  font-size: 15px;
  margin-bottom: 2px;
}
.ref-mode-btn small {
  display: block;
  font-size: 11px;
  color: var(--gray-400);
  font-weight: 400;
}
@media (max-width: 600px) {
  .ref-mode-switcher {
    flex-direction: column;
    gap: 8px;
  }
  .ref-mode-btn {
    padding: 12px 16px;
  }
  .ref-mode-btn .ref-mode-icon {
    font-size: 22px;
  }
}

/* === Achats mini stats (fusionné dans Référencer) === */
.achats-mini-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--gray-100);
  padding: 10px 16px;
  border-radius: 10px;
  flex: 1;
  min-width: 70px;
}
.achats-mini-value {
  font-size: 18px;
  font-weight: 700;
}
.achats-mini-label {
  font-size: 11px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* === Achats card list === */
.achats-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.achat-card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--gray-50, #fafaf8);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  gap: 12px;
  transition: border-color 0.2s;
}
.achat-card-item:hover {
  border-color: var(--primary);
}
.achat-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.achat-card-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.achat-card-thumb-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.achat-card-body {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.achat-card-info {
  min-width: 0;
  flex: 1;
}
.achat-card-info strong {
  display: block;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.achat-card-futur {
  margin-top: 4px;
}
.achat-future-name {
  width: 100%;
  max-width: 340px;
  padding: 4px 8px;
  font-size: 12px;
  border: 1.5px dashed var(--gray-300);
  border-radius: 6px;
  background: var(--gray-50, #fafafa);
  color: var(--gray-700, #444);
  outline: none;
  transition: border-color 0.2s;
}
.achat-card-meta {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
  flex-wrap: wrap;
  align-items: center;
}
.achat-card-source {
  background: var(--gray-100);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
}
.achat-photos-badge {
  background: #e3f2fd;
  color: #1565c0;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 6px;
}
.achat-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.achat-card-actions {
  display: flex;
  gap: 6px;
}

/* Moved to bottom mobile section */

/* === Détourage par photo badge === */
.photo-thumb-detourage {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.8);
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
  opacity: 0.6;
}
.photo-thumb-detourage.active {
  background: #2e7d32;
  border-color: #43a047;
  opacity: 1;
  box-shadow: 0 0 6px rgba(46, 125, 50, 0.5);
}
.photo-thumb-detourage:hover {
  transform: scale(1.15);
  opacity: 1;
}
.photo-thumb.detourage-on {
  box-shadow: 0 0 0 2px #43a047;
}

/* ===== VINTED IMPORT ===== */
.vinted-import-zone {
  background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
  border: 2px dashed #81c784;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.vinted-input-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}
.vinted-input-row input {
  flex: 1;
  border: 2px solid #a5d6a7 !important;
}
.vinted-input-row input:focus {
  border-color: #43a047 !important;
  box-shadow: 0 0 0 3px rgba(67, 160, 71, 0.15);
}
.vinted-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  background: white;
  border-radius: 10px;
  padding: 10px;
  border: 1px solid #c8e6c9;
}
.vinted-preview img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.vinted-preview div {
  flex: 1;
  min-width: 0;
}
.vinted-preview strong {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vinted-preview span {
  font-size: 14px;
  font-weight: 700;
  color: #2e7d32;
}
.form-divider {
  display: flex;
  align-items: center;
  margin: 16px 0;
  color: var(--gray-400);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}
.form-divider span {
  padding: 0 12px;
}

/* === Mannequin AI Photo === */
.photo-thumb-mannequin {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.95);
  background: rgba(21, 101, 192, 0.85);
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
  opacity: 1;
  z-index: 3;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.photo-thumb-mannequin:hover {
  transform: scale(1.15);
  background: rgba(21, 101, 192, 1);
  box-shadow: 0 2px 8px rgba(21, 101, 192, 0.5);
}

.photo-thumb.mannequin-photo {
  border-color: #1565c0;
  box-shadow: 0 0 0 2px #1565c0;
}
.photo-thumb.mannequin-photo .photo-thumb-badge {
  background: #1565c0;
}

/* Loading overlay pendant la génération */
.photo-generating-overlay {
  position: absolute;
  inset: 0;
  background: rgba(21, 101, 192, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 4;
  border-radius: inherit;
  backdrop-filter: blur(2px);
}
.photo-generating-overlay span {
  color: white;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.photo-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: mannequin-spin 0.8s linear infinite;
}
@keyframes mannequin-spin {
  to { transform: rotate(360deg); }
}

.photo-thumb.generating {
  pointer-events: none;
  border-color: var(--blue) !important;
  box-shadow: 0 0 0 2px var(--blue), 0 0 12px rgba(21, 101, 192, 0.3) !important;
}
.photo-thumb.generating .photo-thumb-remove,
.photo-thumb.generating .photo-thumb-detourage,
.photo-thumb.generating .photo-thumb-mannequin {
  display: none !important;
}

/* Mannequin provider radio options (Paramètres) */
.mannequin-provider-option:has(input:checked) {
  border-color: var(--primary) !important;
  background: rgba(26, 115, 232, 0.04);
}
.mannequin-provider-option:hover {
  border-color: var(--gray-300) !important;
}

/* ===== PANNEAU SELECTION PHOTOS SOURCE ===== */

.source-photos-panel {
  background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
  border: 2px solid var(--blue);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.source-photos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.source-photos-header > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.source-photos-icon {
  font-size: 20px;
}

.source-photos-badge {
  background: var(--blue);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

.source-photos-hint {
  font-size: 13px;
  color: var(--gray-500);
  margin: 0 0 12px 0;
}

.source-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.source-photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.2s ease;
  background: var(--gray-200);
}

.source-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.source-photo-item:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.source-photo-item:hover img {
  transform: scale(1.05);
}

.source-photo-item.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue), 0 4px 12px rgba(21, 101, 192, 0.3);
}

.source-photo-item .photo-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: 2px solid var(--gray-300);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s ease;
}

.source-photo-item.selected .photo-check {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.source-photo-item .photo-number {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.source-photo-item.loading img {
  opacity: 0.3;
}

.source-photo-item .photo-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-300);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.source-photos-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.source-photos-actions .btn-primary {
  font-weight: 600;
}

/* ===== INVENTORY MULTI-SELECT ===== */
.bulk-actions-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--blue);
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: slideDown 0.2s ease;
  box-shadow: 0 2px 8px rgba(21, 101, 192, 0.3);
}

.bulk-actions-left,
.bulk-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bulk-count {
  font-size: 13px;
  margin-right: 4px;
}

.bulk-actions-bar button {
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.bulk-actions-bar button:hover {
  background: rgba(255,255,255,0.35);
}

.bulk-actions-bar button.bulk-delete,
.bulk-actions-bar button.btn-danger {
  background: var(--red);
  border-color: var(--red);
}

.bulk-actions-bar button.bulk-delete:hover,
.bulk-actions-bar button.btn-danger:hover {
  background: #b71c1c;
}

.bulk-actions-bar select {
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.bulk-actions-bar select option {
  background: var(--black);
  color: white;
}

/* Checkbox cells */
.select-cell {
  width: 36px;
  text-align: center;
  padding: 4px !important;
}

.inv-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--blue);
}

/* Selected row highlight */
.row-selected {
  background: var(--blue-bg) !important;
}

.row-selected:hover {
  background: #bbdefb !important;
}

.select-sm {
  padding: 4px 8px !important;
  font-size: 12px !important;
  min-width: 120px;
}

/* ===== LIVE FULLSCREEN MODE ===== */
body.live-fullscreen .sidebar { display: none; }
body.live-fullscreen .main-content { margin-left: 0; max-width: 100%; padding: 0; }
body.live-fullscreen .page-header { display: none; }
body.live-fullscreen .whatnot-subtab { display: none; }
body.live-fullscreen #whatnot-live-section > .card {
  border: none; border-radius: 0; min-height: 100vh; padding: 20px 32px;
}
body.live-fullscreen .live-stats-bar {
  position: sticky; top: 0; z-index: 50; background: var(--white);
  padding: 16px 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px;
}
body.live-fullscreen .live-lot-row img { width: 72px; height: 72px; }
body.live-fullscreen .live-client-input { width: 220px !important; padding: 10px 14px !important; font-size: 15px !important; }
body.live-fullscreen .live-prix-input { width: 130px !important; padding: 10px 14px !important; font-size: 15px !important; }
.live-exit-btn {
  position: fixed; top: 16px; right: 16px; z-index: 200;
  background: var(--black); color: white; border: none; border-radius: 8px;
  padding: 8px 16px; font-size: 13px; cursor: pointer; display: none;
}
body.live-fullscreen .live-exit-btn { display: block; }

/* Autocomplete dropdown */
.live-autocomplete {
  position: absolute; left: 0; top: 100%; background: var(--white);
  border: 1.5px solid var(--gray-200); border-radius: 8px;
  box-shadow: var(--shadow-lg); max-height: 180px; overflow-y: auto;
  z-index: 100; display: none; min-width: 200px;
}
.live-autocomplete-item { padding: 8px 12px; font-size: 13px; cursor: pointer; }
.live-autocomplete-item:hover, .live-autocomplete-item.active { background: var(--blue-bg); }

/* ============================================
   MOBILE OPTIMISATION — iPhone & Android
   ============================================ */
@media (max-width: 600px) {

  /* --- Stock: Pièces en attente cards --- */
  .achat-card-item {
    padding: 8px 10px !important;
    gap: 6px !important;
  }
  .achat-card-item > .achat-select-cb {
    margin-top: 0;
    width: 18px !important;
    height: 18px !important;
    align-self: center;
  }
  .achat-card-body {
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 4px !important;
  }
  .achat-card-left {
    gap: 8px !important;
  }
  .achat-card-thumb,
  .achat-card-thumb-placeholder {
    width: 40px !important;
    height: 40px !important;
  }
  .achat-card-info {
    flex: 1 !important;
    min-width: 0 !important;
  }
  .achat-card-info strong {
    font-size: 13px !important;
    display: block !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .achat-card-meta {
    gap: 4px !important;
    font-size: 11px !important;
  }
  /* Input "Futur nom" compact sur mobile */
  .achat-card-futur {
    margin-top: 2px !important;
  }
  .achat-future-name {
    max-width: 100% !important;
    padding: 3px 8px !important;
    font-size: 12px !important;
    height: 28px !important;
    border: 1px dashed var(--gray-300) !important;
    border-radius: 6px !important;
    background: white !important;
  }
  .achat-card-right {
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: center !important;
    padding-top: 4px !important;
    border-top: 1px solid var(--gray-200) !important;
    gap: 4px !important;
    flex-wrap: wrap !important;
  }
  .achat-card-actions {
    gap: 4px !important;
    flex-wrap: wrap !important;
  }
  .achat-card-actions .btn {
    min-height: 30px !important;
    padding: 4px 8px !important;
    font-size: 11px !important;
  }

  /* --- Whatnot: Sale detail piece cards --- */
  .sale-piece-card {
    flex-wrap: wrap !important;
    padding: 8px 10px !important;
    gap: 6px !important;
    align-items: center !important;
    position: relative !important;
  }
  .sale-piece-card .drag-handle {
    font-size: 14px !important;
  }
  .sale-piece-card .sale-piece-lot {
    font-size: 11px !important;
    min-width: 22px !important;
  }
  .sale-piece-card .sale-piece-img,
  .sale-piece-card img.sale-piece-img {
    width: 42px !important;
    height: 42px !important;
  }
  .sale-piece-card .sale-piece-info {
    flex: 1 !important;
    min-width: 0 !important;
    max-width: calc(100vw - 220px) !important;
  }
  .sale-piece-card .sale-piece-titre {
    font-size: 12px !important;
  }
  .sale-piece-card .sale-piece-meta {
    gap: 4px !important;
    font-size: 10px !important;
  }
  .sale-piece-card .sale-piece-meta span[style*="font-size:9px"] {
    font-size: 8px !important;
    padding: 1px 4px !important;
  }
  .sale-piece-card .sale-piece-price {
    flex-shrink: 0 !important;
  }
  .sale-piece-card .sale-piece-price > div:first-child {
    font-size: 13px !important;
  }
  .sale-piece-card .sale-piece-price .badge {
    font-size: 9px !important;
    padding: 1px 5px !important;
  }
  .sale-piece-card .sale-piece-actions {
    width: 100% !important;
    justify-content: flex-end !important;
    border-top: 1px solid var(--gray-100);
    padding-top: 6px !important;
    margin-top: 2px !important;
    gap: 6px !important;
  }
  .sale-piece-card .sale-piece-actions:empty {
    display: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .sale-piece-card .sale-piece-actions input[type="number"] {
    width: 60px !important;
    padding: 4px !important;
    font-size: 12px !important;
  }
  .sale-piece-card .sale-piece-actions .btn {
    padding: 4px 8px !important;
    font-size: 10px !important;
    min-height: 32px !important;
  }

  /* --- Whatnot: Actions bar (Emballé, Expédié, Payé, etc.) --- */
  .whatnot-actions-bar {
    gap: 6px !important;
    margin-bottom: 10px !important;
  }
  .whatnot-actions-bar .btn {
    font-size: 11px !important;
    padding: 6px 10px !important;
    min-height: 36px !important;
  }
  .whatnot-actions-bar .badge {
    font-size: 10px !important;
    padding: 3px 8px !important;
  }

  /* --- Whatnot: History cards --- */
  .whatnot-history-card {
    padding: 12px !important;
  }
  .whatnot-kpi-card {
    padding: 12px 10px !important;
  }
  .whatnot-kpi-value {
    font-size: 22px !important;
  }

  /* --- General mobile polish --- */
  .badge {
    font-size: 10px !important;
    padding: 2px 6px !important;
  }
  .badge-vendu { white-space: nowrap; }
  .badge-encours { white-space: nowrap; }

  /* Touch feedback for cards */
  .achat-card-item:active,
  .sale-piece-card:active {
    background: var(--gray-100) !important;
    transform: scale(0.995);
  }
}

/* === Restrictions par role : custom et preparation ne voient pas les chiffres === */
body.role-restricted .admin-only { display: none !important; }

