/* Chargement de la police du thème — si on change de police dans
   tokens.css, on remplace AUSSI cette ligne (une seule, pour tout le site). */
/* Polices : chaque page demande Inter elle-même (lot 1 audit, 11/10/2026) —
   l'ancien @import ajoutait un 4e saut bloquant : page → design → theme-app2 → polices. */

/* =====================================================================
   C-DIRECT · THEME-APP2.CSS — thème applicatif v2 « manière Livramed »
   Créé le 23 août 2026 (décision Robert : gabarit Livramed, bleu AZUR
   dominant, terracotta pour les avis, vert pomme réservé aux succès).

   RÈGLES :
   · Toutes les couleurs viennent de tokens.css (--cd2-…). AUCUNE couleur
     en dur ici hors gris utilitaires. Changer la palette = tokens.css.
   · Tout est préfixé « body.theme-app2 » : une page qui ne porte pas
     cette classe n'est jamais affectée. Déploiement page par page.
   · Chargé APRÈS design.css. Les !important ci-dessous ne combattent
     pas design.css par caprice : ils neutralisent les styles INLINE
     que auth.js pose sur le menu injecté (style="…" gagne toujours
     sur une feuille, sauf !important).
   ===================================================================== */

/* ---------- 0. remappage des variables de page ----------
   Les pages écrivent var(--vert), var(--fond)… : en les repointant ici
   vers les jetons du thème, tout l'écran bascule sans réécrire chaque
   composant. --jaune et --rouge restent intacts (sémantique conservée). */
body.theme-app2{
  --vert:      var(--cd2-primaire,     #2F6FA8);
  --vert-vif:  var(--cd2-primaire-vif, #3F84BF);
  --fond:      var(--cd2-fond,         #EDEFF1);
  --panneau:   var(--cd2-surface,      #FFFFFF);
  --panneau2:  #F4F6F8;
  --ligne:     var(--cd2-ligne,        #E2E5E8);
  --ligne2:    #D3D7DC;
  --texte:     var(--cd2-texte,        #28303A);
  --sourd:     #68717C;

  background: var(--cd2-fond, #EDEFF1) !important;
  color: var(--cd2-texte, #28303A);
}

/* ---------- 1. barre du haut ---------- */
body.theme-app2 .topbar{
  background: var(--cd2-creme, #F7F8FA) !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid #E4E6E9;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
body.theme-app2 .topbar .in{ height: auto; min-height: 62px; padding: 4px 22px; }
body.theme-app2 .topbar .brand{ font-weight: 800; font-size: 17px; color: var(--cd2-fonce, #1E4E75); }

/* menu injecté par auth.js : libellé AU-DESSUS, icône DESSOUS (gabarit).
   auth.js pose tout en style inline → chaque propriété doit être !important. */
body.theme-app2:not(.cd-b3) #cd-menu{ font-family:var(--cd2-police-corps,'Inter',sans-serif) !important; gap: 2px !important; }
body.theme-app2:not(.cd-b3) #cd-menu a{
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 3px !important;
  font-family: 'Inter',sans-serif !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
  letter-spacing: .06em !important;
  text-transform: uppercase !important;
  color: #68717C !important;
  background: transparent !important;
  border-radius: 8px !important;
  padding: 7px 14px !important;
  margin: 0 !important;
  outline: none !important;
  line-height: 1.15 !important;
}
body.theme-app2:not(.cd-b3) #cd-menu a:hover{ background: #EDF1F5 !important; color: var(--cd2-primaire, #2F6FA8) !important; }
body.theme-app2:not(.cd-b3) #cd-menu a[aria-current="page"]{ color: var(--cd2-primaire, #2F6FA8) !important; }

/* icônes du menu (masques CSS, teintés par currentColor) —
   ordre du rôle pharmacie : Publier · Affichés · Confirmés · Calendrier ·
   Factures · Messages. Si le menu change dans auth.js, remettre en ordre. */
body.theme-app2:not(.cd-b3) #cd-menu a::after{
  content:''; width: 22px; height: 22px; background: currentColor;
  -webkit-mask: var(--app2-ico) center / contain no-repeat;
          mask: var(--app2-ico) center / contain no-repeat;
}
body.theme-app2:not(.cd-b3) #cd-menu a:nth-of-type(1){ --app2-ico: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11h-4v4h-2v-4H7v-2h4V7h2v4h4v2z'/></svg>"); }
body.theme-app2:not(.cd-b3) #cd-menu a:nth-of-type(2){ --app2-ico: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M3 5h18v2H3V5zm0 6h18v2H3v-2zm0 6h12v2H3v-2z'/></svg>"); }
body.theme-app2:not(.cd-b3) #cd-menu a:nth-of-type(3){ --app2-ico: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z'/></svg>"); }
body.theme-app2:not(.cd-b3) #cd-menu a:nth-of-type(4){ --app2-ico: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M19 4h-1V2h-2v2H8V2H6v2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 16H5V9h14v11z'/></svg>"); }
body.theme-app2:not(.cd-b3) #cd-menu a:nth-of-type(5){ --app2-ico: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 2v20l3-2 3 2 3-2 3 2V2H6zm10 9H8V9h8v2zm0 4H8v-2h8v2z'/></svg>"); }
body.theme-app2:not(.cd-b3) #cd-menu a:nth-of-type(6){ --app2-ico: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2z'/></svg>"); }

/* icônes de droite (♥, cloche, ⚙) : carrés bleu foncé du gabarit */
body.theme-app2 #cd-entete-session > a[title]{
  width: 38px !important; height: 38px !important;
  border-radius: 6px !important;
  background: var(--cd2-fonce, #1E4E75) !important;
  color: #fff !important;
}

/* ---------- 2. le grand panneau blanc ---------- */
body.theme-app2 .wrap{
  max-width: 1440px;
  background: var(--cd2-surface, #FFFFFF);
  border-radius: 4px;
  box-shadow: 0 1px 6px rgba(0,0,0,.10);
  padding: 26px 28px 40px;
  margin: 26px auto 40px;
}
body.theme-app2 .wrap h1{
  font-family: var(--cd2-police-titres,'Inter',sans-serif);
  text-transform: uppercase;
  font-weight: 800;
  font-size: 25px;
  letter-spacing: .02em;
}
body.theme-app2 .wrap .sous{ font-size: 12px; font-weight: 600; color: var(--cd2-sourd, #8B9099); }

/* cartes → sections du panneau, séparées par un filet (plus de boîtes) */
body.theme-app2 .carte{
  border: none;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--cd2-ligne, #E2E5E8);
  padding: 20px 0 10px;
  margin-bottom: 8px;
}
body.theme-app2 .sec{ text-transform: uppercase; font-size: 11px; letter-spacing: .06em; font-weight: 700; }

/* ---------- 3. bande d'action « Publier » (gabarit) ---------- */
body.theme-app2 .app2-bande{
  display: block; width: 100%;
  background: var(--cd2-primaire, #2F6FA8);
  color: #fff; border: none; border-radius: 4px;
  padding: 13px 16px 10px; margin: 6px 0 16px;
  text-align: center; cursor: pointer;
  font-family: var(--cd2-police-corps,'Inter',sans-serif);
  transition: background .15s ease;
}
body.theme-app2 .app2-bande:hover{ background: var(--cd2-primaire-vif, #3F84BF); }
body.theme-app2 .app2-bande .l1{
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
body.theme-app2 .app2-bande kbd{
  background: #fff; color: var(--cd2-texte, #28303A);
  border-radius: 4px; padding: 2px 8px; font-size: 11px; font-weight: 700;
  font-family: var(--cd2-police-corps,'Inter',sans-serif);
}
body.theme-app2 .app2-bande svg{ width: 24px; height: 24px; fill: #fff; margin-top: 3px; }

/* ---------- 4. onglets → rangée de filtres du gabarit ---------- */
body.theme-app2 #ep-onglets, body.theme-app2 #admin-onglets{ display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
body.theme-app2 #ep-onglets button, body.theme-app2 #admin-onglets button{
  font-family: var(--cd2-police-corps,'Inter',sans-serif);
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: var(--cd2-gris-btn, #989CA3);
  border: none; border-radius: 4px; padding: 13px 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
  cursor: pointer;
}
body.theme-app2 #ep-onglets button:hover, body.theme-app2 #admin-onglets button:hover{ filter: brightness(1.06); }
body.theme-app2 #ep-onglets button.actif, body.theme-app2 #admin-onglets button.actif{ background: var(--cd2-primaire-vif, #3F84BF); }

/* ---------- 5. contenus : listes, pastilles, KPI ---------- */
body.theme-app2 .contrat{ background: #fff; border: none; border-bottom: 1px solid var(--cd2-ligne, #E2E5E8); border-radius: 0; margin-bottom: 0; }
body.theme-app2 .contrat .tete:hover{ background: #F5F7F9; }
body.theme-app2 .contrat .ref{ font-family: var(--cd2-police-corps,'Inter',sans-serif); font-weight: 800; letter-spacing: .02em; }

body.theme-app2 .badge{ border: none; color: #fff; font-weight: 700; text-transform: uppercase; font-size: 10.5px; letter-spacing: .06em; border-radius: 4px; padding: 5px 10px; }
body.theme-app2 .badge.ouvert{ background: var(--cd2-succes, #79A93E); }
body.theme-app2 .badge.attribue{ background: var(--cd2-primaire, #2F6FA8); }
body.theme-app2 .badge.autre{ background: var(--cd2-gris-btn, #989CA3); }

body.theme-app2 .pb-kpi{ background: #F4F6F8; border: 1px solid var(--cd2-ligne, #E2E5E8); border-radius: 4px; }

/* bandeaux d'avis : terracotta (remplace l'orange du gabarit) */
body.theme-app2 .avis-app2, body.theme-app2 #banniere-messages .avis-app2{
  background: var(--cd2-avis, #D97757); color: #fff;
  border-radius: 4px; padding: 12px 16px; margin-bottom: 14px;
  font-size: 13.5px; font-weight: 600;
}

/* ---------- 6. boutons & champs ---------- */
body.theme-app2 .btn{ background: var(--cd2-primaire, #2F6FA8); border-radius: 5px; }
body.theme-app2 .btn:hover{ background: var(--cd2-primaire-vif, #3F84BF); }
body.theme-app2 .btn-mini{ background: var(--cd2-fonce, #1E4E75); border-radius: 5px; }
body.theme-app2 .btn-mini:hover{ background: var(--cd2-primaire, #2F6FA8); }
/* les variantes jaune/rouge (contre-offre, refus) gardent leur sémantique */
body.theme-app2 .btn-mini.jaune, body.theme-app2 .btn-mini.rouge, body.theme-app2 .btn-mini.coeur{ background: transparent; }

body.theme-app2 input:focus, body.theme-app2 select:focus, body.theme-app2 textarea:focus{
  border-color: var(--cd2-primaire, #2F6FA8) !important;
  box-shadow: 0 0 0 3.5px rgba(47,111,168,.14) !important;
}
body.theme-app2 input, body.theme-app2 select, body.theme-app2 textarea{ border-radius: 5px !important; }
body.theme-app2 ::selection{ background: rgba(47,111,168,.16); }

/* ---------- 7. petits écrans ---------- */
@media (max-width: 900px){
  body.theme-app2 #ep-onglets, body.theme-app2 #admin-onglets{ grid-template-columns: 1fr 1fr; }
  body.theme-app2 .wrap{ margin: 12px 10px 30px; padding: 18px 14px 30px; }
}
@media (max-width: 560px){
  body.theme-app2 #ep-onglets, body.theme-app2 #admin-onglets{ grid-template-columns: 1fr; }
  body.theme-app2:not(.cd-b3) #cd-menu a{ padding: 6px 8px !important; font-size: 9.5px !important; }
}

/* ---------- 8. typographie des contenus : Inter partout (le gabarit
   n'utilise pas de monospace ; les chiffres restent tabulaires) ---------- */
body.theme-app2 .pb-kpi small, body.theme-app2 .pb-kpi b{ font-family:var(--cd2-police-corps,'Inter',sans-serif); }
body.theme-app2 .pb-kpi b{ font-variant-numeric: tabular-nums; }
body.theme-app2 .contrat .tete, body.theme-app2 .compteur, body.theme-app2 .contrat .meta,
body.theme-app2 .candidat, body.theme-app2 .vide, body.theme-app2 .aucun{ font-family:var(--cd2-police-corps,'Inter',sans-serif); }
