/* ===== MINI-STAGES 44 — Design System v2 ===== */
/* ── Police système — aucune requête réseau externe ──
   Priorité : Segoe UI (Windows) → system-ui (macOS/iOS) → Ubuntu (Linux)
   Toutes proches d'Inter, sans dépendance externe.              ── */
@font-face {
  font-family: 'Inter';
  src: local('Segoe UI'), local('system-ui'), local('Ubuntu'), local('Helvetica Neue'), local('Arial');
  font-weight: 400 800;
  font-style: normal;
}

:root {
  --primary:       #007d73;
  --primary-dark:  #005f5a;
  --blue:          #005f99;
  --night:         #0f172a;
  --slate:         #1e293b;
  --muted:         #64748b;
  --border:        #dbe7ea;
  --bg:            #f8fafc;
  --teal-light:    #e6f4f3;
  --white:         #ffffff;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --gradient:      linear-gradient(135deg, #007d73, #005f99);

  --shadow-sm:     0 2px 8px rgba(15,23,42,.06);
  --shadow-md:     0 8px 24px rgba(15,23,42,.09);
  --shadow-lg:     0 16px 48px rgba(15,23,42,.12);
  --radius-sm:     8px;
  --radius:        12px;
  --radius-lg:     20px;
  --radius-pill:   100px;
}

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

html { font-size: 14px; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Ubuntu, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--night);
  line-height: 1.7;
}

/* ===== LAYOUT ===== */
.ms-app {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.ms-sidebar {
  width: 240px;
  height: 100vh;
  max-height: 100vh;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: transform .25s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.ms-sidebar__logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.ms-sidebar__logo-title {
  font-size: 18px;
  font-weight: 800;
  color: white;
  letter-spacing: -.3px;
}
.ms-sidebar__logo-sub {
  font-size: 10px;
  color: rgba(255,255,255,.45);
  margin-top: 2px;
  line-height: 1.4;
}

.ms-sidebar__profile {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.ms-sidebar__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gradient);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: white;
  margin-bottom: 8px;
}
.ms-sidebar__name  { font-size: 12px; font-weight: 600; color: white; }
.ms-sidebar__role  { font-size: 10px; color: rgba(255,255,255,.45); }
.ms-sidebar__etab  { font-size: 10px; color: rgba(255,255,255,.35); margin-top: 1px; }

.ms-sidebar__nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.ms-nav-section {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.28);
  padding: 12px 20px 4px;
}

.ms-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .15s ease;
}
.ms-nav-link:hover {
  background: rgba(255,255,255,.08);
  color: white;
  border-left-color: rgba(255,255,255,.4);
}
.ms-nav-link.active {
  background: rgba(255,255,255,.14);
  color: white;
  border-left-color: white;
  font-weight: 700;
}
.ms-nav-link .icon {
  width: 16px; height: 16px;
  opacity: .8;
  flex-shrink: 0;
}
.ms-nav-link:hover .icon,
.ms-nav-link.active .icon { opacity: 1; }

.ms-sidebar__footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.07);
}

/* ===== MAIN CONTENT ===== */
.ms-main {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== TOPBAR ===== */
.ms-topbar {
  height: 56px;
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.ms-topbar__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--night);
}
.ms-topbar__actions { display: flex; align-items: center; gap: 12px; }
.ms-topbar__user {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* ===== PAGE CONTENT ===== */
.ms-content {
  flex: 1;
  padding: 28px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

/* ===== STAT CARDS ===== */
.ms-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.ms-stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
}
.ms-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.ms-stat-card__label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin-bottom: 8px;
}
.ms-stat-card__value {
  font-size: 28px;
  font-weight: 800;
  color: var(--night);
  line-height: 1;
}
.ms-stat-card__delta {
  font-size: 11px;
  color: var(--success);
  margin-top: 4px;
}
.ms-stat-card__icon {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.ms-stat-card__icon--teal  { background: var(--teal-light); color: var(--primary); }
.ms-stat-card__icon--blue  { background: #dbeafe; color: var(--blue); }
.ms-stat-card__icon--green { background: #d1fae5; color: var(--success); }
.ms-stat-card__icon--amber { background: #fef3c7; color: var(--warning); }

/* ===== CARD ===== */
.ms-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.ms-card__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ms-card__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--night);
}
.ms-card__body { padding: 20px; }

/* ===== TABLE ===== */
.ms-table-wrap { overflow-x: auto; }
.ms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.ms-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.ms-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--slate);
  vertical-align: middle;
}
.ms-table tr:last-child td { border-bottom: none; }
.ms-table tr:hover td { background: #f8fafc; }

/* ===== BADGES ===== */
.ms-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.ms-badge--teal    { background: var(--teal-light);  color: var(--primary); }
.ms-badge--blue    { background: #dbeafe;             color: var(--blue); }
.ms-badge--green   { background: #d1fae5;             color: #065f46; }
.ms-badge--amber   { background: #fef3c7;             color: #92400e; }
.ms-badge--red     { background: #fee2e2;             color: #991b1b; }
.ms-badge--slate   { background: #f1f5f9;             color: var(--muted); }

/* ===== BUTTONS ===== */
.ms-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Ubuntu, 'Helvetica Neue', Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: transform .15s ease, opacity .15s ease, box-shadow .15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.ms-btn:hover { transform: translateY(-2px); opacity: .92; }
.ms-btn:active { transform: translateY(0); }

.ms-btn--primary {
  background: var(--gradient);
  color: white;
  box-shadow: 0 4px 14px rgba(0,125,115,.30);
}
.ms-btn--primary:hover { box-shadow: 0 6px 20px rgba(0,125,115,.40); }

.ms-btn--secondary {
  background: var(--teal-light);
  color: var(--primary);
}
.ms-btn--ghost {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
}
.ms-btn--danger {
  background: #fee2e2;
  color: var(--danger);
}
.ms-btn--sm { padding: 5px 12px; font-size: 11px; }
.ms-btn--full { width: 100%; }

/* ===== FORMS ===== */
.ms-form-group { margin-bottom: 16px; }
.ms-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--slate);
  margin-bottom: 6px;
}
.ms-input, .ms-select, .ms-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Ubuntu, 'Helvetica Neue', Arial, sans-serif;
  font-size: 12px;
  color: var(--night);
  background: white;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ms-input:focus, .ms-select:focus, .ms-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,125,115,.10);
}
.ms-input.error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,.10); }
.ms-input.success { border-color: var(--success); box-shadow: 0 0 0 3px rgba(16,185,129,.10); }
.ms-input:disabled { background: var(--bg); opacity: .5; cursor: not-allowed; }
.ms-textarea { resize: vertical; min-height: 80px; }

/* ===== ALERTS ===== */
.ms-alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ms-alert--error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.ms-alert--success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.ms-alert--info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ===== PAGE TITLE ===== */
.ms-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.ms-page-title  { font-size: 20px; font-weight: 800; color: var(--night); }
.ms-page-sub    { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ===== GRID ===== */
.ms-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.ms-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.ms-grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===== HAMBURGER TOGGLE (mobile) ===== */
.ms-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--night);
}

/* ===== LOGIN PAGE ===== */
.ms-login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, #f8fafc 0%, #eef4f7 100%);
}
.ms-login-card {
  width: 100%;
  max-width: 1000px;
  display: grid;
  grid-template-columns: 1fr 420px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.ms-login-left {
  background: var(--gradient);
  padding: 44px 50px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  color: white;
}
.ms-login-left__pill {
  display: inline-block;
  padding: 7px 14px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 22px;
  align-self: flex-start;
}
.ms-login-left__title {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 16px;
}
.ms-login-left__desc {
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255,255,255,.85);
}
/* Logos dans le panel droit, en haut à côté de "Connexion" */
.ms-login-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.ms-login-logos img {
  height: 54px;
  width: auto;
  max-width: 100px;
  object-fit: contain;
  background: white;
  padding: 5px;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.ms-login-logos__pill {
  display: none; /* inutilisée dans ce layout */
}
.ms-login-right {
  padding: 36px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.ms-login-right__title { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.ms-login-right__sub   { font-size: 12px; color: var(--muted); margin-bottom: 28px; }
.ms-login-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}
.ms-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  text-align: center;
  display: block;
  padding: 4px 0;
}
.ms-link:hover { text-decoration: underline; }
.ms-password-wrap { position: relative; }
.ms-password-wrap .ms-input { padding-right: 40px; }
.ms-eye-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  display: flex;
}

/* ===== DATATABLE SEARCH ===== */
.ms-table-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.ms-search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}
.ms-search-box input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Ubuntu, 'Helvetica Neue', Arial, sans-serif;
  outline: none;
  background: var(--bg);
  transition: border-color .15s;
}
.ms-search-box input:focus { border-color: var(--primary); background: white; }
.ms-search-box svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 900px) {
  .ms-sidebar {
    transform: translateX(-100%);
  }
  .ms-sidebar.open {
    transform: translateX(0);
  }
  .ms-main { margin-left: 0; }
  .ms-hamburger { display: flex; }
  .ms-login-card { grid-template-columns: 1fr; }
  .ms-login-left { padding: 28px 32px; }
  .ms-login-left__title { font-size: 24px; }
  .ms-login-right { padding: 28px 28px; }
  .ms-login-logos img { height: 44px; max-width: 80px; }
  .ms-grid-2, .ms-grid-form, .ms-grid-3 { grid-template-columns: 1fr; }
  .ms-stats { grid-template-columns: 1fr 1fr; }
  .ms-content { padding: 16px; }
  .ms-topbar { padding: 0 16px; }
  .ms-page-header { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .ms-stats { grid-template-columns: 1fr; }
  .ms-login-logos img { height: 36px; max-width: 64px; }
  .ms-login-logos { gap: 10px; }
  .ms-login-left__title { font-size: 20px; }
}

/* ===== SIDEBAR OVERLAY ===== */
.ms-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}
.ms-overlay.show { display: block; }

/* ===== REACT MOUNT ZONE ===== */
#react-root { width: 100%; }

/* ===== SPINNER ===== */
.ms-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== EMPTY STATE ===== */
.ms-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.ms-empty svg { margin: 0 auto 12px; display: block; opacity: .35; }
.ms-empty p   { font-size: 13px; }

/* ===== PAGINATION ===== */
.ms-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 0 0;
}
.ms-page-btn {
  min-width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  color: var(--slate);
}
.ms-page-btn:hover, .ms-page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}


/* ======================================================
   SIDEBAR — Tous les textes en blanc (override complet)
   ====================================================== */
.ms-sidebar,
.ms-sidebar *,
.ms-sidebar a,
.ms-sidebar span,
.ms-sidebar div,
.ms-sidebar p,
.ms-sidebar button {
  color: white !important;
}
.ms-sidebar__logo-sub,
.ms-sidebar__role,
.ms-sidebar__etab,
.ms-nav-section {
  color: rgba(255,255,255,.55) !important;
}
.ms-nav-link {
  color: rgba(255,255,255,.88) !important;
}
.ms-nav-link:hover,
.ms-nav-link.active {
  color: #fff !important;
}
.ms-sidebar__footer .ms-btn--ghost {
  color: rgba(255,255,255,.80) !important;
  border-color: rgba(255,255,255,.28) !important;
  background: rgba(255,255,255,.08) !important;
}
.ms-sidebar__footer .ms-btn--ghost:hover {
  color: #fff !important;
  background: rgba(255,255,255,.18) !important;
  border-color: rgba(255,255,255,.5) !important;
}

/* ── Pagination ellipsis ── */
.ms-pg-ellipsis {
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 32px;
}

/* ── Bouton paginateur désactivé ── */
.ms-page-btn[disabled] {
  opacity: .35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Footer tableau : info à gauche, pagination à droite ── */
.ms-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.ms-table-info {
  font-size: 12px;
  color: var(--muted);
}
.ms-table-footer .ms-pagination {
  padding: 0;
}

/* ── Sidebar scrollbar fine ── */
.ms-sidebar::-webkit-scrollbar { width: 4px; }
.ms-sidebar::-webkit-scrollbar-track { background: transparent; }
.ms-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.3);
  border-radius: 4px;
}
.ms-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,.5);
}
.ms-sidebar { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.3) transparent; }
/* Le nav ne scroll plus lui-même, c'est le sidebar entier qui scroll */
.ms-sidebar__nav { overflow-y: visible; flex: 1; }

/* ── Conteneur pagination ── */
.ms-pg-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}
.ms-pg-dots {
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 32px;
  user-select: none;
}
.ms-page-btn[disabled] {
  opacity: .35;
  cursor: not-allowed;
  pointer-events: none;
}
.ms-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.ms-table-info {
  font-size: 12px;
  color: var(--muted);
}

/* ── Cacher le paginateur natif DataTables (remplacé par notre footer custom) ── */
.dataTables_paginate,
.dataTables_length,
.dataTables_info,
.dataTables_filter {
  display: none !important;
}
