/* ==========================================================================
   CAMPAGNE STATISTIQUE - Design System
   Ecrit comme un systeme coherent : tokens -> primitives -> composants.
   Palette : terracotta chaleureux (evoque le Sahel) + ardoise profonde.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS
   -------------------------------------------------------------------------- */
:root {
  /* Couleurs primaires (terracotta) */
  --c-primary-50:  #fef6ed;
  --c-primary-100: #fde8cf;
  --c-primary-200: #fbcd9d;
  --c-primary-300: #f8a960;
  --c-primary-400: #f28433;
  --c-primary-500: #e66a1c;
  --c-primary-600: #c65914;   /* principal */
  --c-primary-700: #a34713;
  --c-primary-800: #833a16;
  --c-primary-900: #6b3015;

  /* Ardoise (neutres chauds) */
  --c-slate-50:  #f7f7f8;
  --c-slate-100: #eeeff2;
  --c-slate-200: #d9dbe1;
  --c-slate-300: #b4b8c3;
  --c-slate-400: #878c9b;
  --c-slate-500: #5d6472;
  --c-slate-600: #434957;
  --c-slate-700: #323744;
  --c-slate-800: #21242e;
  --c-slate-900: #13151c;

  /* Semantique */
  --c-success: #16a34a;
  --c-success-bg: #dcfce7;
  --c-warning: #d97706;
  --c-warning-bg: #ffedd5;
  --c-error:   #dc2626;
  --c-error-bg:#fee2e2;
  --c-info:    #0284c7;
  --c-info-bg: #e0f2fe;

  /* Fonds */
  --c-bg:      #f5f4f1;
  --c-surface: #ffffff;
  --c-surface-2: #fafaf7;
  --c-border:  #e6e4df;
  --c-border-strong: #d5d1c9;

  /* Typographie */
  --ff-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  --fs-xs: 11px;
  --fs-sm: 12.5px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;
  --lh-tight: 1.25;
  --lh-normal: 1.55;

  /* Espacements (scale 4px) */
  --sp-0: 0;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
  --sp-9: 56px;

  /* Rayons */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 9999px;

  /* Ombres (douces, progressives) */
  --sh-xs: 0 1px 2px rgba(22, 25, 35, .06);
  --sh-sm: 0 1px 3px rgba(22, 25, 35, .07), 0 1px 2px rgba(22, 25, 35, .04);
  --sh-md: 0 4px 8px rgba(22, 25, 35, .06), 0 2px 4px rgba(22, 25, 35, .04);
  --sh-lg: 0 12px 28px rgba(22, 25, 35, .08), 0 4px 10px rgba(22, 25, 35, .05);
  --sh-xl: 0 24px 60px rgba(22, 25, 35, .14), 0 8px 20px rgba(22, 25, 35, .06);
  --sh-focus: 0 0 0 3px rgba(198, 89, 20, .22);

  /* Transitions */
  --t-fast: 120ms cubic-bezier(.4, 0, .2, 1);
  --t-base: 180ms cubic-bezier(.4, 0, .2, 1);
  --t-slow: 260ms cubic-bezier(.4, 0, .2, 1);

  /* Layout */
  --sidebar-w: 248px;
  --topbar-h:  64px;
  --container-max: 1360px;
}

/* --------------------------------------------------------------------------
   2. RESET / BASE
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ff-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--c-slate-800);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv11';
}
h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; line-height: var(--lh-tight); color: var(--c-slate-900); }
p { margin: 0 0 var(--sp-3); }
a { color: var(--c-primary-600); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--c-primary-700); }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }
input, select, textarea, button { font-family: inherit; }
hr { border: 0; border-top: 1px solid var(--c-border); margin: var(--sp-5) 0; }

/* Scrollbar personnalise (webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-slate-200); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--c-slate-300); }

.muted { color: var(--c-slate-500); }
.small { font-size: var(--fs-sm); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.link { color: var(--c-primary-600); font-weight: 500; }
.link:hover { text-decoration: underline; }
.req { color: var(--c-error); font-weight: 700; margin-left: 2px; }

/* Focus accessible partout */
*:focus-visible {
  outline: 2px solid var(--c-primary-500);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* --------------------------------------------------------------------------
   3. LAYOUT SHELL
   -------------------------------------------------------------------------- */
.layout {
  display: flex;
  min-height: 100vh;
}
.layout-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-w);
}
.content {
  flex: 1;
  padding: var(--sp-6) var(--sp-7);
  max-width: var(--container-max);
  width: 100%;
  margin: 0 auto;
}
.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-4) var(--sp-7);
  font-size: var(--fs-sm);
  color: var(--c-slate-500);
  border-top: 1px solid var(--c-border);
  background: var(--c-surface);
}

/* --------------------------------------------------------------------------
   4. SIDEBAR
   -------------------------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--c-slate-900) 0%, var(--c-slate-800) 100%);
  color: var(--c-slate-100);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 30;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.sidebar-logo {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--c-primary-500), var(--c-primary-700));
  display: grid; place-items: center;
  color: #fff; font-size: 18px;
  box-shadow: 0 4px 12px rgba(230, 106, 28, .35);
}
.sidebar-title {
  font-weight: 700;
  color: #fff;
  font-size: var(--fs-md);
  letter-spacing: .2px;
}
.sidebar-sub {
  font-size: var(--fs-xs);
  color: var(--c-slate-400);
}
.sidebar-nav {
  flex: 1;
  padding: var(--sp-4) var(--sp-3);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 14px;
  border-radius: var(--r-md);
  color: var(--c-slate-300);
  font-size: var(--fs-base);
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.nav-item i { width: 20px; text-align: center; font-size: 15px; }
.nav-item:hover {
  background: rgba(255, 255, 255, .06);
  color: #fff;
}
.nav-item.active {
  background: linear-gradient(135deg, var(--c-primary-600), var(--c-primary-700));
  color: #fff;
  box-shadow: 0 4px 12px rgba(198, 89, 20, .35);
}
.nav-item.active i { color: #fff; }
.sidebar-user {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid rgba(255, 255, 255, .06);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.sidebar-user-info .name { color: #fff; font-weight: 600; font-size: var(--fs-sm); }
.sidebar-user-info .role { color: var(--c-slate-400); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .5px; }

.avatar    { width: 40px; height: 40px; border-radius: var(--r-full); object-fit: cover; border: 2px solid rgba(255, 255, 255, .12); flex-shrink: 0; background: var(--c-slate-700); }
.avatar-sm { width: 32px; height: 32px; border-radius: var(--r-full); object-fit: cover; border: 2px solid var(--c-border); background: var(--c-slate-100); flex-shrink: 0; }

/* --------------------------------------------------------------------------
   5. TOPBAR
   -------------------------------------------------------------------------- */
.topbar {
  height: var(--topbar-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-7);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(1.2);
}
.menu-toggle {
  display: none;
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  color: var(--c-slate-700);
}
.menu-toggle:hover { background: var(--c-slate-100); }
.page-title {
  font-weight: 600;
  font-size: var(--fs-lg);
  color: var(--c-slate-800);
}
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.badge-campagne {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 12px;
  background: var(--c-primary-50);
  color: var(--c-primary-700);
  border: 1px solid var(--c-primary-200);
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: 500;
}
.topbar-user { position: relative; }
.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 14px 6px 6px;
  border-radius: var(--r-full);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.topbar-user-btn:hover { background: var(--c-slate-50); border-color: var(--c-border-strong); }
.topbar-user-name { font-weight: 500; font-size: var(--fs-sm); }
.topbar-user-btn i.fa-chevron-down { font-size: 10px; color: var(--c-slate-500); }
.menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all var(--t-base);
}
.menu-dropdown.open {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.menu-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--c-slate-700);
  font-size: var(--fs-base);
  width: 100%;
  text-align: left;
}
.menu-item:hover { background: var(--c-slate-50); color: var(--c-slate-900); }
.menu-item.danger { color: var(--c-error); }
.menu-item.danger:hover { background: var(--c-error-bg); }
.menu-form { margin: 0; display: block; }

/* --------------------------------------------------------------------------
   6. PAGE-LEVEL UTILITIES
   -------------------------------------------------------------------------- */
.page-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
}
.page-h1 {
  font-size: var(--fs-2xl);
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -.01em;
}
.page-intro > div > p { margin: 0; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px 14px;
  background: var(--c-info-bg);
  color: var(--c-info);
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: 500;
}
.pill-warn { background: var(--c-warning-bg); color: var(--c-warning); }
.btn-group { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-5);
}
@media (max-width: 1024px) { .grid-2 { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   7. CARDS
   -------------------------------------------------------------------------- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  overflow: hidden;
}
.card-head {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--c-surface-2);
}
.card-head h3 {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-md);
  color: var(--c-slate-800);
}
.card-head h3 i { color: var(--c-primary-600); }
.card-body { padding: var(--sp-5); }
.card-body.no-pad { padding: 0; }
.card-form { padding: var(--sp-6) var(--sp-6) var(--sp-5); }

/* --------------------------------------------------------------------------
   8. STAT CARDS
   -------------------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  box-shadow: var(--sh-xs);
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  color: #fff;
  font-size: 20px;
  flex-shrink: 0;
}
.s-blue   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.s-green  { background: linear-gradient(135deg, #22c55e, #15803d); }
.s-orange { background: linear-gradient(135deg, var(--c-primary-400), var(--c-primary-600)); }
.s-purple { background: linear-gradient(135deg, #a855f7, #6d28d9); }
.stat-label { color: var(--c-slate-500); font-size: var(--fs-sm); font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: var(--fs-2xl); font-weight: 700; color: var(--c-slate-900); line-height: 1.1; margin-top: 2px; }
.stat-sub   { font-size: var(--fs-xs); color: var(--c-slate-500); margin-top: 2px; }
@media (max-width: 1024px) { .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px)  { .stats-grid { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   9. BUTTONS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 10px 18px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: var(--fs-base);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  user-select: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn i { font-size: 13px; }
.btn-primary {
  background: linear-gradient(135deg, var(--c-primary-500), var(--c-primary-600));
  color: #fff;
  box-shadow: 0 1px 2px rgba(198, 89, 20, .3), inset 0 1px 0 rgba(255, 255, 255, .15);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--c-primary-600), var(--c-primary-700));
  box-shadow: 0 4px 12px rgba(198, 89, 20, .35);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--c-slate-800); color: #fff;
}
.btn-secondary:hover:not(:disabled) { background: var(--c-slate-900); }
.btn-light {
  background: var(--c-surface);
  color: var(--c-slate-700);
  border-color: var(--c-border);
}
.btn-light:hover:not(:disabled) {
  background: var(--c-slate-50);
  border-color: var(--c-border-strong);
  color: var(--c-slate-900);
}
.btn-danger { background: var(--c-error); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-link {
  background: transparent;
  color: var(--c-slate-600);
  padding: 10px 12px;
}
.btn-link:hover { color: var(--c-primary-600); }
.btn-block { width: 100%; padding: 12px 18px; }
.btn-sm { padding: 6px 12px; font-size: var(--fs-sm); }

.btn-icon {
  width: 34px; height: 34px;
  display: inline-grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--c-slate-600);
  background: transparent;
  border: 1px solid transparent;
  transition: all var(--t-fast);
  cursor: pointer;
}
.btn-icon:hover {
  background: var(--c-slate-100);
  color: var(--c-primary-600);
  border-color: var(--c-border);
}
.btn-icon.danger:hover { background: var(--c-error-bg); color: var(--c-error); }
.actions-cell { white-space: nowrap; }
.actions-cell .btn-icon + .btn-icon { margin-left: 2px; }

/* --------------------------------------------------------------------------
   10. FORMULAIRES
   -------------------------------------------------------------------------- */
label { display: block; font-size: var(--fs-sm); font-weight: 500; color: var(--c-slate-700); margin-bottom: 6px; }
.field { display: flex; flex-direction: column; }
.field + .field { margin-top: var(--sp-3); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="tel"], input[type="search"], input[type="url"],
select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  color: var(--c-slate-900);
  font-size: var(--fs-base);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
input:hover, select:hover, textarea:hover { border-color: var(--c-border-strong); }
input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--c-primary-500);
  box-shadow: var(--sh-focus);
}
input:read-only, input:disabled, select:disabled, textarea:disabled {
  background: var(--c-slate-50);
  color: var(--c-slate-500);
  cursor: not-allowed;
}
textarea { resize: vertical; min-height: 80px; font-family: var(--ff-sans); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4);
}
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}
.form-actions {
  margin-top: var(--sp-6);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--c-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
}

/* Input avec icone */
.input-icon { position: relative; }
.input-icon i:first-child {
  position: absolute;
  left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--c-slate-400);
  font-size: 14px;
  pointer-events: none;
}
.input-icon input { padding-left: 38px; }
.toggle-pwd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  color: var(--c-slate-400);
  display: grid; place-items: center;
}
.toggle-pwd:hover { color: var(--c-primary-600); background: var(--c-slate-50); }

/* Radios / checkboxes stylises */
.radios, .checks {
  display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-5);
  padding: 6px 0;
}
.radios label, .checks label {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; font-weight: 400; color: var(--c-slate-700); margin-bottom: 0;
  font-size: var(--fs-base);
}
.radios input, .checks input {
  width: 18px; height: 18px;
  accent-color: var(--c-primary-600);
  cursor: pointer;
}

/* Switch (toggle) */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
  margin-bottom: 0;
  font-weight: 400;
  padding-top: 8px;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-slider {
  width: 42px; height: 24px;
  background: var(--c-slate-300);
  border-radius: var(--r-full);
  position: relative;
  transition: background var(--t-base);
  flex-shrink: 0;
}
.switch-slider::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: var(--r-full);
  box-shadow: var(--sh-sm);
  transition: transform var(--t-base);
}
.switch input:checked + .switch-slider { background: var(--c-primary-600); }
.switch input:checked + .switch-slider::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-slider { box-shadow: var(--sh-focus); }
.switch-label { font-size: var(--fs-sm); color: var(--c-slate-600); }

/* Photo picker */
.photo-picker {
  display: flex; align-items: center; gap: var(--sp-5);
  padding: var(--sp-4);
  background: var(--c-slate-50);
  border-radius: var(--r-md);
  border: 1px dashed var(--c-border-strong);
}
.photo-preview {
  width: 96px; height: 96px;
  border-radius: var(--r-full);
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: var(--sh-md);
}

/* --------------------------------------------------------------------------
   11. FILTRES
   -------------------------------------------------------------------------- */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-4);
  box-shadow: var(--sh-xs);
}
.filters-bar .filter {
  position: relative;
  flex: 1 1 180px;
}
.filters-bar .filter i {
  position: absolute;
  left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--c-slate-400);
  font-size: 13px;
  pointer-events: none;
}
.filters-bar .filter input,
.filters-bar .filter select {
  padding-left: 34px;
  background: var(--c-slate-50);
  border-color: transparent;
}
.filters-bar .filter select { padding-left: 12px; }
.filters-bar .filter input:focus,
.filters-bar .filter select:focus { background: #fff; border-color: var(--c-primary-500); }

/* --------------------------------------------------------------------------
   12. TABLES
   -------------------------------------------------------------------------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-base);
}
.table thead th {
  text-align: left;
  padding: 14px var(--sp-5);
  background: var(--c-surface-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--c-slate-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
}
.table tbody td {
  padding: 14px var(--sp-5);
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
  color: var(--c-slate-700);
}
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--c-primary-50); }
.table tbody tr:last-child td { border-bottom: 0; }
.table strong { color: var(--c-slate-900); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Table responsive : scroll horizontal sur mobile */
.card-body.no-pad { overflow-x: auto; }

/* Chips / badges */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .2px;
  white-space: nowrap;
}
.chip-brouillon { background: var(--c-warning-bg); color: var(--c-warning); }
.chip-soumis    { background: var(--c-info-bg); color: var(--c-info); }
.chip-valide,
.chip-ouverte   { background: var(--c-success-bg); color: var(--c-success); }
.chip-rejete,
.chip-cloturee  { background: var(--c-error-bg); color: var(--c-error); }
.chip-archivee  { background: var(--c-slate-100); color: var(--c-slate-600); }
.chip-role      { background: var(--c-slate-100); color: var(--c-slate-700); }

/* --------------------------------------------------------------------------
   13. ALERTES (flash messages)
   -------------------------------------------------------------------------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: 14px var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid;
  margin-bottom: var(--sp-4);
  font-size: var(--fs-base);
  animation: slideDown .3s ease-out;
}
.alert i { margin-top: 2px; font-size: 16px; }
.alert span { flex: 1; }
.alert-close {
  background: transparent; border: 0; cursor: pointer;
  font-size: 20px; line-height: 1; color: inherit; opacity: .6;
}
.alert-close:hover { opacity: 1; }
.alert-success { background: var(--c-success-bg); color: #166534; border-color: #bbf7d0; }
.alert-error,
.alert-danger  { background: var(--c-error-bg); color: #991b1b; border-color: #fecaca; }
.alert-warning { background: var(--c-warning-bg); color: #9a3412; border-color: #fed7aa; }
.alert-info    { background: var(--c-info-bg); color: #075985; border-color: #bae6fd; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* --------------------------------------------------------------------------
   14. REFERENTIELS (parametrage)
   -------------------------------------------------------------------------- */
.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-4);
}
.ref-card {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-5);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  color: var(--c-slate-800);
  transition: all var(--t-base);
  position: relative;
  overflow: hidden;
}
.ref-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
  background: var(--c-primary-500);
  transform: translateX(-4px);
  transition: transform var(--t-base);
}
.ref-card:hover {
  border-color: var(--c-primary-300);
  box-shadow: var(--sh-md);
  transform: translateY(-2px);
  color: var(--c-slate-900);
}
.ref-card:hover::before { transform: translateX(0); }
.ref-icon {
  width: 48px; height: 48px;
  background: var(--c-primary-50);
  color: var(--c-primary-600);
  border-radius: var(--r-md);
  display: grid; place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.ref-body { flex: 1; }
.ref-title { font-weight: 600; font-size: var(--fs-md); }
.ref-count { color: var(--c-slate-500); font-size: var(--fs-sm); margin-top: 2px; }
.ref-arrow { color: var(--c-slate-400); transition: transform var(--t-base); }
.ref-card:hover .ref-arrow { transform: translateX(4px); color: var(--c-primary-600); }

/* --------------------------------------------------------------------------
   15. COLLECTE (formulaire principal)
   -------------------------------------------------------------------------- */
.collecte-wrap {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--sp-5);
  align-items: start;
}
@media (max-width: 1024px) { .collecte-wrap { grid-template-columns: 1fr; } }

.collecte-nav {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  box-shadow: var(--sh-xs);
}
.collecte-nav a {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--c-slate-600);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: all var(--t-fast);
}
.collecte-nav a:hover { background: var(--c-slate-50); color: var(--c-slate-900); }
.collecte-nav a.active {
  background: var(--c-primary-50);
  color: var(--c-primary-700);
  font-weight: 600;
}
.collecte-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.coll-section {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  scroll-margin-top: calc(var(--topbar-h) + 16px);
  box-shadow: var(--sh-xs);
}
.sec-title {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--c-primary-700);
  margin: 0 0 var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 2px solid var(--c-primary-100);
  position: relative;
}
.sec-title::before {
  content: ''; position: absolute; bottom: -2px; left: 0;
  width: 60px; height: 2px;
  background: var(--c-primary-600);
}
.sub-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--c-slate-800);
  margin: var(--sp-5) 0 var(--sp-3);
  padding-left: var(--sp-2);
  border-left: 3px solid var(--c-primary-500);
}
.readonly-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3) var(--sp-5);
  padding: var(--sp-4);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-4);
  font-size: var(--fs-sm);
  color: var(--c-slate-700);
}
.readonly-box strong { color: var(--c-slate-900); }
@media (max-width: 720px) { .readonly-box { grid-template-columns: 1fr; } }

/* GPS bloc */
.gps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
}
.gps-grid label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .4px; color: var(--c-slate-500); }
.gps-actions { grid-column: span 4; }
@media (max-width: 720px) {
  .gps-grid { grid-template-columns: repeat(2, 1fr); }
  .gps-actions { grid-column: span 2; }
}

/* Tableau de saisie en grille */
.grid-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-base);
  margin-bottom: var(--sp-3);
}
.grid-table thead th {
  background: var(--c-slate-50);
  color: var(--c-slate-700);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--c-border);
}
.grid-table th:first-child { border-top-left-radius: var(--r-sm); }
.grid-table th:last-child  { border-top-right-radius: var(--r-sm); }
.grid-table tbody td,
.grid-table tbody th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
.grid-table tbody th {
  font-weight: 500;
  color: var(--c-slate-700);
  background: var(--c-surface-2);
  text-align: left;
}
.grid-table tbody tr:last-child td,
.grid-table tbody tr:last-child th { border-bottom: 0; }
.grid-table input, .grid-table select {
  padding: 7px 9px;
  font-size: var(--fs-sm);
  border-color: transparent;
  background: transparent;
}
.grid-table input:hover, .grid-table select:hover { background: var(--c-slate-50); border-color: var(--c-border); }
.grid-table input:focus, .grid-table select:focus { background: #fff; border-color: var(--c-primary-500); }
.grid-table input[readonly] { background: var(--c-slate-50); font-weight: 600; color: var(--c-primary-700); }

/* Yes/No grid compacte */
.yesno-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  background: var(--c-border);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: var(--sp-4);
}
.yn-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px var(--sp-3);
  background: var(--c-surface);
  gap: var(--sp-3);
}
.yn-label { font-size: var(--fs-sm); color: var(--c-slate-700); flex: 1; }
.yn-choices { display: flex; gap: var(--sp-4); }
.yn-choices label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 400; color: var(--c-slate-600); margin: 0; font-size: var(--fs-sm); }
@media (max-width: 720px) { .yesno-grid { grid-template-columns: 1fr; } }

/* Repeater */
.repeater { margin-bottom: var(--sp-4); }
.repeater .btn { margin-top: var(--sp-2); }

/* Read-only mode (collecte deja soumise) */
.collecte-wrap.is-readonly input,
.collecte-wrap.is-readonly select,
.collecte-wrap.is-readonly textarea {
  pointer-events: none;
  background: var(--c-slate-50);
  color: var(--c-slate-600);
}
.collecte-wrap.is-readonly .btn-icon[data-row-remove],
.collecte-wrap.is-readonly [data-row-add] { display: none; }

/* Apercu */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-3) var(--sp-5);
  padding: var(--sp-4) 0;
  font-size: var(--fs-sm);
}
.preview-grid strong { color: var(--c-slate-900); }

/* --------------------------------------------------------------------------
   16. DEFINITION LIST (profil)
   -------------------------------------------------------------------------- */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; font-size: var(--fs-sm); }
.dl dt { color: var(--c-slate-500); font-weight: 500; }
.dl dd { margin: 0; color: var(--c-slate-900); font-weight: 500; }

.log-details {
  max-width: 400px;
  white-space: normal;
  word-break: break-word;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  color: var(--c-slate-600);
}

/* --------------------------------------------------------------------------
   17. AUTH SCREEN
   -------------------------------------------------------------------------- */
.auth-body {
  min-height: 100vh;
  margin: 0;
  background: var(--c-bg);
}
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } .auth-hero { display: none; } }

.auth-hero {
  position: relative;
  background: linear-gradient(135deg, var(--c-primary-600) 0%, var(--c-primary-800) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--sp-9);
  overflow: hidden;
}
.brand-block { position: relative; z-index: 2; max-width: 460px; }
.brand-logo {
  width: 56px; height: 56px;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, .15);
  backdrop-filter: blur(10px);
  display: grid; place-items: center;
  font-size: 24px;
  margin-bottom: var(--sp-5);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .15);
}
.brand-name {
  font-size: var(--fs-3xl);
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: var(--sp-3);
}
.brand-tag {
  color: rgba(255, 255, 255, .85);
  font-size: var(--fs-lg);
  line-height: 1.5;
}
.brand-decor { position: absolute; inset: 0; z-index: 1; }
.bubble { position: absolute; border-radius: var(--r-full); opacity: .12; background: #fff; }
.b1 { width: 320px; height: 320px; top: -80px; right: -80px; }
.b2 { width: 180px; height: 180px; bottom: 60px; right: 120px; }
.b3 { width: 120px; height: 120px; top: 40%; left: -40px; opacity: .08; }

.auth-card-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--sp-7);
  background: var(--c-surface);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  animation: fadeUp .4s ease-out;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.auth-head { margin-bottom: var(--sp-6); text-align: center; }
.auth-head h2 { font-size: var(--fs-2xl); margin-bottom: 4px; }
.auth-actions { display: flex; justify-content: flex-end; margin: var(--sp-3) 0 var(--sp-5); }
.auth-footer { text-align: center; color: var(--c-slate-500); font-size: var(--fs-sm); margin-top: var(--sp-5); }

/* --------------------------------------------------------------------------
   18. TOASTS
   -------------------------------------------------------------------------- */
#toast-container {
  position: fixed;
  top: var(--sp-5);
  right: var(--sp-5);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
  max-width: 380px;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: 14px 16px;
  background: var(--c-surface);
  border-radius: var(--r-md);
  border-left: 4px solid;
  box-shadow: var(--sh-lg);
  font-size: var(--fs-base);
  pointer-events: auto;
  animation: toastIn .35s cubic-bezier(.16,.84,.44,1);
  max-width: 380px;
}
.toast.hiding { animation: toastOut .25s ease-in forwards; }
.toast-icon { font-size: 18px; line-height: 1; margin-top: 2px; }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; margin-bottom: 2px; color: var(--c-slate-900); }
.toast-msg { color: var(--c-slate-600); font-size: var(--fs-sm); line-height: 1.5; }
.toast.success { border-color: var(--c-success); }
.toast.success .toast-icon { color: var(--c-success); }
.toast.error   { border-color: var(--c-error); }
.toast.error   .toast-icon { color: var(--c-error); }
.toast.warning { border-color: var(--c-warning); }
.toast.warning .toast-icon { color: var(--c-warning); }
.toast.info    { border-color: var(--c-info); }
.toast.info    .toast-icon { color: var(--c-info); }
@keyframes toastIn  { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(40px); } }

/* --------------------------------------------------------------------------
   19. MODAL (remplace alert/confirm)
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(19, 21, 28, .6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 9000;
  animation: modalFade .2s ease-out;
  padding: var(--sp-4);
}
.modal {
  background: var(--c-surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-xl);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  animation: modalIn .3s cubic-bezier(.16,.84,.44,1);
  overflow: hidden;
}
.modal.modal-lg  { max-width: 720px; }
.modal.modal-xl  { max-width: 960px; }
.modal-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--c-border);
}
.modal-head .modal-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-full);
  display: grid; place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.modal-head .modal-icon.warn { background: var(--c-warning-bg); color: var(--c-warning); }
.modal-head .modal-icon.danger { background: var(--c-error-bg); color: var(--c-error); }
.modal-head .modal-icon.info  { background: var(--c-info-bg); color: var(--c-info); }
.modal-head .modal-icon.success { background: var(--c-success-bg); color: var(--c-success); }
.modal-title { font-size: var(--fs-lg); font-weight: 600; flex: 1; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--c-slate-500);
}
.modal-close:hover { background: var(--c-slate-100); color: var(--c-slate-900); }
.modal-body { padding: var(--sp-5) var(--sp-6); color: var(--c-slate-700); overflow-y: auto; }
.modal-body p { margin: 0 0 var(--sp-3); }
.modal-body p:last-child { margin: 0; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--c-border);
  background: var(--c-surface-2);
}
.modal-result-box {
  padding: var(--sp-3);
  background: var(--c-slate-900);
  color: #fff;
  border-radius: var(--r-sm);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: var(--fs-md);
  text-align: center;
  letter-spacing: 2px;
  margin: var(--sp-3) 0;
}
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn   { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* --------------------------------------------------------------------------
   20. LOADING / SPINNER
   -------------------------------------------------------------------------- */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--r-full);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.is-loading { position: relative; pointer-events: none; }
.is-loading > * { opacity: .55; }
.is-loading::after {
  content: '';
  position: absolute; top: 50%; left: 50%;
  width: 24px; height: 24px; margin: -12px 0 0 -12px;
  border: 3px solid var(--c-primary-600);
  border-right-color: transparent;
  border-radius: var(--r-full);
  animation: spin .7s linear infinite;
}

/* --------------------------------------------------------------------------
   21. PRINT
   -------------------------------------------------------------------------- */
.print-body { background: #fff; color: #000; margin: 0; padding: 0; font-family: var(--ff-sans); font-size: 12px; }
.print-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 12px; margin-bottom: 14px;
  border-bottom: 2px solid var(--c-primary-600);
}
.print-logo { display: flex; align-items: center; gap: 10px; }
.print-app { font-weight: 700; font-size: 16px; color: var(--c-primary-700); }
.print-meta { color: var(--c-slate-500); font-size: 11px; }
.print-title { font-size: 14px; font-weight: 600; color: var(--c-slate-800); }
.print-subtitle { margin: 8px 0 12px; color: var(--c-slate-600); font-size: 12px; }
.print-content h3 { font-size: 13px; color: var(--c-primary-700); margin: 14px 0 6px; border-bottom: 1px solid var(--c-primary-200); padding-bottom: 4px; }
.print-table {
  width: 100%; border-collapse: collapse; margin-bottom: 8px; font-size: 11px;
}
.print-table th, .print-table td {
  padding: 6px 8px; border: 1px solid var(--c-border-strong);
  text-align: left; vertical-align: top;
}
.print-table thead th { background: var(--c-primary-50); color: var(--c-primary-800); font-weight: 600; }
.print-table .num { text-align: right; }
.print-footer {
  display: flex; justify-content: space-between;
  padding-top: 10px; margin-top: 14px;
  border-top: 1px solid var(--c-border-strong);
  color: var(--c-slate-600); font-size: 10px;
}

/* --------------------------------------------------------------------------
   22. RESPONSIVE - MOBILE
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .content { padding: var(--sp-4); }
  .topbar { padding: 0 var(--sp-4); }
  .menu-toggle { display: inline-grid; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--t-base);
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--sh-xl); }
  .layout-main { margin-left: 0; }
  .topbar-user-name { display: none; }
}
@media (max-width: 640px) {
  .page-h1 { font-size: var(--fs-xl); }
  .btn { padding: 9px 14px; }
  .content { padding: var(--sp-3); }
}

/* Accessibility: reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
/* --------------------------------------------------------------------------
   14b. PARAMETRAGE — Onglets a 2 etages
   -------------------------------------------------------------------------- */
.param-tabs {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-5);
  overflow: hidden;
  box-shadow: var(--sh-xs);
}

/* ---------- Niveau 1 : categories ---------- */
.param-tabs-primary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  padding: var(--sp-2);
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
}
.param-tab-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  color: var(--c-slate-600);
  font-weight: 500;
  font-size: var(--fs-sm);
  transition: all var(--t-base);
  border: 1px solid transparent;
  white-space: nowrap;
}
.param-tab-primary:hover {
  background: var(--c-surface);
  color: var(--c-slate-800);
}
.param-tab-primary.is-active {
  background: var(--c-surface);
  color: var(--c-primary-700);
  border-color: var(--c-primary-200);
  box-shadow: var(--sh-xs);
}
.param-tab-primary i {
  font-size: 15px;
  color: var(--c-slate-400);
  transition: color var(--t-base);
}
.param-tab-primary.is-active i,
.param-tab-primary:hover i {
  color: var(--c-primary-600);
}
.param-tab-primary .param-tab-badge {
  font-size: var(--fs-xs);
  background: var(--c-slate-100);
  color: var(--c-slate-600);
  padding: 2px 7px;
  border-radius: var(--r-full);
  margin-left: var(--sp-1);
  font-weight: 600;
  min-width: 22px;
  text-align: center;
}
.param-tab-primary.is-active .param-tab-badge {
  background: var(--c-primary-50);
  color: var(--c-primary-700);
}

/* ---------- Niveau 2 : referentiels ---------- */
.param-tabs-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  padding: var(--sp-3) var(--sp-4);
  overflow-x: auto;
}
.param-tab-secondary {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  color: var(--c-slate-600);
  transition: all var(--t-base);
  white-space: nowrap;
  border: 1px solid transparent;
}
.param-tab-secondary:hover {
  background: var(--c-slate-50);
  color: var(--c-slate-900);
}
.param-tab-secondary.is-active {
  background: var(--c-primary-50);
  color: var(--c-primary-700);
  border-color: var(--c-primary-200);
  font-weight: 600;
}
.param-tab-count {
  font-size: var(--fs-xs);
  background: var(--c-slate-100);
  color: var(--c-slate-500);
  padding: 1px 6px;
  border-radius: var(--r-full);
  min-width: 22px;
  text-align: center;
  font-weight: 600;
}
.param-tab-secondary.is-active .param-tab-count {
  background: var(--c-primary-100);
  color: var(--c-primary-700);
}

/* ---------- Contenu ---------- */
.param-content-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.param-section-title {
  font-size: var(--fs-xl);
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--c-slate-900);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .param-tabs-primary {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .param-tab-primary {
    flex-shrink: 0;
  }
  .param-tabs-secondary {
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .param-tab-secondary {
    flex-shrink: 0;
  }
}
@media (max-width: 480px) {
  .param-tab-primary .param-tab-label {
    display: none;
  }
  .param-tab-primary.is-active .param-tab-label {
    display: inline;
  }
}

/* --------------------------------------------------------------------------
   18. ETAT DESACTIVE (campagne cloturee, etc.)
   -------------------------------------------------------------------------- */
/*
 * .is-disabled s'applique aux liens/boutons non-<button> que l'on veut
 * griser visuellement sans avoir a utiliser l'attribut `disabled`
 * (qui n'existe pas sur <a> ou <span>).
 * Utilise notamment quand la campagne active est cloturee, pour signaler
 * qu'une action n'est plus permise.
 */
.btn.is-disabled,
.btn-icon.is-disabled,
a.is-disabled,
span.is-disabled {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
  user-select: none;
  filter: grayscale(0.4);
}
.btn-icon.is-disabled {
  color: var(--c-slate-400);
}

/* --------------------------------------------------------------------------
   19. COMPLETUDE DE COLLECTE (barre de progression liste + sticky formulaire)
   -------------------------------------------------------------------------- */
/* ---- Cellule dans la liste /collectes ---- */
.compl-cell {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.compl-track {
  flex: 1;
  height: 8px;
  background: var(--c-slate-100);
  border-radius: var(--r-full);
  overflow: hidden;
  min-width: 80px;
}
.compl-fill {
  height: 100%;
  transition: width var(--t-slow);
  border-radius: var(--r-full);
}
.compl-pct {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--c-slate-700);
  min-width: 36px;
  text-align: right;
}
/* Tranches de couleur : rouge < 33 %, ambre < 75 %, vert >= 75 % */
.compl-fill-low  { background: var(--c-error); }
.compl-fill-mid  { background: var(--c-warning); }
.compl-fill-high { background: var(--c-success); }

/* ---- Barre sticky du formulaire de saisie ---- */
.compl-bar {
  position: sticky;
  top: var(--topbar-h, 64px);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-sm);
  margin-bottom: var(--sp-4);
}
.compl-bar-left {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--c-slate-700);
  font-weight: 500;
  font-size: var(--fs-sm);
  flex-shrink: 0;
}
.compl-bar-left i {
  color: var(--c-primary-600);
  font-size: 16px;
}
.compl-bar-mid {
  flex: 1;
  min-width: 150px;
}
.compl-bar-track {
  height: 10px;
  background: var(--c-slate-100);
  border-radius: var(--r-full);
  overflow: hidden;
}
.compl-bar-fill {
  height: 100%;
  transition: width 320ms cubic-bezier(.4,0,.2,1), background-color var(--t-base);
  border-radius: var(--r-full);
}
.compl-bar-right {
  display: inline-flex;
  align-items: baseline;
  gap: var(--sp-2);
  flex-shrink: 0;
}
.compl-bar-pct {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--c-slate-900);
  font-variant-numeric: tabular-nums;
}
.compl-bar-count {
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .compl-bar { flex-wrap: wrap; gap: var(--sp-2); }
  .compl-bar-mid { flex-basis: 100%; order: 3; }
  .compl-bar-left { flex: 1; }
}

/* --------------------------------------------------------------------------
   20. VUE WORKFLOW (cycle de validation)
   -------------------------------------------------------------------------- */
.wf-section-title {
  font-size: var(--fs-xl);
  font-weight: 700;
  margin: 0 0 var(--sp-4);
  color: var(--c-slate-900);
  letter-spacing: -0.01em;
}

/* ---------- HERO ---------- */
.wf-hero {
  background: linear-gradient(145deg, var(--c-surface) 0%, var(--c-surface-2) 100%);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  margin-bottom: var(--sp-6);
  box-shadow: var(--sh-sm);
}
.wf-hero-head {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.wf-hero-head h2 {
  font-size: var(--fs-xl);
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--c-slate-900);
}
.wf-hero-head p { margin: 0; font-size: var(--fs-sm); }
.wf-hero-badge {
  width: 52px; height: 52px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--c-primary-500), var(--c-primary-700));
  color: #fff;
  display: grid; place-items: center;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(198, 89, 20, .3);
}

/* ---------- DIAGRAMME SVG ---------- */
.wf-diagram {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-5);
  overflow-x: auto;
  border: 1px solid var(--c-border);
}
.wf-diagram svg {
  width: 100%;
  height: auto;
  min-width: 700px;
  display: block;
}

/* Texte dans le SVG */
.wf-node-title {
  font-family: var(--ff-sans);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.04em;
}
.wf-node-sub {
  font-family: var(--ff-sans);
  font-size: 12px;
  font-weight: 500;
  opacity: 0.8;
}
.wf-edge-label {
  font-family: var(--ff-sans);
  font-size: 13px;
  font-weight: 600;
}
.wf-edge-label-submit   { fill: #075985; }
.wf-edge-label-validate { fill: #14532d; }
.wf-edge-label-reject   { fill: #7f1d1d; }
.wf-edge-label-correct  { fill: #9a3412; }
.wf-edge-actor {
  font-family: var(--ff-sans);
  font-size: 11px;
  font-weight: 500;
  fill: var(--c-slate-500);
  font-style: italic;
}
/* Animation douce des fleches au hover */
.wf-node { transition: transform 260ms cubic-bezier(.4,0,.2,1); cursor: default; }
.wf-node:hover { transform: scale(1.03); }
.wf-edge path { transition: stroke-width 200ms, opacity 200ms; }
.wf-edge:hover path { stroke-width: 4; }

/* ---------- LEGENDE ACTEURS ---------- */
.wf-actors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-3);
}
.wf-actor-pill {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  line-height: 1.4;
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.wf-actor-pill:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
}
.wf-actor-pill i {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  font-size: 15px;
  flex-shrink: 0;
}
.wf-actor-operateur   i { background: #ffedd5; color: #9a3412; }
.wf-actor-superviseur i { background: #e0f2fe; color: #075985; }
.wf-actor-admin       i { background: #ede9fe; color: #5b21b6; }

@media (max-width: 720px) {
  .wf-actors { grid-template-columns: 1fr; }
}

/* ---------- CARTES D'ETATS ---------- */
.wf-states { margin-bottom: var(--sp-7); }
.wf-state-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-4);
}
.wf-state-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  position: relative;
  overflow: hidden;
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.wf-state-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}
.wf-state-brouillon::before { background: var(--c-warning); }
.wf-state-soumis::before    { background: var(--c-info); }
.wf-state-valide::before    { background: var(--c-success); }
.wf-state-rejete::before    { background: var(--c-error); }
.wf-state-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-md);
}
.wf-state-card header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.wf-state-num {
  width: 36px; height: 36px;
  border-radius: var(--r-full);
  background: var(--c-slate-100);
  color: var(--c-slate-700);
  font-weight: 700;
  font-size: 14px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.wf-state-brouillon .wf-state-num { background: var(--c-warning-bg); color: var(--c-warning); }
.wf-state-soumis .wf-state-num    { background: var(--c-info-bg);    color: var(--c-info); }
.wf-state-valide .wf-state-num    { background: var(--c-success-bg); color: var(--c-success); }
.wf-state-rejete .wf-state-num    { background: var(--c-error-bg);   color: var(--c-error); }

.wf-state-card h3 {
  font-size: var(--fs-md);
  font-weight: 600;
  margin: 0 0 var(--sp-2);
  color: var(--c-slate-900);
}
.wf-state-card p {
  font-size: var(--fs-sm);
  color: var(--c-slate-600);
  margin: 0 0 var(--sp-3);
  line-height: 1.5;
}
.wf-state-actions {
  list-style: none;
  padding: 0; margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  border-top: 1px solid var(--c-border);
  padding-top: var(--sp-3);
}
.wf-state-actions li {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--c-slate-700);
}
.wf-state-actions i {
  width: 16px;
  text-align: center;
  color: var(--c-slate-400);
}
.wf-state-brouillon .wf-state-actions i { color: var(--c-warning); }
.wf-state-soumis    .wf-state-actions i { color: var(--c-info); }
.wf-state-valide    .wf-state-actions i { color: var(--c-success); }
.wf-state-rejete    .wf-state-actions i { color: var(--c-error); }

/* ---------- TRANSITIONS ---------- */
.wf-transitions { margin-bottom: var(--sp-7); }
.wf-trans-grid {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.wf-trans-row {
  display: grid;
  grid-template-columns: auto auto auto 1fr auto;
  align-items: center;
  gap: var(--sp-3);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  transition: background-color var(--t-base);
}
.wf-trans-row:hover {
  background: var(--c-surface-2);
}
.wf-trans-arrow {
  color: var(--c-slate-400);
  font-size: 14px;
}
.wf-trans-desc {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: var(--sp-3);
  min-width: 0;
}
.wf-trans-desc strong {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--c-slate-900);
}
.wf-trans-desc span {
  font-size: var(--fs-sm);
}
.wf-trans-actor {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--c-slate-600);
  background: var(--c-slate-100);
  padding: 4px 10px;
  border-radius: var(--r-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .wf-trans-row {
    grid-template-columns: 1fr;
    gap: var(--sp-2);
  }
  .wf-trans-arrow { display: none; }
  .wf-trans-desc { margin-left: 0; }
}

/* ---------- TABLEAU DES DROITS ---------- */
.wf-rights { margin-bottom: var(--sp-7); }
.wf-rights-table th,
.wf-rights-table td {
  text-align: center;
}
.wf-rights-table th:first-child,
.wf-rights-table td:first-child {
  text-align: left;
}
.wf-yes { color: var(--c-success); font-size: 16px; }
.wf-no  { color: var(--c-slate-300); font-size: 16px; }
.wf-ic-c1, .wf-ic-c2, .wf-ic-c3 { color: var(--c-primary-600); margin-right: 8px; }
.wf-ic-c4 { color: var(--c-success);  margin-right: 8px; }
.wf-ic-c5 { color: var(--c-error);    margin-right: 8px; }
.wf-ic-c6 { color: var(--c-info);     margin-right: 8px; }
.wf-ic-c7 { color: var(--c-slate-500);margin-right: 8px; }

/* ---------- NOTICE BAS DE PAGE ---------- */
.wf-notice-card {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  background: linear-gradient(135deg, #fff7ed 0%, #fef6ed 100%);
  border: 1px solid var(--c-primary-200);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}
.wf-notice-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  background: var(--c-primary-600);
  color: #fff;
  display: grid; place-items: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(198, 89, 20, .25);
}
.wf-notice-card h3 {
  font-size: var(--fs-md);
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--c-primary-900);
}
.wf-notice-card p {
  font-size: var(--fs-sm);
  margin: 0;
  line-height: 1.5;
}

/* ==========================================================================
   21. COPILOT FORPRO - Interface de chat IA
   ========================================================================== */
.cp-title-badge {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
  vertical-align: -8px;
  margin-right: 8px;
}
.al-title-badge {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f97316, #dc2626);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
  vertical-align: -8px;
  margin-right: 8px;
}

/* Sidebar : nav IA avec un indicateur discret */
.nav-item-ai {
  position: relative;
}
.nav-item-ai::after {
  content: 'IA';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 1px 6px;
  border-radius: 10px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #fff;
}

/* Conteneur principal du copilot */
.copilot-shell {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 180px);
  min-height: 520px;
  overflow: hidden;
  box-shadow: var(--sh-sm);
}

.copilot-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface-2);
}
.copilot-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.copilot-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
  animation: cp-pulse 2s ease-in-out infinite;
}
@keyframes cp-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
  50%      { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.05); }
}
.copilot-head-title {
  font-weight: 600;
  color: var(--c-slate-900);
  font-size: 14px;
}
.copilot-head-sub {
  font-size: 12px;
}

/* Zone de messages scrollable */
.copilot-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Welcome (premier ecran) */
.cp-welcome {
  margin: auto;
  text-align: center;
  max-width: 680px;
  padding: 20px;
}
.cp-welcome-icon {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #fff;
  display: grid; place-items: center;
  font-size: 26px;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.3);
}
.cp-welcome h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--c-slate-900);
  margin: 0 0 6px;
}
.cp-welcome p {
  margin: 0 0 24px;
}
.cp-suggestions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.cp-sugg {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 13px;
  color: var(--c-slate-700);
  text-align: left;
  transition: all var(--t-base);
  font-family: inherit;
}
.cp-sugg:hover {
  background: var(--c-surface-2);
  border-color: #8b5cf6;
  color: var(--c-slate-900);
  transform: translateY(-1px);
  box-shadow: var(--sh-sm);
}
.cp-sugg i {
  color: #8b5cf6;
  font-size: 14px;
  flex-shrink: 0;
}

/* Bulles de message */
.cp-msg {
  display: flex;
  gap: 12px;
  max-width: 90%;
}
.cp-msg-user {
  flex-direction: row-reverse;
  margin-left: auto;
}
.cp-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-size: 14px;
  flex-shrink: 0;
}
.cp-msg-user .cp-avatar {
  background: linear-gradient(135deg, var(--c-primary-500), var(--c-primary-700));
}
.cp-msg-assistant .cp-avatar {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}
.cp-bubble {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--c-slate-800);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  max-width: 100%;
  overflow-wrap: break-word;
}
.cp-msg-user .cp-bubble {
  background: linear-gradient(135deg, var(--c-primary-50, #fff7ed), #fff0e0);
  border-color: var(--c-primary-200, #fbcd9d);
  color: var(--c-slate-900);
  border-bottom-right-radius: 4px;
}
.cp-msg-assistant .cp-bubble {
  border-bottom-left-radius: 4px;
}

/* Rendu markdown dans la bulle */
.cp-bubble p { margin: 0 0 10px; }
.cp-bubble p:last-child { margin-bottom: 0; }
.cp-bubble h3 {
  font-size: 15px; font-weight: 700; margin: 12px 0 6px;
  color: var(--c-slate-900);
}
.cp-bubble h4 {
  font-size: 14px; font-weight: 600; margin: 10px 0 4px;
  color: var(--c-slate-900);
}
.cp-bubble ul, .cp-bubble ol {
  margin: 6px 0 10px; padding-left: 22px;
}
.cp-bubble li { margin: 2px 0; }
.cp-bubble strong { color: var(--c-slate-900); }
.cp-bubble code {
  background: rgba(0,0,0,0.05);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12.5px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}
.cp-bubble pre {
  background: var(--c-slate-900);
  color: #e5e7eb;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  overflow-x: auto;
  margin: 8px 0;
}
.cp-bubble pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

/* Indicateur "en train d'ecrire" */
.cp-bubble-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-height: 20px;
  padding: 14px 16px;
}
.cp-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--c-slate-400);
  animation: cp-bounce 1.2s infinite ease-in-out;
}
.cp-dot:nth-child(2) { animation-delay: 0.15s; }
.cp-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes cp-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-4px); opacity: 1; }
}

/* Saisie */
.copilot-input {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--c-border);
  background: var(--c-surface);
}
.copilot-input textarea {
  flex: 1;
  resize: none;
  min-height: 40px;
  max-height: 180px;
  padding: 10px 14px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--c-slate-800);
  background: var(--c-surface);
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.copilot-input textarea:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}
.cp-send-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  font-size: 15px;
  padding: 0;
  flex-shrink: 0;
}
.cp-send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.copilot-footnote {
  padding: 6px 18px 10px;
  font-size: 11px;
  text-align: center;
  border-top: 1px solid var(--c-border);
  background: var(--c-surface-2);
}

/* ==========================================================================
   22. ALERTES CRITIQUES - Rapport genere par IA
   ========================================================================== */
.al-generated {
  display: inline-block;
  margin-left: 12px;
  font-size: 11px;
  color: var(--c-slate-500);
  font-style: italic;
}

.al-empty {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 48px 24px;
  text-align: center;
}
.al-empty-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--c-success-bg);
  color: var(--c-success);
  display: grid; place-items: center;
  font-size: 22px;
  margin: 0 auto 14px;
}
.al-empty h2 {
  font-size: 18px; font-weight: 600; margin: 0 0 6px;
  color: var(--c-slate-900);
}
.al-empty p { margin: 0; }

/* Section synthese */
.al-summary {
  background: linear-gradient(135deg, #fff7ed 0%, #fef6ed 100%);
  border: 1px solid var(--c-primary-200, #fbcd9d);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}
.al-summary-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: var(--sp-4);
}
.al-summary-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #fff;
  display: grid; place-items: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}
.al-summary-head h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--c-slate-900);
}
.al-summary-head p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--c-slate-700);
}

/* Indicateurs KPI */
.al-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.al-kpi {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.al-kpi::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
}
.al-kpi-total::before    { background: var(--c-slate-400); }
.al-kpi-critique::before { background: #dc2626; }
.al-kpi-elevee::before   { background: #f97316; }
.al-kpi-moyenne::before  { background: #0284c7; }
.al-kpi-val {
  font-size: 26px;
  font-weight: 700;
  color: var(--c-slate-900);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.al-kpi-lab {
  font-size: 11px;
  color: var(--c-slate-600);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}
@media (max-width: 720px) {
  .al-kpis { grid-template-columns: repeat(2, 1fr); }
}

/* Titres de section */
.al-section-h {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 var(--sp-3);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--c-slate-900);
}
.al-section-h i { color: var(--c-primary-600); }

/* Actions prioritaires */
.al-actions {
  margin-bottom: var(--sp-5);
}
.al-actions-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.al-actions-list li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-primary-500);
  border-radius: var(--r-md);
  padding: 14px 16px;
}
.al-action-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--c-primary-600);
  color: #fff;
  display: grid; place-items: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.al-action-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--c-slate-800);
  padding-top: 3px;
}

/* Liste des regions */
.al-regions {
  margin-bottom: var(--sp-5);
}
.al-region {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  margin-bottom: 10px;
  overflow: hidden;
  transition: box-shadow var(--t-base);
}
.al-region[open] {
  box-shadow: var(--sh-sm);
}
.al-region-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  background: var(--c-surface-2);
  transition: background var(--t-base);
}
.al-region-head::-webkit-details-marker { display: none; }
.al-region-head:hover { background: var(--c-slate-100); }
.al-region-head-l {
  display: flex;
  align-items: center;
  gap: 12px;
}
.al-region-head-r {
  display: flex;
  align-items: center;
  gap: 12px;
}
.al-region-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--c-slate-900);
}
.al-chevron {
  font-size: 11px;
  color: var(--c-slate-400);
  transition: transform var(--t-base);
}
.al-region[open] .al-chevron { transform: rotate(180deg); }
.al-region-synth {
  padding: 14px 18px 0;
  font-size: 13px;
  color: var(--c-slate-600);
  font-style: italic;
  line-height: 1.5;
}

/* Pills de severite */
.al-sev-pill {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 9999px;
  white-space: nowrap;
}
.al-sev-critique { background: #fee2e2; color: #991b1b; }
.al-sev-elevee   { background: #ffedd5; color: #9a3412; }
.al-sev-moyenne  { background: #e0f2fe; color: #075985; }
.al-sev-faible   { background: #dcfce7; color: #166534; }

/* Departement */
.al-dep {
  padding: 14px 18px;
  border-top: 1px solid var(--c-border);
}
.al-dep-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--c-slate-700);
  font-size: 13px;
  font-weight: 600;
}
.al-dep-head i { color: var(--c-slate-400); font-size: 12px; }
.al-dep-name { color: var(--c-slate-900); }

/* Etablissement cards */
.al-etabs {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.al-etab {
  display: flex;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.al-etab-bar {
  width: 4px;
  flex-shrink: 0;
}
.al-etab.al-sev-critique .al-etab-bar { background: #dc2626; }
.al-etab.al-sev-elevee   .al-etab-bar { background: #f97316; }
.al-etab.al-sev-moyenne  .al-etab-bar { background: #0284c7; }
.al-etab.al-sev-faible   .al-etab-bar { background: #16a34a; }
.al-etab-body {
  flex: 1;
  padding: 12px 14px;
}
.al-etab-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.al-etab-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--c-slate-900);
  font-size: 14px;
}
.al-etab-type-ico {
  color: var(--c-slate-400);
  font-size: 13px;
}
.al-etab-code {
  font-size: 11px;
  background: var(--c-slate-100);
  color: var(--c-slate-600);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}
.al-etab-tags {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.al-type-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 9999px;
  background: var(--c-slate-100);
  color: var(--c-slate-700);
  font-weight: 500;
}
.al-etab-ano {
  font-size: 13px;
  color: var(--c-slate-700);
  line-height: 1.5;
  margin-bottom: 6px;
}
.al-etab-act {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--c-slate-800);
  background: var(--c-surface-2);
  padding: 8px 10px;
  border-radius: 6px;
  margin-top: 6px;
  line-height: 1.5;
}
.al-etab-act i {
  color: var(--c-primary-600);
  font-size: 11px;
  margin-top: 4px;
  flex-shrink: 0;
}

/* ==========================================================================
   LOADING OVERLAY - Affiche pendant la navigation vers les pages IA lentes
   (ex: alertes-critiques). Pilote depuis app.js.
   ========================================================================== */
#app-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: all;
}
#app-loading-overlay.visible { opacity: 1; }

.app-loader-card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 30px 40px 26px;
  text-align: center;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.14);
  max-width: 360px;
  min-width: 280px;
}

/* Spinner : cercle bleu Windows pulsant avec icone cerveau + ripple */
.app-loader-spinner {
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0078d4, #2b88d8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  position: relative;
  animation: app-loader-pulse 1.6s ease-in-out infinite;
  box-shadow: 0 6px 18px rgba(0, 120, 212, 0.32);
}
.app-loader-spinner::before,
.app-loader-spinner::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid #0078d4;
  opacity: 0;
  animation: app-loader-ripple 1.8s ease-out infinite;
  pointer-events: none;
}
.app-loader-spinner::after { animation-delay: 0.9s; }

@keyframes app-loader-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}
@keyframes app-loader-ripple {
  0%   { transform: scale(1);    opacity: 0.55; }
  80%  { opacity: 0; }
  100% { transform: scale(1.75); opacity: 0; }
}

.app-loader-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-slate-900);
  margin-bottom: 4px;
  line-height: 1.35;
}
.app-loader-sub {
  font-size: 12px;
  color: var(--c-slate-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* 3 petits points qui rebondissent pour indiquer l'activite continue */
.app-loader-dots {
  display: inline-flex;
  gap: 3px;
}
.app-loader-dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #0078d4;
  animation: app-loader-dot 1.2s ease-in-out infinite;
}
.app-loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.app-loader-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes app-loader-dot {
  0%, 80%, 100% { transform: translateY(0);    opacity: 0.35; }
  40%           { transform: translateY(-4px); opacity: 1; }
}

/* Masque l'overlay a l'impression */
@media print {
  #app-loading-overlay { display: none !important; }
}

/* ==========================================================================
   ONGLETS + CONTENU PWA / HORS LIGNE (page "Saisie et cycle validation")
   ========================================================================== */

/* ---- Barre d'onglets horizontale ---- */
.wf-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: var(--sp-5);
  border-bottom: 1px solid var(--c-border);
  padding: 0 2px;
  overflow-x: auto;
}
.wf-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  color: var(--c-slate-600);
  font-size: var(--fs-base);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.wf-tab i { font-size: 14px; }
.wf-tab:hover { color: var(--c-slate-900); background: var(--c-slate-50); border-radius: 6px 6px 0 0; }
.wf-tab.is-active {
  color: #0078d4;
  border-bottom-color: #0078d4;
}
.wf-tab.is-active i { color: #0078d4; }
.wf-tab-badge {
  margin-left: 2px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #0078d4, #2b88d8);
  color: #fff;
  border-radius: 999px;
}

.wf-tabpanel { animation: wf-tab-fade 0.25s ease; }
.wf-tabpanel[hidden] { display: none; }
@keyframes wf-tab-fade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Hero specifique onglet "Hors ligne" ---- */
.wf-off-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
  padding: 22px 26px;
  margin-bottom: var(--sp-6);
  background: linear-gradient(120deg, #003f7f 0%, #0078d4 55%, #2b88d8 100%);
  color: #fff;
  border-radius: var(--r-lg);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 120, 212, 0.22);
}
.wf-off-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(255,255,255,0.18), transparent 70%);
  pointer-events: none;
}
.wf-off-hero::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background: linear-gradient(90deg,
    var(--c-primary-600) 0% 33%,
    var(--sn-yellow)     33% 66%,
    var(--sn-red)        66% 100%);
}
.wf-off-hero-badge {
  width: 60px; height: 60px;
  border-radius: 14px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.3);
  display: grid;
  place-items: center;
  font-size: 26px;
  color: #fff;
  backdrop-filter: blur(4px);
}
.wf-off-hero-text h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}
.wf-off-hero-text p {
  margin: 0;
  font-size: 13.5px;
  color: rgba(255,255,255,0.92);
  line-height: 1.55;
}
@media (max-width: 640px) {
  .wf-off-hero { grid-template-columns: 1fr; text-align: center; }
  .wf-off-hero-badge { margin: 0 auto; }
}

/* ---- Etapes du parcours offline ---- */
.wf-off-steps { margin-bottom: var(--sp-6); }
.wf-off-steps-list {
  list-style: none;
  padding: 0; margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  counter-reset: none;
}
.wf-off-steps-list > li {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 16px;
  align-items: stretch;
  position: relative;
}
.wf-off-steps-list > li:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 23px;
  top: 52px;
  bottom: -14px;
  width: 2px;
  background: linear-gradient(to bottom, #0078d4, transparent);
  opacity: 0.35;
}
.wf-off-step-num {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0078d4, #2b88d8);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 3px 8px rgba(0, 120, 212, 0.28);
  position: relative;
  z-index: 1;
}
.wf-off-step-body {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 14px 18px;
  position: relative;
}
.wf-off-step-ico {
  position: absolute;
  top: 14px; right: 16px;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: #e6f1fb;
  color: #0078d4;
  display: grid;
  place-items: center;
  font-size: 14px;
}
.wf-off-step-body h3 {
  margin: 0 0 6px;
  padding-right: 44px;
  font-size: 15px;
  font-weight: 600;
  color: var(--c-slate-900);
}
.wf-off-step-body p {
  margin: 0;
  font-size: 13px;
  color: var(--c-slate-700);
  line-height: 1.55;
}

/* ---- Chips "etat de synchronisation" ---- */
.wf-off-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  vertical-align: middle;
  border: 1px solid transparent;
}
.wf-off-chip i { font-size: 10.5px; }
.wf-off-chip-ok {
  background: #dcfce7; color: #14532d; border-color: #bbf7d0;
}
.wf-off-chip-off {
  background: #fee2e2; color: #7f1d1d; border-color: #fecaca;
}
.wf-off-chip-pending {
  background: #fef3c7; color: #78350f; border-color: #fde68a;
}
.wf-off-chip-sync {
  background: #e0f2fe; color: #075985; border-color: #bae6fd;
}

/* ---- Ce qui fonctionne / ne fonctionne pas ---- */
.wf-off-scope { margin-bottom: var(--sp-6); }
.wf-off-scope-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 780px) {
  .wf-off-scope-grid { grid-template-columns: 1fr; }
}
.wf-off-scope-card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.wf-off-scope-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
}
.wf-off-scope-yes::before { background: #16a34a; }
.wf-off-scope-no::before  { background: #dc2626; }
.wf-off-scope-card header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.wf-off-scope-ico {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 16px;
}
.wf-off-scope-yes .wf-off-scope-ico { background: #dcfce7; color: #14532d; }
.wf-off-scope-no  .wf-off-scope-ico { background: #fee2e2; color: #7f1d1d; }
.wf-off-scope-card header h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--c-slate-900);
}
.wf-off-scope-card ul {
  list-style: none;
  padding: 0; margin: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.wf-off-scope-card ul li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 12.5px;
  color: var(--c-slate-700);
  line-height: 1.5;
}
.wf-off-scope-card ul li i {
  color: var(--c-slate-500);
  width: 14px;
  text-align: center;
  flex-shrink: 0;
  margin-top: 3px;
}
.wf-off-scope-yes ul li i { color: #16a34a; }
.wf-off-scope-no  ul li i { color: #dc2626; }

/* ---- Instructions d'installation ---- */
.wf-off-install { margin-bottom: var(--sp-6); }
.wf-off-install-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 780px) {
  .wf-off-install-grid { grid-template-columns: 1fr; }
}
.wf-off-install-card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 16px 18px;
}
.wf-off-install-platform {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-slate-900);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.wf-off-install-platform i { font-size: 18px; color: #0078d4; }
.wf-off-install-card ol {
  margin: 0;
  padding-left: 20px;
  font-size: 12.5px;
  color: var(--c-slate-700);
  line-height: 1.6;
}
.wf-off-install-card ol li { margin-bottom: 5px; }
.wf-off-install-card ol li:last-child { margin-bottom: 0; }

/* ---- Indicateurs visuels (chips + descriptions) ---- */
.wf-off-signals { margin-bottom: var(--sp-6); }
.wf-off-signals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.wf-off-signal {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 12px 14px;
}
.wf-off-signal .wf-off-chip {
  font-size: 12px;
  padding: 3px 11px;
  margin-bottom: 8px;
}
.wf-off-signal p {
  margin: 0;
  font-size: 12px;
  color: var(--c-slate-700);
  line-height: 1.5;
}

/* ---- Bonnes pratiques ---- */
.wf-off-tips { margin-bottom: var(--sp-6); }
.wf-off-tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.wf-off-tip {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 12px 14px;
}
.wf-off-tip > i {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: #e6f1fb;
  color: #0078d4;
  display: grid;
  place-items: center;
  font-size: 15px;
}
.wf-off-tip strong {
  display: block;
  font-size: 13px;
  color: var(--c-slate-900);
  font-weight: 600;
  margin-bottom: 2px;
}
.wf-off-tip p {
  margin: 0;
  font-size: 12px;
  color: var(--c-slate-600);
  line-height: 1.5;
}

/* ---- Notice de bas de page offline ---- */
.wf-off-notice-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 18px;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fde68a;
  border-radius: var(--r-md);
  border-left: 4px solid #d97706;
}
.wf-off-notice-ico {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: #fde68a;
  color: #78350f;
  display: grid;
  place-items: center;
  font-size: 16px;
}
.wf-off-notice-card h3 {
  margin: 0 0 4px;
  font-size: 14.5px;
  color: #78350f;
  font-weight: 600;
}
.wf-off-notice-card p { font-size: 12.5px; line-height: 1.55; margin: 0; }

/* ==========================================================================
   PERIMETRE OPERATEUR : bandeau de synthese (liste collectes)
   + picker d'etablissement (ecran Nouvelle collecte)
   ========================================================================== */

/* ---- Bandeau "Mon perimetre de saisie" sur la liste ---- */
.op-scope-banner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: flex-start;
  background: linear-gradient(135deg, #e6f1fb, #f0f7fe);
  border: 1px solid #bae0fb;
  border-left: 4px solid #0078d4;
  border-radius: var(--r-md);
  padding: 14px 18px;
  margin-bottom: 18px;
}
.op-scope-banner-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: #fff;
  color: #0078d4;
  display: grid;
  place-items: center;
  font-size: 18px;
  border: 1px solid #bae0fb;
  flex-shrink: 0;
}
.op-scope-banner-body { min-width: 0; }
.op-scope-banner-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.op-scope-banner-head strong {
  font-size: 13.5px;
  color: var(--c-slate-900);
}
.op-scope-banner-count {
  font-size: 12px;
  color: #0c447c;
  background: rgba(0,120,212,0.12);
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.op-scope-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.op-scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  line-height: 1.2;
}
.op-scope-chip i { font-size: 10.5px; }
.op-scope-chip small { opacity: 0.8; font-weight: 500; }
.op-scope-chip-done {
  background: #dcfce7;
  color: #14532d;
  border-color: #bbf7d0;
}
.op-scope-chip-todo {
  background: #fef3c7;
  color: #78350f;
  border-color: #fde68a;
}

/* ---- Picker d'etablissement (ecran Nouvelle collecte - operateur) ---- */
.op-etab-picker {
  margin-top: 18px;
}
.op-etab-picker-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--c-border);
}
.op-etab-picker-head > i {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--c-primary-50, #ecfdf5);
  color: var(--c-primary-700);
  display: grid;
  place-items: center;
  font-size: 15px;
}
.op-etab-picker-head strong {
  font-size: 14px;
  color: var(--c-slate-900);
  display: block;
}
.op-etab-picker-head p { margin: 2px 0 0; }

.op-etab-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}
.op-etab-option {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.15s ease;
  align-items: flex-start;
}
.op-etab-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.op-etab-option:hover {
  border-color: var(--c-primary-400, #4ade80);
  background: var(--c-primary-50, #f0fdf4);
}
.op-etab-option:has(input[type="radio"]:checked) {
  border-color: var(--c-primary-600, #00853f);
  background: var(--c-primary-50, #f0fdf4);
  box-shadow: 0 0 0 3px rgba(0,133,63,0.12);
}
.op-etab-option:has(input[type="radio"]:focus-visible) {
  outline: 2px solid var(--c-primary-600);
  outline-offset: 2px;
}

.op-etab-option-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.op-etab-option-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-slate-900);
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.op-etab-option-code {
  font-size: 11px;
  font-weight: 500;
  color: var(--c-slate-500);
  background: var(--c-slate-50, #f8fafc);
  padding: 1px 7px;
  border-radius: 4px;
  border: 1px solid var(--c-border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.op-etab-option-meta {
  font-size: 12px;
  color: var(--c-slate-600);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.op-etab-option-meta i { font-size: 10px; color: var(--c-slate-500); }
.op-etab-option-status {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.op-etab-option-status small {
  font-size: 11px;
  color: var(--c-slate-500);
}
.op-etab-option-status-todo {
  color: #78350f;
}
.op-etab-option-status-todo i { color: #d97706; font-size: 10px; }
.op-etab-option-status-todo small { color: #78350f; font-weight: 500; }

.op-etab-option-check {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--c-border-strong, #cbd5e1);
  display: grid;
  place-items: center;
  font-size: 13px;
  color: transparent;
  background: #fff;
  transition: all 0.15s ease;
  flex-shrink: 0;
  margin-top: 2px;
}
.op-etab-option:has(input[type="radio"]:checked) .op-etab-option-check {
  background: var(--c-primary-600, #00853f);
  border-color: var(--c-primary-600, #00853f);
  color: #fff;
}

/* Option correspondant a une collecte deja existante : variante informative */
.op-etab-option-done {
  background: #fefce8;
  border-color: #fef08a;
}
.op-etab-option-done:hover {
  background: #fef9c3;
  border-color: #fde047;
}
.op-etab-option-done:has(input[type="radio"]:checked) {
  background: #fef9c3;
  border-color: #eab308;
  box-shadow: 0 0 0 3px rgba(234,179,8,0.15);
}
.op-etab-option-done .op-etab-option-title {
  color: var(--c-slate-700);
}

@media (max-width: 640px) {
  .op-etab-list { grid-template-columns: 1fr; }
  .op-scope-banner { grid-template-columns: 1fr; }
  .op-scope-banner-icon { width: 34px; height: 34px; font-size: 15px; }
}

/* ==========================================================================
   SECTION I - Identite en lecture seule + zone editable pour le volatil
   ========================================================================== */

/* Badge "Partiellement pre-remplie" dans le titre de section */
.sec-prefilled-tag {
  display: inline-block;
  margin-left: 10px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  vertical-align: middle;
  text-transform: none;
}

/* Bandeau explicatif en haut de la section */
.prefilled-notice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #eff6ff, #f5faff);
  border: 1px solid #bfdbfe;
  border-left: 4px solid #2563eb;
  border-radius: var(--r-md);
}
.prefilled-notice > i {
  color: #1d4ed8;
  font-size: 18px;
  margin-top: 1px;
}
.prefilled-notice strong {
  color: var(--c-slate-900);
  font-weight: 600;
  display: inline;
  font-size: 13px;
}
.prefilled-notice > div {
  font-size: 12.5px;
  color: var(--c-slate-700);
  line-height: 1.55;
}

/* Sous-titre de bloc lecture seule (plus discret que sub-title classique) */
.sub-title-ro {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-slate-600);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sub-title-ro > i {
  font-size: 11px;
  color: var(--c-primary-600);
  width: 16px;
  text-align: center;
}
.sub-title-ro:first-of-type { margin-top: 0; }

/* Petit cadenas "Lecture seule" a droite du sous-titre */
.sub-title-lock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--c-slate-500);
  letter-spacing: 0.03em;
  padding: 2px 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  margin-left: auto;
  text-transform: none;
}
.sub-title-lock i { font-size: 9px; }

/* Grille de champs lecture seule */
.ro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 14px;
  margin-bottom: 6px;
}

.ro-field {
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  min-width: 0;
}
.ro-field-wide { grid-column: 1 / -1; }
.ro-label {
  font-size: 10.5px;
  color: var(--c-slate-500);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  line-height: 1.2;
}
.ro-value {
  font-size: 13.5px;
  color: var(--c-slate-900);
  font-weight: 500;
  line-height: 1.4;
  word-break: break-word;
}
.ro-empty {
  color: var(--c-slate-400, #94a3b8);
  font-weight: 400;
  font-style: italic;
  font-size: 12.5px;
}

/* ==========================================================================
   PWA OFFLINE BANNER - Bandeau d'etat de connexion
   Affiche en bas a droite (ou en haut en mobile). Change d'apparence selon
   l'etat : hors ligne (rouge), en ligne avec sync en attente (ambre), ou
   totalement sync (vert discret, puis disparait).
   ========================================================================== */
#pwa-offline-banner {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 20px rgba(0,0,0,0.14);
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(.4,0,.2,1), background 0.3s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
}
#pwa-offline-banner.is-hidden {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

/* --- Offline (rouge institutionnel) --- */
#pwa-offline-banner.is-offline {
  background: rgba(220, 38, 38, 0.95);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
}

/* --- En ligne avec sync en attente (ambre) --- */
#pwa-offline-banner.is-pending {
  background: rgba(217, 119, 6, 0.95);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
}

/* --- En ligne, tout sync (vert discret, puis disparait) --- */
#pwa-offline-banner.is-online {
  background: rgba(0, 133, 63, 0.95);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
}

/* Icone pulsante */
.pwa-bnr-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.22);
  border-radius: 50%;
  flex-shrink: 0;
}
.pwa-bnr-icon i { font-size: 10px; color: #fff; }
#pwa-offline-banner.is-offline .pwa-bnr-icon { animation: pwa-bnr-pulse 1.8s ease-in-out infinite; }
@keyframes pwa-bnr-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.5); }
  50%      { box-shadow: 0 0 0 6px rgba(255,255,255,0); }
}

/* Texte d'etat */
.pwa-bnr-text {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Badge "N en attente" */
.pwa-bnr-pending {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  background: rgba(255,255,255,0.22);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* Bouton "Synchroniser" */
.pwa-bnr-sync {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  background: #fff;
  color: var(--c-slate-900, #1e293b);
  border: none;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s ease;
}
.pwa-bnr-sync:hover { transform: scale(1.04); }
.pwa-bnr-sync i { font-size: 10px; }

/* Responsive : en mobile, le bandeau prend toute la largeur en haut */
@media (max-width: 640px) {
  #pwa-offline-banner {
    bottom: auto;
    top: 8px;
    left: 8px;
    right: 8px;
    justify-content: center;
    border-radius: 10px;
    padding: 10px 14px;
  }
}

/* A l'impression : on masque le bandeau */
@media print {
  #pwa-offline-banner { display: none !important; }
}

/* Indicateur d'installation PWA (bouton "Installer l'app" si dispo) */
.pwa-install-prompt {
  position: fixed;
  bottom: 70px;
  right: 16px;
  z-index: 9997;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #fff;
  color: var(--c-slate-900);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.pwa-install-prompt.is-visible { display: inline-flex; }
.pwa-install-prompt i { color: #00853f; font-size: 16px; }
@media (max-width: 640px) { .pwa-install-prompt { bottom: 64px; } }

/* ==========================================================================
   BOUTON "CHAMPS MANQUANTS" (a cote du %) + MODAL DETAILLE
   ========================================================================== */
.compl-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
  padding: 5px 10px 5px 9px;
  background: #fff;
  border: 1.5px solid var(--c-border, #e2e8f0);
  border-radius: 999px;
  color: var(--c-slate-700, #334155);
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  transition: all 0.15s ease;
  position: relative;
}
.compl-bar-btn:hover {
  background: var(--c-primary-50, #f0fdf4);
  border-color: var(--c-primary-400, #4ade80);
  color: var(--c-primary-800, #14532d);
}
.compl-bar-btn:focus-visible {
  outline: 2px solid var(--c-primary-600);
  outline-offset: 2px;
}
.compl-bar-btn i {
  font-size: 11px;
  color: var(--c-slate-500);
}
.compl-bar-btn:hover i { color: var(--c-primary-700); }

/* Etat "tout rempli" : vert, cadenas vert */
.compl-bar-btn.is-complete {
  background: var(--c-primary-50, #ecfdf5);
  border-color: var(--c-primary-400, #4ade80);
  color: var(--c-primary-800, #14532d);
}
.compl-bar-btn.is-complete i { color: var(--c-primary-600); }

/* Badge numerique compteur de manquants */
.compl-bar-missing-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #dc2626;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 999px;
  line-height: 1;
}
.compl-bar-btn.is-complete .compl-bar-missing-badge,
.compl-bar-missing-badge.is-zero {
  background: var(--c-primary-600, #00853f);
}

/* ---- Contenu du modal "Champs manquants" ---- */
.missing-head {
  padding: 2px 0 14px;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 14px;
}
.missing-head p {
  margin: 0;
  font-size: 13.5px;
  color: var(--c-slate-700);
  line-height: 1.5;
}
.missing-head strong {
  color: #dc2626;
  font-size: 15px;
}

.missing-section {
  margin-bottom: 14px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.missing-section-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--c-border);
  text-decoration: none;
  color: var(--c-slate-900);
  transition: background 0.15s ease;
  cursor: pointer;
}
.missing-section-head:hover {
  background: var(--c-primary-50, #f0fdf4);
}
.missing-section-num {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: var(--c-primary-600, #00853f);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  border-radius: 8px;
  letter-spacing: 0.02em;
}
.missing-section-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--c-slate-900);
  line-height: 1.3;
}
.missing-section-count {
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  background: #dc2626;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.missing-section-head > i {
  color: var(--c-slate-400);
  font-size: 11px;
  transition: transform 0.15s ease;
}
.missing-section-head:hover > i {
  color: var(--c-primary-600);
  transform: translateX(3px);
}

.missing-list {
  list-style: none;
  padding: 8px 14px 12px;
  margin: 0;
}
.missing-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--c-slate-700);
  line-height: 1.35;
  border-bottom: 1px dashed var(--c-border);
}
.missing-list li:last-child { border-bottom: none; }
.missing-list li i {
  font-size: 6px;
  color: #d97706;
  width: 10px;
  flex-shrink: 0;
}

/* Etat vide (tout rempli) */
.missing-empty {
  text-align: center;
  padding: 24px 16px;
}
.missing-empty > i {
  font-size: 42px;
  color: var(--c-primary-600, #00853f);
  margin-bottom: 14px;
  display: block;
}
.missing-empty strong {
  display: block;
  font-size: 16px;
  color: var(--c-slate-900);
  margin-bottom: 6px;
}
.missing-empty p {
  font-size: 13px;
  color: var(--c-slate-600);
  margin: 0;
  line-height: 1.5;
}

/* Responsive : bouton compact sur mobile */
@media (max-width: 640px) {
  .compl-bar-btn { margin-left: 8px; padding: 5px 8px; font-size: 11.5px; }
  .missing-section-head { grid-template-columns: auto 1fr auto; }
  .missing-section-head > i:last-child { display: none; }
}


/* ==========================================================================
   ALERTES CRITIQUES - 3 cartes de couverture (stats de campagne active)
   Affichees en haut de page, independantes de l'analyse IA.
   ========================================================================== */
.al-coverage {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
@media (max-width: 860px) {
  .al-coverage { grid-template-columns: 1fr; }
}

.al-cov-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--c-border, #e2e8f0);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
}
.al-cov-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

/* Barre de couleur verticale a gauche selon le type de carte */
.al-cov-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
}
.al-cov-total::before     { background: #0078d4; }
.al-cov-progress::before  { background: #d97706; }
.al-cov-done::before      { background: #00853f; }

.al-cov-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.al-cov-total    .al-cov-icon { background: #eff6ff; color: #0078d4; }
.al-cov-progress .al-cov-icon { background: #fff7ed; color: #d97706; }
.al-cov-done     .al-cov-icon { background: #f0fdf4; color: #00853f; }

.al-cov-body  { min-width: 0; }
.al-cov-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-slate-500, #64748b);
  line-height: 1.2;
  margin-bottom: 4px;
}
.al-cov-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--c-slate-900, #0f172a);
  line-height: 1;
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.al-cov-pct {
  font-size: 13px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  letter-spacing: 0;
}
.al-cov-progress .al-cov-pct { background: #fff7ed; color: #b45309; }
.al-cov-done     .al-cov-pct { background: #f0fdf4; color: #166534; }

.al-cov-bar {
  height: 5px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 9px;
}
.al-cov-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(.4,0,.2,1);
}
.al-cov-progress .al-cov-bar > span { background: linear-gradient(90deg, #f59e0b, #d97706); }
.al-cov-done     .al-cov-bar > span { background: linear-gradient(90deg, #22c55e, #00853f); }

.al-cov-sub {
  font-size: 12px;
  color: var(--c-slate-500, #64748b);
  margin-top: 6px;
  line-height: 1.4;
}
.al-cov-sub strong {
  color: var(--c-slate-700, #334155);
  font-weight: 600;
}
