:root {
  color-scheme: light dark;
  --fond: #f3f4f1;
  --surface: #ffffff;
  --surface-2: #f7f8f6;
  --bord: #e2e5de;
  --texte: #1c211b;
  --discret: #646e62;
  --accent: #2f8a4c;
  --accent-texte: #ffffff;
  --accent-doux: #e3f2e7;
  --attention: #a86a12;
  --attention-doux: #fbf0dc;
  --danger: #c0392b;
  --danger-doux: #fbe6e3;
  --console-fond: #12161a;
  --console-texte: #d5dbd3;
  --console-discret: #7c8a83;
  --ombre: 0 1px 2px rgb(20 30 20 / 6%), 0 2px 8px rgb(20 30 20 / 4%);
  --rayon: 12px;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #101310;
    --surface: #181c18;
    --surface-2: #1e231e;
    --bord: #2a302a;
    --texte: #e5e9e3;
    --discret: #8d978b;
    --accent: #4cb86b;
    --accent-texte: #0d1a10;
    --accent-doux: #1d3324;
    --attention: #e0a43c;
    --attention-doux: #3a2e17;
    --danger: #ec6a5c;
    --danger-doux: #3b1f1c;
    --console-fond: #0b0d0f;
    --ombre: none;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, p { margin: 0; }
h1 { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 13px; font-weight: 600; color: var(--discret); text-transform: uppercase; letter-spacing: 0.05em; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- En-tête */

.entete {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--bord);
  position: sticky;
  top: 0;
  z-index: 5;
}
.marque { display: flex; align-items: center; gap: 12px; }
.sous-titre { font-size: 13px; color: var(--discret); }
.statut { display: flex; align-items: center; gap: 10px; flex: 1; }
.actions { display: flex; gap: 8px; }

.pastille {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px 4px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--discret);
}
.pastille .point { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pastille.ok { background: var(--accent-doux); color: var(--accent); }
.pastille.attente { background: var(--attention-doux); color: var(--attention); }
.pastille.attente .point { animation: battement 1.2s ease-in-out infinite; }
.pastille.erreur { background: var(--danger-doux); color: var(--danger); }
@keyframes battement { 50% { opacity: 0.3; } }

.bandeau {
  margin: 16px 24px 0;
  padding: 10px 14px;
  border-radius: var(--rayon);
  background: var(--danger-doux);
  color: var(--danger);
  font-size: 14px;
}

/* ---------- Boutons et champs */

.bouton {
  padding: 7px 14px;
  border: 1px solid var(--bord);
  border-radius: 8px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.bouton:hover { background: var(--surface-2); }
.bouton:disabled { opacity: 0.5; cursor: default; }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
.bouton.principal:hover { filter: brightness(1.07); }
.bouton.danger { color: var(--danger); }
.bouton.danger:hover { background: var(--danger-doux); border-color: var(--danger-doux); }
.bouton.petit { padding: 3px 9px; font-size: 13px; border-radius: 6px; }

input[type="text"], input[type="password"], input:not([type]), input[type="search"] {
  min-width: 0;
  padding: 7px 11px;
  border: 1px solid var(--bord);
  border-radius: 8px;
  background: var(--surface-2);
  outline: none;
}
input:focus-visible, .bouton:focus-visible, .copier:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ---------- Mise en page */

main { max-width: 1440px; margin: 0 auto; padding: 20px 24px 32px; }

.tuiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.tuile, .carte {
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
}
.tuile { padding: 14px 16px; min-width: 0; }
.valeur { margin-top: 6px; font-size: 26px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.valeur small { font-size: 15px; font-weight: 500; color: var(--discret); }
.detail { font-size: 13px; color: var(--discret); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adresse { font-size: 16px; overflow: hidden; }
.copier {
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font-weight: 600;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
}
.copier:hover { color: var(--accent); }
.bon { color: var(--accent); }
.mauvais { color: var(--danger); }
.moyen { color: var(--attention); }

.colonnes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  align-items: start;
}
.pile { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.carte { padding: 14px 16px 16px; min-width: 0; }
.carte-entete { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; min-height: 32px; }
.outils { display: flex; align-items: center; gap: 12px; }
.filtre { width: 160px; padding: 5px 10px !important; font-size: 13px; }
.case { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--discret); cursor: pointer; user-select: none; }
.compteur { font-size: 13px; color: var(--discret); }

/* ---------- Console */

.console {
  height: min(62vh, 640px);
  min-height: 280px;
  overflow-y: auto;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--console-fond);
  color: var(--console-texte);
  font: 12.5px/1.55 var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
}
.console div { padding: 0 2px; }
.console .warn { color: #e5b65a; }
.console .err { color: #f2776a; }
.console .init { color: var(--console-discret); }
.console .jeu { color: #7fd69a; }
.console .chat { color: #9ec9ff; }
.console .moi { color: #ffffff; font-weight: 600; margin-top: 4px; }
.console .reponse { color: #b9e3c4; border-left: 2px solid #3d6a4b; padding-left: 8px; margin-bottom: 4px; }
.console .info-locale { color: var(--console-discret); font-style: italic; }

.commande { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.commande .invite { font: 600 15px var(--mono); color: var(--discret); }
.commande input { flex: 1; font-family: var(--mono); font-size: 13.5px; }

/* ---------- Listes */

.ajout { display: flex; gap: 8px; margin-bottom: 10px; }
.ajout input { flex: 1; }

.liste { list-style: none; margin: 0; padding: 0; }
.liste li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  border-top: 1px solid var(--bord);
  min-width: 0;
}
.liste li:first-child { border-top: 0; }
.liste .nom { flex: 1; min-width: 0; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.liste .boutons { display: flex; gap: 6px; }
.liste.compacte li { font-size: 13.5px; padding: 6px 2px; }
.liste.compacte .nom { font-family: var(--mono); font-weight: 400; font-size: 12.5px; }
.liste .vide { color: var(--discret); font-size: 13.5px; justify-content: center; padding: 14px 0; }

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  position: relative;
}
.avatar.connecte::after {
  content: "";
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3fbf63;
  border: 2px solid var(--surface);
}
.badge {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  background: var(--attention-doux);
  color: var(--attention);
}
.badge.discret { background: var(--surface-2); color: var(--discret); }

/* ---------- Onglets */

.onglets { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--bord); }
.onglet {
  padding: 5px 14px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 550;
  color: var(--discret);
  text-decoration: none;
}
.onglet:hover { color: var(--texte); }
.onglet.actif { background: var(--surface); color: var(--texte); box-shadow: var(--ombre); }
.onglet:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Vue Carte */

.vue-carte {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: none;
  height: calc(100dvh - var(--hauteur-entete, 64px));
  padding: 12px 16px 16px;
}
.vue-carte[hidden] { display: none; }
.barre-carte { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.barre-carte .rendu { display: flex; align-items: center; gap: 10px; min-width: 0; }
.barre-carte .rendu .detail { white-space: normal; }
.barre-carte a.bouton { text-decoration: none; color: inherit; }
.cadre-carte {
  position: relative;
  flex: 1;
  min-height: 320px;
  overflow: hidden;
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  background: var(--console-fond);
}
#carte { display: block; width: 100%; height: 100%; border: 0; }
.carte-vide {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--console-discret);
  font-size: 14px;
}

/* ---------- Vue Plugins */

h3 { margin: 16px 0 8px; font-size: 14px; font-weight: 650; }
h3:first-of-type { margin-top: 4px; }
code { font-family: var(--mono); font-size: 0.92em; padding: 1px 5px; border-radius: 5px; background: var(--surface-2); }
.note { margin-top: 12px; font-size: 13px; color: var(--discret); line-height: 1.5; }

.tableau-plugins { display: flex; flex-direction: column; }
.ligne-plugin {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 110px 130px 90px minmax(150px, 190px) 80px;
  align-items: center;
  gap: 12px;
  padding: 10px 2px;
  border-top: 1px solid var(--bord);
  font-size: 14px;
}
.ligne-plugin:first-child { border-top: 0; }
.ligne-plugin.entete-tableau { font-size: 12px; font-weight: 600; color: var(--discret); text-transform: uppercase; letter-spacing: 0.04em; padding-top: 0; }
.ligne-plugin .details { display: contents; } /* ses cellules restent dans la grille (regroupées sur mobile) */
.ligne-plugin .titre { min-width: 0; }
.ligne-plugin .titre strong { font-weight: 650; }
.ligne-plugin .titre a { color: inherit; text-decoration: none; }
.ligne-plugin .titre a:hover { color: var(--accent); text-decoration: underline; }
.ligne-plugin .titre p { font-size: 12.5px; color: var(--discret); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-plugin .mono { font-family: var(--mono); font-size: 12.5px; }
.ligne-plugin a.maj { color: var(--attention); font-weight: 600; }
.etiquette-mobile { display: none; }
.badge.vert { background: var(--accent-doux); color: var(--accent); }
.badge.rouge { background: var(--danger-doux); color: var(--danger); }
.badge.bleu { background: color-mix(in srgb, #3b82f6 16%, transparent); color: #3b82f6; }

.grille-plugins {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.formulaire { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; margin-top: 12px; }
.formulaire label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 550; color: var(--discret); }
.formulaire input, .formulaire select { width: 100%; }
.formulaire .estimation, .formulaire .rangee-boutons { grid-column: 1 / -1; }
.estimation { font-size: 13px; color: var(--discret); }
.rangee-boutons { display: flex; flex-wrap: wrap; gap: 8px; }

select {
  padding: 7px 10px;
  border: 1px solid var(--bord);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--texte);
  font: inherit;
  font-size: 14px;
}
input[type="number"] { padding: 7px 11px; border: 1px solid var(--bord); border-radius: 8px; background: var(--surface-2); }

.taches { display: flex; flex-direction: column; gap: 10px; }
.tache { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--bord); }
.tache .haut { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; font-weight: 600; }
.tache .bas { margin-top: 6px; font-size: 12.5px; color: var(--discret); font-variant-numeric: tabular-nums; }
.barre { height: 8px; margin-top: 8px; border-radius: 99px; background: var(--bord); overflow: hidden; }
.barre span { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width 0.6s ease; }
.tache.pause .barre span { background: var(--attention); }
.aucune-tache { font-size: 13.5px; color: var(--discret); }

.puces { display: flex; flex-wrap: wrap; gap: 6px; }
.puce {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 11px;
  border: 1px solid var(--bord);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
}
.puce.seule { padding-right: 11px; }
.puce:hover { border-color: var(--accent); }
.puce.choisie { background: var(--accent-doux); border-color: var(--accent); color: var(--accent); }
.puce small { color: var(--discret); font-weight: 500; }
.puce .retirer {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--discret);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.puce .retirer:hover { background: var(--danger-doux); color: var(--danger); }
.puces + .ajout { margin-top: 10px; }

.encart { margin-top: 12px; padding: 4px 12px 12px; border-radius: 10px; border: 1px dashed var(--bord); }
.sous-entete { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sous-entete h3 { margin-top: 10px; }
#lp-groupe-nom, #lp-joueur-nom { font-family: var(--mono); color: var(--accent); }

.sortie {
  max-height: 320px;
  margin: 12px 0 0;
  padding: 10px 12px;
  overflow: auto;
  border-radius: 8px;
  background: var(--console-fond);
  color: var(--console-texte);
  font: 12.5px/1.55 var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
}
.sortie a { color: #8fd3ff; }

.infos { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.infos dt { color: var(--discret); }
.infos dd { margin: 0; font-weight: 550; }

/* ---------- Page de connexion (accès public) */

.page-connexion { display: grid; place-items: center; min-height: 100dvh; padding: 16px; }
.boite-connexion { width: 100%; max-width: 380px; padding: 24px; }
.formulaire-connexion { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.formulaire-connexion label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 550; color: var(--discret); }
.formulaire-connexion input { font-size: 16px; color: var(--texte); }
.erreur-connexion { font-size: 14px; color: var(--danger); }

/* ---------- Notifications */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 32px));
  z-index: 10;
}
.toast {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--texte);
  color: var(--fond);
  font-size: 14px;
  box-shadow: 0 6px 24px rgb(0 0 0 / 18%);
  animation: entree 0.18s ease-out;
  white-space: pre-wrap;
}
.toast.erreur { background: var(--danger); color: #fff; }
@keyframes entree { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Petits écrans */

@media (max-width: 1000px) {
  .colonnes { grid-template-columns: minmax(0, 1fr); }
  .ligne-plugin { grid-template-columns: 34px minmax(0, 1fr); row-gap: 6px; }
  .ligne-plugin .details { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; grid-column: 2; }
  .ligne-plugin.entete-tableau { display: none; }
  .etiquette-mobile { display: inline; color: var(--discret); font-size: 12.5px; margin-right: 6px; }
}
@media (max-width: 640px) {
  .entete { padding: 12px 16px; }
  .statut { flex-basis: 100%; order: 3; }
  main { padding: 16px 16px 28px; }
  .bandeau { margin: 12px 16px 0; }
  .console { height: 55vh; }
  .filtre { width: 110px; }
  .commande .bouton { padding: 7px 10px; }
  .onglets { order: 2; }
  .formulaire { grid-template-columns: minmax(0, 1fr); }
}
