/**
 * AIGE-ERP — Design System v2.0
 * UI moderne, vivante, colorée — référence ERP Mali
 * Tailwind CSS + Alpine.js + Lucide Icons
 */

/* =========================================================
   TOKENS & CUSTOM PROPERTIES
   ========================================================= */
:root {
  /* Brand */
  --aige-brand:        #2563eb;
  --aige-brand-dark:   #1d4ed8;
  --aige-brand-light:  #dbeafe;

  /* Mali palette */
  --mali-green:  #009A44;
  --mali-gold:   #FCD116;
  --mali-red:    #CE1126;

  /* Semantic */
  --aige-success: #059669;
  --aige-warning: #d97706;
  --aige-danger:  #dc2626;
  --aige-info:    #0891b2;

  /* Neutrals */
  --aige-ink:     #0b1220;
  --aige-text:    #1e293b;
  --aige-muted:   #64748b;
  --aige-line:    #cbd5e1;
  --aige-subtle:  #f1f5f9;

  /* Sidebar */
  --sidebar-bg-top:    #0d1b35;
  --sidebar-bg-mid:    #0a1628;
  --sidebar-bg-bot:    #060f1d;
  --sidebar-text:      #e2e8f0;
  --sidebar-muted:     #94a3b8;

  /* Shadows */
  --shadow-xs:   0 1px 3px rgba(15,23,42,.08);
  --shadow-sm:   0 4px 12px rgba(15,23,42,.10);
  --shadow-md:   0 8px 24px rgba(15,23,42,.12);
  --shadow-lg:   0 18px 48px rgba(15,23,42,.14);
  --shadow-glow-blue:  0 0 0 3px rgba(37,99,235,.20);
  --shadow-glow-green: 0 0 0 3px rgba(0,154,68,.20);

  /* Radius */
  --r-sm:  0.5rem;
  --r-md:  0.75rem;
  --r-lg:  1rem;
  --r-xl:  1.25rem;
  --r-2xl: 1.5rem;

  /* Transitions */
  --t-fast:   100ms ease;
  --t-base:   180ms ease;
  --t-slow:   300ms ease;
}

/* =========================================================
   RESET HELPERS
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
[x-cloak] { display: none !important; }

/* =========================================================
   SCROLLBAR
   ========================================================= */
* { scrollbar-color: rgba(37,99,235,.32) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: rgba(37,99,235,.30); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

/* =========================================================
   BODY — fond très vivant
   ========================================================= */
body {
  min-height: 100vh;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--aige-text);
  background-color: #edf2fb;
  background-image:
    radial-gradient(ellipse 90% 55% at 8% 0%,   rgba(37,99,235,.22) 0%,  transparent 60%),
    radial-gradient(ellipse 60% 40% at 95% 5%,  rgba(0,154,68,.18)  0%,  transparent 50%),
    radial-gradient(ellipse 50% 35% at 50% 100%, rgba(252,209,22,.12) 0%, transparent 55%),
    linear-gradient(165deg, #e8f0fe 0%, #f0f7ff 35%, #f4fbf7 65%, #fffbf0 100%);
}

/* subtle dot-grid overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle, rgba(15,23,42,.055) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.6) 0%, transparent 55%);
}

/* =========================================================
   SHELL
   ========================================================= */
.aige-shell { background: transparent; position: relative; z-index: 1; }
.aige-main  { position: relative; }

/* top accent line */
.aige-main::before {
  content: "";
  position: fixed;
  top: 0; left: 18rem; right: 0;
  height: 3px;
  background: linear-gradient(90deg,
    var(--mali-green) 0%,
    var(--mali-gold) 45%,
    var(--mali-red) 100%
  );
  z-index: 40;
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.sidebar {
  width: 18rem;
  flex-shrink: 0;
  background:
    linear-gradient(180deg,
      var(--sidebar-bg-top) 0%,
      var(--sidebar-bg-mid) 55%,
      var(--sidebar-bg-bot) 100%);
  border-right: 1px solid rgba(255,255,255,.07);
  box-shadow: 12px 0 40px rgba(0,0,0,.35);
  color: var(--sidebar-text);
  position: relative;
  z-index: 20;
}

/* decorative ambient glow inside sidebar */
.sidebar::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 320px;
  background: radial-gradient(ellipse 120% 60% at 50% 0%,
    rgba(37,99,235,.18) 0%, transparent 70%);
  pointer-events: none;
}

.aige-sidebar-brand {
  border-bottom: 1px solid rgba(255,255,255,.09);
  background: linear-gradient(135deg,
    rgba(37,99,235,.22),
    rgba(0,154,68,.10));
  padding: 1.1rem 1rem;
  position: relative;
  z-index: 1;
}

.aige-brand-mark {
  background: linear-gradient(135deg, #fff 0%, #dbeafe 100%);
  box-shadow: 0 8px 24px rgba(37,99,235,.35), 0 0 0 1px rgba(255,255,255,.3);
}

/* group section */
.aige-nav-group {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--r-xl);
  background: rgba(255,255,255,.03);
  overflow: hidden;
  transition: border-color var(--t-base);
}
.aige-nav-group:hover { border-color: rgba(255,255,255,.14); }

.aige-nav-group-button {
  color: #f1f5f9;
  font-size: .81rem;
  letter-spacing: .015em;
}
.aige-nav-group-button:hover { background: rgba(255,255,255,.06); }

/* per-group accent colors via data-group attribute */
.aige-nav-group[data-group="finance"]  .aige-nav-group-button { border-left: 3px solid var(--mali-green); }
.aige-nav-group[data-group="rh"]       .aige-nav-group-button { border-left: 3px solid #818cf8; }
.aige-nav-group[data-group="stock"]    .aige-nav-group-button { border-left: 3px solid var(--mali-gold); }
.aige-nav-group[data-group="projets"]  .aige-nav-group-button { border-left: 3px solid #fb923c; }
.aige-nav-group[data-group="admin"]    .aige-nav-group-button { border-left: 3px solid var(--mali-red); }
.aige-nav-group[data-group="pilotage"] .aige-nav-group-button { border-left: 3px solid var(--aige-brand); }

.aige-nav-link {
  color: #b0c4de;
  border-radius: var(--r-md);
  font-size: .82rem;
  transition: background var(--t-base), color var(--t-base), border-color var(--t-base);
}
.aige-nav-link:hover {
  background: rgba(99,155,255,.14);
  color: #fff;
}
.aige-nav-link.is-active {
  background: linear-gradient(130deg, rgba(37,99,235,.90), rgba(0,154,68,.70));
  color: #fff;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(37,99,235,.30);
}
.aige-nav-link svg { color: #7ba7d8; }
.aige-nav-link.is-active svg,
.aige-nav-link:hover svg { color: #fff; }

/* =========================================================
   HEADER
   ========================================================= */
.aige-header {
  background: rgba(255,255,255,.88);
  border-bottom: 1px solid rgba(203,213,225,.6);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 4px 20px rgba(15,23,42,.07);
  position: relative;
  z-index: 30;
}

.aige-searchbox {
  background: rgba(241,245,249,.8);
  border: 1.5px solid #dbeafe;
  border-radius: var(--r-xl);
  transition: border-color var(--t-base), box-shadow var(--t-base);
  cursor: pointer;
}
.aige-searchbox:hover {
  border-color: var(--aige-brand);
  box-shadow: var(--shadow-glow-blue);
}

/* =========================================================
   PAGE HEADER (section .aige-page-head)
   ========================================================= */
.aige-page-head {
  border-radius: var(--r-2xl);
  padding: 1.4rem 1.6rem;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(147,197,253,.5);
  background:
    linear-gradient(135deg, rgba(37,99,235,.08) 0%, rgba(255,255,255,.95) 40%, rgba(0,154,68,.07) 100%);
  box-shadow: var(--shadow-md);
}

/* decorative blobs */
.aige-page-head::before {
  content: "";
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,.12), transparent 70%);
  pointer-events: none;
}
.aige-page-head::after {
  content: "";
  position: absolute;
  bottom: -30px; left: 30%;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,154,68,.10), transparent 70%);
  pointer-events: none;
}

.aige-kicker {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .70rem;
  font-weight: 800;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--aige-brand);
}
.aige-kicker::before {
  content: "";
  width: .5rem; height: .5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mali-green), var(--mali-gold));
  animation: pulse-dot 2.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .7; transform: scale(1.4); }
}

/* =========================================================
   KPI / STAT CARDS — colorées et vivantes
   ========================================================= */
.aige-stat-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl);
  padding: 1.4rem;
  border: 1px solid rgba(255,255,255,.6);
  box-shadow: var(--shadow-md);
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.aige-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* card variants — !important to override Tailwind CDN dynamic injection */
.aige-stat-card.blue {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 60%, #3b82f6 100%) !important;
  color: white !important;
  border-color: rgba(255,255,255,.25) !important;
}
.aige-stat-card.green {
  background: linear-gradient(135deg, #047857 0%, #059669 60%, #10b981 100%) !important;
  color: white !important;
  border-color: rgba(255,255,255,.25) !important;
}
.aige-stat-card.gold {
  background: linear-gradient(135deg, #b45309 0%, #d97706 60%, #f59e0b 100%) !important;
  color: white !important;
  border-color: rgba(255,255,255,.25) !important;
}
.aige-stat-card.red {
  background: linear-gradient(135deg, #991b1b 0%, #dc2626 60%, #ef4444 100%) !important;
  color: white !important;
  border-color: rgba(255,255,255,.25) !important;
}
.aige-stat-card.indigo {
  background: linear-gradient(135deg, #3730a3 0%, #4f46e5 60%, #6366f1 100%) !important;
  color: white !important;
  border-color: rgba(255,255,255,.25) !important;
}
.aige-stat-card.teal {
  background: linear-gradient(135deg, #0e7490 0%, #0891b2 60%, #22d3ee 100%) !important;
  color: white !important;
  border-color: rgba(255,255,255,.25) !important;
}
.aige-stat-card.purple {
  background: linear-gradient(135deg, #6b21a8 0%, #7c3aed 60%, #a78bfa 100%) !important;
  color: white !important;
  border-color: rgba(255,255,255,.25) !important;
}

/* decorative shape in corner */
.aige-stat-card::before {
  content: "";
  position: absolute;
  right: -1.5rem; top: -1.5rem;
  width: 7rem; height: 7rem;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  pointer-events: none;
}
.aige-stat-card::after {
  content: "";
  position: absolute;
  right: 1rem; bottom: -1.8rem;
  width: 4.5rem; height: 4.5rem;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  pointer-events: none;
}

.aige-stat-label {
  font-size: .70rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  opacity: .80;
}
.aige-stat-value {
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1.1;
  margin-top: .25rem;
}
.aige-stat-sub {
  font-size: .72rem;
  opacity: .75;
  margin-top: .2rem;
}
.aige-stat-icon-wrap {
  width: 3rem; height: 3rem;
  border-radius: var(--r-lg);
  background: rgba(255,255,255,.20);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  flex-shrink: 0;
}
.aige-stat-icon-wrap svg { color: #fff; }

/* =========================================================
   CARDS GÉNÉRIQUES
   ========================================================= */
.aige-card {
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(203,213,225,.7);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-base), transform var(--t-base);
  overflow: hidden;
}
.aige-card:hover { box-shadow: var(--shadow-md); }

.aige-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.4rem;
  border-bottom: 1px solid rgba(203,213,225,.5);
  background: linear-gradient(135deg,
    rgba(239,246,255,.9) 0%,
    rgba(255,255,255,.98) 60%,
    rgba(240,253,244,.9) 100%);
}
.aige-card-header-icon {
  width: 2.4rem; height: 2.4rem;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* section headers with colored accent bar */
.aige-section-header {
  position: relative;
  padding-left: 1rem;
}
.aige-section-header::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 1.5rem;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--aige-brand), var(--mali-green));
}

/* =========================================================
   TABLES
   ========================================================= */
.aige-table-wrap {
  overflow-x: auto;
  border-radius: var(--r-xl);
  border: 1px solid rgba(203,213,225,.6);
  box-shadow: var(--shadow-sm);
}

table.aige-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
table.aige-table thead {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: #fff;
}
table.aige-table thead th {
  padding: .85rem 1rem;
  font-weight: 800;
  font-size: .72rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: none;
}
table.aige-table thead th:first-child { border-radius: var(--r-xl) 0 0 0; }
table.aige-table thead th:last-child  { border-radius: 0 var(--r-xl) 0 0; }

table.aige-table tbody tr {
  border-bottom: 1px solid rgba(203,213,225,.4);
  transition: background var(--t-fast);
}
table.aige-table tbody tr:nth-child(even) { background: rgba(241,245,249,.55); }
table.aige-table tbody tr:hover           { background: rgba(219,234,254,.45); }

table.aige-table td {
  padding: .8rem 1rem;
  vertical-align: middle;
  color: var(--aige-text);
}

/* global override for existing main table markup */
main table { border-collapse: collapse; }
main table thead {
  background: linear-gradient(135deg, #1d4ed8, #2563eb) !important;
  color: #fff !important;
}
main table thead th {
  color: #fff !important;
  font-weight: 800 !important;
  font-size: .72rem !important;
  letter-spacing: .07em !important;
  text-transform: uppercase !important;
  padding: .85rem 1rem !important;
  border: none !important;
}
main table tbody tr { border-bottom: 1px solid rgba(203,213,225,.4); }
main table tbody tr:nth-child(even) { background: rgba(241,245,249,.55); }
main table tbody tr:hover { background: rgba(219,234,254,.45) !important; }
main table td { padding: .8rem 1rem; vertical-align: middle; }

/* =========================================================
   BADGES / STATUS PILLS
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .70rem;
  font-weight: 800;
  letter-spacing: .04em;
  white-space: nowrap;
}
.badge-blue    { background: #dbeafe; color: #1e40af; }
.badge-green   { background: #d1fae5; color: #065f46; }
.badge-gold    { background: #fef9c3; color: #854d0e; }
.badge-red     { background: #fee2e2; color: #991b1b; }
.badge-purple  { background: #ede9fe; color: #4c1d95; }
.badge-gray    { background: #f1f5f9; color: #475569; }
.badge-teal    { background: #ccfbf1; color: #134e4a; }

.badge-active   { background: linear-gradient(135deg,#d1fae5,#a7f3d0); color: #065f46; }
.badge-pending  { background: linear-gradient(135deg,#fef9c3,#fde68a); color: #92400e; }
.badge-rejected { background: linear-gradient(135deg,#fee2e2,#fecaca); color: #991b1b; }
.badge-draft    { background: linear-gradient(135deg,#f1f5f9,#e2e8f0); color: #475569; }

/* dot before */
.badge::before {
  content: "";
  width: .42rem; height: .42rem;
  border-radius: 50%;
  background: currentColor;
  opacity: .75;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem 1.1rem;
  border-radius: var(--r-lg);
  font-size: .84rem;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition:
    background var(--t-base),
    border-color var(--t-base),
    box-shadow var(--t-base),
    transform var(--t-base),
    opacity var(--t-base);
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover    { transform: translateY(-1px); }
.btn:active   { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 4px 16px rgba(37,99,235,.28);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  box-shadow: 0 8px 24px rgba(37,99,235,.38);
}

.btn-success {
  background: linear-gradient(135deg, #059669, #047857);
  color: #fff;
  box-shadow: 0 4px 16px rgba(5,150,105,.25);
}
.btn-success:hover { box-shadow: 0 8px 24px rgba(5,150,105,.35); }

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
  box-shadow: 0 4px 16px rgba(220,38,38,.25);
}
.btn-danger:hover { box-shadow: 0 8px 24px rgba(220,38,38,.35); }

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  box-shadow: 0 4px 16px rgba(245,158,11,.25);
}

.btn-outline {
  background: transparent;
  color: var(--aige-brand);
  border-color: var(--aige-brand);
}
.btn-outline:hover {
  background: var(--aige-brand-light);
  box-shadow: var(--shadow-glow-blue);
}

.btn-ghost {
  background: transparent;
  color: var(--aige-muted);
  border-color: var(--aige-line);
}
.btn-ghost:hover { background: var(--aige-subtle); color: var(--aige-text); }

.btn-sm { padding: .38rem .8rem; font-size: .78rem; border-radius: var(--r-md); }
.btn-lg { padding: .75rem 1.5rem; font-size: .92rem; }
.btn-icon { padding: .5rem; border-radius: var(--r-md); }

/* =========================================================
   FORMS
   ========================================================= */
.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 700;
  color: var(--aige-text);
  margin-bottom: .4rem;
}
.form-label .required { color: var(--aige-danger); margin-left: .15rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="search"],
input[type="tel"],
input[type="url"],
select,
textarea {
  width: 100%;
  background: #fff !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: var(--r-lg) !important;
  color: var(--aige-ink) !important;
  font-size: .87rem !important;
  padding: .6rem .9rem !important;
  transition: border-color var(--t-base), box-shadow var(--t-base) !important;
  box-shadow: var(--shadow-xs) !important;
}
input:focus, select:focus, textarea:focus {
  outline: none !important;
  border-color: var(--aige-brand) !important;
  box-shadow: var(--shadow-glow-blue) !important;
  background: #fff !important;
}
input::placeholder { color: #94a3b8 !important; }
textarea { resize: vertical; min-height: 6rem; }

/* =========================================================
   ALERTS / FLASH
   ========================================================= */
.alert {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .9rem 1.1rem;
  border-radius: var(--r-lg);
  font-size: .85rem;
  border-width: 1.5px;
  border-style: solid;
}
.alert-success {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-color: #86efac;
  color: #14532d;
}
.alert-danger {
  background: linear-gradient(135deg, #fff1f2, #fee2e2);
  border-color: #fca5a5;
  color: #7f1d1d;
}
.alert-warning {
  background: linear-gradient(135deg, #fffbeb, #fef9c3);
  border-color: #fde68a;
  color: #713f12;
}
.alert-info {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-color: #93c5fd;
  color: #1e3a8a;
}

/* =========================================================
   BREADCRUMB
   ========================================================= */
.aige-breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  color: var(--aige-muted);
  flex-wrap: wrap;
}
.aige-breadcrumb a { color: var(--aige-brand); font-weight: 600; text-decoration: none; }
.aige-breadcrumb a:hover { text-decoration: underline; }
.aige-breadcrumb .sep { opacity: .5; }

/* =========================================================
   WORKFLOWS / STEPPER
   ========================================================= */
.aige-step {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .82rem;
}
.aige-step-dot {
  width: 2rem; height: 2rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .70rem; font-weight: 800;
  flex-shrink: 0;
  border: 2px solid currentColor;
}
.aige-step-done   .aige-step-dot { background: #059669; color: #fff; border-color: #059669; }
.aige-step-active .aige-step-dot { background: var(--aige-brand); color: #fff; border-color: var(--aige-brand); }
.aige-step-wait   .aige-step-dot { background: transparent; color: var(--aige-muted); border-color: var(--aige-line); }

/* =========================================================
   QUICK-ACCESS CARDS
   ========================================================= */
.aige-quick-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  padding: 1rem;
  border-radius: var(--r-xl);
  border: 1.5px solid rgba(203,213,225,.5);
  background: rgba(255,255,255,.85);
  text-align: center;
  text-decoration: none;
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base), background var(--t-base);
  cursor: pointer;
}
.aige-quick-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(37,99,235,.18);
  border-color: var(--aige-brand);
  background: #fff;
}
.aige-quick-link .icon-wrap {
  width: 2.8rem; height: 2.8rem;
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  color: var(--aige-brand);
}
.aige-quick-link:hover .icon-wrap {
  background: linear-gradient(135deg, var(--aige-brand), var(--mali-green));
  color: #fff;
}
.aige-quick-link span {
  font-size: .78rem;
  font-weight: 800;
  color: #374151;
}
.aige-quick-link:hover span { color: var(--aige-brand); }

/* =========================================================
   UTILITIES
   ========================================================= */
.text-primary   { color: var(--aige-ink); }
.text-secondary { color: var(--aige-muted); }
.text-brand     { color: var(--aige-brand); }
.text-success   { color: var(--aige-success); }
.text-danger    { color: var(--aige-danger); }
.text-warning   { color: var(--aige-warning); }

.bg-body   { background-color: #edf2fb; }
.bg-card   { background-color: #fff; }
.bg-subtle { background-color: var(--aige-subtle); }

/* divider */
.aige-divider {
  border: none;
  border-top: 1px solid rgba(203,213,225,.55);
  margin: 1.25rem 0;
}

/* avatar */
.aige-avatar {
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  background: linear-gradient(135deg, #2563eb, #059669);
  color: #fff;
  flex-shrink: 0;
}

/* gradient text utility */
.text-gradient {
  background: linear-gradient(135deg, var(--aige-brand), var(--mali-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* colored section pill */
.aige-pill-blue   { background: #dbeafe; color: #1e40af; padding: .2rem .75rem; border-radius: 999px; font-size: .72rem; font-weight: 800; }
.aige-pill-green  { background: #d1fae5; color: #065f46; padding: .2rem .75rem; border-radius: 999px; font-size: .72rem; font-weight: 800; }
.aige-pill-gold   { background: #fef9c3; color: #854d0e; padding: .2rem .75rem; border-radius: 999px; font-size: .72rem; font-weight: 800; }
.aige-pill-red    { background: #fee2e2; color: #991b1b; padding: .2rem .75rem; border-radius: 999px; font-size: .72rem; font-weight: 800; }

/* =========================================================
   ANIMATIONS
   ========================================================= */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-fade-up     { animation: fadeInUp .35s ease both; }
.animate-fade-in     { animation: fadeIn .25s ease both; }
.animate-slide-right { animation: slideInRight .30s ease both; }

/* staggered children */
.aige-stagger > *:nth-child(1) { animation-delay: .05s; }
.aige-stagger > *:nth-child(2) { animation-delay: .10s; }
.aige-stagger > *:nth-child(3) { animation-delay: .15s; }
.aige-stagger > *:nth-child(4) { animation-delay: .20s; }
.aige-stagger > *:nth-child(5) { animation-delay: .25s; }
.aige-stagger > *:nth-child(6) { animation-delay: .30s; }

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

/* =========================================================
   AUTH LAYOUT
   ========================================================= */
.auth-bg {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 60% at 15% 5%,   rgba(37,99,235,.55)  0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 90% 95%,  rgba(0,154,68,.45)   0%, transparent 50%),
    radial-gradient(ellipse 70% 40% at 85% 10%,  rgba(252,209,22,.20) 0%, transparent 45%),
    linear-gradient(160deg, #0d1b35 0%, #0a1628 55%, #08162a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}
/* grid overlay on auth */
.auth-bg::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
}

.shadow-auth {
  box-shadow: 0 30px 80px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.07);
}

/* Mali color bar */
.mali-bar {
  display: flex;
  height: 4px;
}
.mali-bar > * { flex: 1; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 767px) {
  .aige-main::before { left: 0; }
  .sidebar {
    position: fixed; z-index: 50;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
  }
  .sidebar.mobile-open { transform: translateX(0); }
}

/* =========================================================
   PRINT
   ========================================================= */
@media print {
  .sidebar, .aige-header { display: none !important; }
  .aige-main { margin-left: 0 !important; }
  body { background: white !important; }
  .aige-stat-card { background: white !important; color: black !important; border: 1px solid #ccc !important; }
}

/* =========================================================
   LEGACY ALIASES — compatibility avec les vues pré-v2
   ========================================================= */
.aige-primary-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.1rem; border-radius: var(--r-lg);
  font-size: .82rem; font-weight: 700; line-height: 1.2;
  background: linear-gradient(135deg, var(--aige-brand), #1d4ed8);
  color: #fff; border: 1px solid transparent;
  box-shadow: 0 4px 16px rgba(37,99,235,.28);
  cursor: pointer; transition: all .18s ease;
  text-decoration: none;
}
.aige-primary-btn:hover { box-shadow: 0 8px 24px rgba(37,99,235,.4); transform: translateY(-1px); }

.aige-secondary-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.1rem; border-radius: var(--r-lg);
  font-size: .82rem; font-weight: 700; line-height: 1.2;
  background: transparent; color: var(--aige-brand);
  border: 1.5px solid var(--aige-brand);
  cursor: pointer; transition: all .18s ease;
  text-decoration: none;
}
.aige-secondary-btn:hover { background: var(--aige-brand-light); }

.aige-page-icon {
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: #fff;
  box-shadow: 0 6px 20px rgba(37,99,235,.3);
}

/* =========================================================
   AMÉLIORATIONS v2.1 — Design Premium Institutionnel
   ========================================================= */

/* ── Table moderne avec lignes alternées et hover subtil ── */
main table, .aige-table {
  border-collapse: collapse;
  width: 100%;
  font-size: .84rem;
}
main table thead tr,
main table thead {
  background: linear-gradient(90deg, #1e3a8a, #2563eb) !important;
  color: #fff !important;
}
main table thead th {
  padding: .9rem 1rem !important;
  font-size: .72rem !important;
  font-weight: 800 !important;
  letter-spacing: .08em !important;
  text-transform: uppercase !important;
  color: rgba(255,255,255,.95) !important;
  white-space: nowrap !important;
  border: none !important;
  user-select: none;
}
main table tbody tr {
  border-bottom: 1px solid rgba(226,232,240,.6) !important;
  transition: background .10s ease !important;
}
main table tbody tr:nth-child(odd)  { background: #fff !important; }
main table tbody tr:nth-child(even) { background: #f8fafc !important; }
main table tbody tr:hover           { background: rgba(219,234,254,.4) !important; }
main table td {
  padding: .75rem 1rem !important;
  vertical-align: middle !important;
  color: #334155 !important;
}
main table tfoot td, main table tfoot th {
  padding: .75rem 1rem !important;
  font-weight: 800 !important;
  border-top: 2px solid #e2e8f0 !important;
}

/* ── Cards v2 — plus propres ── */
.aige-card {
  background: #fff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 1.125rem !important;
  box-shadow: 0 1px 3px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.06) !important;
  transition: box-shadow .2s ease !important;
}
.aige-card:hover {
  box-shadow: 0 2px 6px rgba(15,23,42,.08), 0 8px 28px rgba(15,23,42,.09) !important;
}
.aige-card-header {
  background: linear-gradient(135deg, rgba(239,246,255,.7) 0%, #fff 100%) !important;
  border-bottom: 1px solid #e2e8f0 !important;
  padding: .9rem 1.25rem !important;
}

/* ── Page header v2 ── */
.aige-page-head {
  background: linear-gradient(135deg, rgba(37,99,235,.06), rgba(255,255,255,.95) 60%, rgba(0,154,68,.05)) !important;
  border: 1px solid rgba(147,197,253,.4) !important;
  border-radius: 1.125rem !important;
  padding: 1.25rem 1.5rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 1rem !important;
}

/* ── KPI stat cards — refined ── */
.aige-stat-card {
  border-radius: 1.125rem !important;
  padding: 1.25rem !important;
  border: 1px solid rgba(255,255,255,.4) !important;
  box-shadow: 0 4px 20px rgba(15,23,42,.14), 0 0 0 1px rgba(255,255,255,.15) inset !important;
}
.aige-stat-value { font-size: 2rem !important; font-weight: 900 !important; line-height: 1.1 !important; }

/* ── Inputs v2 — plus nets ── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="search"],
select,
textarea {
  background: #f8fafc !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: .75rem !important;
  color: #0f172a !important;
  font-size: .875rem !important;
  padding: .55rem .875rem !important;
  transition: border-color .15s, box-shadow .15s, background .15s !important;
  font-family: inherit !important;
}
input:focus, select:focus, textarea:focus {
  background: #fff !important;
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,.15) !important;
  outline: none !important;
}
select { cursor: pointer; }

/* ── Boutons v2 ── */
.btn {
  font-family: inherit !important;
  font-size: .8rem !important;
  font-weight: 700 !important;
  letter-spacing: .01em !important;
  border-radius: .625rem !important;
  padding: .45rem 1rem !important;
  transition: all .15s ease !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: .375rem !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  border: 1.5px solid transparent !important;
}
.btn-sm { padding: .35rem .75rem !important; font-size: .75rem !important; border-radius: .5rem !important; }
.btn-primary { background: #2563eb !important; color: #fff !important; box-shadow: 0 2px 8px rgba(37,99,235,.3) !important; }
.btn-primary:hover { background: #1d4ed8 !important; box-shadow: 0 4px 16px rgba(37,99,235,.4) !important; transform: translateY(-1px) !important; }
.btn-success { background: #059669 !important; color: #fff !important; }
.btn-success:hover { background: #047857 !important; }
.btn-danger { background: #dc2626 !important; color: #fff !important; box-shadow: 0 2px 8px rgba(220,38,38,.25) !important; }
.btn-danger:hover { background: #b91c1c !important; box-shadow: 0 4px 14px rgba(220,38,38,.35) !important; }
.btn-warning { background: #d97706 !important; color: #fff !important; }
.btn-outline { background: transparent !important; color: #2563eb !important; border-color: #2563eb !important; }
.btn-outline:hover { background: #eff6ff !important; }
.btn-ghost { background: transparent !important; color: #64748b !important; border-color: #e2e8f0 !important; }
.btn-ghost:hover { background: #f8fafc !important; color: #1e293b !important; }

/* ── Badges v2 — plus compacts ── */
.badge {
  font-size: .68rem !important;
  font-weight: 700 !important;
  padding: .18rem .55rem !important;
  border-radius: 9999px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: .25rem !important;
  white-space: nowrap !important;
}
.badge::before { width: .35rem !important; height: .35rem !important; }

/* ── Formulaire label v2 ── */
.form-label {
  font-size: .78rem !important;
  font-weight: 700 !important;
  color: #374151 !important;
  display: block !important;
  margin-bottom: .3rem !important;
}

/* ── Sidebar v2 — fond plus contrasté ── */
.sidebar {
  background: linear-gradient(175deg, #0c1929 0%, #0a1525 50%, #071120 100%) !important;
}
.aige-nav-link.is-active {
  background: linear-gradient(135deg, rgba(37,99,235,.85), rgba(0,154,68,.65)) !important;
  box-shadow: 0 4px 14px rgba(37,99,235,.28) !important;
}
.aige-nav-group { border-color: rgba(255,255,255,.07) !important; }

/* ── Header v2 ── */
.aige-header {
  background: rgba(255,255,255,.92) !important;
  backdrop-filter: blur(16px) !important;
  border-bottom: 1px solid rgba(226,232,240,.7) !important;
  box-shadow: 0 1px 0 rgba(226,232,240,.5), 0 2px 8px rgba(15,23,42,.05) !important;
}

/* ── Alertes v2 ── */
.alert { border-radius: .875rem !important; padding: .875rem 1.1rem !important; }

/* ── Bon de commande print ── */
.doc-print-container {
  max-width: 850px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1.125rem;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(15,23,42,.10);
}
@media print {
  .doc-print-container { box-shadow: none; border: none; border-radius: 0; }
  body { background: white !important; background-image: none !important; }
  .aige-header, .sidebar, .aige-page-head, .no-print { display: none !important; }
  .aige-main { margin-left: 0 !important; }
  main { padding: 0 !important; }
}

/* ── Animation fade up raffinée ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fade-up { animation: fadeInUp .3s cubic-bezier(.16,1,.3,1) both; }

/* =========================================================
   CORRECTIONS v2.2 — table_module + print fix
   ========================================================= */

/* Assure que le fond du body du print ne montre que le doc */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  html, body { background: #fff !important; background-image: none !important; }
  body::before { display: none !important; }
  .aige-shell { display: block !important; }
  .sidebar, .aige-header, footer, .aige-main::before,
  .no-print, [x-cloak] { display: none !important; }
  .aige-main { margin-left: 0 !important; }
  main { padding: 0 !important; margin: 0 !important; }
}

/* tbl-search — champ de recherche dans les tables */
.tbl-search {
  height: 2.25rem;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: .75rem;
  padding: 0 .75rem;
  font-size: .84rem;
  color: #1e293b;
  transition: border-color .15s, box-shadow .15s;
}
.tbl-search:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

/* Prevent the global input override from affecting table search inputs */
input[type="search"].tbl-search { padding: 0 .75rem 0 2.25rem !important; }

/* Boutons d'action inline dans les tables */
.tbl-action-btn {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .25rem .6rem;
  border-radius: .5rem;
  font-size: .72rem;
  font-weight: 600;
  border: 1.5px solid;
  cursor: pointer;
  transition: all .12s ease;
  white-space: nowrap;
  text-decoration: none;
}
