/* Suivi EraCraft — une seule feuille, sans framework.
   Les couleurs sont celles du site et du plugin : fond vert-noir, texte pierre, émeraude, laiton. */

:root {
  --fond: #0a0e0c;
  --grille: #111713;
  --surface: #121814;
  --surface-haute: #19211c;
  --trait: #26312a;
  --trait-fort: #34423a;
  --pierre: #e2d9d2;
  --second: #a3b0a8;
  --faible: #6c7a72;
  --emeraude: #85e6a6;
  --emeraude-sombre: #1d3a29;
  --laiton: #da9623;
  --laiton-sombre: #3a2b12;
  --ciel: #7fb4e8;
  --ciel-sombre: #1a2b3b;
  --valeur: #ffe08a;
  --alerte: #ff8a80;
  --alerte-sombre: #3d1f1d;
  --rayon: 4px;
  --texte: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --chasse: ui-monospace, "SFMono-Regular", "JetBrains Mono", Consolas, "DejaVu Sans Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { background: var(--fond); }

body {
  margin: 0;
  color: var(--pierre);
  font: 15px/1.5 var(--texte);
  /* La grille de 32 px du site : des blocs, à peine visibles. */
  background-image:
    linear-gradient(var(--grille) 1px, transparent 1px),
    linear-gradient(90deg, var(--grille) 1px, transparent 1px);
  background-size: 32px 32px;
  min-height: 100vh;
}

a { color: var(--emeraude); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

h1, h2, h3 { font-weight: 650; line-height: 1.25; margin: 0; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; }

.cle { font-family: var(--chasse); font-size: .82em; color: var(--second); letter-spacing: .01em; }
.faible { color: var(--faible); }
.second { color: var(--second); }
.petit { font-size: .85rem; }

/* --- Charpente ------------------------------------------------------------------------ */

.charpente { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }

.cote {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 1.25rem;
  padding: 1rem .75rem;
  background: var(--surface);
  border-right: 1px solid var(--trait);
}

.marque { display: block; padding: .25rem .5rem 0; }
.marque img { display: block; width: 100%; max-width: 168px; height: auto; }
.marque span { display: block; margin-top: .35rem; font-size: .78rem; color: var(--faible); letter-spacing: .06em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: .45rem .6rem; border-radius: var(--rayon);
  color: var(--second); font-weight: 500;
}
.nav a:hover { background: var(--surface-haute); color: var(--pierre); text-decoration: none; }
.nav a.actif { background: var(--surface-haute); color: var(--pierre); box-shadow: inset 2px 0 0 var(--emeraude); }
.nav .compte { font-family: var(--chasse); font-size: .78rem; color: var(--faible); }

.moi { margin-top: auto; display: flex; align-items: center; gap: .6rem; padding: .5rem; border-top: 1px solid var(--trait); }
.moi img { width: 28px; height: 28px; border-radius: 50%; }
.moi div { min-width: 0; flex: 1; }
.moi strong { display: block; font-size: .88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.moi button { padding: 0; border: 0; background: none; color: var(--faible); font: inherit; font-size: .8rem; cursor: pointer; }
.moi button:hover { color: var(--alerte); }

.page { padding: 1.25rem 1.5rem 3rem; min-width: 0; }
.entete { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.entete p { margin: .2rem 0 0; color: var(--second); font-size: .9rem; }

/* --- Boutons, champs, pastilles ------------------------------------------------------------ */

.bouton {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .8rem; border: 1px solid var(--trait-fort); border-radius: var(--rayon);
  background: var(--surface-haute); color: var(--pierre);
  font: 500 .9rem/1.2 var(--texte); cursor: pointer; white-space: nowrap;
}
.bouton:hover { border-color: var(--second); text-decoration: none; }
.bouton.principal { background: var(--emeraude); border-color: var(--emeraude); color: #0b1a11; font-weight: 600; }
.bouton.principal:hover { background: #9befb8; }
.bouton.danger { color: var(--alerte); border-color: var(--alerte-sombre); background: transparent; }
.bouton.danger:hover { border-color: var(--alerte); }
.bouton.large { width: 100%; justify-content: center; }

input[type=text], input[type=search], select, textarea {
  width: 100%; padding: .45rem .6rem;
  border: 1px solid var(--trait-fort); border-radius: var(--rayon);
  background: var(--fond); color: var(--pierre);
  font: inherit; font-size: .92rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--emeraude); outline: none; }
textarea { min-height: 9rem; resize: vertical; line-height: 1.55; }
input[type=color] { width: 2.4rem; height: 2rem; padding: 0; border: 1px solid var(--trait-fort); border-radius: var(--rayon); background: none; }
label.champ { display: block; margin-bottom: .8rem; }
label.champ > span { display: block; margin-bottom: .25rem; font-size: .8rem; color: var(--second); font-weight: 500; }

.pastille {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .05rem .45rem; border-radius: 3px;
  font-size: .75rem; font-weight: 600; line-height: 1.5; white-space: nowrap;
  border: 1px solid transparent;
}
.pastille.todo { color: var(--second); border-color: var(--trait-fort); }
.pastille.in_progress { color: var(--ciel); background: var(--ciel-sombre); }
.pastille.review { color: var(--laiton); background: var(--laiton-sombre); }
.pastille.done { color: var(--emeraude); background: var(--emeraude-sombre); }
.pastille.open { color: var(--laiton); background: var(--laiton-sombre); }
.pastille.merged { color: var(--emeraude); background: var(--emeraude-sombre); }
.pastille.closed { color: var(--faible); border-color: var(--trait-fort); }

.type { font-size: .8rem; }
.type.feature { color: var(--emeraude); }
.type.bug { color: var(--alerte); }
.type.task { color: var(--ciel); }
.type.validation { color: var(--laiton); }

.priorite { display: inline-block; width: 8px; height: 8px; border-radius: 1px; flex: none; }
.priorite.low { background: var(--trait-fort); }
.priorite.normal { background: var(--second); }
.priorite.high { background: var(--laiton); }
.priorite.urgent { background: var(--alerte); }

.epopee { display: inline-block; max-width: 100%; padding-left: .45rem; border-left: 3px solid var(--c, var(--trait-fort)); font-size: .78rem; color: var(--second); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 22px; height: 22px; border-radius: 50%; vertical-align: middle; }

.message { margin-bottom: 1rem; padding: .6rem .8rem; border-radius: var(--rayon); border: 1px solid var(--emeraude-sombre); background: var(--surface); color: var(--emeraude); font-size: .9rem; }
.message.erreur { color: var(--alerte); border-color: var(--alerte-sombre); }

/* --- Filtres --------------------------------------------------------------------------- */

.filtres { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filtres input[type=search] { width: 15rem; }
.filtres select { width: auto; min-width: 9rem; }
.filtres .bascule { display: inline-flex; align-items: center; gap: .35rem; font-size: .88rem; color: var(--second); cursor: pointer; }
.filtres .effacer { font-size: .85rem; color: var(--faible); }

/* --- Tableau --------------------------------------------------------------------------- */

.tableau { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: .75rem; align-items: start; overflow-x: auto; padding-bottom: 1rem; }

.colonne { background: color-mix(in srgb, var(--surface) 85%, transparent); border: 1px solid var(--trait); border-radius: var(--rayon); min-height: 60vh; display: flex; flex-direction: column; }
.colonne > header { display: flex; align-items: center; justify-content: space-between; padding: .6rem .7rem; border-bottom: 1px solid var(--trait); position: sticky; top: 0; background: var(--surface); border-radius: var(--rayon) var(--rayon) 0 0; z-index: 1; }
.colonne > header h2 { font-size: .8rem; letter-spacing: .07em; text-transform: uppercase; color: var(--second); display: flex; align-items: center; gap: .45rem; }
.colonne > header h2::before { content: ""; width: 8px; height: 8px; border-radius: 1px; background: var(--trait-fort); }
.colonne.in_progress > header h2::before { background: var(--ciel); }
.colonne.review > header h2::before { background: var(--laiton); }
.colonne.done > header h2::before { background: var(--emeraude); }
.colonne > header .compte { font-family: var(--chasse); color: var(--faible); font-size: .78rem; margin-left: .15rem; letter-spacing: 0; }
.colonne > header a { color: var(--faible); font-size: 1.1rem; line-height: 1; padding: 0 .2rem; }
.colonne > header a:hover { color: var(--emeraude); text-decoration: none; }
.cartes { display: flex; flex-direction: column; gap: .5rem; padding: .6rem; flex: 1; }
.cartes.survol { background: color-mix(in srgb, var(--emeraude) 5%, transparent); }
.colonne .suite { display: block; padding: .5rem .7rem .7rem; font-size: .82rem; color: var(--faible); }

.carte {
  display: block; padding: .6rem .65rem; border: 1px solid var(--trait); border-radius: var(--rayon);
  background: var(--surface-haute); color: var(--pierre); cursor: grab;
}
.carte:hover { border-color: var(--trait-fort); text-decoration: none; }
.carte.saisie { opacity: .45; }
.carte .haut { display: flex; align-items: center; gap: .45rem; margin-bottom: .3rem; }
.carte .haut .pr { margin-left: auto; font-family: var(--chasse); font-size: .74rem; color: var(--second); }
.carte .titre { font-size: .9rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.carte .bas { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .5rem; min-height: 22px; }
.carte .bas .composant { font-size: .74rem; color: var(--faible); white-space: nowrap; }

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

.liste { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; }
.liste th, .liste td { padding: .55rem .7rem; border-bottom: 1px solid var(--trait); text-align: left; vertical-align: middle; }
.liste th { font-size: .76rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faible); background: var(--surface); }
.liste th a { color: inherit; }
.liste th a.trie { color: var(--pierre); }
.liste tbody tr:hover { background: var(--surface-haute); }
.liste tr:last-child td { border-bottom: 0; }
.liste td.titre a { color: var(--pierre); }
.liste td.titre a:hover { color: var(--emeraude); }
.liste .etroit { width: 1%; white-space: nowrap; }

.pagination { display: flex; gap: .4rem; justify-content: center; margin-top: 1rem; font-size: .9rem; }
.pagination a, .pagination span { padding: .3rem .6rem; border: 1px solid var(--trait); border-radius: var(--rayon); color: var(--second); }
.pagination .actuelle { color: var(--pierre); border-color: var(--emeraude); }

/* --- Ticket ---------------------------------------------------------------------------- */

.ticket { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 1.5rem; align-items: start; }
.ticket h1 { font-size: 1.45rem; margin: .3rem 0 1rem; }
.bloc { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.bloc > h2 { font-size: .8rem; letter-spacing: .07em; text-transform: uppercase; color: var(--faible); margin-bottom: .75rem; }
.texte { line-height: 1.65; overflow-wrap: anywhere; }
.texte > :first-child { margin-top: 0; }
.texte > :last-child { margin-bottom: 0; }
.texte code { font-family: var(--chasse); font-size: .86em; background: var(--fond); padding: .1rem .3rem; border-radius: 3px; border: 1px solid var(--trait); }
.texte pre { background: var(--fond); border: 1px solid var(--trait); border-radius: var(--rayon); padding: .7rem .9rem; overflow-x: auto; }
.texte pre code { border: 0; padding: 0; background: none; }
.texte table { border-collapse: collapse; }
.texte th, .texte td { border: 1px solid var(--trait); padding: .3rem .55rem; }
.texte blockquote { margin: 0; padding-left: .8rem; border-left: 3px solid var(--trait-fort); color: var(--second); }
.vide { color: var(--faible); font-style: italic; }

.proprietes dl { display: grid; grid-template-columns: auto 1fr; gap: .55rem .8rem; margin: 0; font-size: .9rem; }
.proprietes dt { color: var(--faible); font-size: .82rem; padding-top: .1rem; }
.proprietes dd { margin: 0; min-width: 0; }

.prs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.prs li { display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.prs li .nom { font-family: var(--chasse); font-size: .8rem; color: var(--second); white-space: nowrap; }
.prs li a.titre { color: var(--pierre); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.fil { list-style: none; margin: 0; padding: 0; }
.fil li { display: flex; gap: .7rem; padding: .7rem 0; border-top: 1px solid var(--trait); }
.fil li:first-child { border-top: 0; padding-top: 0; }
.fil .qui { font-weight: 600; font-size: .88rem; }
.fil .quand { color: var(--faible); font-size: .8rem; margin-left: .4rem; }

.journal { list-style: none; margin: 0; padding: 0; font-size: .84rem; color: var(--second); }
.journal li { padding: .3rem 0; display: flex; gap: .5rem; }
.journal li time { color: var(--faible); white-space: nowrap; margin-left: auto; }

details.modifier > summary { list-style: none; cursor: pointer; color: var(--faible); font-size: .85rem; }
details.modifier > summary::-webkit-details-marker { display: none; }
details.modifier > summary:hover { color: var(--emeraude); }
details.modifier[open] > summary { margin-bottom: .8rem; }

/* --- Épopées --------------------------------------------------------------------------- */

.epopees { display: flex; flex-direction: column; gap: .75rem; }
.chantier { display: grid; grid-template-columns: 4px 1fr; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden; }
.chantier > .couleur { background: var(--c); }
.chantier > div { padding: .85rem 1rem; }
.chantier .ligne { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.chantier p { margin: .25rem 0 0; color: var(--second); font-size: .9rem; }
.jauge { height: 6px; background: var(--fond); border: 1px solid var(--trait); border-radius: 2px; margin: .65rem 0 .5rem; overflow: hidden; }
.jauge > span { display: block; height: 100%; background: var(--emeraude); }
.reste { display: flex; flex-wrap: wrap; gap: .35rem .9rem; margin-top: .4rem; font-size: .86rem; }
.reste a { color: var(--pierre); display: inline-flex; align-items: center; gap: .35rem; }

/* --- Connexion ------------------------------------------------------------------------- */

.accueil { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.accueil .boite { width: 100%; max-width: 380px; text-align: center; }
.accueil img { width: 100%; max-width: 300px; height: auto; }
.accueil h1 { font-size: 1.1rem; font-weight: 600; margin: 1rem 0 .3rem; }
.accueil p { color: var(--second); margin: 0 0 1.4rem; font-size: .92rem; }
.accueil .bouton { padding: .65rem 1rem; font-size: .95rem; }
.accueil .note { margin-top: 1rem; font-size: .8rem; color: var(--faible); }

@media (max-width: 900px) {
  .charpente { grid-template-columns: 1fr; }
  .cote { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .marque img { max-width: 110px; }
  .marque span { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .moi { margin: 0 0 0 auto; border: 0; }
  .ticket { grid-template-columns: 1fr; }
  .tableau { grid-template-columns: repeat(4, 280px); }
}
