/* ═══════════════════════════════════════════════════════════════════════════
   GestionBoutique — Design System SaaS Ultra-Moderne
   Palette : Indigo/Violet primaire, fond sombre/neutre, accents colorés
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Transitions de page natives (View Transitions API) ───────────────────
   Fondu/morph fluide entre pages sans framework JS. Ignoré silencieusement
   par les navigateurs qui ne le supportent pas encore. ─────────────────── */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: page-out .22s cubic-bezier(.4,0,.2,1) both;
}
::view-transition-new(root) {
  animation: page-in .32s cubic-bezier(.16,1,.3,1) both;
}

@keyframes page-out {
  to { opacity: 0; transform: translateY(-6px) scale(.99); }
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
}

/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
  --primary:        #6366f1;
  --primary-dark:   #4f46e5;
  --primary-light:  #818cf8;
  --primary-subtle: #eef2ff;

  --success:  #10b981;
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --info:     #3b82f6;

  --bg:         #f8fafc;
  --bg-card:    #ffffff;
  --bg-sidebar: #0f172a;
  --bg-header:  #ffffff;

  --text:       #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-white: #ffffff;

  --border:     #e2e8f0;
  --border-hover:#cbd5e1;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --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 10px 40px rgba(0,0,0,.12);
  --shadow-primary: 0 8px 24px rgba(99,102,241,.25);

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

  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --transition: .2s cubic-bezier(.4,0,.2,1);
  --transition-slow: .35s cubic-bezier(.4,0,.2,1);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; display: block; }

/* ── Scrollbar personnalisée ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT — Sidebar + Content
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-slow);
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99,102,241,.4);
}

.sidebar-logo-icon svg { width: 22px; height: 22px; color: #fff; }

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.sidebar-logo-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logo-sub {
  font-size: 11px;
  color: #64748b;
  font-weight: 400;
}

/* Navigation groupes */
.sidebar-nav { flex: 1; padding: 12px 0; }

.sidebar-group { margin-bottom: 4px; }

.sidebar-group-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #475569;
  padding: 10px 20px 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 16px;
  margin: 2px 8px;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  cursor: pointer;
}

.sidebar-link:hover {
  background: rgba(255,255,255,.06);
  color: #e2e8f0;
  transform: translateX(2px);
}

.sidebar-link.active {
  background: linear-gradient(90deg, rgba(99,102,241,.25), rgba(99,102,241,.1));
  color: #fff;
  border-left: 3px solid var(--primary);
  margin-left: 8px;
  padding-left: 13px;
}

.sidebar-link.active .nav-icon { color: var(--primary-light); }

.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

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

/* Sidebar bottom (user info) */
.sidebar-bottom {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  cursor: pointer;
}

.sidebar-user:hover { background: rgba(255,255,255,.06); }

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-info { flex: 1; min-width: 0; }

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role { font-size: 11px; color: #64748b; }

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

/* ── Top Header ────────────────────────────────────────────────────────── */
.topbar {
  height: var(--header-h);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}

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

.topbar-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

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

/* ── Page Content ──────────────────────────────────────────────────────── */
.page-content { padding: 24px; flex: 1; }

/* ═══════════════════════════════════════════════════════════════════════════
   COMPOSANTS — Cards, Boutons, Inputs, Tables, etc.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.card:hover { box-shadow: var(--shadow); }

.card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title svg { width: 18px; height: 18px; color: var(--primary); }

.card-body { padding: 22px; }

.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}

/* Stat cards (dashboard) */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 22px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--card-accent, var(--primary)), transparent);
}

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

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

.stat-icon svg { width: 24px; height: 24px; }

.stat-info { flex: 1; min-width: 0; }

.stat-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -.02em;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-sub.up   { color: var(--success); }
.stat-sub.down { color: var(--danger); }

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

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  color: #fff;
  box-shadow: 0 8px 28px rgba(99,102,241,.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text);
}
.btn-secondary:hover {
  background: #e2e8f0;
  color: var(--text);
}

.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 4px 14px rgba(16,185,129,.3);
}
.btn-success:hover {
  background: #059669;
  color: #fff;
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 14px rgba(239,68,68,.25);
}
.btn-danger:hover { background: #dc2626; color: #fff; transform: translateY(-1px); }

.btn-warning {
  background: var(--warning);
  color: #fff;
}
.btn-warning:hover { background: #d97706; color: #fff; }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-subtle); color: var(--primary); }

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

.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 6px; }
.btn-sm svg { width: 14px; height: 14px; }

.btn-lg { padding: 13px 28px; font-size: 15px; border-radius: 10px; }

.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  border-radius: 8px;
}
.btn-icon svg { width: 17px; height: 17px; }

.btn:disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }

/* ── Inputs ─────────────────────────────────────────────────────────────── */
.input-modern {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-card);
  transition: all var(--transition);
  outline: none;
  appearance: none;
}

.input-modern::placeholder { color: var(--text-light); }

.input-modern:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

.input-modern:hover:not(:focus) { border-color: var(--border-hover); }

.input-modern.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,.1);
}

input[type="color"].input-modern {
  width: 100%;
  height: 42px;
  padding: 4px;
  cursor: pointer;
}

select.input-modern {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 38px;
}

.input-group {
  position: relative;
}

.input-group .input-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
  width: 17px; height: 17px;
}

.input-group .input-modern { padding-left: 38px; }

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

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

.form-label .required { color: var(--danger); margin-left: 3px; }

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

.invalid-feedback {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

/* ── Champs à label flottant ────────────────────────────────────────────── */
.field-float {
  position: relative;
  margin-bottom: 20px;
}

.field-float > .input-modern {
  width: 100%;
  height: 52px;
  padding: 20px 14px 6px;
}

.field-float > textarea.input-modern {
  height: auto;
  min-height: 84px;
  padding: 22px 14px 8px;
  resize: vertical;
}

.field-float > select.input-modern {
  padding-top: 20px;
  padding-bottom: 6px;
}

.field-float > label {
  position: absolute;
  left: 14px;
  top: 26px;
  transform: translateY(-50%);
  font-size: 13.5px;
  color: var(--text-light);
  pointer-events: none;
  transition: all .15s cubic-bezier(.4,0,.2,1);
  background: var(--bg-card);
  padding: 0 4px;
  margin-left: -4px;
  max-width: calc(100% - 20px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field-float > label .required { color: var(--danger); }

.field-float > textarea.input-modern ~ label { top: 22px; transform: translateY(0); }

.field-float > .input-modern:focus ~ label,
.field-float > .input-modern:not(:placeholder-shown) ~ label,
.field-float.always-float > label {
  top: 0;
  transform: translateY(-50%) scale(.82);
  color: var(--primary);
  font-weight: 700;
}

.field-float > .input-modern:focus ~ label { color: var(--primary); }
.field-float > .input-modern.is-invalid ~ label { color: var(--danger); }

/* Les <select> affichent toujours une valeur : label flottant en permanence */
.field-float > select.input-modern ~ label { top: 0; transform: translateY(-50%) scale(.82); color: var(--text-muted); font-weight: 700; }
.field-float > select.input-modern:focus ~ label { color: var(--primary); }

.field-float .form-text, .field-float .invalid-feedback { margin-top: 5px; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table thead tr {
  background: #f8fafc;
  border-bottom: 1.5px solid var(--border);
}

.table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}

.table td {
  padding: 13px 16px;
  color: var(--text);
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--transition);
}

.table tbody tr:hover { background: #f8fafc; }

.table tbody tr:last-child td { border-bottom: none; }

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

/* ── Badges / Chips ─────────────────────────────────────────────────────── */
.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-primary { background: var(--primary-subtle); color: var(--primary-dark); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-gray    { background: #f1f5f9; color: var(--text-muted); }
.badge-dark    { background: #1e293b; color: #94a3b8; }

.badge svg { width: 11px; height: 11px; }

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

.page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  transition: all var(--transition);
  cursor: pointer;
}

.page-link:hover { background: var(--primary-subtle); border-color: var(--primary); color: var(--primary); }
.page-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-link.disabled { opacity: .4; pointer-events: none; }

/* ── Alerts / Toasts ────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  border-left: 4px solid transparent;
  animation: slideDown .3s ease;
}

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

.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #f0fdf4; border-color: var(--success); color: #14532d; }
.alert-error   { background: #fff5f5; border-color: var(--danger);  color: #7f1d1d; }
.alert-warning { background: #fffbeb; border-color: var(--warning); color: #78350f; }
.alert-info    { background: #eff6ff; border-color: var(--info);    color: #1e3a5f; }

.alerts-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
  width: 100%;
}

.toast {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  animation: toastIn .35s cubic-bezier(.175,.885,.32,1.1);
  cursor: pointer;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%) scale(.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

.toast-exit {
  animation: toastOut .25s ease forwards;
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(100%); }
}

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

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

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(.95) translateY(10px);
  transition: transform var(--transition);
}

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

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

.modal-title { font-size: 17px; font-weight: 700; color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Dropdown ───────────────────────────────────────────────────────────── */
.dropdown { position: relative; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(.97);
  transition: all .15s ease;
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
}

.dropdown-item:hover { background: var(--bg); }
.dropdown-item svg { width: 15px; height: 15px; color: var(--text-muted); }
.dropdown-divider { border-top: 1px solid var(--border); margin: 4px 0; }

/* ── Breadcrumb ─────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb svg { width: 12px; height: 12px; flex-shrink: 0; }
.breadcrumb .current { color: var(--text); font-weight: 500; }

/* ── Search bar ─────────────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  transition: border-color var(--transition);
}

.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}

.search-bar svg { color: var(--text-light); width: 16px; height: 16px; flex-shrink: 0; }

.search-bar input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text);
  width: 220px;
}

/* ── Stock indicator ────────────────────────────────────────────────────── */
.stock-bar {
  height: 6px;
  border-radius: 99px;
  background: #e2e8f0;
  overflow: hidden;
  min-width: 80px;
}

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

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

/* ── Product card ───────────────────────────────────────────────────────── */
.product-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
}

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

.product-card-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card-img svg { width: 48px; height: 48px; color: #cbd5e1; }

.product-card-body { padding: 14px; }

.product-card-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card-ref { font-size: 11.5px; color: var(--text-muted); margin-bottom: 8px; }

.product-card-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
}

.product-card-stock { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.product-card-stock.low  { color: var(--warning); }
.product-card-stock.empty { color: var(--danger); }

.product-card-add {
  position: absolute;
  top: 10px; right: 10px;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(.8);
  transition: all var(--transition);
  box-shadow: var(--shadow-primary);
}

.product-card:hover .product-card-add {
  opacity: 1;
  transform: scale(1);
}

/* ── POS — Point de vente ───────────────────────────────────────────────── */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  height: calc(100vh - var(--header-h) - 48px);
}

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

.pos-cart {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--shadow);
}

.cart-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.cart-title { font-size: 16px; font-weight: 700; color: var(--text); }

.cart-items {
  flex: 1;
  padding: 12px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  animation: cartItemIn .25s ease;
}

@keyframes cartItemIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cart-item:hover { background: #f8fafc; }

.cart-item-info { flex: 1; min-width: 0; }

.cart-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-price { font-size: 12px; color: var(--text-muted); }

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty-btn {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: #f1f5f9;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  transition: background var(--transition);
}

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

.qty-val { font-size: 14px; font-weight: 700; color: var(--text); min-width: 24px; text-align: center; }

.cart-item-total { font-size: 13.5px; font-weight: 700; color: var(--text); min-width: 70px; text-align: right; }

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-muted);
  gap: 10px;
}

.cart-empty svg { width: 48px; height: 48px; color: var(--border); }

.cart-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  position: sticky;
  bottom: 0;
  flex-shrink: 0;
  z-index: 2;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13.5px;
}

.cart-total-row.grand {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  padding-top: 10px;
  border-top: 1.5px solid var(--border);
  margin-top: 6px;
}

/* ── Grid helpers ───────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.grid-auto-sm { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }

/* ── Flex helpers ───────────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap-sm { gap: 8px; }
.flex-gap { gap: 12px; }
.flex-gap-lg { gap: 20px; }
.flex-col { flex-direction: column; }

/* ── Spacing ─────────────────────────────────────────────────────────────── */
.mb-0  { margin-bottom: 0; }
.mb-1  { margin-bottom: 6px; }
.mb-2  { margin-bottom: 12px; }
.mb-3  { margin-bottom: 18px; }
.mb-4  { margin-bottom: 24px; }
.mb-5  { margin-bottom: 32px; }
.mt-2  { margin-top: 12px; }
.mt-3  { margin-top: 18px; }
.mt-4  { margin-top: 24px; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 12px; }
.gap-3 { gap: 18px; }

/* ── Text ────────────────────────────────────────────────────────────────── */
.text-sm    { font-size: 12.5px; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-bold  { font-weight: 700; }
.font-semi  { font-weight: 600; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  gap: 14px;
}

.empty-state-icon {
  width: 72px; height: 72px;
  border-radius: 20px;
  background: var(--primary-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state-icon svg { width: 36px; height: 36px; color: var(--primary); }
.empty-state h3 { font-size: 17px; font-weight: 700; color: var(--text); }
.empty-state p  { font-size: 13.5px; color: var(--text-muted); max-width: 340px; }

/* ── Avatar ─────────────────────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }

/* ── Divider ─────────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 18px 0; }

/* ── Loader skeleton ─────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

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

/* ── Reveal on scroll / mount (apparition en cascade) ──────────────────────
   Ajouter la classe .reveal + un style="--i:N" (index) sur les éléments
   d'une grille pour un effet d'apparition élégant et échelonné. ────────── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .55s cubic-bezier(.16,1,.3,1), transform .55s cubic-bezier(.16,1,.3,1);
  transition-delay: calc(var(--i, 0) * 45ms);
}
.reveal.in-view { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* ── Category card (avec vraie photo) ──────────────────────────────────── */
.category-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-slow), box-shadow var(--transition-slow), border-color var(--transition);
  position: relative;
}

.category-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--cat-accent, var(--primary));
}

.category-card-img {
  width: 100%;
  height: 130px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--cat-accent, var(--primary)) 0%, #0000 130%), #eef2ff;
}

.category-card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s cubic-bezier(.16,1,.3,1);
}

.category-card:hover .category-card-img img { transform: scale(1.08); }

.category-card-img .no-photo {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.category-card-img .no-photo svg { width: 34px; height: 34px; color: rgba(255,255,255,.65); }

.category-card-img::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,.55) 100%);
}

.category-card-icon {
  position: absolute;
  top: 10px; left: 10px;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
  z-index: 1;
}
.category-card-icon svg { width: 18px; height: 18px; color: var(--cat-accent, var(--primary)); }

.category-card-count {
  position: absolute;
  bottom: 10px; left: 14px;
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  z-index: 1;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
}

.category-card-body { padding: 14px 16px; }

.category-card-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Category filter chips (POS) ────────────────────────────────────────── */
.cat-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 4px;
  scrollbar-width: none;
}
.cat-chips::-webkit-scrollbar { display: none; }

.cat-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  padding: 6px 14px 6px 6px;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.cat-chip:hover { border-color: var(--chip-accent, var(--primary)); color: var(--text); }

.cat-chip.active {
  background: var(--chip-accent, var(--primary));
  border-color: var(--chip-accent, var(--primary));
  color: #fff;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--chip-accent, var(--primary)) 35%, transparent);
}

.cat-chip-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--chip-accent, var(--primary));
  display: flex; align-items: center; justify-content: center;
}
.cat-chip-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cat-chip-avatar svg { width: 13px; height: 13px; color: #fff; }
.cat-chip.active .cat-chip-avatar { background: rgba(255,255,255,.25); }

/* ── Image dropzone (upload) ───────────────────────────────────────────── */
.image-dropzone {
  position: relative;
  border: 1.5px dashed var(--border-hover);
  border-radius: var(--radius-lg);
  background: #fafbfc;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
}

.image-dropzone:hover, .image-dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-subtle);
}

.image-dropzone.has-image { border-style: solid; padding: 0; }

.image-dropzone input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0;
  cursor: pointer;
}

.image-dropzone-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.image-dropzone-empty svg { width: 32px; height: 32px; color: var(--text-light); }
.image-dropzone-empty span { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }

.image-dropzone-preview {
  width: 100%; height: 180px;
  position: relative;
}
.image-dropzone-preview img { width: 100%; height: 100%; object-fit: cover; }

.image-dropzone-remove {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: rgba(15,23,42,.65);
  backdrop-filter: blur(4px);
  color: #fff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background var(--transition);
}
.image-dropzone-remove:hover { background: var(--danger); }

/* ── Detail catégorie : bannière héro ──────────────────────────────────── */
.category-hero {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  min-height: 180px;
  display: flex;
  align-items: flex-end;
  padding: 24px 28px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, var(--hero-accent, var(--primary)), #1e1b4b);
  box-shadow: var(--shadow);
  animation: page-in .4s cubic-bezier(.16,1,.3,1) both;
}

.category-hero-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: .55;
}

.category-hero::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(15,23,42,.15) 0%, rgba(15,23,42,.75) 100%);
}

.category-hero-content { position: relative; z-index: 1; color: #fff; }
.category-hero-content h1 { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.category-hero-content p { font-size: 13.5px; color: rgba(255,255,255,.8); margin-top: 4px; max-width: 520px; }

/* ── Sidebar toggle mobile ───────────────────────────────────────────────── */
.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
}

.hamburger svg { width: 20px; height: 20px; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}

/* ── Login page ─────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,.15) 0%, transparent 70%);
  top: -200px; right: -100px;
  animation: float 8s ease-in-out infinite;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,.1) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  animation: float 10s ease-in-out infinite reverse;
}

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

.login-card {
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 42px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 60px rgba(0,0,0,.3);
  position: relative;
  z-index: 1;
  animation: loginIn .5s cubic-bezier(.175,.885,.32,1.1);
}

@keyframes loginIn {
  from { opacity: 0; transform: translateY(30px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(99,102,241,.4);
}

.login-logo-icon svg { width: 28px; height: 28px; color: #fff; }

.login-title h1 { font-size: 22px; font-weight: 800; color: var(--text); }
.login-title p  { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Chart container ─────────────────────────────────────────────────────── */
.chart-container { position: relative; height: 260px; }

/* ── Sidebar collapsed mobile ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 240px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .page-content { padding: 16px; }
  .pos-layout { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stat-card { padding: 16px; }
}