/* ═══════════════════════════════════════════════════════════
   🎨 DESIGN SYSTEM — GestoStock (Palette Business)
   ═══════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  /* ═══ Couleurs primaires — BLEU BUSINESS ═══ */
  --navy:         #1E3A8A;
  --navy-dark:    #1E40AF;
  --navy-deep:    #172554;
  --navy-light:   #EFF6FF;
  --navy-soft:    rgba(30, 58, 138, 0.08);

  /* ═══ Couleurs secondaires — ÉMERAUDE ═══ */
  --green:        #059669;
  --green-dark:   #047857;
  --green-light:  #D1FAE5;
  --green-soft:   rgba(5, 150, 105, 0.10);

  /* ═══ Couleurs sémantiques ═══ */
  --orange:       #EA580C;
  --orange-light: #FFEDD5;
  --amber:        #F59E0B;
  --amber-light:  #FEF3C7;
  --cyan:         #0891B2;
  --cyan-light:   #CFFAFE;
  --purple:       #7C3AED;
  --purple-light: #EDE9FE;
  --red:          #DC2626;
  --red-light:    #FEE2E2;

  /* ═══ Neutres ═══ */
  --ink:          #0F172A;
  --slate:        #334155;
  --stone:        #64748B;
  --mist:         #94A3B8;
  --fog:          #CBD5E1;
  --line:         #E2E8F0;
  --bg:           #F8FAFC;
  --paper:        #F1F5F9;
  --white:        #FFFFFF;

  /* ═══ Shadows ═══ */
  --shadow-card:  0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-soft:  0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 12px 32px rgba(30, 58, 138, 0.12);
  --shadow-brand: 0 12px 25px rgba(30, 58, 138, 0.20);

  /* ═══ Radius ═══ */
  --radius-sm:    8px;
  --radius:       12px;
  --radius-lg:    16px;
  --radius-2xl:   20px;
  --radius-3xl:   24px;
  --radius-pill:  999px;

  --transition:   all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ICÔNES SVG */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 22px; height: 22px; }
.icon-xl { width: 26px; height: 26px; }

/* BOUTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.1px;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}
.btn-primary {
  background: var(--navy);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.20);
}
.btn-primary:hover {
  background: var(--navy-dark);
  box-shadow: 0 8px 20px rgba(30, 58, 138, 0.28);
  transform: translateY(-1px);
}
.btn-success {
  background: var(--green);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.20);
}
.btn-success:hover { background: var(--green-dark); transform: translateY(-1px); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { background: #B91C1C; }
.btn-secondary {
  background: var(--white);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.btn-secondary:hover { background: var(--paper); border-color: var(--fog); }
.btn-ghost {
  background: transparent;
  color: var(--stone);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--navy-light); color: var(--navy); }
.btn-icon { width: 38px; height: 38px; padding: 0; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-sm.btn-icon { width: 32px; height: 32px; }
.btn-lg { padding: 13px 22px; font-size: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* FORMULAIRES */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.form-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--slate);
  letter-spacing: -0.1px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

input[type="text"], input[type="tel"], input[type="email"],
input[type="number"], input[type="password"], input[type="search"],
input[type="date"], select, textarea {
  width: 100%;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  transition: var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px var(--navy-soft);
}
input::placeholder, textarea::placeholder { color: var(--mist); }
input:disabled, select:disabled, textarea:disabled {
  background: var(--paper);
  color: var(--mist);
  cursor: not-allowed;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  letter-spacing: -0.1px;
  white-space: nowrap;
}
.badge-blue   { background: var(--navy-light);  color: var(--navy); }
.badge-green  { background: var(--green-light); color: var(--green); }
.badge-amber  { background: var(--amber-light); color: #B45309; }
.badge-red    { background: var(--red-light);   color: var(--red); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-cyan   { background: var(--cyan-light);   color: var(--cyan); }
.badge-gray   { background: var(--paper);        color: var(--stone); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* CARTES */
.card {
  background: var(--white);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-hover); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 14px;
  gap: 12px;
}
.card-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-header h3 .icon { color: var(--navy); }
.card-body { padding: 0 22px 22px; }
.card-body.no-padding { padding: 0; }

/* TABLEAUX */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.data-table thead th {
  text-align: left;
  padding: 12px 22px;
  font-size: 11px;
  font-weight: 700;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.data-table tbody td {
  padding: 14px 22px;
  font-size: 13.5px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--navy-light); }
.table-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* LOADING / EMPTY */
.loading-state, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
  text-align: center;
  color: var(--stone);
}
.empty-state h3 { font-size: 15px; color: var(--ink); font-weight: 800; }
.empty-state p { font-size: 13px; color: var(--mist); max-width: 320px; }
.empty-state-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--navy-light);
  color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.empty-state-icon .icon { width: 26px; height: 26px; }

.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ALERTS */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  border: 1.5px solid transparent;
}
.alert-error   { background: var(--red-light);    color: #991B1B; border-color: #FECACA; }
.alert-success { background: var(--green-light);  color: #065F46; border-color: #A7F3D0; }
.alert-info    { background: var(--navy-light);   color: var(--navy); border-color: #C7D2FE; }
.alert-warning { background: var(--amber-light);  color: #92400E; border-color: #FDE68A; }

/* INFO LIST & TIMELINE */
.info-list { display: flex; flex-direction: column; }
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  gap: 12px;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--stone); font-weight: 500; flex-shrink: 0; }
.info-value { color: var(--ink); font-weight: 700; text-align: right; }
.timeline { padding: 12px 22px; display: flex; flex-direction: column; }
.timeline-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--navy-light);
  color: var(--navy);
}
.timeline-content { flex: 1; min-width: 0; }
.timeline-header {
  display: flex; justify-content: space-between;
  margin-bottom: 4px;
  gap: 10px;
}
.timeline-title { font-size: 13.5px; font-weight: 800; }
.timeline-date { font-size: 11.5px; color: var(--mist); font-weight: 500; flex-shrink: 0; }
.timeline-note { font-size: 13px; color: var(--stone); line-height: 1.55; }

/* NOTIFICATIONS LIST */
.notif-list { display: flex; flex-direction: column; gap: 10px; }
.notif-item {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  background: var(--white);
  border-radius: var(--radius-2xl);
  cursor: pointer;
  transition: var(--transition);
  border-left: 4px solid var(--navy);
  box-shadow: var(--shadow-soft);
}
.notif-item:hover { box-shadow: var(--shadow-card); transform: translateX(2px); }
.notif-item.notif-read { border-left-color: var(--line); opacity: 0.65; }
.notif-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--navy-light);
  color: var(--navy);
}
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 14px; font-weight: 800; margin-bottom: 3px; }
.notif-message { font-size: 13px; color: var(--stone); line-height: 1.5; }
.notif-meta {
  font-size: 11.5px;
  color: var(--mist);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* EXPORT MENU */
.export-menu-wrapper { position: relative; }
.export-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  padding: 6px;
  min-width: 210px;
  z-index: 100;
  animation: slideUp 0.15s ease;
}
.export-menu button {
  width: 100%;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--slate);
  font-weight: 600;
  text-align: left;
}
.export-menu button:hover { background: var(--navy-light); color: var(--navy); }

/* KPI GRID */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.kpi-card {
  background: var(--white);
  border-radius: var(--radius-2xl);
  padding: 18px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 14px;
}
.kpi-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.kpi-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.kpi-icon-blue   { background: var(--navy-light);   color: var(--navy); }
.kpi-icon-green  { background: var(--green-light);  color: var(--green); }
.kpi-icon-amber  { background: var(--amber-light);  color: var(--amber); }
.kpi-icon-gold   { background: var(--amber-light);  color: #B45309; }
.kpi-icon-purple { background: var(--purple-light); color: var(--purple); }
.kpi-icon-red    { background: var(--red-light);    color: var(--red); }
.kpi-icon .icon  { width: 22px; height: 22px; }
.kpi-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.kpi-value {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.8px;
  color: var(--ink);
  line-height: 1.1;
}

/* ═══════════════════════════════════════════════════════════
   TOOLBAR — Alignement horizontal des filtres
   ═══════════════════════════════════════════════════════════ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* Barre de recherche : prend l'espace restant mais limité */
.toolbar .input-search {
  flex: 1 1 240px;
  min-width: 220px;
  max-width: 420px;
  padding: 10px 14px 10px 40px;
  font-size: 13.5px;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 14px center;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: var(--transition);
}
.toolbar .input-search:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px var(--navy-soft);
}

/* Sélecteurs : largeur auto (pas 100%) */
.toolbar .input-select {
  width: auto;
  min-width: 140px;
  max-width: 200px;
  padding: 10px 14px;
  font-size: 13.5px;
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--ink);
  font-weight: 600;
  flex-shrink: 0;
}

/* Inputs date : largeur auto */
.toolbar input[type="date"] {
  width: auto;
  min-width: 150px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  flex-shrink: 0;
}

/* Bouton Réinitialiser dans la toolbar */
.toolbar .btn-ghost {
  flex-shrink: 0;
  font-weight: 700;
  padding: 10px 16px;
  color: var(--stone);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
}
.toolbar .btn-ghost:hover {
  background: var(--navy-light);
  color: var(--navy);
}

/* Responsive : sur mobile, tout s'empile */
@media (max-width: 900px) {
  .toolbar .input-search,
  .toolbar .input-select,
  .toolbar input[type="date"] {
    max-width: none;
    flex: 1 1 100%;
    width: 100%;
  }
}

/* PAGINATION */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px;
  border-top: 1px solid var(--line);
}
.pagination button {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
  background: transparent;
  color: var(--stone);
  border: 1.5px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}
.pagination button:hover:not(:disabled) {
  background: var(--navy-light);
  color: var(--navy);
}
.pagination button.active {
  background: var(--navy);
  color: var(--white);
}
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }

/* ═══════════════════════════════════════════════════════════
   TABLE CRUD — Style commun onglet Gestion
   ═══════════════════════════════════════════════════════════ */
.crud-table-card {
  background: var(--white);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-top: 8px;
}
.crud-table thead th {
  text-align: left;
  padding: 14px 20px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.crud-table tbody td {
  padding: 14px 20px;
  font-size: 13.5px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.crud-table tbody tr:last-child td { border-bottom: none; }
.crud-table tbody tr { transition: var(--transition); }
.crud-table tbody tr:hover { background: var(--navy-light); }

.crud-cell-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.crud-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}
.crud-avatar.blue   { background: var(--navy-light);   color: var(--navy); }
.crud-avatar.green  { background: var(--green-light);  color: var(--green); }
.crud-avatar.amber  { background: var(--amber-light);  color: #B45309; }
.crud-avatar.purple { background: var(--purple-light); color: var(--purple); }
.crud-avatar.cyan   { background: var(--cyan-light);   color: var(--cyan); }
.crud-avatar.red    { background: var(--red-light);    color: var(--red); }
.crud-avatar .icon  { width: 18px; height: 18px; }

.crud-cell-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.3;
}
.crud-cell-sub {
  font-size: 11.5px;
  color: var(--mist);
  margin-top: 2px;
  font-weight: 500;
}

.crud-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  align-items: center;
}
.crud-action-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--stone);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  padding: 0;
}
.crud-action-btn:hover {
  background: var(--navy-light);
  color: var(--navy);
  border-color: var(--navy-light);
}
.crud-action-btn.danger:hover {
  background: var(--red-light);
  color: var(--red);
  border-color: var(--red-light);
}
.crud-action-btn.warn:hover {
  background: var(--amber-light);
  color: #B45309;
  border-color: var(--amber-light);
}
.crud-action-btn .icon { width: 16px; height: 16px; }