/* Core Design System & Theme Variables */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #121829;
  --card-bg: rgba(20, 27, 47, 0.75);
  --card-border: rgba(255, 255, 255, 0.06);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --header-bg: rgba(10, 14, 26, 0.75);
  
  --primary: #5f5dec;
  --primary-hover: #4e4bcb;
  --primary-glow: rgba(95, 93, 236, 0.2);
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --success-border: rgba(16, 185, 129, 0.3);
  
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --danger-border: rgba(239, 68, 68, 0.3);
  
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  
  --border-radius: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme (Thème Clair) */
body.light-theme {
  --bg-primary: #f3f4f6;
  --bg-secondary: #ffffff;
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-border: rgba(0, 0, 0, 0.08);
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --header-bg: rgba(243, 244, 246, 0.8);
  
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-glow: rgba(79, 70, 229, 0.15);
  
  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.08);
  --success-border: rgba(5, 150, 105, 0.2);
  
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.08);
  --danger-border: rgba(220, 38, 38, 0.2);
  
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.08);
}

body.light-theme {
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(79, 70, 229, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.04) 0%, transparent 40%);
}

body.light-theme input, 
body.light-theme textarea, 
body.light-theme select {
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
  border-color: rgba(0, 0, 0, 0.12);
}

body.light-theme input:focus, 
body.light-theme textarea:focus, 
body.light-theme select:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

body.light-theme .barcode-badge {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  color: #111827;
}

body.light-theme .stat-card {
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

body.light-theme .stat-icon {
  background: rgba(0, 0, 0, 0.02);
}

body.light-theme .activity-item {
  background: rgba(0, 0, 0, 0.02);
}

body.light-theme .scanner-box, 
body.light-theme .camera-box {
  background: rgba(255, 255, 255, 0.85);
}

body.light-theme .scanned-barcode-graphic {
  background: rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .stock-display {
  background: rgba(255, 255, 255, 0.9) !important;
}

/* Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(95, 93, 236, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
}

/* App Loading Screen */
.app-loading {
  position: fixed;
  inset: 0;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--card-border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Layout App Container */
.app-container {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--card-border);
  margin: -24px -24px 24px -24px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  height: 48px;
  width: auto;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.header-logo h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-logo h1 span {
  color: var(--primary);
  font-weight: 400;
}

.header-status {
  display: none !important;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  font-size: 14px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s infinite;
}

.status-dot.offline {
  background-color: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Main content */
.app-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex-grow: 1;
}

/* Cards (Glassmorphism / Liquid Glass Style) */
.card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%), var(--card-bg) !important;
  backdrop-filter: blur(30px) saturate(190%) !important;
  -webkit-backdrop-filter: blur(30px) saturate(190%) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: 0 16px 40px 0 rgba(0, 0, 0, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.15) !important;
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 24px 50px 0 rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.2) !important;
  transform: translateY(-2px);
}

.card h2 {
  font-size: 20px;
  margin-bottom: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%), var(--card-bg) !important;
  backdrop-filter: blur(30px) saturate(190%) !important;
  -webkit-backdrop-filter: blur(30px) saturate(190%) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18), inset 0 1px 1px rgba(255, 255, 255, 0.15) !important;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28), inset 0 1px 1px rgba(255, 255, 255, 0.2) !important;
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 32px;
  background: rgba(255, 255, 255, 0.03);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--card-border);
}

.stat-card.alert {
  border-color: var(--danger-border);
}

.stat-card.alert .stat-icon {
  background: var(--danger-bg);
}

.stat-content h3 {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
}

.stat-content p {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 4px;
}

/* Dashboard Grid Layout (Desktop) */
.dashboard-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
}

/* Inputs and Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

input, textarea, select {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(0, 0, 0, 0.3);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  gap: 8px;
}

.btn.primary {
  background-color: var(--primary);
  color: #fff;
}

.btn.primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 0 16px var(--primary-glow);
}

.btn.secondary {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
}

.btn.secondary:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.btn-small {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-small.print {
  background-color: var(--primary-glow);
  color: #a5b4fc;
  border: 1px solid rgba(95, 93, 236, 0.3);
}

.btn-small.print:hover {
  background-color: var(--primary);
  color: white;
}

.btn-small.edit {
  background-color: rgba(255,255,255,0.05);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
}

.btn-small.edit:hover {
  background-color: rgba(255,255,255,0.15);
}

/* Search bar */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.card-header h2 {
  margin-bottom: 0;
}

.search-bar {
  position: relative;
  width: 100%;
}

.search-bar input {
  padding-left: 36px;
  border-radius: 20px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 14px;
}

/* Data Table */
.table-container {
  overflow-x: auto;
}

.fabric-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.fabric-table th {
  padding: 12px 16px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13px;
  border-bottom: 1px solid var(--card-border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fabric-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.fabric-table tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}


.accounting-inline-input {
  min-width: 110px !important;
  width: 120px !important;
  border: 1.5px solid var(--card-border) !important;
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  text-align: right !important;
  padding: 6px 10px !important;
  border-radius: 8px !important;
  transition: all 0.2s ease !important;
  font-family: inherit !important;
  box-sizing: border-box !important;
}

.accounting-inline-input:hover {
  border-color: var(--primary) !important;
  background: rgba(99, 102, 241, 0.05) !important;
}

.accounting-inline-input:focus {
  border-color: var(--primary) !important;
  background: var(--bg-primary) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3) !important;
}

input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button,
.accounting-inline-input::-webkit-outer-spin-button,
.accounting-inline-input::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}

input[type=number],
.accounting-inline-input[type=number] {
  -moz-appearance: textfield !important;
}

.accounting-inline-input_old_stub {
  width: 75px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.accounting-inline-input:hover {
  border-color: var(--card-border);
  background: rgba(255, 255, 255, 0.05);
}

.accounting-inline-input:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Enlever les flèches sur les inputs number en ligne */
.accounting-inline-input::-webkit-outer-spin-button,
.accounting-inline-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.accounting-inline-input[type=number] {
  -moz-appearance: textfield;
}

.barcode-badge {
  font-family: monospace;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.badge-loc {
  background: rgba(245, 158, 11, 0.1);
  color: #fdba74;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.qty-val {
  font-weight: 600;
}

.qty-val.low {
  color: var(--warning);
}

.qty-val.empty {
  color: var(--danger);
}

.actions-cell {
  display: flex;
  gap: 8px;
}

/* Activity Feed */
.activity-section {
  margin-top: 12px;
}

.activity-feed {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 8px;
}

.activity-item {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid var(--text-muted);
}

.activity-item.system {
  border-left-color: var(--primary);
  color: var(--text-secondary);
}

.activity-item.add {
  border-left-color: var(--success);
  background: var(--success-bg);
}

.activity-item.subtract {
  border-left-color: var(--danger);
  background: var(--danger-bg);
}

.activity-item.create {
  border-left-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  float: right;
}

/* --- MOBILE LAYOUT & SCAN VIEW --- */
.scan-tabs {
  display: flex;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  padding: 4px;
  border: 1px solid var(--card-border);
  margin-bottom: 20px;
}

.scan-tab {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: var(--transition);
  font-size: 14px;
}

.scan-tab.active {
  background: var(--primary);
  color: white;
}

.scan-workspace {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.scanner-box, .camera-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 30px;
  position: relative;
  overflow: hidden;
}

/* Scanner line effect */
.scanner-laser {
  width: 80%;
  height: 2px;
  background-color: var(--danger);
  position: absolute;
  top: 30%;
  box-shadow: 0 0 8px var(--danger);
  animation: scanning 2s linear infinite;
  pointer-events: none;
  opacity: 0.7;
}

@keyframes scanning {
  0% { top: 25%; }
  50% { top: 75%; }
  100% { top: 25%; }
}

.scan-instructions {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 16px 0 24px;
  max-width: 300px;
  line-height: 1.5;
}

#barcode-input {
  font-size: 20px;
  font-family: monospace;
  text-align: center;
  max-width: 320px;
  letter-spacing: 2px;
  margin-bottom: 16px;
  border-width: 2px;
}

/* Camera Reader Container */
#reader-container,
#invoice-reader-container {
  width: 100%;
  max-width: 350px;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--primary);
  position: relative;
  background: black;
  margin: 0 auto;
}

#reader,
#invoice-reader {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
}

#reader video,
#invoice-reader video {
  object-fit: cover !important;
  width: 100% !important;
  height: 100% !important;
}

/* Scanned Product Panel - Unified Slide-in Side Sheet [V6.5] */
.scanned-fabric-card {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  height: 100vh !important;
  z-index: 1001 !important;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.45) !important;
  background: rgba(10, 14, 26, 0.88) !important;
  backdrop-filter: blur(25px) !important;
  -webkit-backdrop-filter: blur(25px) !important;
  border: none !important;
  border-left: 1px solid var(--card-border) !important;
  border-radius: 0 !important;
  margin: 0 !important;
  overflow-y: auto !important;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.45s ease !important;
  transform: translateX(100%) !important;
  opacity: 0 !important;
}

.scanned-fabric-card.active {
  transform: translateX(0) !important;
  opacity: 1 !important;
}

body.light-theme .scanned-fabric-card {
  background: rgba(255, 255, 255, 0.88) !important;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1) !important;
}

/* Side Sheet Overlay */
.side-sheet-overlay {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.4) !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
  z-index: 1000 !important;
  opacity: 0 !important;
  transition: opacity 0.4s ease !important;
  pointer-events: none !important;
}

.side-sheet-overlay.active {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.scanned-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.close-card-btn {
  background: rgba(255,255,255,0.05);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.close-card-btn:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.scanned-fabric-card h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.scanned-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 24px;
}

.scanned-meta .dot {
  color: var(--text-muted);
}

.stock-display {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--card-border);
  padding: 20px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}

.stock-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.stock-value {
  font-size: 48px;
  font-weight: 700;
  color: var(--success);
  line-height: 1.2;
  margin: 4px 0;
}

.stock-unit {
  font-size: 14px;
  color: var(--text-secondary);
}

.stock-adjustment-section h3 {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 12px;
}

/* Quick Adjust Buttons */
.quick-adjust-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.btn-adjust {
  padding: 14px 0;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-adjust.minus {
  background: var(--danger-bg);
  color: #fda4af;
  border: 1px solid var(--danger-border);
}

.btn-adjust.minus:hover {
  background: var(--danger);
  color: white;
}

.btn-adjust.plus {
  background: var(--success-bg);
  color: #6ee7b7;
  border: 1px solid var(--success-border);
}

.btn-adjust.plus:hover {
  background: var(--success);
  color: white;
}

/* Manual Adjustment Form */
.manual-adjust-form {
  border-top: 1px solid var(--card-border);
  padding-top: 16px;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-inline {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
}

.select-action {
  background: rgba(0,0,0,0.3);
  font-weight: 500;
}

/* --- RESPONSIVE LAYOUT SWITCH --- */

/* Écran ordinateur (Bureau) par défaut */
@media (min-width: 900px) {
  #mobile-view {
    display: none !important; /* On cache la vue mobile sur grand écran */
  }

  /* Afficher la fiche produit sous forme de panneau latéral coulissant sur Mac */
  #scanned-fabric-card.scanned-fabric-card {
    width: 460px !important;
  }
}

/* ============================================================
   CENTRE D'AIDE — V7.18
   Développé par Edouard LAFARGE <edouardlafarge@gmail.com>
   ============================================================ */
.help-sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}
.help-card {
  background: var(--bg-secondary);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 20px;
  transition: transform .18s, box-shadow .18s;
}
.help-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.help-card h3 {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 10px;
  color: var(--text-primary);
}
.help-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 0;
}
.help-card-admin {
  border-color: var(--accent-primary);
  background: linear-gradient(135deg, var(--bg-secondary) 80%, rgba(var(--accent-rgb),.08) 100%);
}
.help-role-tab.active {
  color: var(--accent-primary) !important;
  border-bottom-color: var(--accent-primary) !important;
}
/* FAQ accordion */
.faq-item {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  margin-bottom: 8px;
  overflow: hidden;
}
.faq-question {
  width: 100%;
  background: var(--bg-secondary);
  border: none;
  padding: 16px 20px;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: background .15s;
}
.faq-question:hover { background: var(--bg-primary); }
.faq-question .faq-arrow { transition: transform .25s; font-size: 12px; flex-shrink: 0; }
.faq-question.open .faq-arrow { transform: rotate(180deg); }
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease, padding .3s;
  background: var(--bg-secondary);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
  padding: 0 20px;
}
.faq-answer.open {
  max-height: 300px;
  padding: 12px 20px 16px;
}
/* Chatbot bubbles */
.chat-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}
.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble.bot {
  align-self: flex-start;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
  border-bottom-left-radius: 4px;
}

/* Écran mobile (iPhone) */
@media (max-width: 899px) {
  .app-container {
    padding: 16px;
  }
  
  /* Masquer l'indicateur de connexion dans le header sur mobile */
  .header-status {
    display: none !important;
  }
  
  /* Masquer l'ajustement rapide de stock sur mobile (iPhone) [V6.5] */
  .stock-adjustment-section .quick-adjust-group,
  .stock-adjustment-section h3[data-i18n="scanned-adjust-title"] {
    display: none !important;
  }
  
  /* Empêcher le zoom automatique de Safari sur iOS et grossir les champs pour le tactile */
  input, textarea, select {
    font-size: 16px !important;
    min-height: 44px !important;
  }

  /* Rendre tous les boutons principaux et secondaires plus grands sur mobile */
  .btn, button.btn {
    min-height: 48px !important;
    font-size: 15px !important;
    border-radius: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px 20px !important;
  }

  /* Convertir le bouton réglage en icône ronde sur mobile */
  #settings-toggle-btn .settings-text {
    display: none !important;
  }
  #settings-toggle-btn {
    width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    justify-content: center !important;
    align-items: center !important;
    font-size: 18px !important;
  }

  /* Ajustement de l'en-tête dépoli sur mobile */
  .app-header {
    margin: -16px -16px 16px -16px;
    padding: 12px 16px;
  }

  .header-logo h1 {
    font-size: 18px;
  }
  
  /* Refonte graphique de la barre d'onglets mobiles */
  .scan-tabs {
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 4px;
    border: 1px solid var(--card-border);
    margin-bottom: 16px;
    display: flex !important;
    height: 48px !important;
  }
  
  .scan-tab {
    flex: 1 !important;
    height: 100% !important;
    padding: 0 !important;
    font-size: 13px !important;
    border-radius: 8px;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 600 !important;
  }

  /* Rendre les boutons de fermeture de carte plus faciles à taper */
  .close-card-btn {
    width: 44px !important;
    height: 44px !important;
    font-size: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .scan-tab.active {
    background: var(--primary);
    box-shadow: 0 4px 10px var(--primary-glow);
    color: white;
  }
  
  /* Sur iPhone (Mobile) : Masque les stats du haut et le tableau lourd d'inventaire du bas */
  #desktop-view {
    display: none !important;
  }
  
  #mobile-view {
    display: block !important;
  }

  .stats-grid {
    display: none !important;
  }

  #scanned-fabric-card.scanned-fabric-card {
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: none !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    border-radius: 0 !important;
    padding-bottom: 120px !important; /* Espace de sécurité supplémentaire pour scroller sur iPhone */
  }

  .scanned-fabric-card h2 {
    font-size: 20px;
  }

  .stock-value {
    font-size: 38px;
  }
  
  .quick-adjust-group {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .btn-adjust {
    padding: 12px 0;
    font-size: 12px;
  }
}

/* --- IMPRESSION DES ÉTIQUETTES (STYLES CSS PRINT) --- */
@media print {
  html, body {
    background: white !important;
    color: black !important;
    min-height: 0 !important;
    height: auto !important;
  }
  
  /* Cacher l'interface entière */
  #app-root, .app-loading {
    display: none !important;
  }
  
  /* Forcer le rendu noir et blanc uniquement sur les textes pour l'impression [V6.5] */
  #print-label {
    background-color: #ffffff !important;
    color: #000000 !important;
    font-size: 0 !important;
    line-height: 0 !important;
  }
  #print-label .label-container {
    background-color: #ffffff !important;
    border-color: #000000 !important;
  }
  #print-label .label-header,
  #print-label .label-info,
  #print-label .label-info span {
    color: #000000 !important;
    background-color: transparent !important;
  }
  #print-label .label-loc {
    background-color: #000000 !important;
    color: #ffffff !important;
  }
  
  /* Forcer le rendu net et vectoriel du code-barres et des polices sans lissage ni anti-aliasing flou */
  #print-label svg, #print-label svg * {
    shape-rendering: crispEdges !important;
    image-rendering: -webkit-optimize-contrast !important;
    image-rendering: crisp-edges !important;
    image-rendering: pixelated !important;
  }
  #print-label, #print-label * {
    -webkit-font-smoothing: none !important;
    -moz-osx-font-smoothing: none !important;
    font-smoothing: none !important;
    text-rendering: optimizeSpeed !important;
  }
  
  /* Afficher uniquement la zone d'impression */
  .print-only {
    display: block !important;
    position: relative !important;
    width: 90mm !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box;
    overflow: visible !important;
    background: white !important;
  }
  
  /* Chaque étiquette physique prend sa hauteur propre, avec un espace entre elles */
  .label-container {
    display: flex;
    flex-direction: column;
    height: 26mm !important;
    width: 87mm !important;
    margin: 1mm auto !important;
    border: 1.5px solid #000;
    border-radius: 3px;
    padding: 1.2mm 1.8mm;
    box-sizing: border-box;
    overflow: hidden;
    background: #fff !important;
    font-size: 12px;
    line-height: normal;
  }

  .label-header {
    font-size: 14px; /* Plus grand grâce à la largeur de 90mm */
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    color: black;
  }

  .label-info {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 10px; /* Plus grand */
    font-weight: 600;
    border-bottom: 0.5px solid #ccc;
    padding-bottom: 1px;
    color: #444;
  }

  .label-loc {
    background: #000;
    color: #fff;
    padding: 0px 4px;
    border-radius: 2px;
  }

  /* Barcode SVG dimensions for print */
  #print-barcode {
    width: 82mm; /* Élargi pour occuper les 90mm de l'étiquette */
    height: 14mm;
    margin: 0 auto;
    /* Rendu ultra-net des vecteurs pour l'impression thermique (pas de flou de lissage) */
    shape-rendering: crispEdges;
    image-rendering: pixelated;
  }
  
  .print-badge {
    border: 2px solid black;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 8px;
    font-weight: 900;
    margin-right: 4px;
    display: inline-block;
    vertical-align: middle;
    letter-spacing: 1px;
  }
  .print-badge.sample {
    background: black !important;
    color: white !important;
    border-color: black !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-badge.stock {
    background: transparent !important;
    color: black !important;
    border-color: black !important;
  }
}

/* Par défaut, cacher la zone d'impression */
.print-only {
  display: none;
}

/* --- SPLASH SCREEN PREMIUM --- */
.splash-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #ffffff 0%, #f1f5f9 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.splash-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.splash-logo {
  height: 220px;
  width: auto;
  animation: bounceLogo 2s infinite ease-in-out;
  object-fit: contain;
}

.splash-title {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #0f172a;
  text-transform: uppercase;
  background: linear-gradient(to right, #0f172a 0%, var(--primary) 50%, #0f172a 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shineTitle 3s linear infinite;
}

.splash-title span {
  font-weight: 300;
  color: var(--primary);
  -webkit-text-fill-color: var(--primary);
}

.splash-loader-bar {
  width: 280px;
  height: 6px;
  background: rgba(197, 160, 89, 0.1);
  border: 1px solid rgba(197, 160, 89, 0.2);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  margin: 16px 0;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.splash-loader-progress {
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, #c5a059, #f3e5ab, #c5a059);
  border-radius: 10px;
  animation: loaderPulse 1.8s infinite ease-in-out;
  box-shadow: 0 0 12px rgba(197, 160, 89, 0.5);
}

#splash-status-text {
  font-size: 13px;
  color: #475569;
  font-weight: 500;
}

@keyframes bounceLogo {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-16px) scale(1.05); }
}

@keyframes shineTitle {
  to { background-position: 200% center; }
}

@keyframes loaderPulse {
  0% { left: -50%; width: 50%; }
  50% { width: 70%; }
  100% { left: 100%; width: 50%; }
}

/* --- SETTINGS FULLSCREEN WEB APP MODAL --- */
.settings-dropdown,
#settings-dropdown {
  display: none;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  z-index: 10000 !important;
  background: rgba(10, 14, 26, 0.85) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  box-sizing: border-box !important;
  border-radius: 0 !important;
  border: none !important;
}

.settings-modal-card {
  background: var(--bg-secondary);
  border: 1.5px solid var(--card-border);
  border-radius: 24px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.7);
  animation: modalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: auto !important;
}

body.light-theme .settings-modal-card {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border-color: rgba(0, 0, 0, 0.1);
}

#close-settings-dropdown-btn {
  display: flex !important;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* --- IMPRESSION DU CATALOGUE PDF & DE LA FACTURE --- */
.print-catalog-only,
.print-invoice-only {
  display: none;
}

@page label-page {
  size: 90mm 29mm;
  margin: 0;
}

@page a4-page {
  size: A4 portrait;
  margin: 15mm 10mm;
}

body.printing-label {
  page: label-page;
}

body.printing-catalog,
body.printing-invoice {
  page: a4-page;
}

@media print {
  /* Default hide for special print containers when not in their mode */
  body:not(.printing-catalog) .print-catalog-only,
  body:not(.printing-invoice) .print-invoice-only,
  body:not(.printing-label) .print-only {
    display: none !important;
  }

  /* Si on imprime le catalogue de tissus */
  body.printing-catalog {
    background: white !important;
    color: black !important;
  }

  body.printing-catalog > *:not(.print-catalog-only) {
    display: none !important;
  }

  body.printing-catalog .print-catalog-only {
    display: block !important;
    width: 100%;
    margin: 0;
    padding: 10mm;
    box-sizing: border-box;
  }

  /* Si on imprime la facture */
  body.printing-invoice {
    background: white !important;
    color: black !important;
  }

  body.printing-invoice > *:not(#print-invoice) {
    display: none !important;
  }

  body.printing-invoice .print-invoice-only {
    display: block !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 10mm !important;
    box-sizing: border-box !important;
  }

  /* Si on imprime l'étiquette */
  body.printing-label {
    background: white !important;
    color: black !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.printing-label > *:not(#print-label) {
    display: none !important;
  }

  body.printing-label #print-label {
    display: block !important;
  }

  body.printing-label .label-container {
    display: flex !important;
  }

  .catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #000;
    padding-bottom: 12px;
    margin-bottom: 20px;
  }

  .catalog-logo {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .catalog-logo span {
    font-size: 28px;
  }

  .catalog-logo h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: black !important;
  }

  .catalog-meta {
    font-size: 12px;
    font-weight: 600;
    color: #444;
  }

  .catalog-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
  }

  .catalog-table th {
    border-bottom: 2px solid #000;
    padding: 10px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: black !important;
    text-align: left;
  }

  .catalog-table td {
    border-bottom: 1px solid #ddd;
    padding: 12px 8px;
    font-size: 11px;
    color: black !important;
    vertical-align: middle;
  }

  .catalog-table tr {
    page-break-inside: avoid;
  }

  /* Code-barres SVG dans le tableau du catalogue */
  .catalog-barcode-svg {
    width: 38mm;
    height: 11mm;
  }
}

/* --- LOGIQUE DE ZOOM D'AFFICHAGE (TAILLE DU TEXTE) --- */
body.zoom-small { font-size: 12px !important; }
body.zoom-medium { font-size: 14px !important; }
body.zoom-large { font-size: 16px !important; }

body.zoom-small input, body.zoom-small select, body.zoom-small textarea, body.zoom-small button, body.zoom-small table, body.zoom-small td, body.zoom-small th, body.zoom-small label { font-size: 12px !important; }
body.zoom-medium input, body.zoom-medium select, body.zoom-medium textarea, body.zoom-medium button, body.zoom-medium table, body.zoom-medium td, body.zoom-medium th, body.zoom-medium label { font-size: 14px !important; }
body.zoom-large input, body.zoom-large select, body.zoom-large textarea, body.zoom-large button, body.zoom-large table, body.zoom-large td, body.zoom-large th, body.zoom-large label { font-size: 16px !important; }

body.zoom-small h1 { font-size: 20px !important; }
body.zoom-small h2 { font-size: 17px !important; }
body.zoom-small h3 { font-size: 13px !important; }
body.zoom-large h1 { font-size: 28px !important; }
body.zoom-large h2 { font-size: 23px !important; }
body.zoom-large h3 { font-size: 16px !important; }

/* --- PARAMÈTRES MOBILE EN BAS DE PAGE (BOTTOM SHEET) --- */
@media (max-width: 899px) {
  

  #close-settings-dropdown-btn {
    display: flex !important;
  }
}

@keyframes slideUpSettings {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* --- AJUSTEMENT ET DÉFORMATION APPAREIL PHOTO --- */
#reader video {
  object-fit: contain !important; /* contain évite l'écrasement ou l'étirement du code-barres */
  width: 100% !important;
  height: 100% !important;
}

/* --- CORRECTIF CHEVAUCHEMENT DES TUILES & BOUTONS --- */
.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
  gap: 16px !important;
  margin-bottom: 24px !important;
}

.stat-card {
  padding: 16px !important;
}

.quick-adjust-group {
  gap: 6px !important;
  margin-bottom: 8px !important;
}

.btn-adjust {
  padding: 10px 0 !important;
  font-size: 12px !important;
  height: auto !important;
}

/* Évite les chevauchements sur les métadonnées mobile */
.scanned-meta {
  flex-wrap: wrap;
  gap: 6px 8px;
}

/* --- AJUSTEMENTS POUR CORRIGER LES CHEVAUCHEMENTS PC & RESPONSIVE --- */
#desktop-view {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dashboard-grid > * {
  min-width: 0;
}

@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }
}

/* --- STYLISATION DU STOCK FAIBLE (ALERTE 20%) --- */
.stat-card.warning {
  border-color: rgba(249, 115, 22, 0.4);
}

.stat-card.warning:hover {
  border-color: rgba(249, 115, 22, 0.6);
}

.stat-card.warning .stat-icon {
  background: rgba(249, 115, 22, 0.1);
  color: #f97316;
}

.low-stock-badge {
  background: rgba(249, 115, 22, 0.15);
  color: #fdba74;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(249, 115, 22, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
}

/* --- STYLISATION DU CHAMP D'ENVOI D'IMAGE (PHOTOS) --- */
.image-upload-wrapper {
  margin-top: 6px;
  width: 100%;
}

.image-upload-btn {
  border: 2px dashed var(--card-border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.15);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.image-upload-btn:hover {
  border-color: var(--primary);
  background: rgba(0, 0, 0, 0.25);
}

.upload-icon {
  font-size: 26px;
}

.upload-text {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.image-preview-container {
  position: relative;
  width: 100%;
  height: 180px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--card-border);
}

.image-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: var(--transition);
}

.image-remove-btn:hover {
  background: var(--danger);
  transform: scale(1.1);
}

/* --- VIGNETTE PHOTO DANS LE TABLEAU --- */
.fabric-thumbnail {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  font-size: 18px;
  margin: 0 auto;
}

.fabric-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- GRAND APERÇU DANS LA FICHE PRODUIT --- */
.scanned-image-wrapper {
  width: 100%;
  height: 200px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
  position: relative;
  cursor: zoom-in;
}

.scanned-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none; /* évite d'interférer avec le mousemove de la loupe */
}

/* Bulle Loupe interactive 2.5x */
.image-zoom-loupe {
  position: absolute;
  width: 150px;
  height: 150px;
  border: 3px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  pointer-events: none;
  background-repeat: no-repeat;
  display: none;
  z-index: 100;
}

.scanned-image-placeholder {
  font-size: 56px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3));
  opacity: 0.6;
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
  0% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}

/* ==========================================================
   V5.0 : AUTHENTIFICATION, ONGLETS & COMPTABILITÉ FINANCIÈRE
   ========================================================== */

/* Écran de Connexion (Login) */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #ffffff 0%, #f1f5f9 100%) !important;
  padding: 20px;
  color: #0f172a !important;
}

.login-card {
  width: 100%;
  max-width: 480px !important;
  padding: 48px 40px !important;
  border-radius: 24px !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.8) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.02) !important;
  animation: loginFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes loginFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-logo {
  height: 140px !important;
  width: auto !important;
  margin-bottom: 24px !important;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.05)) !important;
  object-fit: contain;
}

.login-card h1 {
  font-size: 28px !important;
  font-weight: 800 !important;
  letter-spacing: 2px !important;
  color: #0f172a !important;
  margin-bottom: 8px !important;
  display: flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
}

.login-card h1 span {
  color: var(--primary) !important;
}

.login-subtitle {
  color: #475569 !important;
  font-size: 14px !important;
  text-align: center;
  margin-bottom: 32px !important;
  line-height: 1.5;
}

.login-card form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px !important;
}

.login-card .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.login-card .form-group label {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #334155 !important;
  text-align: left;
}

.login-card .form-group input {
  width: 100%;
  padding: 16px 20px !important;
  font-size: 16px !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02) !important;
  transition: all 0.2s ease !important;
  box-sizing: border-box;
  outline: none;
}

.login-card .form-group input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.02) !important;
}

.login-card button.btn.primary {
  padding: 16px 24px !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  border-radius: 12px !important;
  margin-top: 10px;
  width: 100%;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2) !important;
}

.login-card .back-to-login-btn {
  padding: 14px 20px !important;
  font-size: 14px !important;
  border-radius: 12px !important;
}

/* Onglets de navigation Header (Desktop) */
.desktop-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: 30px;
  border: 1px solid var(--card-border);
  margin-left: 24px;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-btn:hover {
  color: var(--text-primary);
  background: var(--card-border);
}

.nav-btn.active {
  color: #ffffff !important;
  background: var(--primary);
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* Masquer la navigation desktop sur mobile */
@media (max-width: 899px) {
  .desktop-nav {
    display: none !important;
  }
}

/* Cartes financières de comptabilité */
.financial-stats .stat-card {
  border-left: 4px solid var(--primary);
}

.financial-stats .stat-card.warning {
  border-left: 4px solid var(--warning);
}

.financial-stats .stat-card.success {
  border-left: 4px solid var(--success);
}

/* Rotation de la flèche d'accordéon d'édition */
#edit-details-toggle {
  user-select: none;
  transition: color 0.3s ease;
}

#edit-details-toggle:hover {
  color: var(--primary);
}

#edit-details-toggle-arrow {
  display: inline-block;
  transition: transform 0.3s ease;
}

#edit-details-toggle.open #edit-details-toggle-arrow {
  transform: rotate(180deg);
}

/* --- BOUTONS PILULES DE REMISE --- */
.btn-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-pill:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  border-color: var(--primary);
}

.btn-pill.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* --- FOOTER DE L'APPLICATION --- */
.app-footer {
  margin-top: 40px;
  margin-bottom: 30px;
  padding: 24px 32px;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--card-border);
  border-radius: 16px;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

.footer-branding {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-branding p {
  margin: 0;
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1.5;
}

.footer-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  padding: 6px 12px;
}

.status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.status-indicator-dot.online {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* --- COMMUTATEUR THÈME STYLE APPLE [V6.4] --- */
.apple-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.apple-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.apple-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(120, 120, 128, 0.32);
  transition: .3s cubic-bezier(0.25, 0.8, 0.25, 1);
  border-radius: 24px;
}

.apple-switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s cubic-bezier(0.25, 0.8, 0.25, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.apple-switch input:checked + .apple-switch-slider {
  background-color: var(--primary); /* Utilisé pour s'adapter au thème premium */
}

.apple-switch input:checked + .apple-switch-slider:before {
  transform: translateX(22px);
}

/* Cercle d'onde de transition pour le mode sombre/clair [V6.5] */
.theme-reveal-circle {
  position: fixed !important;
  border-radius: 50% !important;
  pointer-events: none !important;
  z-index: 99999 !important;
  transform: scale(0) !important;
  transform-origin: center center !important;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease !important;
  opacity: 1 !important;
}

/* Transition de clic élastique sur les boutons et onglets [V6.5] */
button, .btn, .btn-adjust, .btn-pill, .scan-tab, .apple-switch {
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s, box-shadow 0.2s !important;
}

button:active, .btn:active, .btn-adjust:active, .btn-pill:active, .scan-tab:active {
  transform: scale(0.92) !important;
}

/* Masquer les options superflues sur mobile (iPhone) pour purifier l'affichage */
@media (max-width: 899px) {
  #export-csv-btn-menu,
  #export-pdf-btn-menu,
  #login-btn-menu {
    display: none !important;
  }
}

/* --- GESTION DES UTILISATEURS & AUDIT LOGS --- */
.user-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 12px 16px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.user-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--primary-border);
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-username {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-role-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.user-role-badge.admin {
  background: rgba(212, 175, 55, 0.15);
  color: var(--primary);
  border: 1px solid rgba(212, 175, 55, 0.3);
}

.user-role-badge.employee {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-secondary);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.user-meta {
  font-size: 11px;
  color: var(--text-secondary);
}

.user-status-container {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.active {
  background-color: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.status-dot.revoked {
  background-color: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.user-actions {
  display: flex;
  gap: 8px;
}

.btn-action-small {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--primary-border);
  background: rgba(124, 58, 237, 0.05); /* violet-tinged */
  color: var(--primary);
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-action-small:hover {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 8px rgba(124, 58, 237, 0.2);
}

.btn-action-small.edit {
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.05);
}

.btn-action-small.edit:hover {
  background: #3b82f6;
  color: white;
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.2);
}

.btn-action-small.danger {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.05);
}

.btn-action-small.danger:hover {
  background: #ef4444;
  color: white;
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.2);
}

.btn-action-small.success {
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.2);
  background: rgba(16, 185, 129, 0.05);
}

.btn-action-small.success:hover {
  background: #10b981;
  color: white;
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.2);
}

/* Timeline des logs d'activité */
.user-log-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 10px 14px;
  position: relative;
}

.user-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-secondary);
}

.user-log-action-badge {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
}

.user-log-details {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}

/* Action actions highlights */
.user-log-item[data-action="connexion"] {
  border-left: 3px solid #3b82f6;
}
.user-log-item[data-action="creer_tissu"],
.user-log-item[data-action="creer_facture"],
.user-log-item[data-action="creer_client"] {
  border-left: 3px solid #10b981;
}
.user-log-item[data-action="modifier_stock"],
.user-log-item[data-action="modifier_tissu"],
.user-log-item[data-action="modifier_client"] {
  border-left: 3px solid #f59e0b;
}
.user-log-item[data-action="supprimer_facture"],
.user-log-item[data-action="supprimer_client"],
.user-log-item[data-action="supprimer_tissus_lot"],
.user-log-item[data-action="statut_utilisateur"] {
  border-left: 3px solid #ef4444;
}

/* --- OPTIMISATIONS TACTILES & MODALS SUR MOBILE (IPHONE) [V7.3] --- */
@media (max-width: 600px) {
  /* Eviter les débordements des cartes de modals */
  #admin-settings-modal, 
  #user-activity-modal, 
  #edit-user-modal, 
  #photo-modal, 
  #login-screen {
    padding: 10px !important;
  }

  #admin-settings-modal .card, 
  #user-activity-modal .card, 
  #edit-user-modal .card {
    padding: 16px 14px !important;
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 16px !important;
    gap: 12px !important;
    max-height: 90vh !important;
  }

  /* Rendre les onglets d'administration flexibles et les empêcher de déborder horizontalement */
  #admin-settings-modal div[style*="display: flex; gap: 8px; border-bottom:"] {
    flex-wrap: wrap !important;
    gap: 4px !important;
    padding-bottom: 6px !important;
  }

  #admin-settings-modal .scan-tab, 
  #user-activity-modal .scan-tab {
    font-size: 11px !important;
    padding: 8px 6px !important;
    flex: 1 1 40% !important; /* Affiche 2 par ligne sur très petits écrans */
    text-align: center;
  }

  /* Agrandir le bouton de fermeture pour faciliter le clic au doigt (cible 44px) */
  .close-card-btn {
    width: 44px !important;
    height: 44px !important;
    font-size: 18px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 50% !important;
    touch-action: manipulation;
  }
  
  /* Ajustements pour les formulaires internes sur mobile */
  .setting-item {
    padding: 10px 8px !important;
  }

  /* Ajustements login sur iPhone pour eviter le scroll vertical */
  .login-card {
    padding: 24px 20px !important;
    border-radius: 16px !important;
  }

  .login-logo {
    height: 80px !important;
    margin-bottom: 16px !important;
  }

  .login-card h1 {
    font-size: 20px !important;
    margin-bottom: 4px !important;
  }

  .login-subtitle {
    font-size: 12px !important;
    margin-bottom: 16px !important;
  }
}

/* Lightbox Modal */
.lightbox-modal {
  display: none;
  position: fixed;
  z-index: 100000;
  padding-top: 50px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
  
  -webkit-
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.lightbox-content {
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation-name: zoom;
  animation-duration: 0.3s;
}

@keyframes zoom {
  from {transform:scale(0.8); opacity: 0;}
  to {transform:scale(1); opacity: 1;}
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.5);
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  z-index: 100001;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.08);
  color: #ffffff;
}

.lightbox-close:hover,
.lightbox-close:focus {
  color: var(--accent-color, #6366f1);
  text-decoration: none;
  cursor: pointer;
}

#lightbox-caption {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
  text-align: center;
  color: #ccc;
  padding: 10px 0;
  height: 150px;
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 500;
}




/* --- ERP FINANCIAL SUITE THEME STYLES (Light & Dark Compatible) --- */
#erp-subtabs-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 12px;
}

.erp-tab-btn {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
}

.erp-tab-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-glow);
}

.erp-tab-btn.active, .erp-tab-btn.primary {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.erp-sub-section {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  padding: 20px;
  border-radius: var(--border-radius);
}

.erp-sub-section h2, .erp-sub-section h3, .erp-sub-section h4 {
  color: var(--text-primary);
}

.erp-pnl-box {
  padding: 16px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid var(--card-border);
  background: var(--bg-secondary);
}

.erp-pnl-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.erp-pnl-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
}



/* --- TABLE ERGONOMICS & STICKY HEADERS [V8.2] --- */
.table-container {
  max-height: 650px;
  overflow-y: auto;
  border-radius: 12px;
  border: 1px solid var(--card-border);
}

.fabric-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  font-weight: 700 !important;
  border-bottom: 2px solid var(--card-border) !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.fabric-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

body.light-theme .fabric-table tbody tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.02);
}

.fabric-table tbody tr:hover td {
  background: var(--primary-glow) !important;
}


.accounting-inline-input {
  min-width: 110px !important;
  width: 120px !important;
  border: 1.5px solid var(--card-border) !important;
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  text-align: right !important;
  padding: 6px 10px !important;
  border-radius: 8px !important;
  transition: all 0.2s ease !important;
  font-family: inherit !important;
  box-sizing: border-box !important;
}

.accounting-inline-input:hover {
  border-color: var(--primary) !important;
  background: rgba(99, 102, 241, 0.05) !important;
}

.accounting-inline-input:focus {
  border-color: var(--primary) !important;
  background: var(--bg-primary) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3) !important;
}

input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button,
.accounting-inline-input::-webkit-outer-spin-button,
.accounting-inline-input::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}

input[type=number],
.accounting-inline-input[type=number] {
  -moz-appearance: textfield !important;
}

.accounting-inline-input_old_stub {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--card-border) !important;
  font-weight: 700 !important;
}



/* Custom High-Priority Modal Overlay Engine */
.modal {
  display: none;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999 !important;
  background: rgba(15, 23, 42, 0.92) !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.modal[style*="display: flex"],
.modal[style*="display:flex"],
.modal[style*="display:block"],
.modal[style*="display: block"],
.modal.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

@media print {
  .modal {
    display: none !important;
  }
}


/* --- GPU HARDWARE-ACCELERATED TOUCH SCROLLING FOR MODALS [V9.4] --- */
.modal-content,
#new-supplier-order-modal .modal-content {
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: auto !important;
  transform: translateZ(0);
}

.table-container,
#so-picker-results {
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: auto !important;
  transform: translateZ(0);
}

/* --- BOUTON RÉGLAGES CENTRÉ SUR MOBILE (IPHONE) --- */
@media (max-width: 899px) {
  .app-header {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .header-controls {
    order: -1 !important;
    margin: 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #settings-toggle-btn {
    width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    border-radius: 50% !important;
    background: var(--bg-secondary) !important;
    border: 1.5px solid var(--primary) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    cursor: pointer !important;
  }
}





/* --- BOUTONS MOBAction CLAIRS ET SÉPARÉS (iPhone) [V9.9] --- */
.scan-tab,
button.scan-tab {
  flex: 1 !important;
  height: 42px !important;
  min-height: 42px !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
  border-radius: 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 700 !important;
  background: var(--bg-secondary, rgba(255, 255, 255, 0.08)) !important;
  border: 1px solid var(--card-border, rgba(255, 255, 255, 0.15)) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12) !important;
  margin: 0 3px !important;
  touch-action: manipulation !important;
}

.scan-tab.active,
button.scan-tab.active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 4px 14px var(--primary-glow, rgba(99, 102, 241, 0.4)) !important;
  color: #ffffff !important;
}

/* PRÉVENTION DU ZOOM SAFARI IOS SUR INPUTS */
@media (max-width: 899px) {
  input, textarea, select {
    font-size: 16px !important;
    min-height: 44px !important;
    touch-action: manipulation !important;
  }
}


/* Écran ordinateur (Mac / PC) : conserve 100% de la vue complète (Cartes Stats + Tableau d'inventaire) */
@media (min-width: 900px) {
  #desktop-view {
    display: flex !important;
  }
  #mobile-view {
    display: none !important;
  }
  .stats-grid {
    display: grid !important;
  }
}


/* Boutons de fermeture de modales / fenêtres optimisés (Croix rouge visible) */
.close-card-btn {
  background: rgba(239, 68, 68, 0.12) !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  border-radius: 50% !important;
  color: #ef4444 !important;
  cursor: pointer !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
  padding: 0 !important;
}

.close-card-btn:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
  transform: scale(1.08) !important;
}


/* Force disable splash screen overlay */
#splash-screen { display: none !important; opacity: 0 !important; pointer-events: none !important; z-index: -9999 !important; }


/* --- ALIGNEMENT PARFAIT EN HAUTEUR ET EXTENSION DE LA TABLE JUSQU'EN BAS --- */
@media (min-width: 900px) {
  .dashboard-grid {
    display: grid !important;
    grid-template-columns: 380px 1fr !important;
    gap: 24px !important;
    align-items: stretch !important;
  }

  .dashboard-col {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
  }

  .dashboard-col > .card,
  .list-col .card,
  .form-col .card {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    box-sizing: border-box !important;
  }

  .list-col .card-header {
    flex-shrink: 0 !important;
  }

  .list-col .table-container {
    flex: 1 1 auto !important;
    height: 100% !important;
    max-height: none !important;
    min-height: 500px !important;
    overflow-y: auto !important;
    border-radius: 12px !important;
    border: 1px solid var(--card-border) !important;
    margin-top: 12px !important;
  }
}


/* --- ALIGNEMENT FULL WIDTH ET PLEINE LARGEUR PC POUR L'ONGLET COMPTABILITÉ --- */
#accounting-view-section,
#accounting-view-section .accounting-grid,
#accounting-view-section .card.glass,
#sales-financial-analysis-card {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

#accounting-view-section .financial-stats {
  width: 100% !important;
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
  gap: 16px !important;
  margin-bottom: 24px !important;
}

#accounting-view-section .table-container {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: auto !important;
}
