/* VITOREX : interface du bureau. Aucune bordure, aucun dégradé, aucun translucide. */

:root {
  --fond: #F4F4F1;
  --surface: #FFFFFF;
  --surface-2: #ECECE8;
  --surface-3: #E1E1DB;
  --encre: #17191F;
  --encre-2: #4A4E58;
  --encre-3: #80848D;
  --or: #D9A13B;
  --or-doux: #F6ECD8;
  --primaire: #17191F;
  --primaire-encre: #FFFFFF;
  --ok: #1E7A46;
  --ok-doux: #DDEFE3;
  --alerte: #96620F;
  --alerte-doux: #F7ECD6;
  --erreur: #B0372B;
  --erreur-doux: #F6E1DE;
  --info: #2B4FA8;
  --info-doux: #E2E7F5;
  --nav: #17191F;
  --nav-encre: #B9BCC4;
  --nav-actif: #262931;
  --code: #EDEDE8;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 28px; --s8: 32px;
  --s9: 36px; --s10: 40px; --s11: 44px; --s12: 48px; --s13: 52px; --s14: 56px; --s15: 60px; --s16: 64px;

  --rayon: 12px;
  --rayon-petit: 8px;
  --police: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #121317;
    --surface: #1A1C21;
    --surface-2: #23252C;
    --surface-3: #2E3139;
    --encre: #ECECE8;
    --encre-2: #B6B8BE;
    --encre-3: #868991;
    --or-doux: #3A2F17;
    --primaire: #ECECE8;
    --primaire-encre: #17191F;
    --ok: #63C68F;
    --ok-doux: #17301F;
    --alerte: #E3B160;
    --alerte-doux: #33280F;
    --erreur: #EE8578;
    --erreur-doux: #3A1A16;
    --info: #93A9EE;
    --info-doux: #1B2443;
    --nav: #0C0D10;
    --nav-actif: #1C1E24;
    --code: #15171B;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--fond); color: var(--encre); font: 15px/1.55 var(--police); -webkit-font-smoothing: antialiased; }
a { color: var(--info); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--or); outline-offset: 2px; }
[hidden] { display: none !important; }

.demarrage { display: grid; place-items: center; min-height: 100vh; }
.chargement { font-weight: 700; letter-spacing: 6px; color: var(--encre-3); }

/* --- Coque --------------------------------------------------------------------------------- */

.coque { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.coque > div { min-width: 0; }
.nav {
  background: var(--nav); color: var(--nav-encre); padding: var(--s5) var(--s3);
  display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.marque { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3) var(--s5); color: #FFFFFF; }
.marque img { width: 32px; height: 32px; }
.marque strong { font-size: 16px; letter-spacing: 3px; }
.marque small { display: block; color: var(--nav-encre); font-size: 11px; letter-spacing: 1px; }
.nav a {
  display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); border-radius: var(--rayon-petit);
  color: var(--nav-encre); text-decoration: none; font-weight: 500; font-size: 14.5px;
}
.nav a:hover { background: var(--nav-actif); color: #FFFFFF; }
.nav a.actif { background: var(--nav-actif); color: #FFFFFF; }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .bas { margin-top: auto; }
.nav button.lien { background: none; border: 0; color: var(--nav-encre); padding: var(--s2) var(--s3); text-align: left; cursor: pointer; }

.colonne { display: flex; flex-direction: column; min-height: 100vh; }
.principal { padding: var(--s8) var(--s10); max-width: 1240px; width: 100%; }
.principal.plein { padding: 0; max-width: none; flex: 1; min-height: 0; }
.entete-mobile { display: none; }
.bandeau { padding: var(--s2) var(--s10); font-size: 14px; font-weight: 500; }
.bandeau.alerte { background: var(--alerte-doux); color: var(--alerte); }
.bandeau.bloque { background: var(--erreur-doux); color: var(--erreur); }

.titre-page { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s6); }
.titre-page h1 { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: -0.2px; }
.titre-page p { margin: var(--s1) 0 0; color: var(--encre-2); }

/* --- Éléments ------------------------------------------------------------------------------ */

.carte { background: var(--surface); border-radius: var(--rayon); padding: var(--s6); }
.carte + .carte { margin-top: var(--s4); }
.carte h2 { margin: 0 0 var(--s4); font-size: 15px; font-weight: 650; }
.grille { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grille-2 { display: grid; gap: var(--s4); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grille-3 { display: grid; gap: var(--s4); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grille > *, .grille-2 > *, .grille-3 > * { min-width: 0; }
.grille > .carte, .grille-2 > .carte, .pile > .carte { margin-top: 0; }
.grille + .carte, .grille-2 + .carte, .carte + .grille, .carte + .grille-2, .grille-2 + .grille-2 { margin-top: var(--s4); }
.pile > * + * { margin-top: var(--s3); }
.discret { color: var(--encre-3); font-size: 13px; }
.chiffre { font-size: 28px; font-weight: 650; line-height: 1.15; }
.mt3 { margin-top: var(--s3); }
.mt4 { margin-top: var(--s4); }
.mb3 { margin-bottom: var(--s3); }
.bloc { display: block; }
.carte-lien { display: block; text-decoration: none; color: inherit; }

.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  border: 0; border-radius: var(--rayon-petit); padding: var(--s2) var(--s4); min-height: 38px;
  background: var(--primaire); color: var(--primaire-encre); font-weight: 600; cursor: pointer; text-decoration: none;
}
.bouton:disabled { background: var(--surface-3); color: var(--encre-3); cursor: default; }
.bouton.second { background: var(--surface-2); color: var(--encre); }
.bouton.second:hover { background: var(--surface-3); }
.bouton.danger { background: var(--erreur-doux); color: var(--erreur); }
.bouton.petit { min-height: 30px; padding: var(--s1) var(--s3); font-size: 13px; }
.bouton.pleine { width: 100%; }
.actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.lien-discret { background: none; border: 0; color: var(--encre-3); font-size: 12.5px; cursor: pointer; padding: var(--s1); }
.lien-discret:hover { color: var(--erreur); }

.champ { display: flex; flex-direction: column; gap: var(--s1); }
.champ label { font-weight: 600; font-size: 13px; color: var(--encre-2); }
input[type=text], input[type=password], input[type=time], input[type=url], input[type=number], select, textarea {
  background: var(--surface-2); border: 0; border-radius: var(--rayon-petit); padding: var(--s2) var(--s3); min-height: 40px; width: 100%;
}
textarea { resize: vertical; line-height: 1.5; }
textarea.code { font-family: var(--mono); font-size: 13px; min-height: 420px; }
.case { display: flex; gap: var(--s2); align-items: center; font-weight: 500; }
.case input { width: 18px; height: 18px; accent-color: var(--encre); }

.badge { display: inline-block; padding: 2px var(--s2); border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--encre-2); white-space: nowrap; }
.badge.ok { background: var(--ok-doux); color: var(--ok); }
.badge.alerte { background: var(--alerte-doux); color: var(--alerte); }
.badge.erreur { background: var(--erreur-doux); color: var(--erreur); }
.badge.info { background: var(--info-doux); color: var(--info); }
.badge.or { background: var(--or-doux); color: var(--alerte); }

.jauge { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: var(--s2) 0; }
.jauge span { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 999px; }
.jauge span.alerte { background: var(--alerte); }
.jauge span.bloque { background: var(--erreur); }

.liste { list-style: none; margin: 0; padding: 0; }
.liste > li, .liste > a { display: flex; gap: var(--s3); align-items: center; padding: var(--s3); border-radius: var(--rayon-petit); color: inherit; text-decoration: none; }
.liste > li:nth-child(odd), .liste > a:nth-child(odd) { background: var(--surface-2); }
.liste > a:hover { background: var(--surface-3); }
.liste .grandit { flex: 1; min-width: 0; }
.ellipse { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.onglets { display: flex; gap: var(--s1); flex-wrap: wrap; margin-bottom: var(--s4); }
.onglets button { border: 0; background: var(--surface-2); padding: var(--s1) var(--s3); border-radius: 999px; cursor: pointer; font-weight: 500; }
.onglets button.actif { background: var(--primaire); color: var(--primaire-encre); }

.vide { padding: var(--s8); text-align: center; color: var(--encre-3); }
pre.brut { background: var(--code); border-radius: var(--rayon-petit); padding: var(--s4); overflow: auto; font: 12.5px/1.5 var(--mono); max-height: 70vh; white-space: pre-wrap; word-break: break-word; }

/* --- Texte mis en forme -------------------------------------------------------------------- */

.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: var(--s5) 0 var(--s2); line-height: 1.3; font-weight: 650; }
.md h1 { font-size: 20px; } .md h2 { font-size: 17px; } .md h3, .md h4 { font-size: 15px; }
.md p { margin: var(--s3) 0; }
.md ul, .md ol { margin: var(--s3) 0; padding-left: var(--s6); }
.md li + li { margin-top: var(--s1); }
.md code { background: var(--code); padding: 1px var(--s1); border-radius: 4px; font: 13px var(--mono); }
.md pre { background: var(--code); padding: var(--s3) var(--s4); border-radius: var(--rayon-petit); overflow: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: var(--s3) 0; padding: var(--s2) var(--s4); background: var(--surface-2); border-radius: var(--rayon-petit); }
.md table { border-collapse: collapse; width: 100%; margin: var(--s3) 0; font-size: 14px; display: block; overflow-x: auto; }
.md th, .md td { padding: var(--s2) var(--s3); text-align: left; vertical-align: top; }
.md thead th { background: var(--surface-2); font-weight: 600; }
.md tbody tr:nth-child(even) td { background: var(--fond); }

/* --- Discussion (comme une messagerie) ----------------------------------------------------- */

.chat { display: grid; grid-template-columns: 250px minmax(0, 1fr); height: 100vh; }
.chat-liste { background: var(--surface-2); padding: var(--s4) var(--s3); overflow-y: auto; display: flex; flex-direction: column; gap: var(--s3); }
.chat-liste .bouton.second { background: var(--surface); }
.chat-liste .bouton.second:hover { background: var(--surface-3); }
.chat-liste nav, .chat-liste-modale { display: flex; flex-direction: column; gap: 2px; }
.chat-liste a, .chat-liste-modale a { display: block; padding: var(--s2) var(--s3); border-radius: var(--rayon-petit); color: inherit; text-decoration: none; font-size: 14px; }
.chat-liste a:hover, .chat-liste-modale a:hover { background: var(--surface-3); }
.chat-liste a.actif, .chat-liste-modale a.actif { background: var(--surface); }
.chat-liste small, .chat-liste-modale small { display: block; color: var(--encre-3); font-size: 12px; }
.chat-fil { display: flex; flex-direction: column; min-height: 0; height: 100vh; }
.fil-haut { padding: var(--s3) var(--s4) 0; }
.fil-defile { flex: 1; overflow-y: auto; min-height: 0; }
.fil-colonne { max-width: 780px; margin: 0 auto; padding: var(--s10) var(--s6) var(--s6); display: flex; flex-direction: column; gap: var(--s6); }
.accueil-chat { margin-top: 16vh; text-align: center; }
.accueil-chat h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.3px; margin: 0 0 var(--s2); }
.msg { min-width: 0; }
.msg-moi { align-self: flex-end; max-width: 85%; display: flex; flex-direction: column; align-items: flex-end; }
.msg-moi .bulle { background: var(--surface-2); border-radius: 18px; padding: var(--s3) var(--s4); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-vitorex { line-height: 1.7; }
.msg-vitorex.echec { background: var(--erreur-doux); border-radius: var(--rayon); padding: var(--s3) var(--s4); }
.msg .meta { font-size: 12px; color: var(--encre-3); margin-top: var(--s2); }
.msg .meta a { color: var(--encre-3); }
.etapes { margin-bottom: var(--s3); font-size: 13px; color: var(--encre-3); }
.etapes summary { cursor: pointer; width: max-content; }
.etapes ol { margin: var(--s2) 0 0; padding-left: var(--s5); max-height: 240px; overflow-y: auto; }
.etapes li + li { margin-top: 2px; }
.etapes .sous { font-style: italic; }
.attente { color: var(--encre-3); }
.attente::after { content: ""; animation: points 1.4s steps(4) infinite; }
@keyframes points { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.fichiers-joints { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.fichiers-joints:empty { display: none; }
.puce { display: inline-flex; align-items: center; gap: var(--s1); background: var(--surface-3); color: var(--encre); border: 0; border-radius: 999px; padding: 3px var(--s3); font-size: 12.5px; cursor: pointer; text-decoration: none; }

.fil-saisie { padding: 0 var(--s6) var(--s4); }
.composeur { max-width: 780px; margin: 0 auto; background: var(--surface); border-radius: 20px; padding: var(--s3) var(--s3) var(--s2) var(--s4); }
.composeur .fichiers-joints { margin: 0 0 var(--s2); }
.composeur textarea { background: transparent; min-height: 28px; max-height: 240px; padding: var(--s1) 0; resize: none; border-radius: 0; }
.composeur textarea:focus-visible { outline: none; }
.composeur-bas { display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap; margin-top: var(--s1); }
.composeur-bas .espace { flex: 1; }
.composeur-accueil { margin: 0; max-width: none; }
select.choix { width: auto; background: transparent; min-height: 32px; padding: 0 var(--s2); color: var(--encre-2); font-size: 13px; cursor: pointer; }
select.choix:hover { background: var(--surface-2); }
.outil-icone { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--encre-2); }
.outil-icone:hover { background: var(--surface-2); }
.outil-icone svg, .bouton-rond svg { width: 18px; height: 18px; }
.bouton-rond { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--primaire); color: var(--primaire-encre); display: grid; place-items: center; cursor: pointer; flex: none; }
.bouton-rond.second { background: var(--surface-2); color: var(--encre); }
.bouton-rond:disabled { background: var(--surface-3); color: var(--encre-3); cursor: default; }
.fil-pied { max-width: 780px; margin: var(--s1) auto 0; text-align: right; }
.mobile-seul { display: none; }

/* --- Fichiers ------------------------------------------------------------------------------ */

.vignettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); }
.vignette { background: var(--surface-2); border: 0; border-radius: var(--rayon-petit); padding: var(--s2); cursor: pointer; text-align: left; min-width: 0; }
.vignette img { width: 100%; height: 110px; object-fit: cover; border-radius: 4px; display: block; background: var(--surface-3); }
.vignette .type { height: 110px; display: grid; place-items: center; background: var(--surface-3); border-radius: 4px; font-weight: 700; color: var(--encre-2); letter-spacing: 1px; }
.vignette span { display: block; font-size: 12.5px; margin-top: var(--s1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apercu img, .apercu video { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border-radius: var(--rayon-petit); }
.apercu audio { width: 100%; }
.apercu iframe { width: 100%; height: 70vh; border: 0; background: #FFFFFF; border-radius: var(--rayon-petit); }

/* --- QR, connexion, modale, messages ------------------------------------------------------- */

.qr { width: 240px; height: 240px; background: #FFFFFF; color: #000000; padding: var(--s3); border-radius: var(--rayon-petit); }
.qr svg { width: 100%; height: 100%; display: block; }
.connexion { min-height: 100vh; display: grid; place-items: center; padding: var(--s4); background: var(--nav); }
.connexion .carte { width: 100%; max-width: 400px; }
.connexion .marque { color: var(--encre); padding: 0 0 var(--s5); }
.connexion .marque small { color: var(--encre-3); }

#modale { position: fixed; inset: 0; background: var(--nav); display: grid; place-items: center; padding: var(--s4); z-index: 50; }
#modale .boite { background: var(--surface); border-radius: var(--rayon); padding: var(--s6); width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; }
#modale .boite.large { max-width: 1000px; }
#modale h2 { margin: 0 0 var(--s3); font-size: 18px; }
#modale .actions { justify-content: flex-end; margin-top: var(--s5); }
#toasts { position: fixed; right: var(--s4); bottom: var(--s4); display: flex; flex-direction: column; gap: var(--s2); z-index: 60; }
.toast { background: var(--encre); color: var(--fond); padding: var(--s3) var(--s4); border-radius: var(--rayon-petit); max-width: 380px; font-weight: 500; }
.toast.erreur { background: var(--erreur); color: #FFFFFF; }
.toast.ok { background: var(--ok); color: #FFFFFF; }

.ligne-lien { display: grid; grid-template-columns: 1fr 2fr 2fr auto; gap: var(--s2); align-items: end; margin-bottom: var(--s2); }

/* --- Mobile -------------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .coque { grid-template-columns: 1fr; }
  .nav { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .coque.menu-ouvert .nav { transform: none; }
  .entete-mobile { display: flex; align-items: center; gap: var(--s3); position: sticky; top: 0; z-index: 30; background: var(--nav); color: #FFFFFF; padding: var(--s3) var(--s4); }
  .entete-mobile button { background: none; border: 0; color: #FFFFFF; padding: var(--s1); cursor: pointer; }
  .entete-mobile svg { width: 24px; height: 24px; display: block; }
  .entete-mobile strong { letter-spacing: 3px; }
  .principal { padding: var(--s5) var(--s4); }
  .bandeau { padding: var(--s2) var(--s4); }
  .grille-2, .grille-3, .ligne-lien { grid-template-columns: 1fr; }
  .chat { grid-template-columns: 1fr; height: calc(100vh - 54px); }
  .chat-liste { display: none; }
  .chat-fil { height: calc(100vh - 54px); }
  .mobile-seul { display: block; }
  .fil-colonne { padding: var(--s4); }
  .fil-saisie { padding: 0 var(--s3) var(--s3); }
  .accueil-chat { margin-top: 8vh; }
  .accueil-chat h1 { font-size: 21px; }
  .msg-moi { max-width: 92%; }
  select.choix { max-width: 46%; }
}
