/* Relais GitLab → Azure DevOps — console d'administration.
   Un seul fichier, aucune ressource externe, aucune étape de build.
   Les jetons de couleur du graphe et de l'interface viennent du même
   système, pour que le SVG et le châssis ne divergent jamais. */

:root {
  color-scheme: light;

  --plane:        #f9f9f7;  /* fond de page */
  --surface:      #fcfcfb;  /* panneaux et surface du graphe */
  --rail:         #f2f1ec;  /* second neutre : barre de nav, en-têtes */
  --ink:          #0b0b0b;
  --ink-2:        #52514e;
  --ink-3:        #898781;
  --grid:         #e1e0d9;  /* filet, séparateur */
  --baseline:     #c3c2b7;
  --accent:       #2a78d6;
  --accent-ink:   #1c5cab;
  --accent-wash:  #eaf1fc;

  --good:     #0ca30c;
  --warning:  #fab219;
  --serious:  #ec835a;
  --critical: #d03b3b;
  --neutral:  #898781;
  --good-text: #006300;

  --seq-1: #cde2fb;
  --seq-2: #86b6ef;
  --seq-3: #3987e5;
  --seq-4: #256abf;

  --radius:    6px;
  --radius-lg: 10px;
  --shadow:    0 1px 2px rgba(11, 11, 11, .05), 0 6px 16px -8px rgba(11, 11, 11, .12);
  --ring:      rgba(11, 11, 11, .10);

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Échelle fixe, pas fluide : la densité est constante en usage bureau. */
  --t-xs: .75rem;
  --t-sm: .8125rem;
  --t-md: .9375rem;
  --t-lg: 1.0625rem;
  --t-xl: 1.375rem;
  --t-2xl: 2rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --plane:       #0d0d0d;
    --surface:     #1a1a19;
    --rail:        #131312;
    --ink:         #ffffff;
    --ink-2:       #c3c2b7;
    --ink-3:       #898781;
    --grid:        #2c2c2a;
    --baseline:    #383835;
    --accent:      #3987e5;
    --accent-ink:  #86b6ef;
    --accent-wash: #16243a;
    --good-text:   #0ca30c;
    --seq-1: #184f95; --seq-2: #256abf; --seq-3: #3987e5; --seq-4: #86b6ef;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 20px -10px rgba(0, 0, 0, .7);
    --ring:   rgba(255, 255, 255, .10);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --plane:       #0d0d0d;
  --surface:     #1a1a19;
  --rail:        #131312;
  --ink:         #ffffff;
  --ink-2:       #c3c2b7;
  --ink-3:       #898781;
  --grid:        #2c2c2a;
  --baseline:    #383835;
  --accent:      #3987e5;
  --accent-ink:  #86b6ef;
  --accent-wash: #16243a;
  --good-text:   #0ca30c;
  --seq-1: #184f95; --seq-2: #256abf; --seq-3: #3987e5; --seq-4: #86b6ef;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 20px -10px rgba(0, 0, 0, .7);
  --ring:   rgba(255, 255, 255, .10);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font: var(--t-md)/1.55 var(--sans);
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

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

code, kbd, .mono { font-family: var(--mono); font-size: .9em; }

/* ---------- Barre de navigation ---------- */

.topbar {
  background: var(--rail);
  border-bottom: 1px solid var(--grid);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 54px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand__mark {
  font-family: var(--mono);
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--accent-ink);
  border: 1px solid var(--ring);
  border-radius: 4px;
  padding: 1px 5px;
  letter-spacing: .04em;
}
.brand__name { font-size: var(--t-md); }

.nav { display: flex; gap: 2px; margin-inline-start: auto; flex-wrap: wrap; }
.nav a {
  padding: 6px 11px;
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: var(--t-sm);
  font-weight: 500;
  transition: background 150ms ease, color 150ms ease;
}
.nav a:hover {
  background: color-mix(in oklab, var(--ink) 5%, transparent);
  color: var(--ink);
  text-decoration: none;
}
.nav a[aria-current="page"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ring);
}
.nav__badge {
  display: inline-block;
  margin-inline-start: 6px;
  min-width: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--critical);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.nav__badge--warning { background: var(--warning); color: #3a2600; }

.topbar__tools { display: flex; align-items: center; gap: 6px; }

/* ---------- Bandeau d'état ---------- */

.health {
  background: var(--surface);
  border-bottom: 1px solid var(--grid);
}
.health__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-wrap: wrap;
}
.health__item {
  padding: 10px 18px 10px 0;
  margin-right: 18px;
  border-right: 1px solid var(--grid);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--t-sm);
}
.health__item:last-child { border-right: 0; margin-right: 0; }
.health__label { color: var(--ink-3); }
.health__value { color: var(--ink); font-weight: 500; }
.health__value--mono { font-family: var(--mono); font-size: var(--t-xs); }

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

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px 72px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
h1 { font-size: var(--t-xl); font-weight: 600; letter-spacing: -.02em; margin: 0 0 3px; text-wrap: balance; }
.page-head p { margin: 0; color: var(--ink-2); font-size: var(--t-sm); max-width: 70ch; }

h2 { font-size: var(--t-lg); font-weight: 600; letter-spacing: -.015em; margin: 0; text-wrap: balance; }
h3 { font-size: var(--t-md); font-weight: 600; margin: 0; }

.panel {
  background: var(--surface);
  border: 1px solid var(--grid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 20px; }
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--grid);
  flex-wrap: wrap;
}
.panel__head p { margin: 3px 0 0; color: var(--ink-2); font-size: var(--t-sm); }
.panel__body { padding: 18px; }
.panel__body--flush { padding: 0; }

.cols {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  margin-top: 20px;
}
@media (max-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Lecture chiffrée (ligne typographique, pas des cartes) ---------- */

.readout { display: flex; flex-wrap: wrap; gap: 0 34px; }
.readout__item { display: flex; flex-direction: column; gap: 1px; }
.readout__label {
  font-size: var(--t-xs);
  color: var(--ink-3);
  letter-spacing: .01em;
}
.readout__value {
  font-size: var(--t-2xl);
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1.1;
}
.readout__value--sm { font-size: var(--t-xl); }
.readout__note { font-size: var(--t-xs); color: var(--ink-2); }
.readout__value--good { color: var(--good-text); }
.readout__value--critical { color: var(--critical); }

/* ---------- Graphe ---------- */

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart__grid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart__baseline { stroke: var(--baseline); stroke-width: 1; shape-rendering: crispEdges; }
.chart__tick { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart__total { fill: var(--ink); font-size: 11px; font-weight: 600; text-anchor: middle; }
.chart__hit { fill: transparent; }
.chart__col:hover .chart__hit { fill: color-mix(in oklab, var(--ink) 4%, transparent); }

.seg--sent    { fill: var(--good); }
.seg--skipped { fill: var(--neutral); }
.seg--pending { fill: var(--warning); }
.seg--failed  { fill: var(--critical); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  padding: 14px 18px 16px;
  border-top: 1px solid var(--grid);
  font-size: var(--t-sm);
  color: var(--ink-2);
}
.legend__item { display: flex; align-items: center; gap: 7px; }
.legend__swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.legend__count { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.tip {
  position: absolute;
  z-index: 5;
  min-width: 150px;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--ring);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: var(--t-xs);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -6px);
  transition: opacity 120ms ease;
}
.tip[data-visible="true"] { opacity: 1; }
.tip__day { font-weight: 600; margin-bottom: 5px; color: var(--ink); }
.tip__row { display: flex; align-items: center; gap: 7px; justify-content: space-between; }
.tip__row span:first-child { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tip__row b { font-variant-numeric: tabular-nums; }
.tip__total { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--grid); }

/* Barres horizontales (magnitude : une seule teinte, dégradé séquentiel) */
.bars { display: flex; flex-direction: column; gap: 11px; margin: 0; }
.bars__row { display: grid; grid-template-columns: minmax(88px, auto) 1fr auto; align-items: center; gap: 12px; }
.bars__label { font-size: var(--t-sm); color: var(--ink-2); }
.bars__track { height: 12px; }
.bars__fill {
  height: 12px;
  border-radius: 0 4px 4px 0;
  background: var(--seq-3);
  min-width: 2px;
}
.bars__value { font-size: var(--t-sm); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Tableaux ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
thead th {
  position: sticky;
  top: 0;
  background: var(--rail);
  text-align: left;
  font-weight: 600;
  font-size: var(--t-xs);
  color: var(--ink-2);
  padding: 9px 14px;
  border-bottom: 1px solid var(--grid);
  white-space: nowrap;
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--grid); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in oklab, var(--ink) 3%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; }
.cell-title { color: var(--ink); display: block; max-width: 46ch; overflow-wrap: anywhere; }
.cell-sub { color: var(--ink-3); font-size: var(--t-xs); display: block; margin-top: 2px; }

/* ---------- Pastilles d'état (point + libellé, jamais la couleur seule) ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 7px;
  border-radius: 20px;
  border: 1px solid var(--ring);
  background: var(--surface);
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}
.pill__dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.pill--good     .pill__dot { background: var(--good); }
.pill--critical .pill__dot { background: var(--critical); }
.pill--warning  .pill__dot { background: var(--warning); }
.pill--neutral  .pill__dot { background: var(--neutral); }

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-size: var(--t-xs);
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- Formulaires ---------- */

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
label { display: block; font-size: var(--t-sm); font-weight: 500; margin-bottom: 5px; }
.hint { font-size: var(--t-xs); color: var(--ink-2); margin: 5px 0 0; max-width: 68ch; }

input[type="text"], input[type="password"], input[type="number"], input[type="search"],
input[type="email"], select, textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--baseline);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: var(--t-sm)/1.5 var(--sans);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
textarea { font-family: var(--mono); min-height: 84px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent);
}
input:disabled, textarea:disabled { background: var(--rail); color: var(--ink-3); cursor: not-allowed; }

.check { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 11px; }
.check:last-child { margin-bottom: 0; }
.check input { width: auto; margin: 3px 0 0; accent-color: var(--accent); flex: none; }
.check label { margin: 0; font-weight: 400; }
.check .hint { margin-top: 1px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 11px 20px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--baseline);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 500 var(--t-sm)/1.4 var(--sans);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}
.btn:hover { background: var(--rail); border-color: var(--ink-3); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn--danger { color: var(--critical); }
.btn--danger:hover { border-color: var(--critical); background: color-mix(in oklab, var(--critical) 8%, transparent); }
.btn--sm { padding: 4px 9px; font-size: var(--t-xs); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--rail); color: var(--ink); }

.actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.actions--tight { margin-top: 0; }

/* Sélecteur de période / filtres : une seule rangée, au-dessus du graphe */
.segmented { display: inline-flex; border: 1px solid var(--baseline); border-radius: var(--radius); overflow: hidden; }
.segmented a {
  padding: 5px 11px;
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--ink-2);
  border-right: 1px solid var(--baseline);
  transition: background 150ms ease, color 150ms ease;
}
.segmented a:last-child { border-right: 0; }
.segmented a:hover { background: var(--rail); color: var(--ink); text-decoration: none; }
.segmented a[aria-current="true"] { background: var(--accent); color: #fff; }

.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--grid); }
.filters .field { margin: 0; min-width: 150px; }
.filters .field--grow { flex: 1 1 220px; }

/* ---------- Messages ---------- */

.flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--ring);
  border-radius: var(--radius);
  font-size: var(--t-sm);
  margin-bottom: 20px;
}
.flash__icon { flex: none; font-weight: 700; line-height: 1.45; }
.flash--ok { background: color-mix(in oklab, var(--good) 9%, var(--surface)); }
.flash--ok .flash__icon { color: var(--good-text); }
.flash--err { background: color-mix(in oklab, var(--critical) 9%, var(--surface)); }
.flash--err .flash__icon { color: var(--critical); }

.empty { padding: 44px 24px; text-align: center; }
.empty h3 { margin-bottom: 6px; }
.empty p { margin: 0 auto; color: var(--ink-2); font-size: var(--t-sm); max-width: 56ch; }
.empty .actions { justify-content: center; }

.pre {
  margin: 0;
  padding: 14px 16px;
  background: var(--plane);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: var(--t-xs);
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  max-height: 460px;
}

/* Rendu du commentaire tel qu'il part chez Azure DevOps */
.preview {
  padding: 16px 18px;
  background: var(--plane);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  font-size: var(--t-sm);
  overflow-wrap: anywhere;
}
.preview p { margin: 0 0 9px; }
.preview p:last-child { margin-bottom: 0; }
.preview ul { margin: 0 0 9px; padding-inline-start: 20px; }
.preview li { margin-bottom: 5px; }
.preview blockquote {
  margin: 0 0 9px;
  padding-inline-start: 12px;
  border-inline-start: 1px solid var(--baseline);
  color: var(--ink-2);
}
.preview hr { border: 0; border-top: 1px solid var(--grid); margin: 12px 0; }
.preview code { background: var(--rail); padding: 1px 4px; border-radius: 3px; }

.dl { display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: 9px 18px; margin: 0; font-size: var(--t-sm); }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; overflow-wrap: anywhere; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 18px; border-top: 1px solid var(--grid); font-size: var(--t-sm); color: var(--ink-2); }

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

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login__panel { width: 100%; max-width: 372px; }
.login__brand { display: flex; align-items: center; gap: 9px; margin-bottom: 20px; }
.login__title { font-size: var(--t-lg); font-weight: 600; letter-spacing: -.015em; margin: 0 0 3px; }
.login__sub { margin: 0 0 20px; color: var(--ink-2); font-size: var(--t-sm); }
.login .btn { width: 100%; justify-content: center; }

.footnote { margin: 26px 0 0; color: var(--ink-3); font-size: var(--t-xs); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}
