@font-face { font-family: "Space Grotesk"; font-weight: 400; font-display: swap; src: url(/fonts/space-grotesk-400.woff2) format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-weight: 600; font-display: swap; src: url(/fonts/space-grotesk-600.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url(/fonts/jetbrains-mono-500.woff2) format("woff2"); }

:root {
  --bg: #f4f6fa; --card: #fff; --text: #1c2333; --muted: #6b7486; --line: #e1e5ee;
  --accent: #1f5fbf; --accent-2: #174a96; --ok: #1a7f37; --ko: #c62828; --warn: #a15c00; --run: #1f5fbf;
  --radius: 10px; --mono: "JetBrains Mono", Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 "Space Grotesk", "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 .6em; font-weight: 600; }
h2 { font-size: 1.25rem; display: flex; align-items: center; gap: .6em; }
h3 { font-size: 1rem; margin-top: 1.2em; }
code { font-family: var(--mono); font-size: .85em; background: #eef2f8; padding: .1em .35em; border-radius: 4px; word-break: break-all; }

.bar { display: flex; align-items: center; gap: 2rem; padding: .7rem 1.5rem; background: #0f1c33; color: #fff; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 600; font-size: 1.05rem; }
.brand img { width: 26px; height: 26px; }
.bar nav { display: flex; gap: .3rem; flex: 1; }
.bar nav a { color: #c9d4ea; text-decoration: none; padding: .4rem .8rem; border-radius: 6px; }
.bar nav a:hover { background: #1b2c4d; }
.bar nav a.active { background: var(--accent); color: #fff; }
.user { display: flex; align-items: center; gap: .8rem; color: #c9d4ea; }
.user .btn.ghost { color: #fff; border-color: #3a4c70; }

main { max-width: 1400px; margin: 1.5rem auto; padding: 0 1.5rem; }
footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.6rem; margin-bottom: 1.2rem; box-shadow: 0 1px 2px rgb(0 0 0 / .04); }
.center { margin: 12vh auto; text-align: center; }
.narrow { max-width: 460px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.hint { color: var(--muted); font-size: .85rem; margin: .5em 0 0; }
.error { color: var(--ko); background: #fdecec; border-radius: 6px; padding: .5em .8em; }
.warn { color: var(--warn); background: #fff4e0; border-radius: 6px; padding: .5em .8em; }
.ko-text { color: var(--ko); font-weight: 600; }
.nowrap { white-space: nowrap; }

.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.split { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.grow { flex: 1; min-width: 260px; }

input[type=url], input[type=search], input[type=text] {
  font: inherit; padding: .55em .8em; border: 1px solid var(--line); border-radius: 7px; background: #fff; min-width: 220px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.btn { font: inherit; display: inline-block; text-decoration: none; cursor: pointer; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; padding: .5em 1.1em; border-radius: 7px; font-weight: 600; }
.btn:hover:not(:disabled) { background: var(--accent-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover:not(:disabled) { background: #eef3fc; }
.btn.danger { background: var(--ko); border-color: var(--ko); }
.btn.danger:hover:not(:disabled) { background: #a31f1f; }
.btn.small { padding: .25em .7em; font-size: .85rem; }
button.link { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-align: left; }
button.link:hover { text-decoration: underline; }

.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin: 1rem 0; }
.tab { font: inherit; background: none; border: 0; border-bottom: 2px solid transparent; padding: .5rem 1rem; cursor: pointer; color: var(--muted); }
.tab.active { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.tab-body { min-height: 120px; }

.list { list-style: none; padding: 0; margin: .8rem 0; max-height: 460px; overflow: auto; border: 1px solid var(--line); border-radius: 7px; }
.list li { padding: .5rem .8rem; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.list li.split { flex-direction: row; }
.list li:last-child { border-bottom: 0; }
.crumbs { margin-bottom: .6rem; color: var(--muted); }

.facts { display: grid; grid-template-columns: 170px 1fr; gap: .45rem 1rem; margin: 1rem 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-word; }

.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 1rem 0; }
@keyframes spin { to { transform: rotate(360deg); } }

.scroll { overflow: auto; max-height: 70vh; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: #f7f9fc; font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
td.num, th.num { text-align: right; }
table.jobs tbody tr { cursor: pointer; }
table.jobs tbody tr:hover { background: #f5f8fd; }
table.jobs tbody tr.sel { background: #e8f0fc; }

.badge { display: inline-block; padding: .1em .6em; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #eceff4; color: var(--muted); }
.badge.ok { background: #e3f4e8; color: var(--ok); }
.badge.ko { background: #fdecec; color: var(--ko); }
.badge.run { background: #e5eefc; color: var(--run); }
.badge.wait { background: #fff4e0; color: var(--warn); }
.bar-track { height: 5px; background: var(--line); border-radius: 3px; margin-top: .3rem; overflow: hidden; min-width: 80px; }
.bar-track i { display: block; height: 100%; background: var(--accent); transition: width .4s; }

.with-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, 40%); gap: 1.2rem; align-items: start; }
.detail { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
details { margin-top: 1rem; }
summary { cursor: pointer; color: var(--muted); }
pre.log { font-family: var(--mono); font-size: .75rem; background: #0f1c33; color: #d6e0f5; padding: .8rem; border-radius: 7px; max-height: 340px; overflow: auto; white-space: pre-wrap; }

@media (max-width: 1000px) { .with-detail { grid-template-columns: 1fr; } .detail { position: static; max-height: none; } .facts { grid-template-columns: 1fr; } }

.choices { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.choice { display: flex; align-items: center; gap: .4rem; border: 1px solid var(--line); border-radius: 7px; padding: .45em .9em; cursor: pointer; }
.choice.active { border-color: var(--accent); background: #eef3fc; font-weight: 600; }

/* Projet : ajout de dossiers à gauche, projet à droite */
.project-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 1.2rem; align-items: start; }
.project-layout > .card:last-child { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
.field { display: flex; flex-direction: column; gap: .3rem; color: var(--muted); font-size: .85rem; margin-bottom: 1rem; }
.field input { color: var(--text); font-size: 1rem; }
.empty { padding: 2rem 0; text-align: center; }
.project-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .7rem; }
.project-item { border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; display: flex; flex-direction: column; gap: .4rem; }
.project-item.has-error { border-color: #f1b4b4; background: #fffafa; }
.project-item p { margin: 0; }
.dest-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.dest-row .choices { margin: 0; }
.dest-picker { border: 1px dashed var(--accent); border-radius: 8px; padding: .7rem .9rem; background: #f7faff; display: flex; flex-direction: column; gap: .5rem; }
.dest-picker .crumbs { margin: 0; }
.list.compact { max-height: 220px; margin: 0; }
.list.compact li { padding: .3rem .7rem; }
.project-footer { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.spinner.inline { display: inline-block; width: 12px; height: 12px; border-width: 2px; margin: 0 .3rem 0 0; vertical-align: -2px; }
.batch-tag { display: inline-block; font-size: .75rem; color: var(--accent); background: #eef3fc; border-radius: 4px; padding: 0 .4em; margin-bottom: .2rem; }
@media (max-width: 1100px) { .project-layout { grid-template-columns: 1fr; } .project-layout > .card:last-child { position: static; max-height: none; } }
