/* ============================================================
   CAROLUS — Design system (source : DESIGN.md + BrandBoard)
   Toutes les valeurs vivent ici. Rien en dur ailleurs.
   ============================================================ */

/* ---------- Polices (self-hosted, fournies par le client) ---------- */
@font-face { font-family: "Gilroy"; src: url("../fonts/gilroy-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Gilroy"; src: url("../fonts/gilroy-medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Gilroy"; src: url("../fonts/gilroy-semibold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Gilroy"; src: url("../fonts/gilroy-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Gilroy"; src: url("../fonts/gilroy-lightitalic.woff2") format("woff2"); font-weight: 300; font-style: italic; font-display: swap; }
@font-face { font-family: "Now"; src: url("../fonts/now-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Now"; src: url("../fonts/now-medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Now"; src: url("../fonts/now-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  /* Palette (BrandBoard + dérivés, contrastes AA — voir DESIGN.md §4) */
  --navy-900: #0F2437;
  --navy-800: #16324A;
  --navy-600: #2C4E6B;
  --texte: #0F2437;
  --texte-secondaire: #51677A;
  --texte-sur-navy: #F9FAFB;
  --texte-sur-navy-2: #A6C5D6;
  --azur: #A6C5D6;
  --bleu-clair: #DCE9F8;
  --fond: #F4F7FA;
  --surface: #FDFEFF;
  --bordure: #E3EAF1;
  --ok: #2E7D5B;
  --attente: #9A6B25;
  --alerte: #A5453C;

  /* Typographie */
  --police-titres: "Gilroy", system-ui, -apple-system, sans-serif;
  --police-ui: "Now", system-ui, -apple-system, sans-serif;

  /* Rayons (système verrouillé : cartes 14, champs 10, pilules 999) */
  --rayon-carte: 14px;
  --rayon-champ: 10px;
  --rayon-pilule: 999px;

  /* Espacements */
  --e-1: 4px; --e-2: 8px; --e-3: 12px; --e-4: 16px;
  --e-5: 24px; --e-6: 32px; --e-7: 40px; --e-8: 64px;

  /* Ombres douces teintées navy (jamais de noir pur) */
  --ombre-1: 0 1px 2px rgba(15, 36, 55, 0.05), 0 4px 12px rgba(15, 36, 55, 0.05);
  --ombre-2: 0 2px 4px rgba(15, 36, 55, 0.06), 0 12px 32px rgba(15, 36, 55, 0.09);

  --transition: 160ms cubic-bezier(0.16, 1, 0.3, 1);
  --largeur-sidebar: 232px;
  --hauteur-topbar: 64px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--police-ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--texte);
  background: var(--fond);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--police-titres); letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 28px; font-weight: 600; }
h2 { font-size: 20px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
a { color: var(--navy-600); }
img { max-width: 100%; height: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--e-2);
  border-radius: var(--rayon-pilule);
  font-family: var(--police-ui);
  font-weight: 500;
  font-size: 15px;
  padding: 12px 24px;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), transform var(--transition), border-color var(--transition);
  border: 1px solid transparent;
}
.btn:active { transform: scale(0.98); }
.btn--primaire { background: var(--navy-900); color: var(--texte-sur-navy); }
.btn--primaire:hover { background: var(--navy-800); transform: translateY(-1px); }
.btn--secondaire { background: transparent; color: var(--navy-900); border-color: var(--azur); }
.btn--secondaire:hover { border-color: var(--navy-600); background: var(--bleu-clair); }
.btn--petit { padding: 7px 16px; font-size: 13px; }
.btn:focus-visible, a:focus-visible, input:focus-visible, button:focus-visible {
  outline: 2px solid var(--navy-600);
  outline-offset: 2px;
}

/* ---------- Champs ---------- */
.champ { display: flex; flex-direction: column; gap: var(--e-2); }
.champ label { font-size: 13px; font-weight: 500; color: var(--texte); }
.champ input {
  font-family: var(--police-ui);
  font-size: 15px;
  color: var(--texte);
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-champ);
  padding: 12px 14px;
  transition: border-color var(--transition);
}
.champ input:hover { border-color: var(--azur); }
.champ input:focus { border-color: var(--navy-600); outline: none; }
.champ input::placeholder { color: var(--texte-secondaire); }

/* ---------- Statuts : point sémantique + texte encre (DESIGN.md §6 — jamais de pilule pastel) ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--e-2);
  font-size: 13px;
  font-weight: 500;
  color: var(--texte);
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--rayon-pilule);
  flex-shrink: 0;
}
.badge--ok::before { background: var(--ok); }
.badge--attente::before { background: var(--attente); }
.badge--alerte { color: var(--alerte); }
.badge--alerte::before { background: var(--alerte); }
.badge--neutre { color: var(--texte-secondaire); }
.badge--neutre::before { background: var(--azur); }

/* ---------- Avatars initiales ---------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--rayon-pilule);
  background: var(--navy-600);
  color: var(--texte-sur-navy);
  font-family: var(--police-titres);
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.avatar--azur { background: var(--azur); color: var(--navy-900); }

/* ---------- Filigrane croissant (signature) ---------- */
.filigrane {
  position: absolute;
  pointer-events: none;
  opacity: 0.08;
  color: var(--texte-sur-navy);
}

/* ============================================================
   ÉCRAN CONNEXION
   ============================================================ */
.auth {
  display: grid;
  grid-template-columns: 45fr 55fr;
  min-height: 100dvh;
}
.auth-panneau {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--navy-900) 0%, var(--navy-800) 100%);
  color: var(--texte-sur-navy);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--e-7);
}
.auth-panneau .filigrane {
  width: 620px;
  right: -180px;
  bottom: -140px;
}
.auth-logo { width: 168px; }
.auth-accroche { position: relative; max-width: 24ch; }
.auth-accroche h2 {
  font-size: 34px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
}
.auth-accroche p {
  font-family: var(--police-titres);
  font-weight: 300;
  font-style: italic;
  font-size: 18px;
  color: var(--texte-sur-navy-2);
  margin-top: var(--e-4);
  line-height: 1.6;
}
.auth-pied { position: relative; font-size: 13px; color: var(--texte-sur-navy-2); }
.auth-scene {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--e-6);
}
.auth-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: var(--e-4); }
.auth-form h1 { font-size: 26px; }
.auth-form .sous-titre { color: var(--texte-secondaire); font-size: 15px; margin-top: calc(-1 * var(--e-2)); }
.separateur {
  display: flex;
  align-items: center;
  gap: var(--e-3);
  color: var(--texte-secondaire);
  font-size: 12px;
}
.separateur::before, .separateur::after { content: ""; height: 1px; flex: 1; background: var(--bordure); }
.note-invitation {
  font-size: 13px;
  color: var(--texte-secondaire);
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-champ);
  padding: var(--e-3) var(--e-4);
  line-height: 1.55;
}
.g-logo { width: 18px; height: 18px; flex-shrink: 0; }

/* ============================================================
   SHELL APP (CRM)
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--largeur-sidebar) 1fr;
  min-height: 100dvh;
}
.sidebar {
  background: var(--navy-900);
  color: var(--texte-sur-navy);
  display: flex;
  flex-direction: column;
  padding: var(--e-5) var(--e-4);
  position: sticky;
  top: 0;
  height: 100dvh;
}
.sidebar-logo { width: 128px; margin: var(--e-2) var(--e-3) var(--e-7); }
.sidebar-nav { display: flex; flex-direction: column; gap: var(--e-1); }
.sidebar-nav a {
  position: relative;
  color: var(--texte-sur-navy-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 10px var(--e-3);
  border-radius: var(--rayon-champ);
  transition: background var(--transition), color var(--transition);
}
.sidebar-nav a:hover { background: var(--navy-800); color: var(--texte-sur-navy); }
.sidebar-nav a[aria-current="page"] { background: var(--navy-800); color: var(--texte-sur-navy); }
.sidebar-nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: var(--rayon-pilule);
  background: var(--azur);
}
.sidebar-section {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy-600);
  margin: var(--e-5) var(--e-3) var(--e-2);
}
.sidebar-profil {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: var(--e-3);
  padding: var(--e-3);
  border-top: 1px solid var(--navy-800);
}
.sidebar-profil .nom { font-size: 14px; font-weight: 500; color: var(--texte-sur-navy); }
.sidebar-profil .role { font-size: 12px; color: var(--texte-sur-navy-2); }

.contenu { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--hauteur-topbar);
  display: flex;
  align-items: center;
  gap: var(--e-4);
  padding: 0 var(--e-6);
  background: var(--surface);
  border-bottom: 1px solid var(--bordure);
}
.recherche {
  flex: 1;
  max-width: 420px;
  font-family: var(--police-ui);
  font-size: 14px;
  color: var(--texte);
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-pilule);
  padding: 9px 18px;
}
.recherche:focus { border-color: var(--navy-600); outline: none; }
.recherche::placeholder { color: var(--texte-secondaire); }
.topbar-droite { margin-left: auto; display: flex; align-items: center; gap: var(--e-4); }

.page { padding: var(--e-6); display: flex; flex-direction: column; gap: var(--e-5); }
.page-entete { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--e-4); }
.page-entete .sous-titre { color: var(--texte-secondaire); font-size: 14px; margin-top: var(--e-1); }

/* Tuiles stats — asymétriques : 1 navy large + 2 claires */
.stats {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--e-4);
}
.stat {
  border-radius: var(--rayon-carte);
  padding: var(--e-5);
  background: var(--surface);
  border: 1px solid var(--bordure);
  box-shadow: var(--ombre-1);
  display: flex;
  flex-direction: column;
  gap: var(--e-2);
}
.stat--navy {
  position: relative;
  overflow: hidden;
  background: linear-gradient(150deg, var(--navy-900), var(--navy-800));
  border: none;
  color: var(--texte-sur-navy);
}
.stat--navy .filigrane { width: 300px; right: -80px; top: -60px; }
.stat .libelle { font-size: 13px; font-weight: 500; color: var(--texte-secondaire); }
.stat--navy .libelle { color: var(--texte-sur-navy-2); }
.stat .valeur { font-family: var(--police-titres); font-size: 34px; font-weight: 600; line-height: 1.1; }
.stat .detail { font-size: 13px; color: var(--texte-secondaire); }
.stat--navy .detail { color: var(--texte-sur-navy-2); }

/* Chips de filtres */
.chips { display: flex; gap: var(--e-2); flex-wrap: wrap; }
.chip {
  font-family: var(--police-ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--texte-secondaire);
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-pilule);
  padding: 7px 16px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.chip:hover { border-color: var(--azur); color: var(--texte); }
.chip[aria-pressed="true"] { background: var(--navy-900); border-color: var(--navy-900); color: var(--texte-sur-navy); }

/* Table clients */
.panneau-table {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-carte);
  box-shadow: var(--ombre-1);
  overflow-x: auto;
}
table { border-collapse: collapse; width: 100%; min-width: 880px; }
thead th {
  font-family: var(--police-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--texte-secondaire);
  text-align: left;
  padding: var(--e-4) var(--e-5);
  border-bottom: 1px solid var(--bordure);
}
tbody td { padding: var(--e-3) var(--e-5); border-bottom: 1px solid var(--bordure); }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bleu-clair); }
.cellule-nom { display: flex; align-items: center; gap: var(--e-3); }
.cellule-nom .nom { font-weight: 500; }
.cellule-nom .objectif { font-size: 12px; color: var(--texte-secondaire); }
.date-relance { font-size: 14px; }
.date-relance small { display: block; font-size: 12px; color: var(--texte-secondaire); }

/* Barre de progression discrète (étapes accompagnement) */
.etapes { display: flex; gap: var(--e-1); align-items: center; }
.etape {
  width: 18px;
  height: 4px;
  border-radius: var(--rayon-pilule);
  background: var(--bordure);
}
.etape--faite { background: var(--navy-600); }
.etapes .texte { font-size: 12px; color: var(--texte-secondaire); margin-left: var(--e-2); }

/* ============================================================
   PORTAIL CLIENT
   ============================================================ */
.portail {
  max-width: 1140px;
  margin: 0 auto;
  padding: var(--e-5) var(--e-5) var(--e-8);
  display: flex;
  flex-direction: column;
  gap: var(--e-5);
}
.portail-topbar {
  height: var(--hauteur-topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--e-4);
}
.portail-topbar img { width: 128px; }
.bandeau {
  position: relative;
  overflow: hidden;
  background: linear-gradient(150deg, var(--navy-900), var(--navy-800));
  color: var(--texte-sur-navy);
  border-radius: var(--rayon-carte);
  padding: var(--e-6);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--e-4);
  box-shadow: var(--ombre-2);
}
.bandeau .filigrane { width: 420px; right: -110px; top: -90px; }
.bandeau h1 { font-size: 26px; }
.bandeau .contexte { color: var(--texte-sur-navy-2); font-size: 14px; margin-top: var(--e-2); }
.bandeau-echeance {
  position: relative;
  background: rgba(249, 250, 251, 0.08);
  border: 1px solid var(--navy-600);
  border-radius: var(--rayon-champ);
  padding: var(--e-3) var(--e-4);
  font-size: 13px;
  color: var(--texte-sur-navy-2);
}
.bandeau-echeance strong { display: block; color: var(--texte-sur-navy); font-size: 15px; font-weight: 500; }

.duo {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: var(--e-5);
  align-items: start;
}

/* Chat */
.chat {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-carte);
  box-shadow: var(--ombre-1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-entete {
  display: flex;
  align-items: center;
  gap: var(--e-3);
  padding: var(--e-4) var(--e-5);
  border-bottom: 1px solid var(--bordure);
}
.chat-entete .titre { font-weight: 600; font-family: var(--police-titres); }
.chat-entete .statut { font-size: 12px; color: var(--texte-secondaire); }
.chat-fil { padding: var(--e-5); display: flex; flex-direction: column; gap: var(--e-4); }
.jour {
  align-self: center;
  font-size: 12px;
  color: var(--texte-secondaire);
  background: var(--fond);
  border-radius: var(--rayon-pilule);
  padding: 3px 14px;
}
.message { display: flex; gap: var(--e-3); max-width: 85%; }
.message .bulle {
  border-radius: var(--rayon-carte);
  padding: var(--e-3) var(--e-4);
  font-size: 14px;
  line-height: 1.55;
}
.message .auteur { font-size: 12px; color: var(--texte-secondaire); margin-bottom: var(--e-1); }
.message--equipe .bulle { background: var(--surface); border: 1px solid var(--bordure); border-top-left-radius: var(--e-1); }
.message--moi { align-self: flex-end; flex-direction: row-reverse; }
.message--moi .bulle { background: var(--bleu-clair); border-top-right-radius: var(--e-1); }
.message--moi .auteur { text-align: right; }

/* Vocal : forme d'onde CSS */
.vocal { display: flex; align-items: center; gap: var(--e-3); min-width: 220px; }
.vocal .lecture {
  width: 34px;
  height: 34px;
  border-radius: var(--rayon-pilule);
  background: var(--navy-900);
  border: none;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.vocal .lecture::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 10px;
  border-left: 10px solid var(--texte-sur-navy);
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
}
.onde { display: flex; align-items: center; gap: 3px; flex: 1; }
.onde span { width: 3px; height: 8px; border-radius: var(--rayon-pilule); background: var(--navy-600); }
.onde span:nth-child(2n) { height: 14px; }
.onde span:nth-child(3n) { height: 18px; }
.onde span:nth-child(4n) { height: 11px; }
.onde span:nth-child(7n) { height: 22px; }
.onde span:nth-child(5n+1) { height: 9px; }
.vocal .duree { font-size: 12px; color: var(--texte-secondaire); }

.chat-saisie {
  display: flex;
  gap: var(--e-3);
  padding: var(--e-4) var(--e-5);
  border-top: 1px solid var(--bordure);
}
.chat-saisie input {
  flex: 1;
  font-family: var(--police-ui);
  font-size: 14px;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-pilule);
  padding: 10px 18px;
  background: var(--fond);
  color: var(--texte);
}
.chat-saisie input:focus { border-color: var(--navy-600); outline: none; }

/* Documents */
.docs {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-carte);
  box-shadow: var(--ombre-1);
  overflow: hidden;
}
.docs-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--e-4) var(--e-5);
  border-bottom: 1px solid var(--bordure);
}
.doc {
  display: flex;
  align-items: center;
  gap: var(--e-3);
  padding: var(--e-4) var(--e-5);
  border-bottom: 1px solid var(--bordure);
  transition: background var(--transition);
}
.doc:hover { background: var(--bleu-clair); }
.doc:last-of-type { border-bottom: none; }
.doc-type {
  font-family: var(--police-titres);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--navy-600);
  background: var(--bleu-clair);
  border-radius: var(--e-1);
  padding: var(--e-2);
  min-width: 40px;
  text-align: center;
}
.doc-infos { flex: 1; min-width: 0; }
.doc-infos .nom { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-infos .meta { font-size: 12px; color: var(--texte-secondaire); }
.doc a { font-size: 13px; font-weight: 500; white-space: nowrap; }
.depot {
  margin: var(--e-4) var(--e-5) var(--e-5);
  border: 1.5px dashed var(--azur);
  border-radius: var(--rayon-champ);
  padding: var(--e-5);
  text-align: center;
  color: var(--texte-secondaire);
  font-size: 13px;
  line-height: 1.6;
  transition: border-color var(--transition), background var(--transition);
}
.depot:hover { border-color: var(--navy-600); background: var(--bleu-clair); }
.depot strong { color: var(--navy-900); }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-panneau { min-height: 300px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: var(--e-3); padding: var(--e-3) var(--e-4); overflow-x: auto; }
  .sidebar-logo { width: 104px; margin: 0 var(--e-3) 0 0; }
  .sidebar-nav { flex-direction: row; }
  .sidebar-section, .sidebar-profil { display: none; }
  .stats { grid-template-columns: 1fr; }
  .duo { grid-template-columns: 1fr; }
  .page, .topbar { padding-left: var(--e-4); padding-right: var(--e-4); }
  .bandeau { flex-direction: column; align-items: flex-start; }
}
