:root {
  --bg: #0d1117;
  --panel: #151b24;
  --panel2: #1b2330;
  --line: #27313f;
  --ink: #e6edf5;
  --muted: #8b9aad;
  --accent: #4da3ff;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.55 ui-sans-serif, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- en-tete --- */
.top {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 12px 22px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 17px; color: var(--ink); letter-spacing: -0.2px; }
.brand .dot { color: var(--accent); }
.top nav { display: flex; gap: 18px; flex: 1; }
.top nav a { color: var(--muted); font-size: 14px; padding: 4px 0;
             border-bottom: 2px solid transparent; }
.top nav a.on { color: var(--ink); border-bottom-color: var(--accent); }
.who { display: flex; align-items: center; gap: 10px; }

/* --- structure --- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 22px 60px; }
.wrap.narrow { max-width: 440px; }
.wrap.center { min-height: 70vh; display: flex; align-items: center; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 20px;
}
.card.auth { width: 100%; }
.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.sidebyside { grid-template-columns: minmax(300px, 380px) 1fr; align-items: start; }
@media (max-width: 900px) { .grid.two, .grid.sidebyside { grid-template-columns: 1fr; } }

h1 { font-size: 22px; margin: 0 0 6px; letter-spacing: -0.3px; }
h2 { font-size: 15px; margin: 0 0 14px; text-transform: uppercase;
     letter-spacing: 0.7px; color: var(--muted); }
h3 { font-size: 15px; margin: 0 0 6px; }
h3.gh { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px;
        color: var(--muted); margin: 18px 0 6px; }
.rowhead { display: flex; justify-content: space-between; align-items: flex-start;
           gap: 16px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.trunc { max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.big { font-size: 17px; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }

/* --- formulaires --- */
form.stack { display: flex; flex-direction: column; gap: 12px; }
form.inline { display: inline; }
form.search { display: flex; gap: 8px; margin-bottom: 14px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
input, textarea, select {
  background: var(--bg); color: var(--ink); border: 1px solid var(--line);
  border-radius: 7px; padding: 9px 11px; font: inherit; font-size: 14px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace;
           font-size: 13px; }
button, .btn {
  background: var(--accent); color: #05070a; border: 0; border-radius: 7px;
  padding: 9px 15px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  display: inline-block;
}
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
button.ghost, .btn.ghost {
  background: transparent; color: var(--ink); border: 1px solid var(--line); font-weight: 500;
}
.mini { font-size: 12px; padding: 2px 7px; border: 1px solid var(--line);
        border-radius: 5px; margin-right: 4px; display: inline-block; }

/* --- pastilles --- */
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap;
}
.pill.ok, .pill.done { color: var(--ok); border-color: #1f4429; background: #0f2416; }
.pill.queued { color: var(--accent); }
.pill.running, .pill.live { color: var(--warn); border-color: #4a3a12; background: #241d0d; }
.pill.error { color: var(--bad); border-color: #4d1f1c; background: #26100f; }
.pill.warn { color: var(--warn); border-color: #4a3a12; }

/* --- tableaux --- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line);
         vertical-align: top; }
thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.5px;
           color: var(--muted); font-weight: 600; }
tbody tr:hover { background: var(--panel2); }
table.tight th, table.tight td { padding: 4px 8px; font-size: 13px; }
table.fields th { width: 34%; color: var(--muted); font-weight: 500; font-size: 13px; }
table.fields td { word-break: break-word; }
td.conf { width: 110px; white-space: nowrap; }
.bar { display: inline-block; width: 46px; height: 5px; border-radius: 3px;
       background: var(--line); position: relative; vertical-align: middle; margin-right: 6px; }
.bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--c);
              background: var(--accent); border-radius: 3px; }
dl.meta { display: grid; grid-template-columns: 200px 1fr; gap: 6px 14px; margin: 12px 0 0;
          font-size: 14px; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; word-break: break-word; }

/* --- blocs d'information --- */
.notice { background: #10233a; border: 1px solid #1d3b5e; border-left: 3px solid var(--accent);
          padding: 11px 14px; border-radius: 7px; font-size: 14px; margin-bottom: 14px; }
.notice.bad { background: #26100f; border-color: #4d1f1c; border-left-color: var(--bad); }
.warnbox { border-color: #4a3a12; background: #1d1809; }
.warnbox h2 { color: var(--warn); }
.warnbox ul { margin: 0; padding-left: 20px; font-size: 14px; }
.statusline { display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
              padding: 10px 0 4px; }
pre.content, pre.err {
  background: var(--bg); border: 1px solid var(--line); border-radius: 7px;
  padding: 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
  font-size: 13px; font-family: ui-monospace, Menlo, Consolas, monospace; margin: 0 0 12px;
}
pre.err { border-color: #4d1f1c; color: #ffb3ae; }
details summary { cursor: pointer; color: var(--muted); font-size: 14px; }
details[open] summary { margin-bottom: 10px; }

/* --- fiche compte --- */
.idcard { display: flex; gap: 16px; align-items: flex-start; }
.avatar { width: 104px; height: 104px; border-radius: 9px; object-fit: cover;
          border: 1px solid var(--line); }
.avatar.placeholder { display: grid; place-items: center; background: var(--panel2);
                      color: var(--muted); font-size: 32px; }
.identity h3 { font-size: 18px; }
.histval { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.histval:last-child { border-bottom: 0; }

/* --- captures --- */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.shots figure { margin: 0; }
.shots img { width: 100%; border: 1px solid var(--line); border-radius: 7px;
             background: #fff; max-height: 460px; object-fit: cover; object-position: top; }
.shots figcaption { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* --- pieces deposees a la main --- */
.shots figure.manual img { border-color: var(--warn); }
.shots figure.manual figcaption { border-left: 2px solid var(--warn); padding-left: 8px; }
input[type="file"] { padding: 7px; background: var(--panel2); }

/* --- rapprochements --- */
ul.reasons { margin: 0 0 4px; padding-left: 18px; font-size: 13px; }
ul.reasons li { margin-bottom: 2px; }
label.inline { flex-direction: row; align-items: center; gap: 6px; }

/* --- graphe --- */
.card.graph { padding: 10px; }
.card.graph svg { width: 100%; height: auto; display: block; border-radius: 7px; }

/* --- choix des sections d'un rapport --- */
.sections { display: flex; flex-direction: column; gap: 9px; }
label.choix { flex-direction: row; align-items: flex-start; gap: 9px; color: var(--ink);
              font-size: 14px; cursor: pointer; }
label.choix input { width: auto; margin-top: 3px; flex: 0 0 auto; }

/* --- pastille de changements non lus --- */
.badge { display: inline-block; min-width: 17px; padding: 0 5px; border-radius: 9px;
         background: var(--bad); color: #fff; font-size: 11px; font-weight: 700;
         text-align: center; line-height: 17px; }

/* --- extraits de recherche --- */
.extrait { max-width: 560px; }
.extrait mark { background: #4a3a12; color: #ffd966; padding: 0 2px; border-radius: 3px; }

/* --- pied --- */
.bottom { border-top: 1px solid var(--line); padding: 16px 22px; display: flex; gap: 20px;
          flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.bottom .warn { color: var(--warn); }

/* --- zone de dépôt d'une pièce --- */
.zone-depot {
  border: 1.5px dashed var(--line); border-radius: 9px; padding: 16px;
  text-align: center; color: var(--muted); font-size: 14px;
  transition: border-color .15s, background .15s;
}
.zone-depot:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.zone-depot.survol { border-color: var(--accent); background: var(--panel2); }
.zone-depot.recu { border-color: var(--ok); background: #0f2416; }
.zone-depot strong { color: var(--ink); }
.zone-depot .apercu {
  display: flex; gap: 14px; align-items: center; justify-content: center;
  margin-top: 14px; text-align: left;
}
/* « display: flex » ci-dessus l'emporte sur la feuille du navigateur : sans
   ces deux regles, l'attribut hidden ne masque plus rien et l'apercu vide
   s'affiche avec une image cassee. */
.zone-depot .apercu[hidden] { display: none; }
.zone-depot .apercu img[hidden] { display: none; }
.zone-depot .apercu img {
  max-width: 220px; max-height: 150px; border-radius: 6px;
  border: 1px solid var(--line); background: #fff;
}
