/* ============================================================
   fondata.css v3.0 — Design System Fondata / NGE Fondations
   Basé sur le langage visuel de SpoNGE v2.2
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

/* ============================================================
   1. VARIABLES — alignées SpoNGE
   ============================================================ */
:root {
  --nge-primary:        #002C77;
  --nge-secondary:      #f6be00;
  --nge-primary-light:  rgba(0, 44, 119, 0.08);
  --nge-primary-dark:   #001a4d;
  --nge-secondary-light:rgba(246, 190, 0, 0.12);
  --nge-fond:           #5580A4;

  --gray-50:  #f5f6f8;
  --gray-100: #eef0f4;
  --gray-200: #d0d6df;
  --gray-300: #b8c1cf;
  --gray-400: #7a90a8;
  --gray-500: #3a5068;
  --gray-600: #2c3e50;
  --gray-700: #1c2d3f;
  --gray-800: #0d1b2a;
  --gray-900: #0a1628;

  --white:      #ffffff;
  --red-500:    #cc2222;
  --green-500:  #1a9e52;
  --orange-500: #e07a00;

  --shadow-sm: 0 1px 2px 0 rgba(0,44,119,0.06);
  --shadow:    0 1px 3px 0 rgba(0,44,119,0.08), 0 1px 2px -1px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,44,119,0.1), 0 2px 4px -2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,44,119,0.12), 0 4px 6px -4px rgba(0,0,0,0.08);

  --radius:    6px;
  --radius-lg: 8px;
  --transition: all 0.15s ease;

  /* Aliases Fondata */
  --marine:     var(--nge-primary);
  --yellow:     var(--nge-secondary);
  --fondations: var(--nge-fond);
  --bg:         var(--gray-50);
  --border:     var(--gray-200);
  --text:       var(--gray-800);
  --text-muted: var(--gray-400);

  --sidebar-width:     240px;
  --sidebar-collapsed: 64px;
  --transition-slow:   all 0.3s ease;
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'IBM Plex Sans', 'Century Gothic', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  font-size: 13px;
  min-height: 100vh;
}

a { color: var(--nge-fond); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--nge-primary); }

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

#main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  background: var(--gray-50);
  transition: var(--transition-slow);
  min-height: 100vh;
  overflow-y: auto;
}

body.sidebar-collapsed #main-content {
  margin-left: var(--sidebar-collapsed);
}

/* ============================================================
   4. SIDEBAR — Style SpoNGE (blanche + bordure jaune)
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 3px solid var(--nge-secondary);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  box-shadow: 2px 0 8px rgba(0,44,119,0.07);
  transition: var(--transition-slow);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-module-name,
.sidebar.collapsed .sidebar-footer-text,
.sidebar.collapsed .nav-section-title { display: none; }

/* Header */
.sidebar-header {
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(0,44,119,0.1);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.sidebar-brand-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.sidebar-brand-name .p1 { color: var(--nge-primary); }
.sidebar-brand-name .p2 { color: var(--nge-secondary); }

.sidebar-brand-sub {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(0,44,119,0.45);
  margin-top: 2px;
}

/* Version avec icône (modules Fondata) */
.sidebar-brand-icon {
  width: 30px; height: 30px;
  background: var(--nge-primary);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  color: var(--nge-secondary);
  font-weight: 800; font-size: 0.9rem;
  flex-shrink: 0;
}

.sidebar-module-name {
  font-size: 15px; font-weight: 700;
  color: var(--nge-primary); letter-spacing: -0.2px;
}

.sidebar-toggle {
  background: none; border: none;
  color: var(--gray-400); cursor: pointer;
  padding: 4px 6px; border-radius: var(--radius);
  font-size: 0.9rem; transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--gray-100); color: var(--nge-primary); }

/* Nav */
.sidebar-nav {
  flex: 1; padding: 12px 0;
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
}

.nav-section-title {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--gray-300);
  padding: 14px 18px 5px;
  white-space: nowrap;
}

.nav-item {
  display: flex; align-items: center;
  padding: 9px 18px; margin: 1px 0;
  border-radius: 0; cursor: pointer;
  transition: all 0.15s ease;
  color: rgba(0,44,119,0.6);
  font-weight: 500; font-size: 12.5px;
  border-left: 3px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
}

.nav-item:hover:not(.disabled) {
  background: rgba(0,44,119,0.04);
  color: var(--nge-primary);
}

.nav-item.active {
  background: rgba(246,190,0,0.13);
  color: var(--nge-primary);
  border-left-color: var(--nge-secondary);
  font-weight: 600;
}

.nav-item.disabled { opacity: 0.35; cursor: not-allowed; }

.nav-icon {
  margin-right: 12px; width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 14px;
}

/* Back to hub / home button */
.sidebar-home {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; margin: 8px 12px;
  border-radius: 6px; cursor: pointer;
  font-size: 11px; font-weight: 600;
  color: var(--nge-primary);
  background: var(--nge-primary-light);
  border: none; text-decoration: none;
  transition: all 0.15s ease;
  font-family: inherit;
}
.sidebar-home:hover {
  background: rgba(0,44,119,0.1);
  color: var(--nge-primary-dark);
}
.sidebar-home svg { flex-shrink: 0; }

/* Sidebar footer improvements */
.sidebar-footer-row {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.sidebar-footer-brand {
  font-weight: 800; font-size: 14px;
  letter-spacing: -0.3px; cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s ease;
}
.sidebar-footer-brand:hover { opacity: 0.7; }
.sidebar-footer-brand .fb1 { color: var(--nge-primary); }
.sidebar-footer-brand .fb2 { color: var(--nge-secondary); }

/* Footer */
.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid rgba(0,44,119,0.1);
  background: var(--white); flex-shrink: 0;
}

.sidebar-footer-text {
  font-size: 10px; color: var(--gray-400); letter-spacing: 0.5px;
}

.sidebar-user {
  text-align: center; font-size: 11px;
  color: rgba(0,44,119,0.5); line-height: 1.4;
}
.sidebar-user strong { color: var(--nge-primary); font-size: 12px; font-weight: 600; }

.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--nge-fond);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: white;
  text-transform: uppercase; margin-bottom: 4px;
}

.sidebar-user-info .user-name { font-size: 12px; color: var(--nge-primary); font-weight: 600; }
.sidebar-user-info .user-role { font-size: 11px; color: rgba(0,44,119,0.5); }

.menu-logout {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; width: 100%; margin-top: 10px;
  padding: 6px 12px; background: none;
  border: 1px solid var(--gray-300); border-radius: var(--radius);
  font-size: 11px; font-weight: 500; cursor: pointer;
  color: var(--gray-500); transition: all 0.2s ease;
  font-family: inherit;
}
.menu-logout:hover {
  border-color: var(--red-500); color: var(--red-500);
  background: rgba(204, 34, 34, 0.05);
}

/* Breadcrumb */
.fondata-breadcrumb {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 20px; font-size: 10px; color: var(--gray-300);
  flex-shrink: 0;
}
.fondata-breadcrumb a {
  color: var(--gray-300); text-decoration: none; transition: color .15s;
}
.fondata-breadcrumb a:hover { color: var(--nge-fond); }
.fondata-breadcrumb .bc-sep { color: var(--gray-200); font-size: 8px; }
.fondata-breadcrumb .bc-current { color: var(--gray-400); font-weight: 500; }

/* ============================================================
   5. CONTENT AREA
   ============================================================ */
.content-area {
  flex: 1; padding: 16px;
  position: relative; overflow-y: auto;
}

.screen { display: none; }
.screen.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

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

/* Page header Fondata */
.page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px; gap: 16px;
}
.page-title    { font-size: 18px; font-weight: 700; color: var(--nge-primary); }
.page-subtitle { font-size: 12px; color: var(--gray-400); margin-top: 2px; }
.page-actions  { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }

/* ============================================================
   6. SECTION TITLES — Style SpoNGE
   ============================================================ */
.section-title {
  font-size: 13px; font-weight: 700;
  color: var(--nge-primary);
  margin-bottom: 10px; padding-bottom: 8px;
  border-bottom: 2px solid var(--nge-secondary);
  display: flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: 0.5px;
}

.section-title::before {
  content: '■';
  color: var(--nge-secondary);
  font-size: 14px;
}

.section-title-row {
  display: flex; align-items: center; gap: 8px;
}
.section-title-row .section-title { flex: 1; }

.section-edit-btn {
  background: none; border: 1px solid var(--gray-200);
  border-radius: 4px; cursor: pointer; font-size: 12px;
  padding: 3px 7px; color: var(--gray-400); transition: var(--transition);
  margin-bottom: 10px;
}
.section-edit-btn:hover {
  background: rgba(246,190,0,0.12);
  border-color: var(--nge-secondary); color: var(--nge-primary);
}

.section-tile {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 10px;
}

/* ============================================================
   7. BOUTONS — Style SpoNGE
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 5px; padding: 7px 14px;
  border-radius: 4px; font-weight: 500; font-size: 12px;
  transition: var(--transition); cursor: pointer; border: none;
  text-decoration: none; font-family: inherit; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary   { background: var(--nge-primary); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: #003494; }

.btn-secondary {
  background: transparent; color: var(--gray-500);
  border: 1px solid var(--gray-200);
}
.btn-secondary:hover:not(:disabled) { background: var(--gray-100); }

.btn-accent    { background: var(--nge-secondary); color: var(--nge-primary); font-weight: 700; }
.btn-accent:hover:not(:disabled) { background: #d4a200; }

.btn-danger    { background: var(--red-500); color: var(--white); }
.btn-danger:hover:not(:disabled) { opacity: 0.85; }

.btn-success   { background: var(--green-500); color: var(--white); }
.btn-success:hover:not(:disabled) { opacity: 0.85; }

.btn-fond      { background: var(--nge-fond); color: var(--white); }
.btn-fond:hover:not(:disabled) { opacity: 0.85; }

.btn-sm  { padding: 4px 10px; font-size: 11px; }
.btn-lg  { padding: 10px 20px; font-size: 14px; }
.btn-icon { padding: 6px; }

/* Action tiles (SpoNGE) */
.action-tile {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 6px 14px; border-radius: var(--radius);
  cursor: pointer; transition: var(--transition);
  border: 1px solid var(--gray-200);
  background: var(--white); box-shadow: var(--shadow-sm);
  min-width: 56px; gap: 2px;
}
.action-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.action-tile .tile-icon  { font-size: 14px; }
.action-tile .tile-label { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.action-tile.edit   { color: var(--nge-primary); border-color: var(--nge-primary-light); }
.action-tile.edit:hover { background: var(--nge-primary-light); }
.action-tile.save   { background: var(--nge-primary); color: var(--white); border-color: var(--nge-primary); }
.action-tile.save:hover { background: var(--nge-primary-dark); }
.action-tile.cancel { color: var(--orange-500); border-color: rgba(224,122,0,0.2); }
.action-tile.cancel:hover { background: rgba(224,122,0,0.1); }
.action-tile.delete { color: var(--red-500); border-color: rgba(204,34,34,0.2); }
.action-tile.delete:hover { background: rgba(204,34,34,0.1); }

/* ============================================================
   8. CARDS — Style SpoNGE
   ============================================================ */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  margin-bottom: 14px; overflow: hidden;
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-200);
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(0,44,119,0.025);
}
.card-title { font-size: 12px; font-weight: 700; color: var(--nge-primary); }
.card-content { padding: 14px 16px; }
.card-footer  { padding: 10px 16px; border-top: 1px solid var(--gray-200); background: var(--gray-50); }

/* Stat cards (dashboard) */
.stat-card {
  background: var(--white); padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  border-top: 3px solid var(--nge-primary);
  text-align: center; transition: var(--transition); cursor: pointer;
}
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.stat-card.active {
  border-color: var(--nge-primary); border-top-color: var(--nge-secondary);
  box-shadow: var(--shadow-md); background: rgba(246,190,0,0.06);
}
.stat-number {
  font-size: 26px; font-weight: 700; color: var(--nge-primary);
  margin-bottom: 4px; line-height: 1;
}
.stat-label {
  font-size: 9px; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: 1px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px; margin-bottom: 20px;
}

/* ============================================================
   9. TABLEAUX — Style SpoNGE
   ============================================================ */
.table-container {
  overflow-x: auto; border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  max-height: 600px; overflow-y: auto;
}

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

.table th {
  background: var(--gray-100); padding: 8px 12px;
  text-align: left; font-weight: 600;
  font-size: 9px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--gray-400);
  border-bottom: 2px solid var(--gray-200);
  position: sticky; top: 0; z-index: 10; white-space: nowrap;
}
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { background: var(--gray-200); color: var(--nge-primary); }
.sort-icon { font-size: 10px; color: var(--gray-300); margin-left: 4px; }

.table td {
  padding: 10px 12px; border-bottom: 1px solid var(--gray-200);
  color: var(--gray-800); vertical-align: middle; font-size: 12px;
}
.table td:first-child { color: var(--nge-primary); }
.table tbody tr { transition: var(--transition); cursor: pointer; }
.table tbody tr:hover { background: rgba(0,44,119,0.03); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr.selected { background: rgba(246,190,0,0.08); }

/* Alias data-table pour compatibilité Fondata */
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table thead th {
  background: var(--gray-100); padding: 8px 12px;
  text-align: left; font-weight: 600; font-size: 9px;
  text-transform: uppercase; letter-spacing: 1px; color: var(--gray-400);
  border-bottom: 2px solid var(--gray-200); white-space: nowrap;
}
.data-table thead th.sortable { cursor: pointer; user-select: none; }
.data-table thead th.sortable:hover { background: var(--gray-200); color: var(--nge-primary); }
.data-table tbody tr { transition: var(--transition); cursor: pointer; }
.data-table tbody tr:hover { background: rgba(0,44,119,0.03); }
.data-table tbody tr.selected { background: rgba(246,190,0,0.08); }
.data-table tbody td { padding: 10px 12px; border-bottom: 1px solid var(--gray-200); color: var(--gray-800); vertical-align: middle; font-size: 12px; }
.data-table tbody tr:last-child td { border-bottom: none; }

.table-wrapper { border-radius: var(--radius-lg); border: 1px solid var(--gray-200); overflow: auto; }
.table-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }

/* ============================================================
   10. FORMULAIRES — Style SpoNGE
   ============================================================ */
.form-grid  { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-group  { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }

.form-label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px; color: var(--gray-400);
}
.form-label.required::after { content: ' *'; color: var(--red-500); }

.form-control {
  padding: 7px 10px;
  border: 1px solid var(--gray-200); border-radius: 4px;
  font-size: 12px; transition: var(--transition);
  background: var(--gray-100); color: var(--gray-800);
  font-family: inherit; width: 100%;
}
.form-control:focus {
  outline: none; border-color: var(--nge-fond);
  background: var(--white); box-shadow: none;
}
.form-control:disabled {
  background: var(--gray-100); color: var(--gray-800);
  cursor: default; border-color: var(--gray-200);
}
.form-control:not(:disabled) {
  border-color: var(--nge-fond); background: var(--white);
}
.form-control.is-invalid { border-color: var(--red-500); }
select.form-control  { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-error { font-size: 10px; color: var(--red-500); display: none; }
.form-control.is-invalid + .form-error { display: block; }
.form-hint  { font-size: 10px; color: var(--gray-400); }

.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12px; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] { width: 14px; height: 14px; accent-color: var(--nge-primary); cursor: pointer; }

/* Filtres */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  background: var(--white); padding: 10px 16px;
  border-radius: var(--radius-lg); margin-bottom: 14px;
  border: 1px solid var(--gray-200);
}
.filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.filter-label { font-size: 12px; font-weight: 500; color: var(--gray-600); }
.filter-control, .filter-select {
  padding: 8px 12px; border: 1px solid var(--gray-300);
  border-radius: var(--radius); font-size: 13px;
  background: var(--white); font-family: inherit; color: var(--gray-800);
}
.filter-input {
  min-width: 200px; padding: 8px 12px;
  border: 1px solid var(--gray-300); border-radius: var(--radius);
  font-size: 13px; background: var(--white); font-family: inherit;
  color: var(--gray-800);
}

/* ============================================================
   11. MODALS — Style SpoNGE (header marine)
   ============================================================ */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 20, 60, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(2px);
  display: none;
}
.modal-overlay.active { display: flex; }

.modal-content, .modal-box {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  max-width: 900px; width: 92vw; max-height: 92vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-box.modal-lg { max-width: 900px; }
.modal-box.modal-sm { max-width: 480px; }

.modal-header {
  padding: 14px 18px;
  background: var(--nge-primary);
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0;
}
.modal-header h3 {
  font-size: 13px; font-weight: 600; color: var(--white); margin: 0;
}

.btn-close, .modal-close {
  background: none; border: none; font-size: 18px;
  cursor: pointer; color: rgba(255,255,255,0.7);
  padding: 2px 6px; border-radius: 4px; transition: var(--transition); line-height: 1;
}
.btn-close:hover, .modal-close:hover {
  color: var(--white); background: rgba(255,255,255,0.2);
}

.modal-body   { padding: 18px; flex: 1; overflow-y: auto; }
.modal-footer { padding: 12px 18px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; }

/* ============================================================
   12. BADGES & STATUTS — Style SpoNGE
   ============================================================ */
.badge-type, .badge {
  display: inline-block; padding: 2px 10px;
  border-radius: 12px; font-size: 11px; font-weight: 600; white-space: nowrap;
}

.status {
  display: inline-flex; align-items: center;
  padding: 4px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.status-active    { background: rgba(26,158,82,0.1);  color: var(--green-500); }
.status-pending   { background: rgba(224,122,0,0.1);  color: var(--orange-500); }
.status-completed { background: var(--nge-primary-light); color: var(--nge-primary); }

/* Statuts phases affaires */
.status-prospect  { background: var(--gray-100);            color: var(--gray-500); }
.status-gonogo    { background: rgba(85,128,164,0.12);       color: var(--nge-fond); }
.status-etudes    { background: rgba(224,122,0,0.1);         color: var(--orange-500); }
.status-chantier  { background: var(--nge-primary-light);    color: var(--nge-primary); }
.status-signe     { background: rgba(26,158,82,0.1);         color: var(--green-500); }
.status-perdu     { background: rgba(204,34,34,0.1);         color: var(--red-500); }
.status-attente   { background: var(--nge-secondary-light);  color: #7a5800; }

/* ============================================================
   13. PHASE CARDS — Style SpoNGE
   ============================================================ */
.phase-cards { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

.phase-card {
  background: var(--white); border: 1.5px solid var(--gray-200);
  border-radius: 6px; padding: 5px 14px; text-align: center;
  transition: all 0.15s; color: rgba(0,44,119,0.5);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
  cursor: pointer;
}
.phase-card:hover:not(.disabled) { border-color: var(--nge-fond); color: var(--nge-fond); }
.phase-card.active { background: var(--nge-primary); color: var(--white); border-color: var(--nge-primary); box-shadow: 0 2px 8px rgba(0,44,119,0.25); }
.phase-card.active.gonogo   { background: var(--nge-fond);     border-color: var(--nge-fond); }
.phase-card.active.chantier { background: var(--green-500);    border-color: var(--green-500); }
.phase-card.active.perdu    { background: var(--red-500);      border-color: var(--red-500); }
.phase-card.disabled { opacity: 0.3; cursor: not-allowed; }

/* ============================================================
   14. CHARTS — Style SpoNGE
   ============================================================ */
.chart-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}
.chart-container {
  background: var(--white); padding: 14px 16px;
  border-radius: var(--radius-lg); border: 1px solid var(--gray-200);
}
.chart-title {
  font-size: 11px; font-weight: 700; color: var(--nge-primary);
  margin-bottom: 12px; text-align: center;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.chart-container canvas { max-height: 250px !important; }

/* ============================================================
   15. LOADING / EMPTY — Style SpoNGE
   ============================================================ */
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--gray-200);
  border-top: 3px solid var(--nge-fond);
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px; color: var(--gray-500);
}

.loading-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(255,255,255,0.85); z-index: 500;
  align-items: center; justify-content: center;
  flex-direction: column; gap: 12px;
  font-size: 13px; color: var(--gray-500);
}
.loading-overlay.active { display: flex; }

/* ============================================================
   16. TOASTS
   ============================================================ */
#toast-container {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 2000; display: flex; flex-direction: column;
  gap: 8px; pointer-events: none;
}

.toast {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; min-width: 260px; max-width: 360px;
  pointer-events: all; animation: toastIn 0.22s ease;
  border-left: 4px solid var(--nge-primary);
}
.toast.success { border-left-color: var(--green-500); }
.toast.error   { border-left-color: var(--red-500); }
.toast.warning { border-left-color: var(--orange-500); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   17. DASHBOARD FILTERS
   ============================================================ */
.dashboard-filters {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px; margin-bottom: 14px; padding: 14px 16px;
  background: var(--white); border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
}

/* ============================================================
   18. TECHNIQUE TAGS (SpoNGE)
   ============================================================ */
.technique-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; background: var(--nge-primary);
  color: var(--white); border-radius: 16px; font-size: 12px; font-weight: 500;
}
.technique-tag-remove {
  background: none; border: none; color: var(--white);
  cursor: pointer; padding: 0; width: 16px; height: 16px;
  border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 14px; transition: var(--transition);
}
.technique-tag-remove:hover { background: rgba(255,255,255,0.2); }

/* ============================================================
   19. UTILITAIRES
   ============================================================ */
.hidden        { display: none !important; }
.text-center   { text-align: center; }
.text-primary  { color: var(--nge-primary); }
.text-muted    { color: var(--gray-400); }
.text-success  { color: var(--green-500); }
.text-danger   { color: var(--red-500); }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.fs-sm  { font-size: 11px; }  .fs-xs  { font-size: 10px; }
.uppercase { text-transform: uppercase; letter-spacing: 0.5px; }
.d-flex { display: flex; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.align-center { align-items: center; } .justify-between { justify-content: space-between; }
.mt-4 { margin-top: 16px; }  .mb-4  { margin-bottom: 16px; }
.mt-8 { margin-top: 8px; }   .mb-8  { margin-bottom: 8px; }
.mt-16 { margin-top: 16px; } .mb-16 { margin-bottom: 16px; }
.w-100 { width: 100%; }
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 12px 0; }

/* ============================================================
   20. RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-width) !important; }
  .sidebar.mobile-open { transform: translateX(0); }
  #main-content { margin-left: 0 !important; }
  .form-grid, .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
}

/* ============================================================
   21. MODE SOMBRE
   ============================================================ */
[data-theme="dark"] {
  --nge-primary-light:  rgba(0, 44, 119, 0.2);
  --nge-secondary-light:rgba(246, 190, 0, 0.15);

  --gray-50:  #1a1d23;
  --gray-100: #22262e;
  --gray-200: #2d3340;
  --gray-300: #3d4556;
  --gray-400: #6b7a8d;
  --gray-500: #9aacbe;
  --gray-600: #c5d0dc;
  --gray-700: #e0e6ed;
  --gray-800: #f0f2f5;

  --white: #181b20;

  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.2);
  --shadow:    0 1px 3px 0 rgba(0,0,0,0.3), 0 1px 2px -1px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -2px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -4px rgba(0,0,0,0.2);
}

[data-theme="dark"] .sidebar {
  border-right-color: #2d3340;
}

[data-theme="dark"] .login-left {
  border-right-color: var(--nge-secondary);
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
  width: 30px; height: 30px;
  border-radius: 6px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: var(--transition);
}
.theme-toggle:hover {
  background: rgba(255,255,255,0.08);
  color: var(--nge-secondary);
}
