/* ============================================
   GESTPRO — DESIGN SYSTEM v3.0
   Ultra-modern, animated, ergonomic
   ============================================ */

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

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

:root {
  --primary:       #6366F1;
  --primary-dark:  #4F46E5;
  --primary-light: #EEF2FF;
  --success:       #10B981;
  --success-light: #ECFDF5;
  --warning:       #F59E0B;
  --warning-light: #FFFBEB;
  --danger:        #EF4444;
  --danger-light:  #FEF2F2;
  --info:          #3B82F6;
  --info-light:    #EFF6FF;

  --sidebar-w:     260px;
  --topbar-h:      64px;

  --bg:       #F1F5F9;
  --surface:  #FFFFFF;
  --border:   #E2E8F0;
  --text:     #0F172A;
  --text-sec: #64748B;
  --text-muted: #94A3B8;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 16px rgba(0,0,0,.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.14);
  --shadow-xl: 0 24px 64px rgba(0,0,0,.18);

  --radius:    14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --transition: .2s cubic-bezier(.4,0,.2,1);
  --bounce:     .3s cubic-bezier(.34,1.56,.64,1);
}

html { font-family: 'Inter', system-ui, sans-serif; font-size: 15px; -webkit-font-smoothing: antialiased; }
body { background: var(--bg); color: var(--text); }

/* ── Scrollbar ───────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ══════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════ */
#sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(160deg, #0F172A 0%, #1E1B4B 100%);
  box-shadow: 4px 0 24px rgba(0,0,0,.25);
  transition: transform var(--transition);
  z-index: 40;
}

/* Logo zone */
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo-icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #818CF8);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(99,102,241,.4);
  flex-shrink: 0;
}
.sidebar-logo-icon i { color: #fff; font-size: 18px; }
.sidebar-logo-text { line-height: 1.2; }
.sidebar-logo-title { font-size: 18px; font-weight: 800; color: #fff; letter-spacing: -.3px; }
.sidebar-logo-sub { font-size: 11px; color: rgba(255,255,255,.4); font-weight: 500; }

/* User card */
.sidebar-user {
  margin: 14px 14px 10px;
  padding: 12px;
  background: rgba(255,255,255,.06);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-user:hover { background: rgba(255,255,255,.1); }
.sidebar-user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #fff; line-height: 1.3; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,.45); }

/* Nav sections */
.nav-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(255,255,255,.3);
  padding: 14px 18px 6px;
}

/* Nav items */
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin: 1px 10px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.55);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer; border: none; background: none;
  width: calc(100% - 20px); text-align: left;
  transition: all var(--transition); position: relative;
  overflow: hidden;
}
/* Le gradient fond passe DERRIÈRE le contenu grâce à z-index */
.nav-item::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--primary), #818CF8);
  opacity: 0; border-radius: var(--radius-sm);
  transition: opacity var(--transition);
  z-index: 0;
}
/* Icône et texte restent toujours au-dessus du ::before */
.nav-item .nav-icon,
.nav-item > span:last-child {
  position: relative; z-index: 1;
}
.nav-item:hover { color: #fff; }
.nav-item:hover::before { opacity: .15; }
.nav-item .nav-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: all var(--transition);
  background: rgba(255,255,255,.06); flex-shrink: 0;
}
.nav-item:hover .nav-icon { background: rgba(255,255,255,.12); transform: scale(1.05); }
.nav-item.active { color: #fff; }
.nav-item.active::before { opacity: 1; }
.nav-item.active .nav-icon {
  background: rgba(255,255,255,.2);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
/* Indicateur barre droite AUSSI en z-index pour rester visible */
.nav-item.active::after {
  content: ''; position: absolute; right: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%; background: #fff;
  border-radius: 3px 0 0 3px;
  z-index: 2;
}

.nav-badge {
  margin-left: auto; background: var(--danger);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 99px; z-index: 1;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-logout {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.45); font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; background: none; width: 100%;
  transition: all var(--transition);
}
.sidebar-logout:hover { color: #FCA5A5; background: rgba(239,68,68,.15); }
.sidebar-logout .nav-icon { background: rgba(239,68,68,.1); color: #FCA5A5; }

/* ══════════════════════════════════════════
   TOPBAR
══════════════════════════════════════════ */
#topbar {
  height: var(--topbar-h);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 30;
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
}
.topbar-title {
  font-size: 18px; font-weight: 700; color: var(--text);
  letter-spacing: -.3px;
  animation: slideDown .25s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-btn {
  width: 38px; height: 38px; border-radius: 10px;
  border: none; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-sec); position: relative;
  transition: all var(--transition);
}
.topbar-btn:hover { background: var(--primary-light); color: var(--primary); }

.topbar-clock {
  font-size: 13px; font-weight: 600; color: var(--text-sec);
  background: var(--bg); padding: 6px 12px; border-radius: 99px;
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 5px;
  border-radius: 12px; cursor: pointer;
  transition: background var(--transition);
}
.topbar-user:hover { background: var(--bg); }
.topbar-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.topbar-name { font-size: 13px; font-weight: 600; color: var(--text); }

/* Alert badge */
.alert-dot {
  position: absolute; top: 5px; right: 5px;
  width: 18px; height: 18px;
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 800;
  border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  animation: alertPulse 2s infinite;
}
@keyframes alertPulse { 0%,100%{transform:scale(1)}50%{transform:scale(1.15)} }

/* ══════════════════════════════════════════
   MAIN LAYOUT
══════════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.page-content { flex: 1; padding: 28px; }

/* ══════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════ */
.login-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #0F172A 0%, #1E1B4B 40%, #312E81 70%, #4C1D95 100%);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.login-bg::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%236366F1' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-orb {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: .25;
  animation: orbFloat 8s ease-in-out infinite;
}
.login-orb-1 { width: 400px; height: 400px; background: #6366F1; top: -100px; right: -100px; animation-delay: 0s; }
.login-orb-2 { width: 300px; height: 300px; background: #8B5CF6; bottom: -80px; left: -80px; animation-delay: -3s; }
.login-orb-3 { width: 200px; height: 200px; background: #3B82F6; top: 40%; left: 30%; animation-delay: -5s; }
@keyframes orbFloat { 0%,100%{transform:translateY(0) scale(1)} 50%{transform:translateY(-20px) scale(1.05)} }

.login-card {
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  width: 100%; max-width: 440px;
  box-shadow: 0 32px 80px rgba(0,0,0,.35);
  animation: loginEntrance .5s cubic-bezier(.34,1.56,.64,1);
  position: relative; z-index: 1;
}
@keyframes loginEntrance { from { opacity: 0; transform: translateY(30px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

.login-logo {
  width: 64px; height: 64px; border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), #818CF8);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(99,102,241,.35);
  animation: logoSpin 1s cubic-bezier(.34,1.56,.64,1) .2s both;
}
@keyframes logoSpin { from { transform: rotate(-15deg) scale(.7); opacity: 0; } to { transform: rotate(0) scale(1); opacity: 1; } }
.login-logo i { color: #fff; font-size: 26px; }

/* ══════════════════════════════════════════
   KPI CARDS
══════════════════════════════════════════ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all var(--bounce);
  cursor: default; position: relative; overflow: hidden;
  animation: cardEntrance .4s ease both;
}
.kpi-card::after {
  content: ''; position: absolute;
  top: -60px; right: -40px;
  width: 140px; height: 140px;
  border-radius: 50%; opacity: .06;
  background: currentColor;
}
.kpi-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; }

@keyframes cardEntrance {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.kpi-card:nth-child(1){animation-delay:.05s}
.kpi-card:nth-child(2){animation-delay:.1s}
.kpi-card:nth-child(3){animation-delay:.15s}
.kpi-card:nth-child(4){animation-delay:.2s}

.kpi-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 14px;
  transition: transform var(--bounce);
}
.kpi-card:hover .kpi-icon { transform: scale(1.1) rotate(-5deg); }

.kpi-value {
  font-size: 26px; font-weight: 800; color: var(--text);
  letter-spacing: -.5px; line-height: 1;
}
.kpi-value span { font-size: 13px; font-weight: 400; color: var(--text-muted); }
.kpi-label { font-size: 12.5px; color: var(--text-sec); margin-top: 4px; font-weight: 500; }
.kpi-trend {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; margin-top: 8px;
  padding: 3px 8px; border-radius: 99px;
}

/* ══════════════════════════════════════════
   CARDS
══════════════════════════════════════════ */
.card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  overflow: hidden; animation: cardEntrance .35s ease both;
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(to right, rgba(249,250,251,.8), var(--surface));
}
.card-header h3 { font-size: 14.5px; font-weight: 700; color: var(--text); }
.card-body { padding: 22px; }

/* ══════════════════════════════════════════
   TABLES
══════════════════════════════════════════ */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: #F8FAFC; font-weight: 600; color: var(--text-sec);
  padding: 11px 16px; text-align: left;
  border-bottom: 2px solid var(--border);
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  white-space: nowrap;
}
.data-table td {
  padding: 13px 16px; border-bottom: 1px solid #F1F5F9;
  vertical-align: middle; color: var(--text); font-size: 13.5px;
  transition: background var(--transition);
}
.data-table tbody tr {
  transition: all var(--transition);
}
.data-table tbody tr:hover td {
  background: linear-gradient(90deg, var(--primary-light), #F8FAFC);
}
.data-table tbody tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px; border-radius: 10px;
  font-weight: 600; font-size: 13px; cursor: pointer;
  transition: all var(--bounce); border: none;
  white-space: nowrap; position: relative; overflow: hidden;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(255,255,255,0); transition: background .15s;
}
.btn:hover::after { background: rgba(255,255,255,.12); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; box-shadow: 0 4px 14px rgba(99,102,241,.35);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(99,102,241,.5); transform: translateY(-1px); }

.btn-success {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #fff; box-shadow: 0 4px 14px rgba(16,185,129,.3);
}
.btn-success:hover { box-shadow: 0 6px 20px rgba(16,185,129,.45); transform: translateY(-1px); }

.btn-danger {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: #fff; box-shadow: 0 4px 14px rgba(239,68,68,.3);
}
.btn-danger:hover { box-shadow: 0 6px 20px rgba(239,68,68,.45); transform: translateY(-1px); }

.btn-warning {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #fff; box-shadow: 0 4px 14px rgba(245,158,11,.3);
}
.btn-warning:hover { box-shadow: 0 6px 20px rgba(245,158,11,.45); transform: translateY(-1px); }

.btn-outline {
  background: var(--surface); border: 1.5px solid var(--border);
  color: var(--text-sec); box-shadow: var(--shadow-sm);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.btn-ghost { background: transparent; color: var(--text-sec); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 13px 28px; font-size: 14.5px; border-radius: 12px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 10px; }

/* ══════════════════════════════════════════
   FORM INPUTS
══════════════════════════════════════════ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-sec); margin-bottom: 6px;
  letter-spacing: .01em;
}
.form-input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  outline: none; font-size: 13.5px; font-family: inherit;
  background: var(--surface); color: var(--text);
  transition: all var(--transition);
  appearance: none;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:hover:not(:focus) { border-color: #CBD5E1; }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2394A3B8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  background-size: 18px; padding-right: 38px;
}

.search-wrapper { position: relative; }
.search-wrapper .search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 13px;
}
.search-input { padding-left: 38px !important; }

/* ══════════════════════════════════════════
   MODAL
══════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalUp .3s cubic-bezier(.34,1.56,.64,1);
  border: 1px solid rgba(255,255,255,.8);
}
.modal-box.lg { max-width: 820px; }
.modal-box.xl { max-width: 1060px; }
@keyframes modalUp { from{opacity:0;transform:translateY(24px) scale(.97)} to{opacity:1;transform:translateY(0) scale(1)} }

.modal-title {
  font-size: 17px; font-weight: 800; color: var(--text);
  display: flex; align-items: center; gap: 10px; margin-bottom: 22px;
}
.modal-title-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ══════════════════════════════════════════
   BADGES
══════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-green  { background: #DCFCE7; color: #15803D; }
.badge-red    { background: #FEE2E2; color: #B91C1C; }
.badge-yellow { background: #FEF9C3; color: #A16207; }
.badge-blue   { background: #DBEAFE; color: #1D4ED8; }
.badge-purple { background: #EDE9FE; color: #6D28D9; }
.badge-gray   { background: #F1F5F9; color: #475569; }
.badge-orange { background: #FFEDD5; color: #C2410C; }

/* ══════════════════════════════════════════
   TOAST NOTIFICATIONS
══════════════════════════════════════════ */
.toast {
  background: var(--surface);
  border-radius: 14px; padding: 14px 18px;
  box-shadow: var(--shadow-xl);
  display: flex; align-items: center; gap: 12px;
  min-width: 300px; max-width: 420px;
  border-left: 4px solid;
  animation: toastIn .35s cubic-bezier(.34,1.56,.64,1);
}
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-msg { font-size: 13.5px; font-weight: 600; color: var(--text); flex: 1; }
.toast.success { border-color: var(--success); }
.toast.success .toast-icon { color: var(--success); }
.toast.error   { border-color: var(--danger); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info    { border-color: var(--info); }
.toast.info    .toast-icon { color: var(--info); }
@keyframes toastIn { from{opacity:0;transform:translateX(60px) scale(.9)} to{opacity:1;transform:translateX(0) scale(1)} }

/* ══════════════════════════════════════════
   STOCK LEVEL BAR
══════════════════════════════════════════ */
.stock-bar-container {
  height: 7px; background: #E2E8F0;
  border-radius: 99px; overflow: hidden;
}
.stock-bar {
  height: 100%; border-radius: 99px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.stock-bar.danger  { background: linear-gradient(90deg, #FCA5A5, #EF4444); }
.stock-bar.warning { background: linear-gradient(90deg, #FCD34D, #F59E0B); }
.stock-bar.success { background: linear-gradient(90deg, #6EE7B7, #10B981); }

/* ══════════════════════════════════════════
   POS ARTICLE CARDS
══════════════════════════════════════════ */
.pos-article-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all var(--bounce);
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.pos-article-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: linear-gradient(90deg, var(--primary), #818CF8);
  transform: scaleX(0); transform-origin: left;
  transition: transform var(--transition);
}
.pos-article-card:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.pos-article-card:hover::before { transform: scaleX(1); }
.pos-article-card:active { transform: scale(.97); }
.pos-article-card.out-of-stock { opacity: .5; cursor: not-allowed; }
.pos-article-card.out-of-stock:hover { transform: none; box-shadow: none; border-color: var(--border); }

/* Cart item */
.cart-item {
  background: #F8FAFC; border-radius: var(--radius-sm);
  padding: 12px; border: 1px solid var(--border);
  transition: all var(--transition);
  animation: cartItemIn .25s ease;
}
@keyframes cartItemIn { from{opacity:0;transform:translateX(10px)} to{opacity:1;transform:translateX(0)} }
.cart-item:hover { border-color: var(--primary); background: var(--primary-light); }

/* ══════════════════════════════════════════
   ALERT BANNER
══════════════════════════════════════════ */
.alert-banner {
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 6px;
  animation: cardEntrance .35s ease;
}
.alert-banner.danger  { background: var(--danger-light); border: 1px solid #FECACA; color: #991B1B; }
.alert-banner.warning { background: var(--warning-light); border: 1px solid #FDE68A; color: #92400E; }
.alert-banner.success { background: var(--success-light); border: 1px solid #A7F3D0; color: #065F46; }
.alert-banner.info    { background: var(--info-light); border: 1px solid #BFDBFE; color: #1E40AF; }

/* ══════════════════════════════════════════
   SPINNER / LOADING
══════════════════════════════════════════ */
.spinner {
  border-radius: 50%; border: 3px solid rgba(99,102,241,.2);
  border-top-color: var(--primary);
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to{transform:rotate(360deg)} }

.page-loader {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px; gap: 14px; color: var(--text-muted);
}
.page-loader .spinner { width: 40px; height: 40px; border-width: 4px; }
.page-loader p { font-size: 13px; font-weight: 500; }

/* ══════════════════════════════════════════
   MISC UTILITIES
══════════════════════════════════════════ */
.price { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: pulseDot 2s infinite; display: inline-block; }
@keyframes pulseDot { 0%,100%{transform:scale(1);opacity:1} 50%{transform:scale(1.4);opacity:.7} }

.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 40px; opacity: .25; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 14px; font-weight: 500; }

/* ── Number input – hide arrows */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ══════════════════════════════════════════
   CARTES UTILISATEURS (module Administration)
══════════════════════════════════════════ */
.user-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.user-card:hover {
  box-shadow: var(--shadow);
  border-color: #C7D2FE;
}

/* Grille des chips de modules */
.perms-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

/* Chip de permission (case à cocher stylisée) */
.perm-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 99px;
  border: 1.5px solid;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all .15s ease;
  white-space: nowrap;
}
.perm-chip:not(.perm-chip-disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(99,102,241,.2);
}
.perm-chip-disabled {
  cursor: default;
  opacity: .75;
}

@media(max-width:768px){
  .user-card { padding: 14px; }
  .perm-chip { font-size: 10.5px; padding: 4px 9px; }
}

/* ── Overlay sidebar mobile ── */
#sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(2px);
  z-index: 39;
  opacity: 0;
  transition: opacity .25s ease;
}
#sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* ── Responsive ── */
@media(max-width:768px){
  /* Sidebar caché par défaut, glisse depuis la gauche */
  #sidebar{
    transform: translateX(-100%);
    z-index: 40;
    box-shadow: none;
    transition: transform .28s cubic-bezier(.4,0,.2,1),
                box-shadow .28s ease;
  }
  #sidebar.open{
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0,0,0,.35);
  }
  .main-content{ margin-left: 0; }
  .page-content{ padding: 14px; }
  .modal-box{ padding: 20px; margin: 12px; }
  .kpi-grid{ grid-template-columns: 1fr 1fr; }
  #menu-toggle{ display: flex !important; }
  .topbar-clock{ display: none !important; }
  /* Topbar padding réduit mobile */
  #topbar{ padding: 0 14px; }
}

/* ── Print */
@media print{
  #sidebar, #topbar{ display:none!important; }
  .main-content{ margin-left:0!important; }
  .no-print{ display:none!important; }
}

/* ══════════════════════════════════════════
   SECTION HEADERS
══════════════════════════════════════════ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; flex-wrap: wrap; gap: 12px;
}
.page-header h2 { font-size: 16px; font-weight: 700; color: var(--text); }

/* ══════════════════════════════════════════
   FILTER BAR
══════════════════════════════════════════ */
.filter-bar {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 14px 18px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 18px; box-shadow: var(--shadow-sm);
}

/* ══════════════════════════════════════════
   STAT MINI CARDS (inside modals / sections)
══════════════════════════════════════════ */
.stat-mini {
  background: var(--bg); border-radius: var(--radius-sm);
  padding: 12px 16px; border: 1px solid var(--border);
  text-align: center;
}
.stat-mini-val { font-size: 20px; font-weight: 800; color: var(--text); }
.stat-mini-lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }

/* ══════════════════════════════════════════
   DIVIDER
══════════════════════════════════════════ */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ══════════════════════════════════════════
   COLOR PICKER BUTTONS
══════════════════════════════════════════ */
.color-btn {
  width: 30px; height: 30px; border-radius: 50%;
  cursor: pointer; border: 3px solid transparent;
  transition: all var(--bounce);
}
.color-btn:hover { transform: scale(1.2); }
.color-btn.selected { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface); }

/* ══════════════════════════════════════════
   WELCOME BANNER (Dashboard)
══════════════════════════════════════════ */
.welcome-banner {
  background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 50%, #EC4899 100%);
  border-radius: var(--radius-lg);
  padding: 22px 28px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(99,102,241,.30);
  animation: cardEntrance .45s var(--bounce) both;
}
.welcome-banner::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,.07);
  border-radius: 50%;
  pointer-events: none;
}
.welcome-banner::after {
  content: '';
  position: absolute;
  bottom: -60px; left: 20%;
  width: 140px; height: 140px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
  pointer-events: none;
}
.welcome-banner-inner {
  display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 12px;
  position: relative; z-index: 1;
}
.welcome-greeting {
  font-size: 20px; font-weight: 800;
  color: #fff; margin: 0 0 4px;
}
.welcome-sub {
  font-size: 13px; color: rgba(255,255,255,.75);
  margin: 0;
}
.welcome-date {
  background: rgba(255,255,255,.15);
  color: #fff; border-radius: 30px;
  padding: 6px 14px; font-size: 12.5px;
  font-weight: 600; backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.20);
  white-space: nowrap;
}

/* ══════════════════════════════════════════
   CHARTS GRIDS (Dashboard)
══════════════════════════════════════════ */
.chart-grid-resp {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.bottom-grid-resp {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) {
  .chart-grid-resp,
  .bottom-grid-resp {
    grid-template-columns: 1fr;
  }
}

/* ══════════════════════════════════════════
   POS LAYOUT — Two-panel
══════════════════════════════════════════ */
.pos-layout {
  display: flex;
  gap: 20px;
  height: calc(100vh - 100px);
  min-height: 600px;
  overflow: hidden;
}
.pos-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.pos-right {
  width: 380px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ══════════════════════════════════════════
   POS SEARCH BAR
══════════════════════════════════════════ */
.pos-search-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 0 0 14px;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════
   POS ARTICLES GRID
══════════════════════════════════════════ */
.pos-articles-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding: 4px 2px 12px;
  align-content: start;
}
.pos-articles-grid::-webkit-scrollbar { width: 5px; }
.pos-articles-grid::-webkit-scrollbar-track { background: transparent; }
.pos-articles-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ══════════════════════════════════════════
   POS ARTICLE CARD sub-elements
══════════════════════════════════════════ */
.pos-card-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin: 0 auto 10px;
  transition: transform var(--bounce);
}
.pos-article-card:hover .pos-card-icon {
  transform: scale(1.12) rotate(-4deg);
}
.pos-card-name {
  font-size: 13px; font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 3px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pos-card-code {
  font-size: 10px; color: var(--text-muted);
  text-align: center; font-family: monospace;
  margin-bottom: 6px;
}
.pos-card-price {
  font-size: 14px; font-weight: 800;
  color: var(--primary);
  text-align: center;
  margin-bottom: 5px;
}
.pos-card-stock {
  font-size: 10.5px; font-weight: 600;
  text-align: center;
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-block;
  margin: 0 auto;
}
.pos-card-stock.in {
  background: #ECFDF5; color: #059669;
}
.pos-card-stock.out {
  background: #FEF2F2; color: #DC2626;
}
.pos-card-overlay {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: rgba(99,102,241,.88);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .18s ease;
  font-size: 28px; color: #fff;
  backdrop-filter: blur(2px);
}
.pos-article-card:hover .pos-card-overlay {
  opacity: 1;
}
.pos-article-card.out-of-stock .pos-card-overlay {
  background: rgba(107,114,128,.85);
  cursor: not-allowed;
}

/* ══════════════════════════════════════════
   POS CART PANEL
══════════════════════════════════════════ */
.pos-cart-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.pos-cart-header h3 {
  font-size: 14px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.pos-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  min-height: 0;
}

/* Variante agrandie : donne plus de place visuelle aux articles */
.pos-cart-items--expanded {
  /* Le flex:1 suffit — on s'assure juste que le footer ne compresse pas le panier */
  min-height: 220px;
}
.pos-cart-items::-webkit-scrollbar { width: 4px; }
.pos-cart-items::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.pos-cart-footer {
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* ══════════════════════════════════════════
   POS TOTALS
══════════════════════════════════════════ */
.pos-totals {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pos-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-sec);
}
.pos-total-row strong {
  color: var(--text);
  font-weight: 700;
}
.pos-total-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 2px solid var(--border);
  margin-top: 4px;
}
.pos-total-main span:first-child {
  font-size: 14px; font-weight: 700; color: var(--text);
}
.pos-total-main span:last-child {
  font-size: 18px; font-weight: 900;
  color: var(--primary);
}

/* ══════════════════════════════════════════
   PULSE DOT (live indicator)
══════════════════════════════════════════ */
.pulse-dot {
  display: inline-block;
  width: 7px; height: 7px;
  background: #10B981;
  border-radius: 50%;
  animation: pulseDot 1.4s ease-in-out infinite;
  vertical-align: middle;
  margin-right: 4px;
}
@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.6); opacity: .6; }
}

/* ══════════════════════════════════════════
   POS RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 768px) {
  .pos-layout { flex-direction: column; height: auto; }
  .pos-right { width: 100%; min-height: 340px; }
  .pos-articles-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); max-height: 45vh; }
}

/* ══════════════════════════════════════════
   MB UTILITY
══════════════════════════════════════════ */
.mb-6 { margin-bottom: 24px !important; }

/* ══════════════════════════════════════════
   QZ TRAY — Styles panneau configuration
══════════════════════════════════════════ */

/* Bannière de statut QZ */
.qz-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.5;
}
.qz-status i { flex-shrink: 0; margin-top: 1px; font-size: 14px; }
.qz-status--ok {
  background: #D1FAE5;
  color: #065F46;
  border-left: 3px solid #10B981;
}
.qz-status--warn {
  background: #FEF3C7;
  color: #92400E;
  border-left: 3px solid #F59E0B;
}
.qz-status--error {
  background: #FEE2E2;
  color: #991B1B;
  border-left: 3px solid #EF4444;
}
.qz-dl-link {
  display: inline-block;
  margin-top: 4px;
  font-weight: 600;
  text-decoration: underline;
  color: inherit;
}

/* Badge d'état QZ (barre d'outils POS) */
.qz-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}
.qz-badge:hover { opacity: .8; }
.qz-badge i { font-size: 11px; flex-shrink: 0; }

.qz-badge--on {
  background: #D1FAE5;
  color: #065F46;
  border: 1px solid #6EE7B7;
}
.qz-badge--warn {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FCD34D;
}
.qz-badge--off {
  background: var(--bg-secondary, #F3F4F6);
  color: var(--text-muted, #6B7280);
  border: 1px solid var(--border, #E5E7EB);
}
