/* Registry v4.0 — Control plane unifié Digital Labs
   Design system : UI UX Pro Max (ops dashboard · dark tech + status green · Fira Sans / Fira Code) */

:root {
  --bg: #0f172a;
  --bg-raised: #131c31;
  --surface: #1b2336;
  --surface-2: #232c41;
  --surface-3: #2c364d;
  --line: #2f3a52;
  --line-strong: #475569;
  --text: #f8fafc;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --accent: #22c55e;
  --accent-strong: #16a34a;
  --on-accent: #0f172a;
  --accent-soft: rgba(34, 197, 94, .14);
  --danger: #f87171;
  --danger-solid: #ef4444;
  --danger-soft: rgba(239, 68, 68, .14);
  --warning: #fbbf24;
  --warning-soft: rgba(245, 158, 11, .14);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, .14);
  --violet: #a78bfa;
  --violet-soft: rgba(139, 92, 246, .16);
  --ring: #f8fafc;
  --glass: rgba(19, 28, 49, .78);
  --shadow: 0 18px 48px rgba(2, 6, 23, .45);

  --font: "Fira Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Fira Code", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px;
  --t-fast: 140ms; --t-mid: 220ms;
  --ease: cubic-bezier(.2, .7, .2, 1);

  --sidebar: 252px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef2f7; --bg-raised: #ffffff; --surface: #ffffff; --surface-2: #f1f5f9; --surface-3: #e2e8f0;
    --line: #dbe2ec; --line-strong: #94a3b8; --text: #0f172a; --text-2: #1e293b; --muted: #475569;
    --accent: #15803d; --accent-strong: #166534; --on-accent: #ffffff; --accent-soft: rgba(22, 163, 74, .12);
    --danger: #b91c1c; --danger-solid: #dc2626; --danger-soft: rgba(220, 38, 38, .1);
    --warning: #a16207; --warning-soft: rgba(202, 138, 4, .12); --info: #0369a1; --info-soft: rgba(2, 132, 199, .1);
    --violet: #6d28d9; --violet-soft: rgba(109, 40, 217, .1); --ring: #0f172a;
    --glass: rgba(255, 255, 255, .82); --shadow: 0 18px 48px rgba(15, 23, 42, .12);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #eef2f7; --bg-raised: #ffffff; --surface: #ffffff; --surface-2: #f1f5f9; --surface-3: #e2e8f0;
  --line: #dbe2ec; --line-strong: #94a3b8; --text: #0f172a; --text-2: #1e293b; --muted: #475569;
  --accent: #15803d; --accent-strong: #166534; --on-accent: #ffffff; --accent-soft: rgba(22, 163, 74, .12);
  --danger: #b91c1c; --danger-solid: #dc2626; --danger-soft: rgba(220, 38, 38, .1);
  --warning: #a16207; --warning-soft: rgba(202, 138, 4, .12); --info: #0369a1; --info-soft: rgba(2, 132, 199, .1);
  --violet: #6d28d9; --violet-soft: rgba(109, 40, 217, .1); --ring: #0f172a;
  --glass: rgba(255, 255, 255, .82); --shadow: 0 18px 48px rgba(15, 23, 42, .12);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--safe-top) + 72px); }
body {
  margin: 0; min-height: 100%;
  background: var(--bg); color: var(--text);
  font: 400 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--info); }
img { max-width: 100%; display: block; }
code, .mono { font-family: var(--mono); font-size: .86em; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--s6);
  padding: calc(var(--safe-top) + var(--s6)) var(--s4) var(--s6);
  background: var(--bg-raised); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s2); text-decoration: none; color: var(--text); }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); }
.brand-mark svg { width: 24px; height: 24px; }
.brand strong { display: block; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.brand small { display: block; color: var(--muted); font-size: 12.5px; }
.nav { display: grid; gap: 2px; }
.nav-label { color: var(--muted); font-size: 12.5px; padding: var(--s3) var(--s3) var(--s1); }
.nav a {
  display: flex; align-items: center; gap: var(--s3); min-height: 44px; padding: 0 var(--s3);
  border-radius: var(--r-md); color: var(--text-2); text-decoration: none; font-weight: 500;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.nav a .count { margin-left: auto; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.sidebar-foot { margin-top: auto; display: grid; gap: var(--s2); padding: 0 var(--s2); color: var(--muted); font-size: 12.5px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--s3);
  padding: calc(var(--safe-top) + var(--s3)) var(--s8) var(--s3);
  background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar .crumbs { display: flex; align-items: center; gap: var(--s2); min-width: 0; color: var(--muted); font-size: 14px; }
.topbar .crumbs a { color: var(--muted); text-decoration: none; }
.topbar .crumbs a:hover { color: var(--text); }
.topbar .crumbs strong { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.topbar .mobile-brand { display: none; }
.content { width: 100%; max-width: 1180px; margin: 0 auto; padding: var(--s8) var(--s8) calc(var(--s10) * 2); }

.bottom-nav { display: none; }

/* ---------- Typography & page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s6); }
.page-head h1 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 600; letter-spacing: -.02em; }
.page-head p { margin: var(--s2) 0 0; color: var(--muted); max-width: 64ch; }
h2 { font-size: 18px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 600; margin: 0; }
.lead { color: var(--muted); margin: var(--s1) 0 0; font-size: 14px; }
.muted { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s4); border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), opacity var(--t-fast);
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger.solid { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.btn.small { min-height: 36px; padding: 0 var(--s3); font-size: 14px; }
.btn.icon-only { width: 44px; padding: 0; }
.btn.small.icon-only { width: 36px; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }

/* ---------- Pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 10px;
  border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.plain::before { display: none; }
.pill.ok { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.pill.warn { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.pill.bad { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.pill.info { color: var(--info); background: var(--info-soft); border-color: transparent; }
.pill.violet { color: var(--violet); background: var(--violet-soft); border-color: transparent; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s5) var(--s5) 0; flex-wrap: wrap; }
.panel-body { padding: var(--s5); }
.panel + .panel, .stack > * + * { margin-top: var(--s5); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--s5); align-items: start; }
.grid-2 > .panel + .panel { margin-top: 0; }

/* ---------- Overview ---------- */
.signal-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; margin-bottom: var(--s5); }
.signal { padding: var(--s5); display: grid; gap: 2px; border-right: 1px solid var(--line); }
.signal:last-child { border-right: 0; }
.signal b { font-size: 30px; line-height: 1.1; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.signal span { color: var(--muted); font-size: 13.5px; }
.signal.alert b { color: var(--warning); }

.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-list li { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) 0; border-top: 1px solid var(--line); }
.attention-list li:first-child { border-top: 0; padding-top: 0; }
.attention-list .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rail); flex: none; margin-top: 8px; }
.attention-list button { all: unset; cursor: pointer; font-weight: 500; }
.attention-list button:hover { text-decoration: underline; }
.attention-list small { display: block; color: var(--muted); font-size: 13px; }

/* ---------- Timeline (journal) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: var(--s3); padding: var(--s3) 0; }
.timeline li::before { content: ""; position: absolute; left: 9px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.timeline li:first-child::before { top: 22px; }
.timeline li:last-child::before { bottom: calc(100% - 22px); }
.timeline .node { position: relative; z-index: 1; width: 20px; height: 20px; margin-top: 2px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line-strong); }
.timeline .node::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.timeline .node.ok { border-color: var(--accent); } .timeline .node.ok::after { background: var(--accent); }
.timeline .node.warn { border-color: var(--warning); } .timeline .node.warn::after { background: var(--warning); }
.timeline .node.bad { border-color: var(--danger); } .timeline .node.bad::after { background: var(--danger); }
.timeline .node.info { border-color: var(--info); } .timeline .node.info::after { background: var(--info); }
.timeline .what { min-width: 0; }
.timeline .what strong { font-weight: 500; }
.timeline .what p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.timeline .when { color: var(--muted); font-size: 13px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag-legacy { font-size: 12px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 6px; padding: 0 6px; margin-left: 6px; white-space: nowrap; }

/* ---------- Catalogue ---------- */
.toolbar { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; margin-bottom: var(--s4); }
.search { position: relative; flex: 1 1 260px; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input[type="search"] { padding-left: 42px; }
.toolbar > label:not(.search) { flex: 1 1 170px; }
.panel-body > .field + .field, .panel-body > .field + div { margin-top: var(--s4); }
.project-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.project-row {
  --rail: var(--line-strong);
  position: relative; display: grid; align-items: center; gap: var(--s4);
  grid-template-columns: 44px minmax(0, 2.2fr) minmax(0, 1.1fr) minmax(0, 1fr) 24px;
  padding: var(--s3) var(--s5) var(--s3) var(--s5); min-height: 72px;
  border-top: 1px solid var(--line); cursor: pointer; text-decoration: none; color: inherit;
  transition: background var(--t-fast) var(--ease);
}
.project-list li:first-child .project-row { border-top: 0; }
.reorder-row {
  position: relative; display: grid; align-items: center; gap: var(--s3);
  grid-template-columns: 28px 44px minmax(0, 1fr) auto;
  padding: var(--s2) var(--s4); min-height: 64px; border-top: 1px solid var(--line); background: var(--surface);
}
.project-list li.reorder-row:first-child { border-top: 0; }
.reorder-row::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--rail); }
.reorder-row .grip { display: grid; place-items: center; height: 44px; color: var(--muted); cursor: grab; touch-action: none; }
.reorder-row.dragging { background: var(--surface-2); box-shadow: var(--shadow); z-index: 1; }
.reorder-row.dragging .grip { cursor: grabbing; }
.btn.icon-only { width: 36px; padding: 0; justify-content: center; }
.project-row::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--rail); }
.project-row:hover { background: var(--surface-2); }
.project-row .chev { color: var(--muted); }
.avatar {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; overflow: hidden;
  font-weight: 600; font-size: 15px; color: var(--text);
  background: color-mix(in srgb, var(--rail, #64748b) 22%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--rail, #64748b) 45%, transparent);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.row-title { min-width: 0; }
.row-title strong { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-title span { display: block; color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { display: flex; gap: var(--s2); flex-wrap: wrap; }
.row-version { font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.row-version small { display: block; font-family: var(--font); color: var(--muted); font-size: 12.5px; }
.empty { padding: var(--s10) var(--s5); text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-weight: 500; margin-bottom: var(--s1); }

/* ---------- Project page ---------- */
.project-hero {
  --rail: var(--accent);
  position: relative; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface);
  padding: var(--s6); margin-bottom: var(--s5); overflow: hidden;
}
.project-hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--rail); }
.hero-top { display: flex; gap: var(--s4); align-items: center; flex-wrap: wrap; }
.hero-top .avatar { width: 56px; height: 56px; border-radius: 15px; font-size: 19px; }
.hero-id { flex: 1; min-width: 200px; }
.hero-id h1 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.hero-id p { margin: 4px 0 0; color: var(--muted); }
.hero-pills { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s3); }

/* Release rail — signature : le fil des livraisons du projet dans sa couleur */
.release-rail { margin-top: var(--s6); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s4); align-items: center; }
.rail-track { position: relative; display: flex; align-items: center; justify-content: space-between; min-height: 34px; }
.rail-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; transform: translateY(-50%); background: color-mix(in srgb, var(--rail) 55%, var(--line)); border-radius: 2px; }
.rail-stop { position: relative; z-index: 1; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--rail); cursor: default; }
.rail-stop.rollback { border-radius: 4px; }
.rail-stop.bad { border-color: var(--danger); }
.rail-stop.warn { border-color: var(--warning); }
.rail-stop.current { width: 20px; height: 20px; background: var(--rail); box-shadow: 0 0 0 5px color-mix(in srgb, var(--rail) 22%, transparent); }
.rail-stop .tip {
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translate(-50%, 4px);
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 10px;
  font-size: 12.5px; white-space: nowrap; color: var(--text); opacity: 0; pointer-events: none;
  transition: opacity var(--t-fast), transform var(--t-fast); box-shadow: var(--shadow);
}
.rail-stop:hover .tip, .rail-stop:focus-visible .tip { opacity: 1; transform: translate(-50%, 0); }
.rail-now { text-align: right; }
.rail-now b { display: block; font-family: var(--mono); font-size: 20px; font-weight: 500; }
.rail-now span { color: var(--muted); font-size: 13px; }
.rail-empty { color: var(--muted); font-size: 13.5px; }

.settings-block { margin-top: var(--s5); }
.watch-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr) 36px; gap: var(--s2); margin-bottom: var(--s2); align-items: center; }
@media (max-width: 720px) { .watch-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px; } .watch-row input[type=url] { grid-column: 1 / 3; grid-row: 2; } }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-bottom: var(--s5); }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  all: unset; display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s4);
  color: var(--muted); font-weight: 500; cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--t-fast);
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--rail, var(--accent)); }
.tabs button:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4) var(--s5); }
.field { display: grid; gap: 6px; align-content: start; }
.field.full { grid-column: 1 / -1; }
.field > span { font-size: 14px; font-weight: 500; color: var(--text-2); }
.field small { color: var(--muted); font-size: 13px; }
input[type="text"], input[type="url"], input[type="number"], input[type="password"], input[type="search"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--r-md);
  background: var(--bg); border: 1px solid var(--line-strong); color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea { min-height: 104px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.mono { font-family: var(--mono); font-size: 14px; }
.color-field { display: flex; gap: var(--s2); }
.color-field input[type="color"] { width: 52px; min-height: 44px; padding: 4px; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--bg); cursor: pointer; }

.choice-group { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
.choice {
  all: unset; box-sizing: border-box; cursor: pointer; display: grid; gap: 4px; padding: var(--s4);
  border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--bg);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.choice strong { font-weight: 600; display: flex; align-items: center; gap: var(--s2); }
.choice small { color: var(--muted); font-size: 13px; }
.choice:hover { border-color: var(--muted); }
.choice[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.choice:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s3) 0; border-top: 1px solid var(--line); }
.switch-row:first-child { border-top: 0; }
.switch-row div { min-width: 0; }
.switch-row strong { display: block; font-weight: 500; }
.switch-row small { color: var(--muted); font-size: 13px; }
.switch { all: unset; flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-strong); position: relative; cursor: pointer; transition: background var(--t-fast); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--text-2); transition: transform var(--t-mid) var(--ease), background var(--t-fast); }
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: var(--on-accent); }
.switch:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 4px 0 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-family: var(--mono); font-size: 13px; }
.chip button { all: unset; cursor: pointer; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
.chip button:hover { background: var(--surface-3); color: var(--text); }
.chip.locked { padding-right: 12px; color: var(--muted); border-style: dashed; }
.inline-add { display: flex; gap: var(--s2); margin-top: var(--s3); }
.inline-add input { flex: 1; }

/* ---------- Data rows (backups, codes, storage) ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; align-items: center; gap: var(--s4); padding: var(--s3) 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.rows > li:first-child { border-top: 0; }
.rows .grow { flex: 1; min-width: 180px; }
.rows .grow strong { font-weight: 500; display: block; }
.rows .grow small { color: var(--muted); font-size: 13px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s2) var(--s5); margin: 0; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--rail, var(--accent)); }

.dropzone {
  display: grid; place-items: center; gap: var(--s2); text-align: center; padding: var(--s8) var(--s5);
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--bg); cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .icon { width: 28px; height: 28px; color: var(--muted); }
.dropzone strong { font-weight: 500; }
.dropzone small { color: var(--muted); }

.steps { list-style: none; margin: var(--s4) 0 0; padding: 0; display: grid; gap: var(--s2); }
.steps li { display: flex; align-items: center; gap: var(--s3); color: var(--muted); }
.steps li .icon { color: var(--line-strong); }
.steps li.done { color: var(--text-2); } .steps li.done .icon { color: var(--accent); }
.steps li.active { color: var(--text); font-weight: 500; } .steps li.active .icon { color: var(--info); animation: spin 1.1s linear infinite; }
.steps li.failed { color: var(--danger); } .steps li.failed .icon { color: var(--danger); }
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: var(--s4); }
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width var(--t-mid) var(--ease); }

.notice { display: flex; gap: var(--s3); padding: var(--s4); border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; }
.notice .icon { margin-top: 2px; }
.notice.ok { background: var(--accent-soft); border-color: transparent; } .notice.ok .icon { color: var(--accent); }
.notice.warn { background: var(--warning-soft); border-color: transparent; } .notice.warn .icon { color: var(--warning); }
.notice.bad { background: var(--danger-soft); border-color: transparent; } .notice.bad .icon { color: var(--danger); }
.notice p { margin: 0; }

.cover { aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden; background: var(--bg); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); }
.cover img { width: 100%; height: 100%; object-fit: cover; }

.tree { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); padding: var(--s2) 0; margin-top: var(--s3); }
.tree label { display: flex; align-items: center; gap: var(--s2); min-height: 32px; padding: 0 var(--s3); font-family: var(--mono); font-size: 13px; cursor: pointer; }
.tree label:hover { background: var(--surface-2); }
.tree input { width: 16px; height: 16px; accent-color: var(--accent); }
.tree .dir { color: var(--text); } .tree .file { color: var(--text-2); }

/* ---------- Save bar, toasts, dialog ---------- */
.savebar {
  position: fixed; z-index: 40; left: calc(var(--sidebar) + 50%); bottom: calc(var(--s6) + var(--safe-bottom));
  transform: translate(calc(-50% - var(--sidebar) / 2), 150%); opacity: 0;
  display: flex; align-items: center; gap: var(--s4); padding: var(--s2) var(--s2) var(--s2) var(--s5);
  border-radius: 999px; background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  transition: transform var(--t-mid) var(--ease), opacity var(--t-mid) var(--ease);
  pointer-events: none;
}
.savebar.show { transform: translate(calc(-50% - var(--sidebar) / 2), 0); opacity: 1; pointer-events: auto; }
.savebar span { font-weight: 500; white-space: nowrap; }

.toasts { position: fixed; z-index: 60; right: var(--s6); top: calc(var(--safe-top) + 76px); display: grid; gap: var(--s2); width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: var(--s3); padding: var(--s4); border-radius: var(--r-md); background: var(--bg-raised); border: 1px solid var(--line-strong); box-shadow: var(--shadow); animation: toast-in var(--t-mid) var(--ease); }
.toast .icon { margin-top: 2px; }
.toast.ok .icon { color: var(--accent); } .toast.bad .icon { color: var(--danger); } .toast.warn .icon { color: var(--warning); } .toast.info .icon { color: var(--info); }
.toast strong { display: block; font-weight: 600; }
.toast p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }

dialog {
  width: min(520px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line-strong); border-radius: var(--r-xl);
  background: var(--bg-raised); color: var(--text); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(2, 6, 23, .62); backdrop-filter: blur(3px); }
dialog[open] { animation: dialog-in var(--t-mid) var(--ease); }
.dialog-body { padding: var(--s6); }
.dialog-body h2 { margin-bottom: var(--s2); }
.dialog-body p { color: var(--text-2); margin: 0 0 var(--s3); }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--s2); padding: 0 var(--s6) var(--s6); flex-wrap: wrap; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .9s linear infinite; }
.loading { display: flex; align-items: center; gap: var(--s3); color: var(--muted); padding: var(--s6) 0; }
.skeleton { height: 72px; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; margin-bottom: var(--s2); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- Login ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: calc(var(--safe-top) + var(--s6)) var(--s5) calc(var(--safe-bottom) + var(--s6)); }
.auth-card { width: min(420px, 100%); }
.auth-card .brand { padding: 0; margin-bottom: var(--s8); }
.auth-card h1 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.auth-card > p { margin: var(--s2) 0 var(--s6); color: var(--muted); }
.auth-card form { display: grid; gap: var(--s4); }
.auth-card .btn { width: 100%; }
.auth-rail { display: flex; gap: 10px; margin-top: var(--s8); align-items: center; color: var(--muted); font-size: 13px; }
.auth-rail i { flex: 1; height: 2px; background: var(--line); border-radius: 2px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-2 > .panel + .panel { margin-top: var(--s5); }
  .project-row { grid-template-columns: 44px minmax(0, 1fr) auto 20px; }
  .project-row .row-meta { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: calc(var(--safe-top) + var(--s2)) var(--s4) var(--s2); }
  .topbar .mobile-brand { display: inline-flex; }
  .topbar .crumbs { display: none; }
  .topbar .label-wide { display: none; }
  .topbar [data-action="new-project"] { width: 40px; padding: 0; }
  .content { padding: var(--s5) var(--s4) calc(96px + var(--safe-bottom)); }
  .page-head h1 { font-size: 24px; }
  .signal-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .signal:nth-child(2) { border-right: 0; }
  .signal:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .form-grid { grid-template-columns: 1fr; }
  .choice-group { grid-template-columns: 1fr; }
  .project-row { padding: var(--s3) var(--s4); gap: var(--s3); }
  .project-hero { padding: var(--s5); }
  .hero-id h1 { font-size: 22px; }
  .release-rail { grid-template-columns: 1fr; }
  /* Sur mobile, la frise devient illisible : l'historique complet reste dans Livraison. */
  .rail-track, .rail-empty { display: none; }
  .rail-now { text-align: left; }
  .bottom-nav {
    position: fixed; z-index: 35; left: 0; right: 0; bottom: 0;
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 6px var(--s2) calc(6px + var(--safe-bottom));
    background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid var(--line);
  }
  .bottom-nav a { display: grid; justify-items: center; gap: 2px; min-height: 52px; padding-top: 6px; color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 500; border-radius: var(--r-md); }
  .bottom-nav a .icon { width: 22px; height: 22px; }
  .bottom-nav a[aria-current="page"] { color: var(--text); }
  .bottom-nav a[aria-current="page"] .icon { color: var(--accent); }
  .savebar { left: var(--s3); right: var(--s3); bottom: calc(78px + var(--safe-bottom)); transform: translateY(150%); gap: var(--s2); padding-left: var(--s4); }
  .savebar.show { transform: translateY(0); }
  .savebar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .toasts { right: 16px; left: 16px; width: auto; top: calc(var(--safe-top) + 64px); }
  .timeline li { grid-template-columns: 20px minmax(0, 1fr); }
  .timeline .when { grid-column: 2; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar, .bottom-nav, .savebar { background: var(--bg-raised); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* v4.1 — agent Git */
.install-steps { margin: var(--s3) 0; padding-left: 20px; color: var(--text-2); display: grid; gap: 6px; font-size: 14px; }
.code-block { position: relative; margin-top: var(--s3); }
.code-block .btn { position: absolute; top: 8px; right: 8px; }
.code-block pre { margin: 0; max-height: 320px; overflow: auto; padding: var(--s4); padding-top: 52px; border-radius: var(--r-md); background: var(--bg); border: 1px solid var(--line); font: 12.5px/1.55 var(--mono); color: var(--text-2); white-space: pre; }
details > summary { list-style-position: inside; }
.steps li.active-static { color: var(--text); font-weight: 500; } .steps li.active-static .icon { color: var(--info); }
