:root {
  --accent: #c73c1b;
  --accent-doux: #fbe9e4;
  --fond: #f6f6f7;
  --surface: #ffffff;
  --surface-2: #f1f1f3;
  --texte: #18181b;
  --texte-2: #5b5b66;
  --bord: #e3e3e8;
  --danger: #c62828;
  --nouveau: #c2410c;
  --nouveau-fond: #ffedd5;
  --en-cours: #1d4ed8;
  --en-cours-fond: #dbeafe;
  --resolu: #15803d;
  --resolu-fond: #dcfce7;
  --ombre: 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 6px rgba(0, 0, 0, 0.04);
  --rayon: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent-doux: #3b1d16;
    --fond: #111113;
    --surface: #1a1a1d;
    --surface-2: #232327;
    --texte: #f2f2f4;
    --texte-2: #a0a0ab;
    --bord: #2e2e34;
    --danger: #f87171;
    --nouveau: #fdba74;
    --nouveau-fond: #431b0b;
    --en-cours: #93c5fd;
    --en-cours-fond: #172554;
    --resolu: #86efac;
    --resolu-fond: #0f2e1a;
    --ombre: none;
    color-scheme: dark;
  }
}

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

h1,
h2 {
  margin: 0;
  line-height: 1.25;
}

h1 {
  font-size: 22px;
  font-weight: 650;
}

h2 {
  font-size: 15px;
  font-weight: 650;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

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

.discret {
  color: var(--texte-2);
}

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

.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--bord);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.bouton:hover {
  background: var(--surface-2);
}

.bouton.principal {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.bouton.principal:hover {
  filter: brightness(1.08);
}

.bouton.danger {
  color: var(--danger);
}

.bouton.discret {
  border-color: transparent;
  background: transparent;
  color: var(--texte-2);
}

.bouton:disabled {
  opacity: 0.6;
  cursor: default;
}

input,
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--bord);
  border-radius: 8px;
  background: var(--surface);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-weight: 550;
}

label small {
  color: var(--texte-2);
  font-weight: 400;
}

.erreur {
  margin: 0;
  color: var(--danger);
}

.erreur:empty {
  display: none;
}

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

.connexion {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 16px;
}

.connexion .carte {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(360px, 100%);
  padding: 32px 28px;
}

.connexion h1 {
  margin-top: -6px;
}

.carte {
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  background: var(--surface);
  box-shadow: var(--ombre);
}

/* Barre -------------------------------------------------------------------- */

.barre {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px max(16px, calc((100vw - 1240px) / 2));
  border-bottom: 1px solid var(--bord);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
}

.marque {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}

.barre nav {
  display: flex;
  flex: 1;
  gap: 4px;
}

.barre nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--texte-2);
  font-weight: 550;
  text-decoration: none;
}

.barre nav a:hover {
  background: var(--surface-2);
  color: var(--texte);
}

.barre nav a[aria-current="page"] {
  background: var(--accent-doux);
  color: var(--texte);
}

.compteur {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 650;
  line-height: 20px;
  text-align: center;
}

/* Contenu ------------------------------------------------------------------ */

.contenu {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.titre-page {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.sous-titre {
  margin-left: 10px;
  color: var(--texte-2);
  font-size: 16px;
  font-weight: 500;
}

.filtres {
  display: flex;
  gap: 8px;
}

.filtres select {
  width: 200px;
}

.filtres input {
  width: 220px;
}

/* Onglets de statut */

.onglets {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--bord);
  overflow-x: auto;
}

.onglets button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--texte-2);
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
}

.onglets button[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--texte);
}

.nombre {
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12px;
  line-height: 20px;
}

/* Liste */

.liste {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ligne-retour {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 10px 14px 10px 10px;
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  background: var(--surface);
  box-shadow: var(--ombre);
  text-decoration: none;
}

.ligne-retour:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--bord));
}

.vignette {
  width: 132px;
  height: 80px;
  border-radius: 6px;
  background: var(--surface-2);
  object-fit: cover;
  object-position: top;
}

.vignette.vide {
  display: grid;
  place-items: center;
  color: var(--texte-2);
  font-size: 12px;
}

.resume {
  min-width: 0;
}

.resume .message {
  display: -webkit-box;
  margin: 0 0 6px;
  overflow: hidden;
  font-weight: 550;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.resume .infos {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0;
  color: var(--texte-2);
  font-size: 13px;
}

.resume .infos span {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resume .nom-projet {
  color: var(--texte);
  font-weight: 550;
}

.statut {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.statut.nouveau {
  background: var(--nouveau-fond);
  color: var(--nouveau);
}

.statut.en_cours {
  background: var(--en-cours-fond);
  color: var(--en-cours);
}

.statut.resolu {
  background: var(--resolu-fond);
  color: var(--resolu);
}

.vide-liste {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 16px;
  color: var(--texte-2);
  text-align: center;
}

.vide-liste p {
  margin: 0;
}

.pied-liste {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

/* Détail ------------------------------------------------------------------- */

.retour-liste {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--texte-2);
  text-decoration: none;
}

.retour-liste:hover {
  color: var(--texte);
}

.actions-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segments {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--bord);
  border-radius: 9px;
  background: var(--surface);
}

.segments button {
  padding: 4px 12px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--texte-2);
  font-weight: 550;
  cursor: pointer;
}

.segments button[aria-checked="true"].nouveau {
  background: var(--nouveau-fond);
  color: var(--nouveau);
}

.segments button[aria-checked="true"].en_cours {
  background: var(--en-cours-fond);
  color: var(--en-cours);
}

.segments button[aria-checked="true"].resolu {
  background: var(--resolu-fond);
  color: var(--resolu);
}

.detail {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr);
  align-items: start;
  gap: 20px;
}

.colonne-capture {
  position: sticky;
  top: 72px;
}

.capture {
  display: block;
  width: 100%;
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  background: var(--surface);
  box-shadow: var(--ombre);
}

.capture.vide {
  display: grid;
  min-height: 240px;
  place-items: center;
  color: var(--texte-2);
}

.colonne-infos {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  background: var(--surface);
  box-shadow: var(--ombre);
}

.colonne-infos h2 {
  margin-top: 6px;
}

.message-complet {
  margin: 0;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  background: var(--surface-2);
  font-size: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0;
}

dt {
  color: var(--texte-2);
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

dd .discret {
  font-size: 12.5px;
}

.selecteur {
  display: block;
  margin-top: 4px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  cursor: copy;
}

.infos-techniques {
  font-size: 13px;
}

.console {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.console li {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface-2);
}

.console .niveau {
  flex: none;
  font-size: 12px;
  font-weight: 650;
}

.console .error .niveau {
  color: var(--danger);
}

.console .warn .niveau {
  color: var(--nouveau);
}

.console pre {
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Projets ------------------------------------------------------------------ */

.grille-projets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 16px;
}

.projet {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  margin-bottom: 16px;
}

.grille-projets .projet {
  margin-bottom: 0;
}

.entete-projet {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.corps-projet {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.libelle {
  margin: 0;
  color: var(--texte-2);
  font-size: 13px;
}

.code {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 12px;
  border-radius: 8px;
  background: var(--surface-2);
}

.code code {
  flex: 1;
  overflow-x: auto;
  white-space: nowrap;
}

.infos-projet {
  font-size: 13px;
}

.formulaire-projet {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.actions-formulaire {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

/* Notice ------------------------------------------------------------------- */

.notice {
  position: fixed;
  bottom: 20px;
  left: 50%;
  z-index: 100;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 8px;
  background: #18181b;
  color: #fafafa;
  font-weight: 550;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.notice.erreur {
  background: var(--danger);
}

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

@media (max-width: 860px) {
  .detail {
    grid-template-columns: 1fr;
  }

  .colonne-capture {
    position: static;
  }

  .grille-projets {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .barre {
    gap: 12px;
  }

  .barre .bouton.discret {
    display: none;
  }

  .filtres {
    width: 100%;
    flex-direction: column;
  }

  .filtres select,
  .filtres input {
    width: 100%;
  }

  .ligne-retour {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .ligne-retour .statut {
    grid-column: 2;
    justify-self: start;
  }

  .vignette {
    width: 84px;
    height: 64px;
  }
}
