/*
 * AcepUI — thème de refonte (partial CSS)
 * Source de vérité : acepui-design-prototype.html (validé) + DESIGN_HANDOFF.md
 * Classes préfixées "acep-" pour ne pas entrer en collision avec le template
 * Bootstrap/NiceAdmin existant (.card, .breadcrumb, .avatar sont déjà pris).
 */

:root{
  /* ACEP — charte graphique : blanc + teal vif + teal profond */
  --acep-white: #FFFFFF;
  --acep-teal: #51C4BD;      /* couleur du logo */
  --acep-teal-deep: #02564A; /* couleur de marque secondaire */

  /* Neutres dérivés du teal profond — sombre, mais jamais noir pur */
  --bg: #071915;
  --bg-elevated: #0E2A22;
  --panel: #12332A;
  --panel-hover: #183E33;
  --border: rgba(158,224,216,0.14);
  --border-strong: rgba(158,224,216,0.32);
  --text: #F4FAF9;
  --text-dim: #B4CCC6;
  --text-faint: #6E8F88;

  /* Famille de nuances de teal — pour distinguer les 7 modules sans sortir de charte */
  --teal-50:  #C9EDE8;
  --teal-100: #9FE0D8;
  --teal-200: #7ED4C9;
  --teal-300: #51C4BD; /* = --acep-teal, brand */
  --teal-400: #33A99C;
  --teal-500: #1F7E74;
  --teal-600: #12554C;
  --teal-700: #02564A; /* = --acep-teal-deep, brand */

  --success: #51C4BD;
  --danger: #C2584B;   /* seul écart volontaire à la charte : rouge = alerte, usage universel */
  --status-pending: var(--teal-100);
  --brand-text: var(--acep-teal);

  --glow-1: rgba(81,196,189,0.08);
  --glow-2: rgba(2,86,74,0.35);
  --grid-line: rgba(255,255,255,0.015);
  --topbar-bg: rgba(15,19,25,0.7);
  --row-hover: rgba(255,255,255,0.015);
  --field-bg: rgba(255,255,255,0.04);

  --radius: 14px;
  --radius-sm: 9px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

/* ---------- Thème clair — même charte, fond clair ---------- */
[data-theme="light"]{
  --bg: #F3FBFA;
  --bg-elevated: #FFFFFF;
  --panel: #FFFFFF;
  --panel-hover: #EAF6F3;
  --border: rgba(2,86,74,0.14);
  --border-strong: rgba(2,86,74,0.26);
  --text: #072A24;
  --text-dim: #3E655F;
  --text-faint: #7B9994;

  --success: #12554C;
  --danger: #A8412F;
  --status-pending: #12554C;
  --brand-text: var(--acep-teal-deep);

  --glow-1: rgba(81,196,189,0.16);
  --glow-2: rgba(81,196,189,0.10);
  --grid-line: rgba(2,86,74,0.05);
  --topbar-bg: rgba(255,255,255,0.78);
  --row-hover: rgba(2,86,74,0.035);
  --field-bg: rgba(2,86,74,0.035);
}

/*
 * .acep-shell = conteneur de la nouvelle charte (topbar + zone déjà migrée).
 * Volontairement PAS posé sur <body> : sur une page hybride (chrome migré,
 * contenu métier Bootstrap encore d'origine, ex. compta/contentieux.php), un
 * reset sur <body> déteint par héritage/cascade sur tout le contenu Bootstrap
 * qui suit (texte quasi blanc sur fond blanc, boutons/DataTables décolorés).
 * .acep-shell borne la nouvelle charte à la zone réellement redessinée.
 */
.acep-shell[data-theme]{
  background:
    radial-gradient(1100px 520px at 12% -8%, var(--glow-1), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, var(--glow-2), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* Modificateur pour une page entièrement migrée (ex. dash.php) : occupe au
   moins tout le viewport même quand le contenu est court. À ne PAS ajouter
   sur une page hybride, sous peine de pousser le contenu Bootstrap d'un
   écran entier vers le bas. */
.acep-shell--page[data-theme]{
  min-height: 100vh;
}

/* subtle ledger-grid texture */
.acep-shell[data-theme]::before{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(1200px 700px at 50% 0%, black, transparent 75%);
  z-index: 0;
}

a.acep-card,
a.acep-subpage-row,
a.acep-breadcrumb-link{
  color:inherit;
  text-decoration:none;
}

.acep-shell :focus-visible{
  outline: 2px solid var(--acep-teal);
  outline-offset: 2px;
  border-radius: 6px;
}

/* En-tête léger pour une page hybride : ne porte que le fil d'Ariane
   au-dessus du contenu métier Bootstrap non migré (contrairement à
   .acep-main, pensé pour une vue entièrement nouvelle). */
.acep-page-head{
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 40px 4px;
}

/* ---------- Topbar ---------- */
.acep-topbar{
  position: sticky;
  top:0;
  z-index: 2;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 18px 40px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
}
.acep-brand{
  display:flex;
  align-items:center;
  gap:12px;
}
.acep-brand-mark{
  width:34px;height:34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--acep-teal), var(--acep-teal-deep));
  display:flex;align-items:center;justify-content:center;
  font-family: var(--font-display);
  font-weight:700;
  color:#04140F;
  font-size: 15px;
}
.acep-brand-text{
  font-family: var(--font-display);
  font-weight:600;
  font-size: 16.5px;
  letter-spacing: 0.2px;
}
.acep-brand-sub{
  font-size:11px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 1px;
}
.acep-topbar-right{
  display:flex;
  align-items:center;
  gap: 18px;
}
.acep-search{
  display:flex;
  align-items:center;
  gap:8px;
  background: var(--panel);
  border:1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--text-faint);
  font-size: 13px;
  width: 260px;
}
.acep-search svg{flex-shrink:0;}
.acep-env-badge{
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.4px;
  color: var(--brand-text);
  background: color-mix(in srgb, var(--acep-teal) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--acep-teal) 30%, transparent);
  padding: 3px 8px;
  border-radius: 100px;
}
.acep-avatar{
  width:34px;height:34px;border-radius:50%;
  background: var(--bg-elevated);
  border:1px solid var(--border-strong);
  display:flex;align-items:center;justify-content:center;
  font-family: var(--font-display);
  font-size: 12.5px;
  color: var(--text-dim);
}
.acep-theme-switch{
  display:flex;
  align-items:center;
  gap:2px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  padding: 3px;
}
/* Reset ciblé : ce sont les 2 seuls <button> bruts introduits par la refonte
   (le sélecteur clair/sombre). Volontairement PAS un reset global "button"
   (voir DESIGN_HANDOFF.md, piège corrigé) : un reset non scopé écraserait
   aussi les boutons Bootstrap/DataTables (.btn, .dt-button) du contenu
   métier encore non migré, en spécificité plus forte que leurs classes. */
.acep-theme-switch button{
  display:flex; align-items:center; gap:6px;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-family: inherit;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.acep-theme-switch button svg{ flex-shrink:0; }
.acep-theme-switch button:hover{ color: var(--text-dim); }
.acep-theme-switch button.active{
  background: var(--acep-teal);
  color: #04140F;
  font-weight: 600;
}
.acep-theme-switch button.active svg{ color:#04140F; }

/* ---------- Main ---------- */
.acep-main{
  position: relative;
  z-index:1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 40px 80px;
}

/* Variante pour une page dont le fil d'Ariane est déjà rendu par
   .acep-page-head juste au-dessus : évite le double espacement en haut. */
.acep-main--flush{
  padding-top: 4px;
}

/* ---------- Home ---------- */
.acep-eyebrow{
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--brand-text);
  margin: 0 0 10px;
}
.acep-home-heading{
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: -0.2px;
}
.acep-home-sub{
  color: var(--text-dim);
  font-size: 14.5px;
  margin: 0 0 40px;
}
.acep-home-sub .dot{color:var(--text-faint); margin: 0 8px;}

.acep-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.acep-card{
  position:relative;
  display:block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px 20px;
  text-align:left;
  cursor:pointer;
  overflow:hidden;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.acep-card::before{
  content:"";
  position:absolute;
  left:0; top:0; bottom:0;
  width: 3px;
  background: var(--accent);
  opacity: .85;
}
.acep-card::after{
  content:"";
  position:absolute;
  right: -40px; top: -40px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  filter: blur(30px);
  transition: opacity .25s ease;
}
.acep-card:hover, .acep-card:focus-visible{
  transform: translateY(-3px);
  border-color: var(--border-strong);
  background: var(--panel-hover);
}
.acep-card:hover::after{ opacity: .16; }

.acep-card-icon{
  width:42px;height:42px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--accent) 26%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  display:flex;align-items:center;justify-content:center;
  color: color-mix(in srgb, var(--accent) 62%, var(--text) 38%);
  margin-bottom: 18px;
}
.acep-card-title{
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 600;
  margin: 0 0 5px;
}
.acep-card-desc{
  font-size: 12.8px;
  color: var(--text-dim);
  line-height:1.5;
  margin: 0 0 18px;
  min-height: 36px;
}
.acep-card-footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-size: 12px;
}
.acep-card-metric{
  font-family: var(--font-mono);
  color: var(--text-dim);
}
.acep-card-metric b{color:var(--text); font-weight:500;}
.acep-card-arrow{
  color: var(--text-faint);
  display:flex;
  transition: transform .18s ease, color .18s ease;
}
.acep-card:hover .acep-card-arrow{ color: var(--accent); transform: translateX(3px); }

/* ---------- Fil d'Ariane (breadcrumb réutilisable) ---------- */
.acep-breadcrumb{
  display:flex;
  align-items:center;
  gap:8px;
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 22px;
}
.acep-breadcrumb a{
  display:flex; align-items:center; gap:6px;
  color: var(--text-dim);
  padding: 4px 0;
}
.acep-breadcrumb a:hover{color:var(--text);}
.acep-breadcrumb .sep{color: var(--text-faint);}
.acep-breadcrumb .current{color:var(--text); font-weight:500;}

/* ---------- Vue module (en-tête + liste des sous-pages) ---------- */
.acep-module-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  margin-bottom: 34px;
  gap: 20px;
  flex-wrap: wrap;
}
.acep-module-title-row{display:flex; align-items:center; gap:14px;}
.acep-module-icon{
  width:44px;height:44px;border-radius:12px;
  display:flex;align-items:center;justify-content:center;
  background: color-mix(in srgb, var(--accent) 26%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  color: color-mix(in srgb, var(--accent) 62%, var(--text) 38%);
}
.acep-module-title{
  font-family: var(--font-display);
  font-size: 24px;
  font-weight:600;
  margin:0;
}
.acep-module-sub{
  font-size:12.5px; color:var(--text-dim); margin-top:3px;
}

.acep-subpage-list{
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.acep-subpage-row{
  display:flex;
  align-items:center;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  cursor:pointer;
  text-align:left;
  width:100%;
  transition: border-color .15s ease, background .15s ease;
}
.acep-subpage-row:hover, .acep-subpage-row:focus-visible{
  background: var(--panel-hover);
  border-color: var(--border-strong);
}
.acep-subpage-dot{
  width:8px; height:8px; border-radius:50%;
  background: var(--accent);
  flex-shrink:0;
}
.acep-subpage-name{
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
  flex-shrink:0;
  min-width: 200px;
}
.acep-subpage-path{
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  flex:1;
}
.acep-subpage-arrow{
  color: var(--text-faint);
  display:flex;
  transition: transform .15s ease, color .15s ease;
}
.acep-subpage-row:hover .acep-subpage-arrow{ color: var(--accent); transform: translateX(3px); }

@media (max-width: 620px){
  .acep-subpage-row{ flex-wrap: wrap; }
  .acep-subpage-name{ min-width: 0; width:100%; }
  .acep-search{ display:none; }
}

/* ==========================================================================
   Contenu métier (formulaires, boutons, tableaux, pagination)
   Patron officiel : acepui-page-demo-contentieux.html (voir DESIGN_HANDOFF.md)
   Classes non préfixées "acep-" ici (.btn, .field, .table-wrap...) : reprises
   telles quelles du patron pour rester copiables/collables page par page.
   Scopées sous .acep-shell pour ne jamais fuir vers un contenu Bootstrap
   non migré qui coexisterait sur une même page (cf. incident chrome-only).
   ========================================================================== */

.acep-shell .page-panel{
  position: relative;
  z-index: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 28px 8px;
  margin-bottom: 22px;
}
.acep-shell .panel-heading{
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--brand-text);
  margin: 0 0 20px;
}

/* ---- Formulaire ---- */
.acep-shell .field-row{ display:flex; align-items:flex-end; gap:12px; flex-wrap:wrap; margin-bottom:22px; }
.acep-shell .field{ display:flex; flex-direction:column; gap:6px; flex:1; min-width:180px; }
.acep-shell .field label{ font-size:11.5px; font-family:var(--font-mono); text-transform:uppercase; letter-spacing:.4px; color:var(--text-faint); }
.acep-shell .field-input{
  display:flex; align-items:center; gap:8px;
  background: var(--field-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  color: var(--text);
  font-size: 13.5px;
  transition: border-color .15s ease;
}
.acep-shell .field-input:focus-within{ border-color: var(--acep-teal); }
.acep-shell .field-input input{
  background:none; border:none; color:inherit; font-family:inherit; font-size:inherit;
  width:100%; outline:none;
}
.acep-shell .field-input input::placeholder{ color:var(--text-faint); }
/* input[type=date] : le widget calendrier reste natif au navigateur (la
   valeur ISO qu'il produit est lue telle quelle par le JS existant, voir
   DESIGN_HANDOFF.md) — seul l'accord de couleur de l'icône est ajusté. */
.acep-shell .field-input input[type="date"]{ color-scheme: dark; }
.acep-shell[data-theme="light"] .field-input input[type="date"]{ color-scheme: light; }

/* ---- <select> natifs : le champ fermé ET le popup d'options ----
   color-scheme seul ne suffit pas sur Chrome/Edge pour peindre le popup en
   thème sombre : ces navigateurs utilisent le background-color/color réels
   posés sur <select> et <option> pour dessiner la liste déroulante ouverte
   (une surface système, hors de portée de .field-input qui ne l'entoure
   pas). D'où un select fermé bien habillé mais un popup blanc/gris système
   si on ne stylait que le conteneur. Règle large sur .acep-shell select
   (pas juste .field-input select) pour couvrir tous les select, y compris
   ceux posés hors d'un .field-input. */
.acep-shell select{
  color-scheme: dark;
}
.acep-shell[data-theme="light"] select{
  color-scheme: light;
}
.acep-shell .field-input select{
  background-color: var(--bg-elevated);
  border:none; color:inherit; font-family:inherit; font-size:inherit;
  width:100%; outline:none;
}
.acep-shell option{
  background-color: var(--bg-elevated);
  color: var(--text);
}
.acep-shell option:hover,
.acep-shell option:checked{
  background-color: var(--panel-hover);
}

/* ---- Boutons ---- */
.acep-shell .btn{
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
}
.acep-shell .btn:hover{ color:var(--text); border-color: var(--acep-teal); }
.acep-shell .btn.primary{
  background: linear-gradient(135deg, var(--acep-teal), var(--acep-teal-deep));
  border-color: transparent;
  color: #04140F;
}
.acep-shell .btn.primary:hover{ filter: brightness(1.06); }
.acep-shell .btn.sm{ padding: 8px 14px; font-size:12.5px; font-weight:500; }

.acep-shell .toolbar{ display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; padding-bottom:16px; }
.acep-shell .export-group{ display:flex; gap:8px; flex-wrap:wrap; }
.acep-shell .export-group .btn{ display:flex; align-items:center; gap:6px; }

.acep-shell .search-field{
  display:flex; align-items:center; gap:8px;
  background: var(--field-bg);
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  padding: 8px 14px;
  font-size: 12.8px;
  color: var(--text-dim);
  min-width: 220px;
}
.acep-shell .search-field input{ background:none; border:none; color:var(--text); font-family:inherit; font-size:inherit; outline:none; width:100%; }
.acep-shell .search-field input::placeholder{ color:var(--text-faint); }

/* ---- Tableau (marquage manuel, pour les pages sans DataTables) ---- */
.acep-shell .table-wrap{ overflow-x:auto; border-top:1px solid var(--border); }
.acep-shell table{ width:100%; border-collapse:collapse; font-size:13px; }
.acep-shell thead th{
  text-align:left; font-family:var(--font-mono); font-size:10.5px; text-transform:uppercase;
  letter-spacing:.4px; color:var(--text-faint); font-weight:500;
  padding: 14px 10px; border-bottom:1px solid var(--border); white-space:nowrap;
}
.acep-shell tbody td{ padding: 14px 10px; border-bottom:1px solid var(--border); color:var(--text-dim); }
.acep-shell tbody tr:last-child td{ border-bottom:none; }
.acep-shell tbody tr:hover td{ background: var(--row-hover); color: var(--text); }
.acep-shell .empty-row td{ text-align:center; color:var(--text-faint); padding: 38px 10px; font-style:normal; }

.acep-shell .table-footer{ display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; padding: 16px 0 20px; font-size:12.5px; color:var(--text-faint); }
.acep-shell .pagination{ display:flex; align-items:center; gap:4px; }
.acep-shell .pagination button{
  font-family: inherit;
  min-width:30px; height:30px; border-radius:8px; font-size:12.5px; color:var(--text-dim);
  display:flex; align-items:center; justify-content:center; cursor:pointer;
  background:none; border:none;
}
.acep-shell .pagination button:hover{ background: var(--panel-hover); }
.acep-shell .pagination button.active{ background: var(--acep-teal); color:#04140F; font-weight:600; }
.acep-shell .pagination button[disabled]{ color: var(--text-faint); cursor:default; }
.acep-shell .pagination button[disabled]:hover{ background:none; }

/* ---- Overlay de chargement (remplace bg-white/bg-opacity-75 Bootstrap,
   qui rendait un pavé blanc plein écran sur fond sombre) ---- */
.acep-loader-overlay{
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(7,25,21,0.75);
}
[data-theme="light"] .acep-loader-overlay{ background: rgba(243,251,250,0.85); }

/* ---- Loader de navigation entre pages (distinct du #loader de contentieux,
   qui sert la soumission d'un filtre en AJAX sans recharger). Overlay partagé
   injecté par minipages/nav-loader.php via topbar.php sur toutes les pages
   migrées. Réutilise .acep-loader-overlay pour le fond ; spinner CSS thémé. ---- */
.acep-nav-loader-inner{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; }
.acep-nav-spinner{
  width:46px; height:46px; border-radius:50%;
  border:4px solid var(--border-strong);
  border-top-color: var(--acep-teal);
  animation: acep-nav-spin 0.7s linear infinite;
}
@keyframes acep-nav-spin{ to{ transform: rotate(360deg); } }

/* ---- Habillage des éléments générés par le plugin jQuery DataTables /
   Buttons (classes imposées par la librairie — jamais renommées, JS d'init
   inchangé, voir minipages/script.php). DataTables applique `color` en
   !important sur ses boutons de pagination ; on doit faire de même pour
   pouvoir le surcharger. ---- */
.acep-shell .dataTables_wrapper{ color: var(--text-dim); font-family: var(--font-body); }
.acep-shell .dataTables_wrapper .dt-buttons{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom: 14px; }
.acep-shell .dataTables_wrapper .dt-button{
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-dim);
}
.acep-shell .dataTables_wrapper .dt-button:hover{ color:var(--text); border-color: var(--acep-teal); background: var(--bg-elevated); }
.acep-shell .dataTables_wrapper .dataTables_filter{ float:none; margin-bottom: 14px; }
.acep-shell .dataTables_wrapper .dataTables_filter label{
  display:flex; align-items:center; gap:8px;
  background: var(--field-bg);
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  padding: 8px 14px;
  font-size: 12.8px;
  color: var(--text-dim);
}
.acep-shell .dataTables_wrapper .dataTables_filter input{
  background:none; border:none; color:var(--text); font-family:inherit; font-size:inherit; outline:none; margin-left:0;
}
.acep-shell .dataTables_wrapper .dataTables_info{ color: var(--text-faint); font-size:12.5px; padding-top:16px; }
.acep-shell .dataTables_wrapper .dataTables_paginate{ padding-top:16px; }
.acep-shell .dataTables_wrapper .dataTables_paginate .paginate_button{
  min-width:30px; height:30px; border-radius:8px; font-size:12.5px; color: var(--text-dim) !important;
  display:inline-flex; align-items:center; justify-content:center;
  border: none !important; background: none !important; margin-left:2px;
}
.acep-shell .dataTables_wrapper .dataTables_paginate .paginate_button:hover{ background: var(--panel-hover) !important; color: var(--text) !important; }
.acep-shell .dataTables_wrapper .dataTables_paginate .paginate_button.current{ background: var(--acep-teal) !important; color:#04140F !important; font-weight:600; }
.acep-shell .dataTables_wrapper .dataTables_paginate .paginate_button.disabled{ color: var(--text-faint) !important; }
.acep-shell table.dataTable{ width:100% !important; border-collapse:collapse; font-size:13px; background: transparent !important; }
.acep-shell table.dataTable thead th{
  text-align:left; font-family:var(--font-mono); font-size:10.5px; text-transform:uppercase;
  letter-spacing:.4px; color:var(--text-faint); font-weight:500;
  padding: 14px 10px; border-bottom:1px solid var(--border); white-space:nowrap;
  background: transparent !important;
}
/* Le thème par défaut de DataTables (jquery.dataTables.min.css, chargé via
   CDN) fixe explicitement `table.dataTable tbody tr{ background-color:#fff }`
   — jamais neutralisé auparavant (on ne gérait que la couleur du texte et le
   survol), d'où le corps de tableau resté blanc pur sous une thead teal. */
.acep-shell table.dataTable tbody tr,
.acep-shell table.dataTable tbody tr.odd,
.acep-shell table.dataTable tbody tr.even{ background-color: transparent !important; }
.acep-shell table.dataTable tbody td{ padding: 14px 10px; border-bottom:1px solid var(--border); color:var(--text-dim); background: transparent !important; }
.acep-shell table.dataTable tbody tr:hover td{ background: var(--row-hover) !important; color: var(--text); }
.acep-shell table.dataTable.no-footer{ border-bottom: none; }

/* Flèches de tri des colonnes triables : le thème CDN leur donne une couleur
   fixe (bleu/violet par défaut), sans hériter de la thead — à recolorer
   explicitement, avec les deux variantes :before/:after selon la version. */
.acep-shell table.dataTable thead th.sorting,
.acep-shell table.dataTable thead th.sorting_asc,
.acep-shell table.dataTable thead th.sorting_desc,
.acep-shell table.dataTable thead th.sorting_asc_disabled,
.acep-shell table.dataTable thead th.sorting_desc_disabled{
  color: var(--text-faint) !important;
}
.acep-shell table.dataTable thead th.sorting:before,
.acep-shell table.dataTable thead th.sorting:after,
.acep-shell table.dataTable thead th.sorting_asc:before,
.acep-shell table.dataTable thead th.sorting_desc:before{
  color: var(--text-faint) !important;
  opacity: 0.6;
}
.acep-shell table.dataTable thead th.sorting_asc:after,
.acep-shell table.dataTable thead th.sorting_desc:after{
  color: var(--acep-teal) !important;
  opacity: 1;
}

/* ---- Barre de défilement personnalisée (ajoutée une seule fois ici, pas
   par page). Scopée à .acep-shell : le fichier n'est chargé que sur les
   pages migrées, et même chargé par erreur ailleurs, ce sélecteur exige un
   ancêtre .acep-shell absent des pages non migrées — donc sans effet. ---- */
.acep-shell, .acep-shell *{
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.acep-shell ::-webkit-scrollbar{ width: 9px; height: 9px; }
.acep-shell ::-webkit-scrollbar-track{ background: transparent; }
.acep-shell ::-webkit-scrollbar-thumb{
  background: var(--border-strong);
  border-radius: 100px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.acep-shell ::-webkit-scrollbar-thumb:hover{ background: var(--acep-teal); background-clip: padding-box; }

/* ==========================================================================
   Pattern "cartes graphiques + modale + dropdown filtrable"
   Patron officiel : acepui-page-demo-checks.html
   La modale et le dropdown filtrable de ce patron sont un jouet de démo
   (HTML/JS maison pour montrer le rendu). Les vraies pages utilisent un vrai
   modal Bootstrap et (en théorie) le plugin bootstrap-select — donc ici on
   habille les classes réelles générées par ces mécanismes, pas de remplacement.
   ========================================================================== */

.acep-shell .chart-grid{ display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:22px; }
@media (max-width:820px){ .acep-shell .chart-grid{ grid-template-columns:1fr; } }
.acep-shell .chart-card{ background:var(--panel); border:1px solid var(--border); border-radius:var(--radius); padding:22px; }
.acep-shell .panel-sub{ font-size:12px; color:var(--text-faint); margin:0 0 18px; }

.acep-shell .status-pill{
  display:inline-flex; align-items:center; gap:6px; font-size:11.5px; padding:3px 10px;
  border-radius:100px; font-family:var(--font-mono);
  color: var(--status-pending);
  background: color-mix(in srgb, var(--status-pending) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--status-pending) 32%, transparent);
}
.acep-shell .status-pill.ok{ color:var(--success); background:color-mix(in srgb, var(--success) 14%, transparent); border-color: color-mix(in srgb, var(--success) 32%, transparent); }
.acep-shell .status-pill.pending{ color:var(--status-pending); background:color-mix(in srgb, var(--status-pending) 14%, transparent); border-color: color-mix(in srgb, var(--status-pending) 32%, transparent); }
.acep-shell .status-pill.err{ color:var(--danger); background:color-mix(in srgb, var(--danger) 14%, transparent); border-color: color-mix(in srgb, var(--danger) 32%, transparent); }

/* ---- Modale Bootstrap réelle (data-bs-toggle="modal", JS de
   bootstrap.bundle.min.js inchangé) ---- */
.acep-shell .modal-content{
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
}
.acep-shell .modal-header,
.acep-shell .modal-footer{ border-color: var(--border); }
.acep-shell .modal-title{ font-family: var(--font-display); font-weight:600; }
.acep-shell[data-theme="dark"] .modal .btn-close,
.acep-shell[data-theme="dark"] .alert .btn-close{ filter: invert(1) grayscale(1) brightness(1.8); }
.acep-shell .modal .form-control{
  background: var(--field-bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.acep-shell .modal select{
  /* background-color explicite (pas --field-bg, quasi transparent) : c'est
     ce qu'utilisent Chrome/Edge pour peindre le popup d'options ouvert,
     une surface système sans rien derrière à laisser transparaître. */
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.acep-shell .modal .form-control:focus,
.acep-shell .modal select:focus{
  border-color: var(--acep-teal); box-shadow:none; color: var(--text);
}
.acep-shell .modal .form-control::placeholder{ color: var(--text-faint); }
/* input[type=file] : natif, pas un plugin — même traitement que les autres
   champs (fond/bordure), le bouton "Parcourir" reste natif au navigateur. */
.acep-shell input[type="file"].form-control{
  background: var(--field-bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13px;
}
.acep-shell input[type="file"].form-control::file-selector-button{
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  padding: 6px 12px;
  margin-right: 10px;
  font-family: inherit;
  cursor: pointer;
}
.acep-shell input[type="file"].form-control::file-selector-button:hover{ color: var(--text); border-color: var(--acep-teal); }
.acep-shell .modal .col-form-label{ font-size:11.5px; font-family:var(--font-mono); text-transform:uppercase; letter-spacing:.4px; color:var(--text-faint); }

/* ---- Alertes Bootstrap (.alert-*) : réutilisées telles quelles (structure/
   JS inchangés), recolorées avec la palette ACEP au lieu des teintes
   Bootstrap par défaut (boîte claire qui jurerait sur fond sombre). ---- */
.acep-shell .alert{ border-radius: var(--radius-sm); font-size: 13.5px; }
.acep-shell .alert-primary,
.acep-shell .alert-info{
  background: color-mix(in srgb, var(--acep-teal) 14%, transparent);
  border-color: color-mix(in srgb, var(--acep-teal) 32%, transparent);
  color: var(--text);
}
.acep-shell .alert-danger{
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  border-color: color-mix(in srgb, var(--danger) 32%, transparent);
  color: var(--text);
}
.acep-shell .alert-success{
  background: color-mix(in srgb, var(--success) 14%, transparent);
  border-color: color-mix(in srgb, var(--success) 32%, transparent);
  color: var(--text);
}
.acep-shell .alert-warning{
  background: color-mix(in srgb, var(--status-pending) 14%, transparent);
  border-color: color-mix(in srgb, var(--status-pending) 32%, transparent);
  color: var(--text);
}

/* ---- Dropdown natif : la classe .selectpicker suppose le plugin
   bootstrap-select, absent du projet (aucun CDN/vendor ne le charge — voir
   note de migration). Le <select> s'affiche donc natif ; habillé comme tel,
   en attendant une décision sur le plugin manquant. ---- */
.acep-shell select.form-control,
.acep-shell select.form-select{
  /* background-color explicite (pas --field-bg, quasi transparent) : c'est
     ce qu'utilisent Chrome/Edge pour peindre le popup d'options ouvert. */
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13.5px;
}

/* ==========================================================================
   Pattern "fiche détail à onglets"
   Patron officiel : acepui-page-demo-fiche-detail.html
   Les onglets du patron (.tabs/.tab-btn) sont réutilisés comme HABILLAGE des
   vraies classes Bootstrap (.nav-tabs/.nav-link, data-bs-toggle="tab") —
   même logique que pour DataTables/modale : le JS de bascule d'onglet de
   bootstrap.bundle.min.js reste inchangé, pas de réimplémentation maison.
   ========================================================================== */

.acep-shell .nav-tabs{ border-bottom: 1px solid var(--border); gap:4px; margin-bottom:26px; }
.acep-shell .nav-tabs .nav-link{
  font-family: inherit;
  padding: 12px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-faint);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  margin-bottom: -1px;
}
.acep-shell .nav-tabs .nav-link:hover{ color: var(--text-dim); border-color: transparent; }
.acep-shell .nav-tabs .nav-link.active{
  color: var(--brand-text);
  background: none;
  border-color: transparent transparent var(--acep-teal);
  font-weight: 600;
}

.acep-shell .fiche-header{ display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:24px; }
.acep-shell .fiche-title{ font-family:var(--font-display); font-size:22px; font-weight:600; margin:0 0 4px; }
.acep-shell .fiche-sub{ font-size:12.5px; color:var(--text-faint); font-family:var(--font-mono); }

.acep-shell .detail-panel{ background:var(--panel); border:1px solid var(--border); border-radius:var(--radius); padding:26px; margin-bottom:20px; }
.acep-shell .detail-panel-title{ font-family:var(--font-display); font-size:14.5px; font-weight:600; color:var(--brand-text); margin:0 0 18px; }
.acep-shell .detail-grid{ display:grid; grid-template-columns:1fr 1fr; gap:22px 28px; }
@media (max-width:600px){ .acep-shell .detail-grid{ grid-template-columns:1fr; } }
.acep-shell .detail-item label{ display:block; font-size:11px; font-family:var(--font-mono); text-transform:uppercase; letter-spacing:.4px; color:var(--text-faint); margin-bottom:6px; }
.acep-shell .detail-value{ font-size:14.5px; color:var(--text); }
.acep-shell .detail-value.mono{ font-family:var(--font-mono); font-size:13.5px; }

.acep-shell .field-row-2{ display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:16px; }
@media (max-width:600px){ .acep-shell .field-row-2{ grid-template-columns:1fr; } }
.acep-shell ::-webkit-scrollbar-corner{ background: transparent; }

/* ---- Éléments Bootstrap natifs restants sur les fiches détail (hors modale) :
   textarea et case à cocher, mêmes tokens que .field-input. ---- */
.acep-shell textarea.form-control{
  background: var(--field-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  padding: 11px 13px;
}
.acep-shell textarea.form-control:focus{ border-color: var(--acep-teal); box-shadow:none; background: var(--field-bg); color: var(--text); }
.acep-shell textarea.form-control::placeholder{ color: var(--text-faint); }

.acep-shell .form-check-input{ background-color: var(--field-bg); border-color: var(--border-strong); }
.acep-shell .form-check-input:checked{ background-color: var(--acep-teal); border-color: var(--acep-teal); }
.acep-shell .form-check-label{ color: var(--text-dim); }

/* ==========================================================================
   Patrons CRH — acepui-page-demo-crh-patterns.html
   ========================================================================== */

/* ---- 1. Cartes de stats : remplace <ul class="list-group"> à couleurs
   inline beige/azure. Conteneur/CSS repris tel quel du patron ; le contenu
   (labels + valeurs réels, déjà rendus par le PHP existant) ne change pas. ---- */
.acep-shell .stat-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(200px,1fr)); gap:14px; margin-bottom: 22px; }
.acep-shell .stat-card{
  background:var(--panel); border:1px solid var(--border); border-radius:var(--radius-sm);
  padding:18px 20px; position:relative; overflow:hidden;
}
.acep-shell .stat-card::before{ content:""; position:absolute; left:0; top:0; bottom:0; width:3px; background:var(--accent); opacity:.85; }
.acep-shell .stat-label{ font-family:var(--font-mono); font-size:11px; text-transform:uppercase; letter-spacing:.4px; color:var(--text-faint); margin-bottom:8px; }
.acep-shell .stat-value{ font-family:var(--font-display); font-size:24px; font-weight:600; }
.acep-shell .stat-value .unit{ font-size:13px; color:var(--text-faint); font-weight:400; margin-left:3px; }

/* ---- 3. simple-datatables — classes RÉELLES vérifiées dans
   assets/vendor/simple-datatables/simple-datatables.js (v7, préfixe
   "dataTable-" avec T majuscule) et son style.css. Le patron de démo
   utilisait "datatable-" minuscule + des suffixes ("-list-item",
   "-list-item-link") qui n'existent PAS dans la version installée — classes
   corrigées ici en conséquence (voir MIGRATION_LOG.md). Le plugin ajoute ces
   classes SUR le <table class="table datatable"> existant et remplace son
   emplacement par un wrapper généré, JS d'init inchangé (main.js). ---- */
.acep-shell .dataTable-wrapper{ color: var(--text-dim); font-family: var(--font-body); }
.acep-shell .dataTable-top,
.acep-shell .dataTable-bottom{ display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.acep-shell .dataTable-top{ margin-bottom:16px; }
.acep-shell .dataTable-top::after,
.acep-shell .dataTable-bottom::after{ content:none; }
.acep-shell .dataTable-bottom{ padding-top:16px; font-size:12.5px; color:var(--text-faint); }
.acep-shell .dataTable-dropdown label{ display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--text-dim); float:none; }
.acep-shell .dataTable-selector{
  background:var(--field-bg); border:1px solid var(--border-strong); border-radius:7px;
  color:var(--text); font-family:inherit; font-size:12.5px; padding:6px 8px;
}
.acep-shell .dataTable-search{ float:none; }
.acep-shell .dataTable-input{
  background:var(--field-bg); border:1px solid var(--border-strong); border-radius:100px;
  color:var(--text); font-family:inherit; font-size:12.8px; padding:8px 14px; min-width:220px; outline:none;
}
.acep-shell .dataTable-input:focus{ border-color:var(--acep-teal); }
.acep-shell .dataTable-container{ overflow-x:auto; }
.acep-shell table.dataTable-table{ width:100%; border-collapse:collapse; font-size:13px; }
.acep-shell table.dataTable-table > thead > tr > th{
  text-align:left; font-family:var(--font-mono); font-size:10.5px; text-transform:uppercase;
  letter-spacing:.4px; color:var(--text-faint); font-weight:500;
  padding:14px 10px; border-bottom:1px solid var(--border); white-space:nowrap;
}
.acep-shell table.dataTable-table > tbody > tr > td{ padding:14px 10px; border-bottom:1px solid var(--border); color:var(--text-dim); }
.acep-shell table.dataTable-table > tbody > tr:last-child > td{ border-bottom:none; }
.acep-shell table.dataTable-table > tbody > tr:hover > td{ background: var(--row-hover); color: var(--text); }
.acep-shell td.dataTables-empty{ text-align:center; color:var(--text-faint); padding:38px 10px; }

/* Flèche de tri : dessinée en triangle CSS via bordures (pas du texte), donc
   le fix "color" utilisé pour jQuery DataTables ne suffit pas ici — il faut
   recolorer border-top/border-bottom directement (le CSS vendor les fixe en
   #000, invisible sur fond sombre). */
.acep-shell .dataTable-sorter::before{ border-top-color: var(--text-faint); }
.acep-shell .dataTable-sorter::after{ border-bottom-color: var(--text-faint); }
.acep-shell th.asc .dataTable-sorter::after,
.acep-shell th.desc .dataTable-sorter::before{ opacity: 1; }
.acep-shell th.asc .dataTable-sorter::after{ border-bottom-color: var(--acep-teal); }
.acep-shell th.desc .dataTable-sorter::before{ border-top-color: var(--acep-teal); }

.acep-shell .dataTable-info{ color: var(--text-faint); margin:0; }
.acep-shell .dataTable-pagination ul{ display:flex; gap:4px; list-style:none; margin:0; padding:0; }
.acep-shell .dataTable-pagination li{ float:none; }
.acep-shell .dataTable-pagination a{
  display:flex; align-items:center; justify-content:center;
  min-width:30px; height:30px; border-radius:8px; border:none;
  font-size:12.5px; color: var(--text-dim); margin-left:0; padding:0;
}
.acep-shell .dataTable-pagination a:hover{ background: var(--panel-hover); color: var(--text); }
.acep-shell .dataTable-pagination .active a,
.acep-shell .dataTable-pagination .active a:hover{ background: var(--acep-teal); color:#04140F; font-weight:600; }
.acep-shell .dataTable-pagination .disabled a{ color: var(--text-faint); }

/* ==========================================================================
   Footer du template (minipages/footer.php) — inclus en frère de <main>, à
   l'intérieur de .acep-shell (comme les modales) pour hériter des variables
   de thème. Avant ça, il gardait le rendu par défaut du template, quel que
   soit le thème choisi.
   ========================================================================== */
.acep-shell .footer{
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 40px 30px;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
}
.acep-shell .footer .copyright{ margin-bottom: 4px; }
.acep-shell .footer .copyright strong{ color: var(--text-dim); }

/* ==========================================================================
   Écran de connexion (pages/connect/connect.php)
   Composé à partir des composants déjà validés (.page-panel/.field/.field-input/
   .btn/.alert), pas un nouveau pattern à valider séparément.
   ========================================================================== */
.acep-auth-main{
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
  z-index: 1;
}
.acep-auth-card{
  width: 100%;
  max-width: 380px;
}
.acep-auth-brand{
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-bottom: 22px;
}
.acep-auth-divider{
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-faint);
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.acep-auth-divider::before,
.acep-auth-divider::after{
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
/* Bouton Google : reste volontairement hors charte ACEP (blanc/gris), les
   règles de marque Google imposent ce rendu neutre quel que soit le thème
   hôte — ce n'est pas un oubli de theming. */
.acep-google-btn{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: #fff;
  border: 1px solid #ddd;
  color: #444;
  border-radius: var(--radius-sm);
  padding: 11px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.acep-google-btn:hover{ background: #4285F4; color: #fff; border-color: #4285F4; }
