/* Dukkani Back-office — Système visuel (ds.css) */

:root {
  --calcaire: #F3F2EC;
  --papier: #FBFAF6;
  --encre: #15201B;
  --ardoise: #5C6661;
  --filet: #DEDCD3;
  --vert: #1E5B47;
  --vert-voile: #E3ECE6;
  --vert-fonce: #164536;
  --alerte: #8A4B12;
  --alerte-voile: #F4EADC;
  --res: cubic-bezier(.32, .72, 0, 1);

  --esp-1: 6px;
  --esp-2: 10px;
  --esp-3: 16px;
  --esp-4: 24px;
  --esp-5: 36px;
  --esp-6: 56px;
  --esp-7: 88px;
}

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

html {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--encre);
  background-color: var(--calcaire);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--calcaire);
  color: var(--encre);
  line-height: 1.5;
  font-size: 15px;
}

/* Accessibilité et focus */
:focus-visible {
  outline: 2px solid var(--vert);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Bandeau d'alerte / notification */
.alerte-banniere {
  position: sticky;
  top: 0;
  z-index: 300;
  padding: var(--esp-2) var(--esp-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--esp-3);
  font-size: 14px;
  font-weight: 500;
  animation: glisserBas 0.25s var(--res);
}

.alerte-banniere-erreur {
  background-color: var(--alerte-voile);
  color: var(--alerte);
  border-bottom: 1px solid rgba(138, 75, 18, 0.2);
}

.alerte-banniere-succes {
  background-color: var(--vert-voile);
  color: var(--vert-fonce);
  border-bottom: 1px solid rgba(30, 91, 71, 0.2);
}

.alerte-fermer {
  background: transparent;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  padding: 4px;
  border-radius: 4px;
}

/* Île de navigation flottante */
.nav-flottante-conteneur {
  position: sticky;
  top: 14px;
  z-index: 100;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 var(--esp-3);
}

.nav-flottante {
  background-color: rgba(251, 250, 246, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 999px;
  padding: var(--esp-1) var(--esp-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--esp-2);
  box-shadow: 0 2px 8px rgba(21, 32, 27, 0.05), 0 8px 24px -4px rgba(21, 32, 27, 0.08);
}

.nav-marque {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-marque img {
  height: 28px;
  width: auto;
  display: block;
}

.nav-liens {
  display: flex;
  align-items: center;
  gap: var(--esp-1);
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.nav-liens::-webkit-scrollbar {
  display: none;
}

.nav-lien {
  display: inline-flex;
  align-items: center;
  gap: var(--esp-1);
  padding: 7px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ardoise);
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  transition: background-color 0.15s var(--res), color 0.15s var(--res);
}

.nav-lien:hover {
  background-color: rgba(21, 32, 27, 0.04);
  color: var(--encre);
}

.nav-lien.actif {
  background-color: var(--vert-voile);
  color: var(--vert-fonce);
  font-weight: 600;
}

.nav-lien .pastille-compte {
  background-color: var(--alerte);
  color: var(--papier);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--esp-2);
  flex-shrink: 0;
}

/* Zone principale */
.zone-principale {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: var(--esp-5) var(--esp-3) var(--esp-6);
  min-width: 0;
}

/* Titres */
.titre-page {
  font-size: clamp(34px, 4vw, 44px);
  letter-spacing: -0.04em;
  font-weight: 700;
  line-height: 1.05;
  color: var(--encre);
  margin-bottom: 0;
}

.titre-section {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--encre);
  margin-bottom: var(--esp-3);
}

.chapeau-page {
  color: var(--ardoise);
  font-size: 15px;
  margin-top: 10px;
  margin-bottom: var(--esp-4);
}

/* Système de Cartes : Coque + Cœur */
.coque {
  background-color: rgba(21, 32, 27, 0.035);
  padding: 5px;
  border-radius: 26px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.coeur {
  background-color: var(--papier);
  border-radius: 21px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75),
              0 2px 4px rgba(21, 32, 27, 0.03),
              0 12px 32px -8px rgba(21, 32, 27, 0.10);
  padding: var(--esp-4);
  flex: 1;
  min-width: 0;
}

/* Boutons pilules */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--esp-2);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.15s var(--res), opacity 0.15s var(--res), background-color 0.15s var(--res);
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  opacity: 0.93;
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primaire {
  background-color: var(--vert);
  color: var(--papier);
}

.btn-primaire:hover:not(:disabled) {
  background-color: var(--vert-fonce);
}

.btn-primaire .disque-icone {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.btn-secondaire {
  background-color: var(--vert-voile);
  color: var(--vert-fonce);
}

.btn-secondaire:hover:not(:disabled) {
  background-color: #d7e4dc;
}

.btn-alerte {
  background-color: var(--alerte-voile);
  color: var(--alerte);
}

.btn-alerte:hover:not(:disabled) {
  background-color: #ecdeca;
}

.btn-discret {
  background-color: rgba(21, 32, 27, 0.05);
  color: var(--encre);
}

.btn-discret:hover:not(:disabled) {
  background-color: rgba(21, 32, 27, 0.08);
}

.btn-icone {
  padding: 8px;
  border-radius: 50%;
}

.btn-compact {
  padding: 5px 12px;
  font-size: 13px;
  line-height: 1.3;
}

/* Pastilles de statut */
.pastille {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

.pastille-point {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

.pastille-succes {
  background-color: var(--vert-voile);
  color: var(--vert-fonce);
}

.pastille-alerte {
  background-color: var(--alerte-voile);
  color: var(--alerte);
}

.pastille-neutre {
  background-color: rgba(21, 32, 27, 0.06);
  color: var(--ardoise);
}

/* Formulaires et champs */
.groupe-champ {
  display: flex;
  flex-direction: column;
  gap: var(--esp-1);
  margin-bottom: var(--esp-3);
  min-width: 0;
}

.label-champ {
  font-size: 13px;
  font-weight: 600;
  color: var(--ardoise);
}

.label-champ .requis {
  color: var(--alerte);
  margin-left: 2px;
}

.champ-saisie,
.champ-select {
  font-family: inherit;
  font-size: 15px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid var(--filet);
  background-color: var(--papier);
  color: var(--encre);
  width: 100%;
  transition: border-color 0.15s var(--res), box-shadow 0.15s var(--res);
}

.champ-saisie:focus,
.champ-select:focus {
  border-color: var(--vert);
  outline: none;
  box-shadow: 0 0 0 3px var(--vert-voile);
}

.champ-aide {
  font-size: 12px;
  color: var(--ardoise);
}

/* Groupes de boutons radio style pastilles */
.radios-pastilles {
  display: flex;
  gap: var(--esp-1);
  flex-wrap: wrap;
}

.radios-pastilles label {
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 999px;
  background-color: rgba(21, 32, 27, 0.04);
  color: var(--ardoise);
  font-size: 13px;
  font-weight: 600;
  transition: background-color 0.15s var(--res), color 0.15s var(--res);
  user-select: none;
}

.radios-pastilles input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radios-pastilles input[type="radio"]:checked + span {
  color: var(--vert-fonce);
}

.radios-pastilles label.selectionne {
  background-color: var(--vert-voile);
  color: var(--vert-fonce);
}

/* Tableaux */
.table-scroll {
  overflow-x: auto;
  width: 100%;
  -webkit-overflow-scrolling: touch;
  border-radius: 16px;
}

.table-donnees {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.table-donnees thead th {
  position: sticky;
  top: 0;
  background-color: var(--papier);
  color: var(--ardoise);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: var(--esp-2) var(--esp-2);
  border-bottom: 1px solid var(--filet);
  /* Les intitulés longs (« Fiches proposées ») passent à la ligne : sinon ils
     élargissent la table et poussent la colonne d'actions hors de la carte. */
  white-space: normal;
  vertical-align: bottom;
  z-index: 2;
}

.table-donnees tbody td {
  padding: var(--esp-3) var(--esp-2);
  border-bottom: 1px solid rgba(222, 220, 211, 0.5);
  color: var(--encre);
}

.table-donnees tbody tr {
  transition: background-color 0.1s var(--res);
}

.table-donnees tbody tr:hover {
  background-color: rgba(21, 32, 27, 0.02);
}

.table-donnees tbody tr.cliquable {
  cursor: pointer;
}

.col-nombre {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-compacte thead th {
  padding: var(--esp-1) var(--esp-2);
}

.table-compacte tbody td {
  padding: var(--esp-2);
}

.col-actions {
  white-space: nowrap;
  text-align: right;
  width: 1%;
}

.cellule-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--esp-1);
  white-space: nowrap;
}

/* Tiroir / Modale */
.tiroir-voile {
  position: fixed;
  inset: 0;
  background-color: rgba(21, 32, 27, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: apparaitre 0.2s var(--res);
}

.tiroir-boite {
  background-color: var(--papier);
  width: 100%;
  max-height: 90vh;
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -8px 36px rgba(21, 32, 27, 0.15);
  display: flex;
  flex-direction: column;
  animation: remonterMobile 0.25s var(--res);
  overflow: hidden;
}

.tiroir-poignee {
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background-color: var(--filet);
  margin: var(--esp-2) auto 0;
}

.tiroir-entete {
  padding: var(--esp-3) var(--esp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--filet);
  flex-shrink: 0;
}

.tiroir-titre {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--encre);
}

.tiroir-corps {
  padding: var(--esp-4);
  overflow-y: auto;
  flex: 1;
}

.tiroir-pied {
  padding: var(--esp-3) var(--esp-4);
  border-top: 1px solid var(--filet);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--esp-2);
  background-color: rgba(21, 32, 27, 0.015);
  flex-shrink: 0;
}

@media (min-width: 681px) {
  .tiroir-voile {
    align-items: center;
  }
  .tiroir-boite {
    max-width: 580px;
    border-radius: 26px;
    animation: zoomerDesktop 0.2s var(--res);
    margin: var(--esp-4);
  }
  .tiroir-poignee {
    display: none;
  }
}

/* Grilles */
.grille-chiffres {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--esp-3);
  margin-bottom: var(--esp-4);
}

.carte-chiffre-valeur {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--encre);
  line-height: 1.1;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.carte-chiffre-libelle {
  font-size: 13px;
  color: var(--ardoise);
  font-weight: 500;
}

@media (min-width: 1040px) {
  .grille-dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(330px, 0.85fr);
    gap: var(--esp-4);
    align-items: start;
  }
}

.grille-colonnes {
  display: flex;
  flex-direction: column;
  gap: var(--esp-4);
  min-width: 0;
}

/* Barres CSS / SVG */
.barre-ligne {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: var(--esp-2);
}

.barre-ligne-entete {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.barre-svg {
  width: 100%;
  height: 8px;
  display: block;
}

.barre-bg {
  fill: rgba(21, 32, 27, 0.06);
}

.barre-fill-vert {
  fill: var(--vert);
}

.barre-fill-alerte {
  fill: var(--alerte);
}

.barre-fill-ardoise {
  fill: var(--ardoise);
}

.graphique-usage-svg {
  width: 100%;
  height: 120px;
  display: block;
}

/* Chargement Fantôme (Skeleton) */
.fantome {
  background: linear-gradient(90deg, rgba(21, 32, 27, 0.04) 25%, rgba(21, 32, 27, 0.09) 50%, rgba(21, 32, 27, 0.04) 75%);
  background-size: 200% 100%;
  animation: scintillement 1.8s infinite var(--res);
  border-radius: 10px;
  display: block;
}

.fantome-texte {
  height: 16px;
  margin-bottom: 8px;
}

.fantome-titre {
  height: 32px;
  width: 60%;
  margin-bottom: 16px;
}

.fantome-carte {
  height: 90px;
}

/* Écran de connexion */
.connexion-conteneur {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--esp-4);
}

.connexion-carte {
  width: 100%;
  max-width: 420px;
}

.connexion-logo {
  display: flex;
  justify-content: center;
  margin-bottom: var(--esp-5);
}

.connexion-logo img {
  height: 48px;
  width: auto;
}

/* File de validation */
.groupe-validation {
  margin-bottom: var(--esp-4);
}

.groupe-validation.selectionne .coeur {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75),
              0 0 0 2px var(--vert),
              0 12px 32px -8px rgba(21, 32, 27, 0.15);
}

.saisies-boutiques-grille {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--esp-3);
  margin-bottom: var(--esp-3);
}

.carte-saisie {
  background-color: rgba(21, 32, 27, 0.025);
  border-radius: 14px;
  padding: var(--esp-3);
  display: flex;
  gap: var(--esp-3);
}

.vignette-produit {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 10px;
  background-color: var(--calcaire);
  flex-shrink: 0;
}

.vignette-absente {
  width: 68px;
  height: 68px;
  border-radius: 10px;
  background-color: rgba(21, 32, 27, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ardoise);
  font-size: 11px;
  flex-shrink: 0;
}

/* Zone de dépôt import */
.zone-depot {
  border: 2px dashed var(--filet);
  border-radius: 18px;
  padding: var(--esp-5) var(--esp-4);
  text-align: center;
  background-color: rgba(251, 250, 246, 0.6);
  cursor: pointer;
  transition: border-color 0.15s var(--res), background-color 0.15s var(--res);
  display: block;
}

.zone-depot:hover,
.zone-depot.survol {
  border-color: var(--vert);
  background-color: var(--vert-voile);
}

.code-licence-grand {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: clamp(26px, 5vw, 36px);
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: var(--esp-4);
  background-color: rgba(21, 32, 27, 0.04);
  border-radius: 16px;
  text-align: center;
  color: var(--vert-fonce);
  user-select: all;
  margin: var(--esp-3) 0;
}

/* Filtres catalogue */
.filtres-ligne {
  display: flex;
  align-items: center;
  gap: var(--esp-2);
  flex-wrap: wrap;
  margin-bottom: var(--esp-3);
}

.pastille-filtre {
  border: 1px solid var(--filet);
  background-color: var(--papier);
  color: var(--ardoise);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s var(--res);
}

.pastille-filtre:hover {
  border-color: var(--ardoise);
  color: var(--encre);
}

.pastille-filtre.actif {
  background-color: var(--vert-voile);
  border-color: var(--vert);
  color: var(--vert-fonce);
  font-weight: 600;
}

/* Pagination */
.pagination-ligne {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--esp-3);
  border-top: 1px solid var(--filet);
  font-size: 14px;
  color: var(--ardoise);
}

/* Animations */
@keyframes scintillement {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes glisserBas {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes apparaitre {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes remonterMobile {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes zoomerDesktop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Utilitaires sans styles inline */
.mt-1 { margin-top: var(--esp-1); }
.mt-2 { margin-top: var(--esp-2); }
.mt-3 { margin-top: var(--esp-3); }
.mt-4 { margin-top: var(--esp-4); }
.mb-1 { margin-bottom: var(--esp-1); }
.mb-2 { margin-bottom: var(--esp-2); }
.mb-3 { margin-bottom: var(--esp-3); }
.mb-4 { margin-bottom: var(--esp-4); }
.h-200 { height: 200px; }
.w-full { width: 100%; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.badge-code { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 13px; font-weight: 600; }


/* Activité : lignes de boutique cliquables (détail en dessous) */
.table-donnees tbody tr[role="button"] { cursor: pointer; }
.table-donnees tbody tr[role="button"]:focus-visible { outline: 2px solid var(--vert); outline-offset: -2px; }
.table-donnees tbody tr.ligne-active { background: var(--vert-voile); }
.activite-vue .col-nombre { white-space: nowrap; }
.activite-vue > .actions-champ { margin-bottom: var(--esp-3); }
.activite-detail { scroll-margin-top: 104px; }   /* sous la barre de navigation fixe */

/* Squelette du graphique du tableau de bord (hauteur en classe : la CSP interdit les styles en ligne) */
.fantome-graphique { height: 200px; }
