/**
 * TOWeb i-Services Admin Modern CSS
 * Design System inspiré de Vercel / GitHub / Linear
 * Version: 1.0
 * Date: 2025-11-25
 */

/* ============================================================================
   DESIGN TOKENS (CSS Variables)
   ============================================================================ */

:root {
  /* Colors - Neutral (Slate/Zinc palette) */
  --color-background: #fafafa;
  --color-surface: #ffffff;
  --color-border: #e5e7eb;
  --color-border-hover: #d1d5db;

  --color-text-primary: #0f172a;
  --color-text-secondary: #64748b;
  --color-text-tertiary: #94a3b8;
  --color-text-inverse: #ffffff;

  /* Colors - Brand */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #dbeafe;

  --color-success: #10b981;
  --color-success-light: #d1fae5;
  --color-warning: #f59e0b;
  --color-warning-light: #fef3c7;
  --color-danger: #ef4444;
  --color-danger-light: #fee2e2;

  /* Sidebar colors */
  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-text-hover: #ffffff;
  --sidebar-active-bg: #1e293b;
  --sidebar-active-text: #ffffff;
  --sidebar-border: #1e293b;

  /* Spacing (4px base) */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */

  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Monaco", "Inconsolata", "Fira Mono", "Droid Sans Mono", "Source Code Pro", monospace;

  --text-xs: 0.75rem;      /* 12px */
  --text-sm: 0.875rem;     /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg: 1.125rem;     /* 18px */
  --text-xl: 1.25rem;      /* 20px */
  --text-2xl: 1.5rem;      /* 24px */
  --text-3xl: 1.875rem;    /* 30px */
  --text-4xl: 2.25rem;     /* 36px */

  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  --line-tight: 1.25;
  --line-normal: 1.5;
  --line-relaxed: 1.75;

  /* Border radius */
  --radius-sm: 0.375rem;   /* 6px */
  --radius-md: 0.5rem;     /* 8px */
  --radius-lg: 0.75rem;    /* 12px */
  --radius-xl: 1rem;       /* 16px */
  --radius-2xl: 1.5rem;    /* 24px */
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --sidebar-width: 240px;
  --header-height: 64px;
  --content-max-width: 1400px;
}

/* ============================================================================
   RESET & BASE STYLES
   ============================================================================ */

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--line-normal);
  color: var(--color-text-primary);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Override Bootstrap padding-top */
body {
  padding-top: 0 !important;
}

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: var(--font-semibold);
  line-height: var(--line-tight);
  color: var(--color-text-primary);
}

h1 {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  letter-spacing: -0.025em;
  margin-bottom: var(--space-6);
}

h2 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-4);
}

h3 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-3);
}

h4 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}

p {
  margin: 0 0 var(--space-4) 0;
  color: var(--color-text-secondary);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-hover);
}

small {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

code {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
}

/* ============================================================================
   LAYOUT - MAIN STRUCTURE
   ============================================================================ */

.admin-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-left: var(--sidebar-width);
}

.admin-header {
  height: var(--header-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
}

.admin-container {
  max-width: var(--content-max-width);
  margin: 0 auto;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  line-height: 1;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  background: none;
  font-family: var(--font-sans);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: var(--color-text-inverse);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text-primary);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-background);
  border-color: var(--color-border-hover);
}

.btn-danger {
  background: var(--color-danger);
  color: var(--color-text-inverse);
  border-color: var(--color-danger);
}

.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--color-background);
  color: var(--color-text-primary);
}

.btn-back {
  background: var(--color-surface);
  color: var(--color-text-primary);
  border-color: var(--color-border);
  margin-right: var(--space-2);
}

.btn-back:hover {
  background: var(--color-background);
  border-color: var(--color-border-hover);
  color: var(--color-text-primary);
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ============================================================================
   CARDS & PANELS
   ============================================================================ */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-text-primary);
  margin: 0;
}

.card-description {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin: var(--space-2) 0 0 0;
}

/* ============================================================================
   TABLES
   ============================================================================ */

/* ============================================================================
   TABLES - Design moderne façon Tailwind CSS
   ============================================================================ */

/* Conteneur de tableau (optionnel) */
.table-container {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Tableau de base */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
  background: white;
}

/* En-tête de tableau */
.table thead {
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.table thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: #374151;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border-bottom: 1px solid #e5e7eb;
}

/* Corps du tableau */
/* Styles déplacés plus bas dans la section TABLES HARMONIZATION */

/* Tableau avec bordures arrondies (standalone) */
.table.table-bordered {
  border: 1px solid var(--color-border) !important;
  border-radius: 0.5rem !important;
  overflow: hidden !important;
}

.table.table-bordered thead th:first-child {
  border-top-left-radius: 0.5rem;
}

.table.table-bordered thead th:last-child {
  border-top-right-radius: 0.5rem;
}

.table.table-bordered tbody tr:last-child td:first-child {
  border-bottom-left-radius: 0.5rem;
}

.table.table-bordered tbody tr:last-child td:last-child {
  border-bottom-right-radius: 0.5rem;
}

/* Table hover (effet plus marqué) */
.table.table-hover tbody tr:hover {
  background-color: #f3f4f6;
}

/* Table striped (lignes alternées) */
.table.table-striped tbody tr:nth-of-type(odd) {
  background-color: #f9fafb;
}

.table.table-striped tbody tr:hover {
  background-color: #f3f4f6;
}

/* Table condensed (plus compact) */
.table.table-condensed thead th {
  padding: 0.5rem 0.75rem;
}

.table.table-condensed tbody td {
  padding: 0.5rem 0.75rem;
}

/* Table sortable (en-têtes cliquables) */
.table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 2rem;
}

.table th.sortable:hover {
  color: #111827;
  background-color: #f3f4f6;
}

.table th.sortable::after {
  content: '⇅';
  position: absolute;
  right: 0.75rem;
  opacity: 0.3;
  font-size: 0.75rem;
}

.table th.sortable:hover::after {
  opacity: 0.6;
}

/* Cellules avec actions (boutons, liens) */
.table td.actions {
  white-space: nowrap;
  width: 1%;
}

/* Alignement texte dans les cellules */
.table td.text-right,
.table th.text-right {
  text-align: right;
}

.table td.text-center,
.table th.text-center {
  text-align: center;
}

/* Couleurs de statut dans les cellules */
.table td.status-success {
  color: #059669;
  font-weight: 500;
}

.table td.status-warning {
  color: #d97706;
  font-weight: 500;
}

.table td.status-error {
  color: #dc2626;
  font-weight: 500;
}

.table td.status-info {
  color: #2563eb;
  font-weight: 500;
}

/* ============================================================================
   BADGES & LABELS
   ============================================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  line-height: 1;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-primary {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.badge-success {
  background: var(--color-success-light);
  color: #047857;
}

.badge-warning {
  background: var(--color-warning-light);
  color: #b45309;
}

.badge-danger {
  background: var(--color-danger-light);
  color: #b91c1c;
}

.badge-neutral {
  background: var(--color-background);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

/* Status badges modernes (pour états de commandes, etc.) */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
  border-radius: 0.375rem;
  white-space: nowrap;
  vertical-align: middle;
}

/* Status warning - Jaune ambré (Attente paiement, En attente) */
.status-badge.warning {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Status validated - Vert clair (Paiement validé) */
.status-badge.validated {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

/* Status preparing - Bleu ciel (En préparation) */
.status-badge.preparing {
  background-color: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* Status info - Violet/Indigo (Expédiée, En transit) */
.status-badge.info {
  background-color: #e0e7ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}

/* Status success - Vert foncé (Livrée, Réceptionnée, Complétée) */
.status-badge.success {
  background-color: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* Status neutral - Gris (Prête à enlever) */
.status-badge.neutral {
  background-color: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

/* Status muted - Gris clair (Annulée) */
.status-badge.muted {
  background-color: #f9fafb;
  color: #6b7280;
  border: 1px solid #e5e7eb;
  text-decoration: line-through;
}

/* Status danger - Rouge (Absent, Échoué, Erreur) */
.status-badge.danger {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Status completed - Turquoise/Cyan (Réceptionné, Complété) */
.status-badge.completed {
  background-color: #ccfbf1;
  color: #115e59;
  border: 1px solid #99f6e4;
}

/* ============================================================================
   STATS GRID
   ============================================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.stat-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border-color: #d1d5db;
}

.stat-label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--color-text-primary);
  line-height: 1;
}

.stat-change {
  font-size: var(--text-xs);
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.stat-change.positive {
  color: var(--color-success);
}

.stat-change.negative {
  color: var(--color-danger);
}

/* Well / Panel (pour graphiques et contenus groupés) */
.well,
.panel {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.well > h3,
.well > h4,
.panel > h3,
.panel > h4 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
}

/* Canvas pour graphiques */
canvas {
  max-width: 100%;
  height: auto !important;
}

/* ============================================================================
   ALERTS & NOTIFICATIONS
   ============================================================================ */

.alert {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

/* ============================================================================
   LOADING STATES
   ============================================================================ */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-8);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

/* ============================================================================
   UTILITIES
   ============================================================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }

.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
  .admin-main {
    margin-left: 0;
  }

  .admin-content {
    padding: var(--space-4);
  }

  .card {
    padding: var(--space-4);
  }

  .table th,
  .table td {
    padding: var(--space-2) var(--space-3);
  }

  .table th:first-child,
  .table td:first-child {
    padding-left: var(--space-3);
  }

  .table th:last-child,
  .table td:last-child {
    padding-right: var(--space-3);
  }

  /* Réduire le padding des boutons dans btn-group sur mobile */
  .btn-group .btn {
    padding: 0.3rem 0;
    font-size: 0.6rem;
    letter-spacing: -0.02em;
  }

  /* Réduire aussi le padding du conteneur btn-group */
  .btn-group {
    padding: 0.15rem;
    gap: 0;
  }
}

/* ============================================================================
   HIDE OLD BOOTSTRAP NAVBAR
   ============================================================================ */

.navbar,
.navbar-fixed-top,
.navbar-inverse,
.hero-unit {
  display: none !important;
}

/* ============================================================================
   TABLES HARMONIZATION
   ============================================================================ */

/* Style unifié pour tous les tableaux du backoffice */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 0.5rem !important;
  overflow: hidden !important;
  border: 1px solid var(--color-border) !important;
  box-shadow: none !important;
  background-color: transparent !important;
}

.table thead {
  background-color: #f8f9fa;
}

.table thead th {
  padding: var(--space-3);
  border-bottom: 2px solid var(--color-border);
  font-weight: 600;
  color: var(--color-text-primary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.table tbody {
  background-color: white;
}

.table tbody tr {
  background-color: white;
  transition: background-color 0.15s ease;
}

.table tbody tr:hover {
  background-color: #f9fafb;
  cursor: pointer;
}

.table tbody td {
  padding: var(--space-3);
  vertical-align: middle;
  color: var(--color-text-primary);
  border-left: none !important;
  border-right: none !important;
  border-top: none !important;
  border-bottom: 1px solid #e5e7eb !important;
}

/* Remove border from last row's cells */
.table tbody tr:last-child td {
  border-bottom: none !important;
}

/* Override Bootstrap table-bordered - désactivé car ne devrait pas être utilisé */
.table-bordered {
  border: 1px solid var(--color-border) !important;
  border-radius: 0.5rem !important;
  overflow: hidden;
}

.table-bordered thead th,
.table-bordered tbody td {
  border: none !important;
}

/* Table variants */
.table-condensed th,
.table-condensed td {
  padding: var(--space-2) !important;
}

.table-hover tbody tr:hover {
  background-color: #f9fafb;
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(0, 0, 0, 0.02);
}

/* ============================================================================
   RESPONSIVE TABLES (Mobile Card Layout)
   ============================================================================ */

@media (max-width: 768px) {
  /* Add padding to main content on mobile */
  .admin-content {
    padding: var(--space-4) var(--space-3) !important;
  }

  /* Remove table wrapper styles that add white background */
  .table {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  /* Hide table headers on mobile */
  .table thead {
    display: none;
  }

  .table tbody {
    background: transparent;
  }

  /* Make each row a card */
  .table tbody tr {
    display: block;
    margin-bottom: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    padding: var(--space-3);
    background: white;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  }

  /* Make each cell a row with label */
  .table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: start;
    padding: var(--space-2) 0 !important;
    border: none !important;
    text-align: right;
  }

  .table tbody td:not(:last-child) {
    border-bottom: 1px solid #f3f4f6 !important;
    padding-bottom: var(--space-2) !important;
    margin-bottom: var(--space-2);
  }

  /* Add labels before each cell using data-label attribute or nth-child fallback */
  .table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    text-align: left;
    flex-shrink: 0;
    padding-right: var(--space-3);
  }

  /* Fallback labels for tables without data-label attributes */
  /* Orders table (twsc/bo.php) - 6 columns: Date, Status, Order#, Client, Total, Actions */
  .table tbody td:nth-child(1):not([data-label])::before {
    content: 'Date';
  }
  .table tbody td:nth-child(2):not([data-label])::before {
    content: 'Status';
  }
  .table tbody td:nth-child(3):not([data-label])::before {
    content: 'Order #';
  }
  .table tbody td:nth-child(4):not([data-label])::before {
    content: 'Client';
  }
  .table tbody td:nth-child(5):not([data-label])::before {
    content: 'Total';
  }
  .table tbody td:nth-child(6):not([data-label])::before {
    content: 'Actions';
  }

  /* Cell content aligned right */
  .table tbody td > * {
    text-align: right;
  }

  /* Special handling for action buttons */
  .table tbody td:last-child {
    justify-content: flex-end;
    margin-top: var(--space-2);
    padding-top: var(--space-2) !important;
  }

  .table tbody td:last-child::before {
    display: none;
  }

  /* Add margins to other elements on mobile */
  .stats-grid,
  .well,
  .panel,
  .container,
  .alert,
  h1, h2, h3, h4 {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Ensure containers don't have excessive padding on mobile */
  .container {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Stats cards on mobile */
  .stat-card {
    margin-bottom: var(--space-3);
  }

  /* Panels/wells on mobile */
  .well,
  .panel {
    padding: var(--space-3) !important;
    margin-bottom: var(--space-3) !important;
  }
}

/* ============================================================================
   FORM INPUTS (for Settings page)
   ============================================================================ */

/* Ajout de padding pour tous les inputs et textareas */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
textarea,
select {
  padding: var(--space-2) var(--space-3) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-md) !important;
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
  outline: none !important;
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px var(--color-primary-light) !important;
}

textarea {
  resize: vertical !important;
  min-height: 80px !important;
}

/* ============================================================================
   LAYOUT FIXES
   ============================================================================ */

/* S'assure que les messages d'information sont centrés */
.admin-content > div[style*="max-width"] {
  margin-left: auto !important;
  margin-right: auto !important;
}

/* ============================================================================
   BOOTSTRAP REPLACEMENT - COMPLETE SYSTEM
   ============================================================================ */

/* GRID SYSTEM - Flexbox moderne inspiré de Tailwind */
.row,
.row-fluid {
  display: flex;
  flex-wrap: wrap;
  margin-left: calc(var(--space-4) * -0.5);
  margin-right: calc(var(--space-4) * -0.5);
  gap: 0;
}

/* Colonnes avec système span (Bootstrap 2 compatibility) */
[class*="span"] {
  flex: 0 0 auto;
  padding-left: calc(var(--space-4) * 0.5);
  padding-right: calc(var(--space-4) * 0.5);
}

.span1 { width: 8.333333%; }
.span2 { width: 16.666667%; }
.span3 { width: 25%; }
.span4 { width: 33.333333%; }
.span5 { width: 41.666667%; }
.span6 { width: 50%; }
.span7 { width: 58.333333%; }
.span8 { width: 66.666667%; }
.span9 { width: 75%; }
.span10 { width: 83.333333%; }
.span11 { width: 91.666667%; }
.span12 { width: 100%; }

/* Container */
.container,
.container-fluid {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.container {
  max-width: 1200px;
}

/* Panels - Cards modernes */
.panels {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.panel {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  flex: 1;
  min-width: 0;
  transition: all 0.2s ease;
}

.panel:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-hover);
}

.panel h2 {
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  margin: 0 0 var(--space-2) 0;
}

.panel h3 {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0 0 var(--space-2) 0;
}

.panel h4 {
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-text-secondary);
  margin: 0;
}

/* Hero unit (deprecated mais nécessaire pour compatibilité) */
.hero-unit {
  padding: var(--space-8);
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
}

/* ============================================================================
   FORMS - Style moderne façon Tailwind CSS
   ============================================================================ */

.form-group {
  margin-bottom: var(--space-4);
}

.form-label,
label,
.control-label,
legend {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  text-decoration: none !important;
}

label a,
.control-label a,
legend a {
  text-decoration: none !important;
}

legend {
  border: 0;
  padding: 0;
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--color-text-primary);
}

/* Champs de formulaire de base */
.form-control,
.input-medium,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.5;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  background-color: white;
  color: #111827;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  font-family: inherit;
}

/* Focus state moderne */
.form-control:focus,
.input-medium:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Placeholder moderne */
.form-control::placeholder,
.input-medium::placeholder,
input::placeholder,
textarea::placeholder {
  color: #9ca3af;
}

/* Tailles de champs */
.input-mini {
  width: auto !important;
  min-width: 60px;
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
}

.input-small {
  width: auto !important;
  min-width: 120px;
}

.input-large {
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
}

/* Select moderne */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

/* Textarea */
textarea {
  resize: vertical;
  min-height: 80px;
}

/* Input groups */
.input-append,
.input-prepend {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.input-append .input-medium,
.input-prepend .input-medium,
.input-append input,
.input-prepend input {
  flex: 1;
}

.input-append .btn,
.input-prepend .btn {
  flex-shrink: 0;
}

/* Disabled state */
input:disabled,
select:disabled,
textarea:disabled {
  background-color: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Alias .form-input pour compatibilité */
.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.5;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  background-color: white;
  color: #111827;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Checkbox moderne */
.form-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--color-text-primary);
}

.form-checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.form-checkbox span {
  user-select: none;
}

/* Input avec erreur */
.input-error,
input.error {
  border-color: #ef4444;
}

.input-error:focus,
input.error:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Input avec succès */
.input-success,
input.success {
  border-color: #10b981;
}

.input-success:focus,
input.success:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* ============================================================================
   BUTTONS - Style moderne façon Tailwind CSS
   ============================================================================ */

/* Boutons de base */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  border-radius: 0.375rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
  user-select: none;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Tailles de boutons */
.btn-sm,
.btn-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  gap: 0.375rem;
}

.btn-lg {
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  gap: 0.625rem;
}

/* Boutons icon-only (pour SVG) */
.btn-sm svg,
.btn-small svg {
  width: 16px;
  height: 16px;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-lg svg {
  width: 20px;
  height: 20px;
}

/* Style Primary - Bleu moderne */
.btn-primary {
  background-color: #3b82f6;
  color: white;
  border-color: #3b82f6;
  box-shadow: 0 1px 2px 0 rgba(59, 130, 246, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background-color: #2563eb;
  border-color: #2563eb;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2), 0 2px 4px -2px rgba(59, 130, 246, 0.15);
}

.btn-primary:active:not(:disabled) {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
}

/* Style Secondary - Gris sobre */
.btn-secondary {
  background-color: #f3f4f6;
  color: #374151;
  border-color: #d1d5db;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover:not(:disabled) {
  background-color: #e5e7eb;
  border-color: #9ca3af;
}

.btn-secondary:active:not(:disabled) {
  background-color: #d1d5db;
}

/* Style Success - Vert */
.btn-success {
  background-color: #10b981;
  color: white;
  border-color: #10b981;
  box-shadow: 0 1px 2px 0 rgba(16, 185, 129, 0.2);
}

.btn-success:hover:not(:disabled) {
  background-color: #059669;
  border-color: #059669;
  color: white;
  box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}

/* Style Danger - Rouge sobre */
.btn-danger {
  background-color: #ef4444;
  color: white;
  border-color: #ef4444;
  box-shadow: 0 1px 2px 0 rgba(239, 68, 68, 0.2);
}

.btn-danger:hover:not(:disabled) {
  background-color: #dc2626;
  border-color: #dc2626;
  color: white;
  box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.2);
}

.btn-danger:active:not(:disabled) {
  background-color: #b91c1c;
}

/* Style Warning - Orange */
.btn-warning {
  background-color: #f59e0b;
  color: white;
  border-color: #f59e0b;
  box-shadow: 0 1px 2px 0 rgba(245, 158, 11, 0.2);
}

.btn-warning:hover:not(:disabled) {
  background-color: #d97706;
  border-color: #d97706;
  color: white;
}

/* Style Info - Cyan */
.btn-info {
  background-color: #06b6d4;
  color: white;
  border-color: #06b6d4;
  box-shadow: 0 1px 2px 0 rgba(6, 182, 212, 0.2);
}

.btn-info:hover:not(:disabled) {
  background-color: #0891b2;
  border-color: #0891b2;
  color: white;
}

/* Bouton actif */
.btn.active {
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
  background-color: #1d4ed8 !important;
  border-color: #1d4ed8 !important;
  color: white !important;
  position: relative;
}

.btn.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

/* Groupes de boutons - Style radio-button */
.btn-group {
  display: inline-flex;
  gap: 0;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  background-color: #f3f4f6;
  padding: 0.25rem;
}

.btn-group .btn {
  border-radius: 0.25rem;
  border: none;
  margin: 0;
  box-shadow: none;
  background-color: transparent;
  color: #6b7280;
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-group .btn:hover:not(.active):not(:disabled) {
  background-color: rgba(255, 255, 255, 0.5);
  color: #374151;
}

.btn-group .btn.active {
  background-color: white !important;
  color: #1d4ed8 !important;
  border-color: transparent !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06) !important;
  font-weight: 600;
}

.btn-group .btn.active::before {
  display: none;
}

.btn-group .btn:first-child {
  border-radius: 0.25rem;
}

.btn-group .btn:last-child {
  border-radius: 0.25rem;
}

.btn-group .btn:not(:first-child):not(:last-child) {
  border-radius: 0.25rem;
}

/* Boutons avec bordure uniquement (outline) */
.btn-outline-primary {
  background-color: transparent;
  color: #3b82f6;
  border-color: #3b82f6;
}

.btn-outline-primary:hover:not(:disabled) {
  background-color: #3b82f6;
  color: white;
}

.btn-outline-secondary {
  background-color: transparent;
  color: #6b7280;
  border-color: #d1d5db;
}

.btn-outline-secondary:hover:not(:disabled) {
  background-color: #f3f4f6;
  border-color: #9ca3af;
}

.btn-outline-danger {
  background-color: transparent;
  color: #ef4444;
  border-color: #ef4444;
}

.btn-outline-danger:hover:not(:disabled) {
  background-color: #ef4444;
  color: white;
}

/* Alertes */
.alert {
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  line-height: 1.6;
  font-size: var(--text-sm);
  display: block !important;
  width: 100% !important;
  column-count: 1 !important;
  -webkit-column-count: 1 !important;
  -moz-column-count: 1 !important;
  columns: auto !important;
  -webkit-columns: auto !important;
  -moz-columns: auto !important;
  column-width: auto !important;
  -webkit-column-width: auto !important;
  -moz-column-width: auto !important;
}

.alert-info {
  background-color: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

.alert-success {
  background-color: var(--color-success-light);
  border-color: #86efac;
  color: #166534;
}

.alert-warning {
  background-color: var(--color-warning-light);
  border-color: #fcd34d;
  color: #92400e;
}

.alert-danger {
  background-color: var(--color-danger-light);
  border-color: #fca5a5;
  color: #991b1b;
}

/* Alertes dismissibles */
.alert-dismissible {
  position: relative;
  padding-right: 3rem;
}

.alert .close {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  padding: 0;
  background: transparent;
  border: none;
  font-size: 0.8125rem;
  line-height: 1;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.alert .close:hover {
  opacity: 0.75;
}

.fade {
  opacity: 0;
  transition: opacity 0.15s linear;
}

.fade.in {
  opacity: 1;
}

/* ============================================================================
   MODALS - Fenêtres modales modernes
   ============================================================================ */

/* Overlay backdrop */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1040;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.modal-backdrop.in {
  opacity: 1;
}

/* Modal container */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1050;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.modal.in {
  opacity: 1;
  pointer-events: auto;
}

/* Hide modal by default */
.modal.hide {
  display: none;
}

/* Modal dialog wrapper (si présent) */
.modal-dialog {
  position: relative;
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-width: 600px;
  width: 100%;
  margin: auto;
  transform: scale(0.95);
  transition: transform 0.15s ease;
}

.modal.in .modal-dialog {
  transform: scale(1);
}

/* Modal header */
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
}

.modal-header .close {
  background: transparent;
  border: none;
  font-size: 0.8125rem;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.modal-header .close:hover {
  opacity: 1;
}

/* Modal body */
.modal-body {
  padding: 1.5rem;
  color: #374151;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.modal-body fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.modal-body legend {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 1rem;
  padding: 0;
}

.modal-body label.radio {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.modal-body label.radio:hover {
  background-color: #f9fafb;
}

.modal-body label.radio input[type="radio"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.modal-body label.radio .label {
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
}

/* Label colors for order states */
.modal-body .label {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.label-default { background-color: #e5e7eb; color: #374151; }
.label-info { background-color: #dbeafe; color: #1e40af; }
.label-success { background-color: #d1fae5; color: #065f46; }
.label-warning { background-color: #fed7aa; color: #92400e; }
.label-danger { background-color: #fee2e2; color: #991b1b; }
.label-primary { background-color: #dbeafe; color: #1e40af; }
.label-inverse { background-color: #1f2937; color: white; }

/* Modal footer */
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background-color: #f9fafb;
  border-radius: 0 0 0.5rem 0.5rem;
}

/* Textarea in modal */
.modal-body textarea {
  width: 100% !important;
  min-height: 100px;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

/* help-block in modal */
.modal-body .help-block {
  display: block;
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.5rem;
}

/* Checkbox in modal */
.modal-body input[type="checkbox"] {
  width: auto !important;
  margin-right: 0.5rem;
  margin-bottom: 0;
}

.modal-body label.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 640px) {
  .modal {
    padding: 0.5rem;
  }

  .modal-dialog {
    max-width: 100%;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1rem;
  }
}

/* Helpers */
.text-center {
  text-align: center !important;
}

.text-left {
  text-align: left !important;
}

.text-right {
  text-align: right !important;
}

.d-block {
  display: block !important;
}

.d-inline-block {
  display: inline-block !important;
}

.d-flex {
  display: flex !important;
}

.mx-auto {
  margin-left: auto !important;
  margin-right: auto !important;
}

.mt-1 { margin-top: var(--space-1) !important; }
.mt-2 { margin-top: var(--space-2) !important; }
.mt-3 { margin-top: var(--space-3) !important; }
.mt-4 { margin-top: var(--space-4) !important; }

.mb-1 { margin-bottom: var(--space-1) !important; }
.mb-2 { margin-bottom: var(--space-2) !important; }
.mb-3 { margin-bottom: var(--space-3) !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }

.p-2 { padding: var(--space-2) !important; }
.p-3 { padding: var(--space-3) !important; }
.p-4 { padding: var(--space-4) !important; }

.gap-2 { gap: var(--space-2) !important; }
.gap-3 { gap: var(--space-3) !important; }
.gap-4 { gap: var(--space-4) !important; }

/* Responsive */
@media (max-width: 768px) {
  .row,
  .row-fluid {
    flex-direction: column;
  }

  [class*="span"] {
    width: 100% !important;
  }

  .panels {
    flex-direction: column;
  }

  .panel {
    width: 100%;
  }
}

/* ============================================================================
   UTILITY CLASSES - Classes utilitaires pour remplacer les styles inline
   ========================================================================= */

/* Text alignment */
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

/* Display */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-flex { display: flex !important; }

/* Flex utilities */
.flex-center { 
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem;
}

/* Colors - Text */
.text-muted { color: #999 !important; }
.text-secondary { color: var(--color-text-secondary) !important; }
.text-primary { color: var(--color-primary) !important; }
.text-success { color: #16a34a !important; }
.text-danger { color: #dc2626 !important; }
.text-warning { color: #ca8a04 !important; }
.text-red { color: red !important; }
.text-green { color: green !important; }
.text-darkgrey { color: darkgrey !important; }

/* Background colors */
.bg-light { background-color: #f8f9fa !important; }
.bg-white { background-color: white !important; }

/* Font weight */
.fw-normal { font-weight: normal !important; }
.fw-bold { font-weight: bold !important; }
.fw-semibold { font-weight: 600 !important; }

/* Font size */
.fs-small { font-size: 0.85em !important; }
.fs-normal { font-size: 1em !important; }

/* Text transform */
.text-uppercase { text-transform: uppercase !important; }

/* Cursor */
.cursor-default { cursor: default !important; }
.cursor-pointer { cursor: pointer !important; }

/* Margins */
.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.ml-0 { margin-left: 0 !important; }
.mr-0 { margin-right: 0 !important; }

.m-1 { margin: 0.5em !important; }
.mt-1 { margin-top: 0.5em !important; }
.mb-1 { margin-bottom: 0.5em !important; }
.ml-1 { margin-left: 0.5em !important; }
.mr-1 { margin-right: 0.5em !important; }

.m-2 { margin: 1em !important; }
.mt-2 { margin-top: 1em !important; }
.mb-2 { margin-bottom: 1em !important; }
.ml-2 { margin-left: 1em !important; }
.mr-2 { margin-right: 1em !important; }

.m-3 { margin: 1.5em !important; }
.mt-3 { margin-top: 1.5em !important; }
.mb-3 { margin-bottom: 1.5em !important; }
.ml-3 { margin-left: 1.5em !important; }
.mr-3 { margin-right: 1.5em !important; }

.m-4 { margin: 2em !important; }
.mt-4 { margin-top: 2em !important; }
.mb-4 { margin-bottom: 2em !important; }
.ml-4 { margin-left: 2em !important; }
.mr-4 { margin-right: 2em !important; }

.m-5 { margin: 3em !important; }
.mt-5 { margin-top: 3em !important; }
.mb-5 { margin-bottom: 3em !important; }
.ml-5 { margin-left: 3em !important; }
.mr-5 { margin-right: 3em !important; }

.mt-16 { margin-top: 16px !important; }
.ml-4px { margin-left: 4px !important; }
.mr-70 { margin-right: 70px !important; }

.mx-auto { margin-left: auto !important; margin-right: auto !important; }

/* Paddings */
.p-0 { padding: 0 !important; }
.pt-0 { padding-top: 0 !important; }
.pb-0 { padding-bottom: 0 !important; }
.pl-0 { padding-left: 0 !important; }
.pr-0 { padding-right: 0 !important; }

.p-1 { padding: 0.5em !important; }
.pt-1 { padding-top: 0.5em !important; }
.pb-1 { padding-bottom: 0.5em !important; }
.pl-1 { padding-left: 0.5em !important; }
.pr-1 { padding-right: 0.5em !important; }

.p-2 { padding: 1em !important; }
.pt-2 { padding-top: 1em !important; }
.pb-2 { padding-bottom: 1em !important; }
.pl-2 { padding-left: 1em !important; }
.pr-2 { padding-right: 1em !important; }

.p-3 { padding: 1.5em !important; }
.pt-3 { padding-top: 1.5em !important; }
.pb-3 { padding-bottom: 1.5em !important; }
.pl-3 { padding-left: 1.5em !important; }
.pr-3 { padding-right: 1.5em !important; }

.p-4 { padding: 2em !important; }
.pt-4 { padding-top: 2em !important; }
.pb-4 { padding-bottom: 2em !important; }
.pl-4 { padding-left: 2em !important; }
.pr-4 { padding-right: 2em !important; }

.p-5 { padding: 3em !important; }
.pt-5 { padding-top: 3em !important; }
.pb-5 { padding-bottom: 3em !important; }
.pl-5 { padding-left: 3em !important; }
.pr-5 { padding-right: 3em !important; }

.pt-5px { padding-top: 5px !important; }
.p-3px { padding: 3px !important; }
.p-3px-5px { padding: 3px 5px !important; }
.p-5px { padding: 5px !important; }
.p-12px { padding: 12px !important; }
.p-24px { padding: 24px !important; }

/* Vertical alignment */
.v-middle { vertical-align: middle !important; }
.v-top { vertical-align: top !important; }
.v-center { vertical-align: center !important; }

/* Width */
.w-100px { width: 100px !important; }
.max-w-768 { max-width: 768px !important; }

/* Height */
.max-h-32 { max-height: 32px !important; }

/* Border utilities */
.border-bottom { border-bottom: 1px solid #dee2e6 !important; }
.border-bottom-2 { border-bottom: 2px solid #dee2e6 !important; }
.border-bottom-light { border-bottom: solid lightgray 1px !important; }
.border-radius-8 { border-radius: 8px !important; }

/* Overflow */
.overflow-hidden { overflow: hidden !important; }

/* Combined utility classes for common patterns */
.empty-state {
  text-align: center;
  color: #999;
  padding: 3em 0;
}

.section-header {
  padding: 12px;
  border-bottom: 2px solid #dee2e6;
}

.section-header-center {
  padding: 12px;
  border-bottom: 2px solid #dee2e6;
  text-align: center;
}

.error-text {
  color: red;
  font-weight: bold;
}

.success-text {
  color: green;
  cursor: default;
}

.pb-6-border {
  border-bottom: solid lightgray 1px;
  padding-bottom: 6px;
}

/* Additional width utilities */
.w-95 { width: 95% !important; }
.w-100 { width: 100% !important; }

/* Info box (development mode) */
.info-box {
  text-align: center;
  padding: 2em;
  border-radius: 8px;
  background-color: #e0f2fe;
  border: 1px solid #7dd3fc;
  color: #0c4a6e;
}

.info-box h3 {
  margin-top: 0;
  color: #0c4a6e;
}

.info-box p {
  font-size: 1.1em;
  line-height: 1.6;
  margin-bottom: 1em;
}

.info-box hr {
  margin: 1.5em 0;
  border-top: 1px solid #7dd3fc;
}

.info-box code {
  background: #bae6fd;
  padding: 2px 6px;
  border-radius: 4px;
}

.info-box strong {
  color: #0c4a6e;
}

/* Max-width container */
.container-800 {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* Additional specific utilities */
.mb-24 { margin-bottom: 24px !important; }
.gap-12 { gap: 12px !important; }

/* Stars color */
.text-stars { color: #ff9800 !important; }

/* Specific widths */
.w-80px { width: 80px !important; }
.w-100px { width: 100px !important; }
.w-140px { width: 140px !important; }
.w-150px { width: 150px !important; }

/* Whitespace */
.ws-nowrap { white-space: nowrap !important; }
.word-wrap { word-wrap: break-word !important; }

/* Link styles */
.link-primary {
  color: var(--color-primary) !important;
  text-decoration: none !important;
}

.link-primary:hover {
  text-decoration: underline !important;
}

/* Flex with wrap */
.flex-wrap {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
}

/* Font size 16px */
.fs-16 { font-size: 16px !important; }

/* Margin right 8px */
.mr-8 { margin-right: 8px !important; }

/* ============================================================================
   IMPROVED CARDS & PANELS - Design moderne avec meilleure typographie
   ========================================================================= */

/* Amélioration du panel de base */
.panel {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
  overflow: hidden;
}

.panel:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Panel header avec meilleure typographie */
.panel-header {
  padding: 1.25rem 1.5rem;
  background: linear-gradient(to bottom, #fafafa 0%, #f5f5f5 100%);
  border-bottom: 1px solid #e5e7eb;
}

.panel-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.panel-body {
  padding: 1.5rem;
}

/* Amélioration de la card */
.card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
  margin-bottom: 1.5rem;
}

.card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

/* Card header amélioré */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #f3f4f6;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.card-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0.25rem 0 0 0;
  font-weight: 400;
}

.card-description {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0.5rem 0 0 0;
  line-height: 1.5;
}

/* Typographie améliorée dans les cards */
.panel h2,
.card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 1rem 0;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.panel h3,
.card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 0.75rem 0;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.panel h4,
.card h4 {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.005em;
  line-height: 1.4;
}

.panel p,
.card p {
  font-size: 0.9375rem;
  color: #374151;
  line-height: 1.6;
  margin: 0 0 1rem 0;
}

.panel p:last-child,
.card p:last-child {
  margin-bottom: 0;
}

/* Stats dans les cards */
.card-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.stat-item {
  text-align: center;
  padding: 1rem;
  background: #f9fafb;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.stat-item:hover {
  background: #f3f4f6;
}

.stat-value {
  display: block;
  font-size: 1.875rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
  margin-bottom: 0.25rem;
}

.stat-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Card avec graphique */
.card-chart {
  margin-top: 1rem;
  padding: 1rem;
  background: #fafafa;
  border-radius: 8px;
}

/* Amélioration des petits textes */
.panel small,
.card small {
  font-size: 0.8125rem;
  color: #6b7280;
  font-weight: 400;
}

.panel strong,
.card strong {
  font-weight: 600;
  color: #111827;
}

/* Dividers dans les cards */
.card-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, #e5e7eb 20%, #e5e7eb 80%, transparent);
  margin: 1.5rem 0;
}

/* Grid de cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Compact card variant */
.card-compact {
  padding: 1rem;
}

.card-compact .card-title {
  font-size: 1rem;
}

/* Large card variant */
.card-large {
  padding: 2rem;
}

.card-large .card-title {
  font-size: 0.8125rem;
}

/* ============================================================================
   PANELS WITH STATS - Titre et chiffre principal sur la même ligne
   ========================================================================= */

/* Panel avec stats: h2 (titre) et h3 (chiffre) sur la même ligne */
.panel h2 + h3 {
  margin-top: -2.5rem; /* Remonte le h3 pour le mettre sur la même ligne que h2 */
  text-align: right;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

/* Le h4 (période) reste normal en dessous */
.panel h2 + h3 + h4 {
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  text-align: center;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

/* Amélioration spécifique pour les panels de stats */
.panels .panel h2 {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

/* Chiffre principal dans les stats */
.panels .panel h3 {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #111827;
  line-height: 1;
  margin-bottom: 0.5rem;
}

/* Wrapper pour forcer h2 et h3 côte à côte */
.panel-stats-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}

.panel-stats-header h2 {
  margin: 0;
  flex: 0 0 auto;
}

.panel-stats-header h3 {
  margin: 0;
  flex: 0 0 auto;
}

/* ============================================================================
   PANELS STATS - Layout amélioré avec alignement parfait
   ========================================================================= */

/* Reset des styles précédents pour les panels de stats */
.panels .panel h2 + h3 {
  margin-top: 0;
  text-align: left;
}

/* Nouveau layout: titre et montant côte à côte */
.panels .panel h2 {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
  line-height: 1.2;
  vertical-align: middle;
}

.panels .panel h3 {
  display: inline-block;
  float: right;
  font-size: 0.75rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
  margin: 0;
  vertical-align: middle;
}

/* Sous-titre (période) - petit et aligné à droite */
.panels .panel h4 {
  clear: both;
  font-size: 0.6875rem;
  font-weight: 400;
  color: #9ca3af;
  text-align: right;
  margin: 0.25rem 0 1rem 0;
  line-height: 1.3;
}

/* Clearfix pour le header */
.panels .panel h2::after {
  content: "";
  display: table;
  clear: both;
}
