/* Console Audiolibre Sync — charte Audiolibre (base commune, teinte lavande). */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-grotesque-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 100%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("fonts/figtree-latin.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  /* Base commune */
  --fond: #F4F5FA;
  --surface: #FFFFFF;
  --trait: #E3E6F0;
  --bord: #C9CDDD;
  --pastille: #ECEEF5;
  --encre: #22253A;
  --texte-2: #4E5370;
  --muet: #686D88;
  /* Teinte lavande */
  --lavande-50: #EEF1FE;
  --lavande-100: #DCE2FC;
  --lavande-200: #AEBBF5;
  --lavande-600: #4654B8;
  --lavande-700: #343F96;
  /* Signal */
  --alerte: #C8383F;
  --alerte-fond: #FBE4E5;
  --alerte-texte: #8F2228;
  --ok: #3F7D63;
  --ok-fond: #DDEFE6;
  --ok-texte: #2C5E49;
  --attente-fond: #FDE0D3;
  --attente-texte: #8E3A21;

  --titre: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
  --interface: "Figtree", "Segoe UI", system-ui, sans-serif;
  --ombre: 0 1px 2px rgba(34, 37, 58, 0.12);
  --ombre-flottante: 0 18px 48px rgba(34, 37, 58, 0.22);
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--fond);
  color: var(--encre);
  font-family: var(--interface);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
h1, h2, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--lavande-600); text-decoration: none; }
a:hover { color: var(--lavande-700); }
[hidden] { display: none !important; }
svg { flex-shrink: 0; }

:focus-visible { outline: 2px solid var(--lavande-600); outline-offset: 2px; }

.noscript { padding: 40px; text-align: center; color: var(--texte-2); }

.titre {
  font-family: var(--titre);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.etiquette {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muet);
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.muet { color: var(--muet); }
.secondaire { color: var(--texte-2); }

/* ---------------------------------------------------------------- boutons */

.bouton {
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: var(--lavande-200);
  color: var(--encre);
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  transition: background-color 0.12s ease;
}
.bouton:hover { background: #9DACF0; }
.bouton:disabled { opacity: 0.55; cursor: default; }
.bouton.contour {
  background: var(--surface);
  border: 1px solid var(--bord);
}
.bouton.contour:hover { background: var(--fond); }
.bouton.discret {
  background: transparent;
  color: var(--texte-2);
  padding: 0 16px;
}
.bouton.discret:hover { background: var(--pastille); color: var(--encre); }
.bouton.petit { height: 36px; padding: 0 12px; border-radius: 10px; font-size: 14px; }
.bouton.large { width: 100%; }
.bouton.icone { width: 44px; padding: 0; }

/* ----------------------------------------------------------------- champs */

.champ { display: flex; flex-direction: column; gap: 6px; }
.champ > label, .champ > .libelle { font-size: 14px; font-weight: 600; }
.champ .aide { font-size: 13px; color: var(--muet); }
.saisie {
  height: 44px;
  width: 100%;
  padding: 0 14px;
  border: 1px solid var(--bord);
  border-radius: 12px;
  background: var(--surface);
  color: var(--encre);
  font-size: 15px;
}
.saisie::placeholder { color: var(--muet); }
.saisie:focus { outline: 2px solid var(--lavande-600); outline-offset: 0; border-color: var(--lavande-600); }
.saisie.mono, .mono { font-family: ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace; font-size: 14px; }
.rangee { display: flex; gap: 8px; align-items: center; }
.rangee > .saisie { flex: 1 1 auto; min-width: 0; }

.recherche {
  height: 44px;
  width: 300px;
  max-width: 100%;
  padding: 0 14px;
  border: 1px solid var(--bord);
  border-radius: 12px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muet);
}
.recherche:focus-within { outline: 2px solid var(--lavande-600); border-color: var(--lavande-600); }
.recherche input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--encre);
}

.message {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
}
.message.erreur { background: var(--alerte-fond); color: var(--alerte-texte); }
.message.info { background: var(--lavande-50); color: var(--texte-2); }

/* -------------------------------------------------------------- connexion */

.connexion {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 32px 16px;
}
.connexion .marque { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.connexion .marque .titre { font-size: 40px; line-height: 1; }
.connexion .marque .sous-titre { margin-top: 8px; color: var(--texte-2); }
.carte {
  background: var(--surface);
  border-radius: 20px;
  padding: 24px;
}
.connexion .carte {
  width: 100%;
  max-width: 400px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.connexion .carte h1 { font-size: 26px; }
.connexion form { display: flex; flex-direction: column; gap: 16px; }
.connexion .pied { font-size: 13px; color: var(--muet); text-align: center; }

/* ----------------------------------------------------------------- coquille */

.coquille { min-height: 100vh; display: flex; }
.menu {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--trait);
  padding: 24px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.menu .marque { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.menu .marque .titre { font-size: 24px; line-height: 1; }
.menu .marque .role { margin-top: 6px; }
.menu nav { display: flex; flex-direction: column; gap: 4px; }
.entree {
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--texte-2);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
}
button.entree:hover, a.entree:hover { background: var(--fond); color: var(--encre); }
.entree[aria-current="page"] { background: var(--lavande-100); color: var(--encre); font-weight: 600; }
.entree[aria-disabled="true"] { color: var(--muet); cursor: default; }
.entree .bientot {
  margin-left: auto;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--pastille);
  color: var(--texte-2);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}
.menu .bas { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.menu .qui {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--fond);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  min-width: 0;
}
.menu .qui .nom { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu .qui .detail { font-size: 12px; color: var(--muet); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.contenu {
  flex: 1 1 auto;
  min-width: 0;
  padding: 32px 40px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.entete h1 { font-size: 32px; }
.entete .actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.bandeau {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--alerte-fond);
  color: var(--alerte-texte);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.bandeau .texte { flex: 1 1 260px; }
.bandeau strong { font-weight: 700; }
.bandeau .bouton { background: var(--surface); }
.bandeau .bouton:hover { background: var(--fond); }

.filtres { display: flex; gap: 8px; flex-wrap: wrap; }
.filtre {
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--texte-2);
  font-size: 14px;
  font-weight: 600;
}
.filtre:hover { color: var(--encre); }
.filtre[aria-pressed="true"] { background: var(--encre); color: #FFFFFF; }

/* ---------------------------------------------------------------- tableau */

.tableau-carte { padding: 8px 8px 8px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 14px 14px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muet);
  line-height: 1.3;
  vertical-align: bottom;
}
td { padding: 14px 14px; border-top: 1px solid var(--trait); vertical-align: middle; }
td.nombre, th.nombre { text-align: right; font-variant-numeric: tabular-nums; }
td.action { text-align: right; white-space: nowrap; }
tbody tr:hover td { background: #FAFAFD; }

.personne { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pastille-nom {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--lavande-100);
  color: var(--lavande-700);
  font-family: var(--titre);
  font-weight: 700;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.personne .nom { font-weight: 600; }
.personne .courriel { font-size: 13px; color: var(--texte-2); overflow-wrap: break-word; }
.personne > div:last-child { min-width: 0; }
td.date { white-space: nowrap; }

.etat {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.etat.actif { background: var(--ok-fond); color: var(--ok-texte); }
.etat.inactif { background: var(--pastille); color: var(--texte-2); }

.espace { min-width: 92px; }
.espace .valeur { font-variant-numeric: tabular-nums; white-space: nowrap; }
.jauge { margin-top: 6px; height: 4px; border-radius: 999px; background: var(--trait); overflow: hidden; }
.jauge > span { display: block; height: 4px; border-radius: 999px; background: var(--lavande-600); }

.vide {
  padding: 56px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  color: var(--texte-2);
}
.vide .titre { font-size: 22px; color: var(--encre); }

/* ---------------------------------------------------------------- fenêtres */

dialog {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  color: var(--encre);
  box-shadow: var(--ombre-flottante);
  overflow: auto;
}
dialog::backdrop { background: rgba(34, 37, 58, 0.42); }
dialog form, dialog .corps { padding: 28px; display: flex; flex-direction: column; gap: 18px; }
dialog h2 { font-size: 24px; }
dialog .pied { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; flex-wrap: wrap; }

.secret {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--lavande-50);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.secret .ligne { display: flex; align-items: baseline; gap: 10px; }
.secret .ligne .etiquette { width: 104px; flex-shrink: 0; }
.secret .valeur { font-weight: 600; overflow-wrap: anywhere; user-select: all; }

/* ------------------------------------------------------------------ toasts */

#toasts {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--encre);
  color: #FFFFFF;
  font-weight: 500;
  box-shadow: var(--ombre-flottante);
  max-width: 360px;
}

/* -------------------------------------------------------- espace utilisateur */

.fiche { max-width: 560px; display: flex; flex-direction: column; gap: 18px; }
.fiche .lignes { display: flex; flex-direction: column; }
.fiche .lignes > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--trait);
}
.fiche .lignes > div > span:last-child { font-weight: 600; text-align: right; overflow-wrap: anywhere; }

/* ----------------------------------------------------------- petits écrans */

/* Écrans moyens : on retire les colonnes secondaires plutôt que de faire défiler. */
@media (max-width: 1279px) and (min-width: 1021px) {
  .col-creation { display: none; }
}
@media (max-width: 1120px) and (min-width: 1021px) {
  .col-appareils { display: none; }
}

@media (max-width: 1020px) {
  .coquille { flex-direction: column; }
  .menu {
    width: auto;
    height: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--trait);
    padding: 12px 16px;
    gap: 12px;
  }
  .menu .marque { flex-direction: row; gap: 8px; align-items: center; }
  .menu .marque svg { width: 36px; height: 36px; }
  .menu .marque .role { margin: 0 0 0 auto; }
  .menu nav { flex-direction: row; overflow-x: auto; }
  .menu nav .entree { width: auto; flex-shrink: 0; }
  .menu .bas { margin-top: 0; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .menu .bas .entree { width: auto; }
  .menu .qui { margin: 0 auto 0 0; }
  .contenu { padding: 20px 16px 32px; }
  .entete h1 { font-size: 28px; }
  .recherche { width: 100%; }
  .entete .actions { width: 100%; }
  .entete .actions .bouton { flex: 1 1 auto; }

  .tableau-carte { padding: 4px 16px; }
  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tr { padding: 14px 0; border-top: 1px solid var(--trait); }
  tbody tr:first-child { border-top: 0; }
  tbody tr:hover td { background: transparent; }
  td { border: 0; padding: 4px 0; }
  td.nombre, td.action { text-align: left; }
  td[data-libelle] { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
  td[data-libelle]::before {
    content: attr(data-libelle);
    font-size: 13px;
    color: var(--muet);
    flex-shrink: 0;
  }
  .espace { min-width: 0; text-align: right; }
  .jauge { width: 110px; margin-left: auto; }
  td.action { padding-top: 10px; }
  #toasts { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }
}

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