/* ============================================================
   SAARI LITE — Design System Premium
   PME Sénégalaises | Dark Mode | Modern UI
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- Variables CSS ---- */
:root {
  /* Palette principale */
  --bg-primary:    #0d1117;
  --bg-secondary:  #161b22;
  --bg-card:       #21262d;
  --bg-card-hover: #2a2f3a;
  --bg-input:      #1c2128;

  /* Bordures */
  --border:        #30363d;
  --border-focus:  #00d4a0;

  /* Couleurs d'accent */
  --accent:        #00d4a0;
  --accent-dark:   #00a07a;
  --accent-glow:   rgba(0, 212, 160, 0.15);
  --gold:          #f0a500;
  --gold-dark:     #c07c00;

  /* États */
  --danger:        #ff4757;
  --danger-bg:     rgba(255, 71, 87, 0.1);
  --warning:       #ffa502;
  --warning-bg:    rgba(255, 165, 2, 0.1);
  --success:       #2ed573;
  --success-bg:    rgba(46, 213, 115, 0.1);
  --info:          #1e90ff;
  --info-bg:       rgba(30, 144, 255, 0.1);

  /* Texte */
  --text-primary:   #e6edf3;
  --text-secondary: #8b949e;
  --text-muted:     #484f58;

  /* Typographie */
  --font:          'Inter', system-ui, sans-serif;

  /* Dimensions */
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     16px;
  --radius-xl:     24px;

  /* Ombres */
  --shadow-sm:  0 1px 4px rgba(0,0,0,0.4);
  --shadow:     0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.6);
  --shadow-accent: 0 0 20px rgba(0, 212, 160, 0.2);

  /* Transitions */
  --transition: all 0.2s ease;
  --transition-slow: all 0.35s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-dark); }

img { max-width: 100%; height: auto; }

/* ============================================================
   LAYOUT — Sidebar + Main
   ============================================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: var(--shadow-accent);
}

.sidebar-logo-text { line-height: 1.2; }
.sidebar-logo-text .brand { font-weight: 800; font-size: 16px; color: var(--text-primary); }
.sidebar-logo-text .tagline { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

.sidebar-nav { flex: 1; padding: 12px 0; }

.sidebar-section {
  padding: 8px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13.5px;
  transition: var(--transition);
  position: relative;
}

.sidebar-link:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  text-decoration: none;
}

.sidebar-link.active {
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid rgba(0,212,160,0.2);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -9px;
  top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.sidebar-link .icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--bg-primary);
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--text-secondary); }

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- Topbar ---- */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 18px; font-weight: 700; flex: 1; }
.topbar-subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.page-body { padding: 24px; flex: 1; }

/* ============================================================
   COMPOSANTS — Cards
   ============================================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
}

.card:hover { border-color: rgba(0,212,160,0.2); }

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

.card-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Stat Cards (Dashboard) ---- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition-slow);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}

.stat-card.green::before { background: linear-gradient(90deg, var(--accent), transparent); }
.stat-card.gold::before  { background: linear-gradient(90deg, var(--gold), transparent); }
.stat-card.red::before   { background: linear-gradient(90deg, var(--danger), transparent); }
.stat-card.blue::before  { background: linear-gradient(90deg, var(--info), transparent); }

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

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

.stat-icon.green { background: var(--success-bg); }
.stat-icon.gold  { background: var(--warning-bg); }
.stat-icon.red   { background: var(--danger-bg); }
.stat-icon.blue  { background: var(--info-bg); }

.stat-value { font-size: 22px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.stat-change { font-size: 11px; margin-top: 6px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   COMPOSANTS — Boutons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13.5px;
  font-family: var(--font);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
}
.btn-primary:hover { background: var(--accent-dark); color: var(--bg-primary); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,212,160,0.3); }

.btn-gold {
  background: var(--gold);
  color: var(--bg-primary);
}
.btn-gold:hover { background: var(--gold-dark); color: var(--bg-primary); transform: translateY(-1px); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #d63031; transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 7px 12px;
}
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 13px 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { padding: 9px; border-radius: var(--radius-sm); }

.btn:disabled, .btn.loading {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ============================================================
   COMPOSANTS — Formulaires
   ============================================================ */

.form-group { margin-bottom: 18px; }

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

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-secondary);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control option { background: var(--bg-card); }

.form-control-lg { padding: 13px 16px; font-size: 16px; border-radius: var(--radius); }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; flex-shrink: 0; }
.input-group-text {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: none;
  padding: 0 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  font-size: 13px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ============================================================
   COMPOSANTS — Tableaux
   ============================================================ */

.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--bg-secondary);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(48,54,61,0.5);
  color: var(--text-primary);
  font-size: 13.5px;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

.table-actions { display: flex; gap: 6px; align-items: center; }

/* ============================================================
   COMPOSANTS — Badges & Tags
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(46,213,115,0.2); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(255,71,87,0.2); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(255,165,2,0.2); }
.badge-info    { background: var(--info-bg);    color: var(--info);    border: 1px solid rgba(30,144,255,0.2); }
.badge-accent  { background: var(--accent-glow); color: var(--accent); border: 1px solid rgba(0,212,160,0.2); }
.badge-muted   { background: var(--bg-secondary); color: var(--text-secondary); border: 1px solid var(--border); }

/* Stock indicators */
.stock-ok      { color: var(--success); font-weight: 600; }
.stock-low     { color: var(--warning); font-weight: 600; }
.stock-critical { color: var(--danger); font-weight: 600; }
.stock-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.stock-dot.ok       { background: var(--success); box-shadow: 0 0 6px var(--success); }
.stock-dot.low      { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.stock-dot.critical { background: var(--danger); box-shadow: 0 0 6px var(--danger); animation: pulse-red 1.5s infinite; }

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 6px var(--danger); }
  50% { box-shadow: 0 0 14px var(--danger); }
}

/* ============================================================
   COMPOSANTS — Alertes & Notifications
   ============================================================ */

.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  border: 1px solid;
  font-size: 13.5px;
}

.alert-success { background: var(--success-bg); color: var(--success); border-color: rgba(46,213,115,0.2); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: rgba(255,71,87,0.2); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(255,165,2,0.2); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-color: rgba(30,144,255,0.2); }

.alert-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 80px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 280px;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  pointer-events: all;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }

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

/* ============================================================
   COMPOSANTS — Modals
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: var(--transition);
}

.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 700; }

.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-secondary); }

/* ============================================================
   MODULE — CAISSE (POS)
   ============================================================ */

.pos-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 20px;
  height: calc(100vh - var(--topbar-height) - 48px);
}

.pos-products {
  overflow-y: auto;
  padding-right: 4px;
}

.pos-search {
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.pos-product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.pos-product-card:hover, .pos-product-card:focus {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-accent);
}

.pos-product-card.out-of-stock {
  opacity: 0.4;
  cursor: not-allowed;
}

.pos-product-img {
  width: 60px; height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  margin: 0 auto 8px;
  display: block;
  background: var(--bg-secondary);
}

.pos-product-name { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.pos-product-price { color: var(--accent); font-weight: 800; font-size: 14px; }
.pos-product-stock { font-size: 11px; color: var(--text-secondary); }

/* Panier */
.pos-cart {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pos-cart-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pos-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.pos-cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border: 1px solid var(--border);
  animation: fadeIn 0.2s ease;
}

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

.pos-cart-item-name { flex: 1; font-weight: 600; font-size: 13px; }
.pos-cart-item-price { font-size: 12px; color: var(--text-secondary); }

.pos-qty-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pos-qty-btn {
  width: 26px; height: 26px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}

.pos-qty-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--bg-primary); }

.pos-qty-val { font-weight: 700; min-width: 28px; text-align: center; }

.pos-cart-summary {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

.summary-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
}

.summary-line.total {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.pos-payment-modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.payment-mode-btn {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  transition: var(--transition);
  font-family: var(--font);
}

.payment-mode-btn:hover, .payment-mode-btn.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
}

/* ============================================================
   MODULE — STOCK status
   ============================================================ */

.stock-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stock-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.stock-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.stock-bar-fill.ok       { background: var(--success); }
.stock-bar-fill.low      { background: var(--warning); }
.stock-bar-fill.critical { background: var(--danger); }

/* ============================================================
   MODULE — CREDITS (Carnet de dettes)
   ============================================================ */

.credit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
  transition: var(--transition);
}

.credit-card:hover { border-color: rgba(0,212,160,0.2); }

.credit-card.en_retard {
  border-color: rgba(255,71,87,0.3);
  background: rgba(255,71,87,0.04);
}

.credit-progress {
  margin-top: 12px;
}

.credit-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}

.credit-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 0.5s ease;
}

/* ============================================================
   UTILITAIRES
   ============================================================ */

.d-flex    { display: flex; }
.d-grid    { display: grid; }
.d-none    { display: none; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8     { gap: 8px; }
.gap-12    { gap: 12px; }
.gap-16    { gap: 16px; }
.gap-24    { gap: 24px; }

.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.text-warning{ color: var(--warning); }
.text-accent { color: var(--accent); }
.text-gold   { color: var(--gold); }
.fw-bold     { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.fs-sm       { font-size: 12px; }
.fs-xs       { font-size: 11px; }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3   { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 0;
}

.page-link {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
}

.page-link:hover { border-color: var(--accent); color: var(--accent); }
.page-link.active { background: var(--accent); border-color: var(--accent); color: var(--bg-primary); }

/* ============================================================
   PAGE — Login
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0,212,160,0.08) 0%, transparent 70%);
  top: -200px; right: -100px;
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(240,165,0,0.06) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 48px 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(0,212,160,0.3);
}

.login-logo h1 { font-size: 26px; font-weight: 800; }
.login-logo p  { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }

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

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  .sidebar {
    transform: translateX(-100%);
    width: 260px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main-content { margin-left: 0; }

  .pos-layout { grid-template-columns: 1fr; height: auto; }

  .stat-cards { grid-template-columns: repeat(2, 1fr); }

  .topbar { padding: 0 16px; }
  .page-body { padding: 16px; }
}

@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr; }
  .form-row   { grid-template-columns: 1fr; }
  .pos-grid   { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   ANIMATIONS GLOBALES
   ============================================================ */

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

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-wave {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* Scanner overlay */
.scanner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

#scanner-preview {
  width: 100%;
  max-width: 400px;
  height: 300px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  border: 2px solid var(--accent);
  box-shadow: var(--shadow-accent);
}

.scanner-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  animation: scan-line 2s ease-in-out infinite;
  box-shadow: 0 0 8px var(--accent);
}

@keyframes scan-line {
  0%, 100% { top: 10%; }
  50% { top: 90%; }
}

#scanner-preview video {
  width: 100%; height: 100%;
  object-fit: cover;
}
