/* Charte graphique Elipsys
   - Rouge brique     #C42127
   - Gris foncé titres #454545
   - Fond clair        #F5F5F6 / blanc
   - Police arrondie moderne */

:root {
  --rouge: #C42127;
  --rouge-clair: #FBECEC;
  --gris-fonce: #454545;
  --gris-moyen: #777;
  --gris-clair: #D6D6D9;
  --fond: #F5F5F6;
  --carte: #FAFAFB;
  --blanc: #fff;
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Poppins", "Segoe UI", system-ui, sans-serif;
  background: var(--fond);
  color: var(--gris-fonce);
  line-height: 1.5;
}

/* En-tête */
.entete {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 40px;
  background: var(--blanc);
  border-bottom: 1px solid #eee;
}
.logo-img {
  height: 40px;
  width: auto;
  display: block;
}
.titre-app {
  border-left: 1px solid #ddd;
  padding-left: 20px;
  color: var(--gris-moyen);
  font-weight: 500;
}

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: var(--blanc);
  border-bottom: 1px solid #eee;
}
.etape {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gris-moyen);
  font-weight: 500;
  font-size: 14px;
}
.etape .puce {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--gris-clair);
  color: var(--blanc);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
}
.etape.active { color: var(--rouge); }
.etape.active .puce { background: var(--rouge); }
.etape.faite .puce { background: var(--rouge); }
.trait { width: 60px; height: 2px; background: var(--gris-clair); }

/* Contenu */
.contenu { max-width: 1100px; margin: 0 auto; padding: 40px 24px; }
.ecran { display: none; }
.ecran.active { display: block; }

h1 { font-size: 30px; font-weight: 700; color: var(--gris-fonce); }
.sous-titre { color: var(--gris-moyen); margin: 10px 0 28px; max-width: 640px; }

/* Champs */
.champs { display: flex; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.champs label { flex: 1; min-width: 220px; font-size: 13px; color: var(--gris-moyen); font-weight: 500; }
.champs input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid var(--gris-clair);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
}

/* Zone de dépôt */
.zone-depot {
  border: 2px dashed var(--gris-clair);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  background: var(--carte);
  transition: border-color .2s, background .2s;
}
.zone-depot.survol { border-color: var(--rouge); background: var(--rouge-clair); }
.icone-upload {
  width: 60px; height: 60px;
  margin: 0 auto 16px;
  background: var(--rouge-clair);
  color: var(--rouge);
  border-radius: 16px;
  display: grid; place-items: center;
  font-size: 24px;
}
.zone-depot .gros { font-size: 18px; font-weight: 600; color: var(--gris-fonce); }
.zone-depot .petit { color: var(--gris-moyen); margin: 4px 0 16px; }
.formats { font-size: 12px; color: var(--gris-moyen); margin-top: 14px; }

/* Liste de fichiers */
.liste-fichiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 20px; }
.carte-fichier {
  display: flex; align-items: center; gap: 10px;
  background: var(--carte);
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}
.carte-fichier .nom { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carte-fichier .suppr { cursor: pointer; color: var(--gris-moyen); border: none; background: none; font-size: 16px; }

/* Boutons */
.btn-rouge {
  background: var(--rouge);
  color: var(--blanc);
  border: none;
  border-radius: 24px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.btn-rouge:disabled { background: var(--gris-clair); cursor: not-allowed; }
.btn-blanc {
  background: var(--blanc);
  color: var(--gris-fonce);
  border: 1px solid var(--gris-clair);
  border-radius: 24px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.gros-bouton { padding: 14px 32px; }
.actions { margin-top: 28px; display: flex; justify-content: flex-end; gap: 12px; }
.actions.entre { justify-content: space-between; }

/* Tableau de frais */
.tableau-wrapper { overflow-x: auto; border: 1px solid #eee; border-radius: var(--radius); }
.tableau-frais { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--blanc); }
.tableau-frais th {
  background: var(--carte);
  text-align: left;
  padding: 12px 10px;
  font-size: 12px;
  color: var(--gris-moyen);
  border-bottom: 1px solid #eee;
}
.tableau-frais td { padding: 8px 10px; border-bottom: 1px solid #f0f0f0; }
.tableau-frais input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px;
  font-family: inherit;
  font-size: 14px;
  background: #f7f7f8;
}
.tableau-frais input:focus { border-color: var(--rouge); outline: none; background: var(--blanc); }
.tableau-frais .col-valeur input { text-align: right; }
.tableau-frais .vignette { font-size: 11px; color: var(--rouge); }
.ligne-total td { font-weight: 700; background: var(--carte); }
.suppr-ligne { border: none; background: none; cursor: pointer; color: var(--gris-moyen); font-size: 16px; }
.astuce { margin-top: 14px; font-size: 13px; color: var(--gris-moyen); }
.astuce strong { color: var(--rouge); }

/* Récapitulatif */
.recap {
  background: var(--blanc);
  border: 1px solid #eee;
  border-radius: var(--radius);
  padding: 28px;
  max-width: 460px;
}
.recap .ligne { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #f0f0f0; }
.recap .ligne:last-child { border: none; }
.recap .total {
  margin-top: 12px;
  background: var(--gris-fonce);
  color: var(--blanc);
  border-radius: 10px;
  padding: 16px 20px;
  display: flex; justify-content: space-between;
  font-size: 18px; font-weight: 700;
}
.confirmation-bloc { margin-top: 20px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.confirmation-bloc[hidden] { display: none; }
.confirmation { color: green; font-weight: 600; margin: 0; }

/* Overlay de chargement */
.overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.85);
  display: grid; place-items: center;
  gap: 16px;
  z-index: 100;
}
.overlay[hidden] { display: none; }
.overlay p { margin-top: 16px; color: var(--gris-fonce); font-weight: 500; }
.spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--gris-clair);
  border-top-color: var(--rouge);
  border-radius: 50%;
  animation: tourne 1s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }

/* Zone utilisateur dans l'en-tête (nom connecté + déconnexion) */
.user-zone { margin-left: auto; display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--gris-moyen); }
.user-zone .lien-deco { color: var(--rouge); text-decoration: none; font-weight: 600; }
.user-zone .lien-deco:hover { text-decoration: underline; }

/* Page de connexion (accueil) */
.login-page { display: grid; place-items: center; padding: 64px 24px; }
.login-carte {
  background: var(--blanc);
  border: 1px solid #eee;
  border-radius: var(--radius);
  padding: 40px;
  max-width: 480px;
  text-align: center;
}
.login-carte h1 { font-size: 26px; }
.login-carte .sous-titre { margin: 12px auto 24px; }
.login-carte .gros-bouton { display: inline-block; text-decoration: none; }
.login-note { margin-top: 16px; font-size: 12px; color: var(--gris-moyen); }
.login-erreur {
  background: var(--rouge-clair);
  color: var(--rouge);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
}

/* =========================================================
   V5 — alignement sur le design claude.ai/design
   (écran 1 + chrome partagé : en-tête, stepper)
   ========================================================= */

/* En-tête : avatar + nom + menu compte */
.entete { position: relative; }
.user-zone { margin-left: auto; display: flex; align-items: center; gap: 12px; position: relative; }
.user-nom { font-size: 14px; font-weight: 600; color: var(--gris-fonce); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--gris-fonce); color: var(--blanc);
  border: none; cursor: pointer;
  font-size: 13px; font-weight: 700; font-family: inherit;
  display: grid; place-items: center;
}
.user-menu {
  position: absolute; top: 48px; right: 0;
  background: var(--blanc); border: 1px solid #eee; border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
  padding: 6px; min-width: 150px; z-index: 50;
}
.user-menu[hidden] { display: none; }
.user-menu a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--gris-fonce); text-decoration: none; font-size: 14px; font-weight: 500; }
.user-menu a:hover { background: var(--rouge-clair); color: var(--rouge); }

/* Stepper : barre pleine largeur, cercles reliés par de longs traits fins,
   label « ÉTAPE N » + nom (calqué sur le design claude.ai/design). */
.stepper { padding: 22px 0; justify-content: initial; gap: 0; }
.stepper-inner { display: flex; align-items: center; width: 100%; max-width: 980px; margin: 0 auto; padding: 0 24px; }
.stepper .etape { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.etape-texte { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.etape-texte small { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--gris-moyen); font-weight: 700; }
.etape.active .etape-texte small { color: var(--rouge); }
.stepper .etape .puce { width: 34px; height: 34px; font-size: 14px; background: var(--blanc); border: 2px solid var(--gris-clair); color: var(--gris-moyen); }
.stepper .etape.active .puce, .stepper .etape.faite .puce { background: var(--rouge); border-color: var(--rouge); color: var(--blanc); }
.stepper .trait { flex: 1 1 auto; width: auto; height: 2px; background: var(--gris-clair); margin: 0 18px; }
.stepper .trait.faite { background: var(--rouge); }

/* Eyebrow rouge en haut d'écran */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--rouge); font-size: 12px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; margin-bottom: 10px;
}
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--rouge); }

/* Libellés de champs avec icône */
.label-titre { display: inline-flex; align-items: center; gap: 7px; }
.label-ico { width: 16px; height: 16px; color: var(--rouge); flex: 0 0 auto; }

/* Listes déroulantes (sélecteur de mois) */
.mois-selects { display: flex; gap: 12px; margin-top: 6px; }
.champ-select {
  flex: 1; padding: 12px 14px;
  border: 1px solid var(--gris-clair); border-radius: 10px;
  font-size: 15px; font-family: inherit; background: var(--blanc);
  color: var(--gris-fonce); cursor: pointer;
}
.champ-select:focus { outline: none; border-color: var(--rouge); }

/* Icône d'upload (SVG) */
.icone-upload svg { width: 26px; height: 26px; }

/* Formats acceptés en pastilles */
.formats { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.formats .pill {
  background: var(--gris-clair); color: var(--gris-fonce);
  border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 600;
}

/* En-tête de la liste de justificatifs */
.liste-entete { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 12px; }
.liste-entete[hidden] { display: none; }
.liste-entete h3 { font-size: 15px; color: var(--gris-fonce); }
.liste-compte { font-size: 13px; color: var(--gris-moyen); }

/* Cartes de justificatifs enrichies (icône + type + taille) */
.liste-fichiers { margin-top: 0; }
.carte-fichier { align-items: center; gap: 12px; padding: 12px; }
.carte-ico {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 9px;
  background: var(--rouge-clair); color: var(--rouge);
  display: grid; place-items: center;
}
.carte-ico svg { width: 20px; height: 20px; }
.carte-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.carte-info .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.carte-info .meta { font-size: 11px; color: var(--gris-moyen); display: flex; align-items: center; gap: 6px; }
.carte-info .badge { background: var(--gris-clair); color: var(--gris-fonce); border-radius: 4px; padding: 1px 6px; font-size: 10px; font-weight: 700; letter-spacing: .03em; }
.carte-fichier .suppr { flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; color: var(--gris-moyen); border: none; background: none; cursor: pointer; }
.carte-fichier .suppr svg { width: 16px; height: 16px; }
.carte-fichier .suppr:hover { color: var(--rouge); }

/* Boutons avec icône (sparkle, etc.) */
.btn-rouge { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-ico { width: 18px; height: 18px; flex: 0 0 auto; }

/* ===== V5 — écran 2 (revue) : tableau modulable, rien n'est coupé ===== */
.tableau-frais { table-layout: fixed; }
.tableau-frais th, .tableau-frais td { vertical-align: top; overflow-wrap: anywhere; }
.tableau-frais th { position: relative; white-space: normal; }
.th-val .th-ico { display: inline-flex; vertical-align: middle; margin-right: 5px; color: var(--gris-moyen); }
.th-ico svg { width: 14px; height: 14px; }

/* Poignée de redimensionnement sur le bord droit des en-têtes */
.col-resize { position: absolute; top: 0; right: -4px; width: 8px; height: 100%; cursor: col-resize; z-index: 2; }
.col-resize:hover { background: rgba(196, 33, 39, .15); }

/* Description : zone de texte multi-lignes qui s'agrandit (rien n'est coupé) */
.tableau-frais .f-desc {
  width: 100%; resize: vertical; min-height: 38px; overflow: hidden;
  border: 1px solid transparent; border-radius: 8px; padding: 8px;
  font-family: inherit; font-size: 14px; line-height: 1.35; background: #f7f7f8; color: var(--gris-fonce);
}
.tableau-frais .f-desc:focus { border-color: var(--rouge); outline: none; background: var(--blanc); }

/* Vignette justificatif : icône + badge numéroté cliquable (aperçu de la source) */
.tableau-frais .vignette { text-align: center; }
.vign-btn { position: relative; border: none; background: none; cursor: pointer; color: var(--rouge); padding: 4px; display: inline-flex; }
.vign-btn svg { width: 22px; height: 22px; }
.vign-badge {
  position: absolute; top: -3px; right: -5px;
  background: var(--rouge); color: #fff; border-radius: 999px;
  font-size: 9px; min-width: 15px; height: 15px; padding: 0 3px;
  display: grid; place-items: center; font-weight: 700;
}
.suppr-ligne svg { width: 16px; height: 16px; }
