:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f0efea;
  --line: #e3e1da;
  --text: #1d1c19;
  --muted: #6b6960;
  --accent: #2f5d50;
  --accent-ink: #ffffff;
  --accent-soft: #e3eee9;
  --ok: #2e7d4f;       --ok-soft: #e2f2e8;
  --info: #3d63a8;     --info-soft: #e5ecf8;
  --low: #8a7a1c;      --low-soft: #f5f0d6;
  --medium: #b4610e;   --medium-soft: #fbead8;
  --high: #c2410c;     --high-soft: #fde3d6;
  --critical: #b42318; --critical-soft: #fbe0de;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.04);
  --font: "Segoe UI", -apple-system, system-ui, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141412; --surface: #1c1c19; --surface-2: #24241f; --line: #33322c;
    --text: #ecebe6; --muted: #9c9a90; --accent: #7fb8a4; --accent-ink: #10201b; --accent-soft: #1f2f29;
    --ok: #6cc28f; --ok-soft: #1d2e23; --info: #8aa9e0; --info-soft: #1e2534;
    --low: #d4c25a; --low-soft: #2c2a1a; --medium: #e8a15a; --medium-soft: #33261a;
    --high: #f08a5d; --high-soft: #36221a; --critical: #f27a6e; --critical-soft: #3a1f1c;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141412; --surface: #1c1c19; --surface-2: #24241f; --line: #33322c;
  --text: #ecebe6; --muted: #9c9a90; --accent: #7fb8a4; --accent-ink: #10201b; --accent-soft: #1f2f29;
  --ok: #6cc28f; --ok-soft: #1d2e23; --info: #8aa9e0; --info-soft: #1e2534;
  --low: #d4c25a; --low-soft: #2c2a1a; --medium: #e8a15a; --medium-soft: #33261a;
  --high: #f08a5d; --high-soft: #36221a; --critical: #f27a6e; --critical-soft: #3a1f1c;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
code, pre { font-family: var(--mono); font-size: 12.5px; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 1.1em; height: 1.1em; vertical-align: -0.18em; flex: none; }
.runner .placeholder > div > svg { width: 32px; height: 32px; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; }
.brand b { display: block; font-size: 15px; }
.brand small { color: var(--muted); font-size: 12px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a .count { margin-left: auto; font-size: 12px; color: var(--muted); }
.nav a .count.alert { color: var(--critical); font-weight: 600; }
.nav svg { width: 17px; height: 17px; flex: none; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 4px; }
.sidebar .me { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 10px 8px 0; border-top: 1px solid var(--line); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.me b { display: block; font-size: 13px; }
.me small { color: var(--muted); font-size: 12px; }

.main { min-width: 0; }
.topbar { display: flex; gap: 12px; align-items: center; padding: 12px 28px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.search { flex: 1; max-width: 520px; position: relative; }
.search input { width: 100%; padding: 8px 12px 8px 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.page { padding: 24px 28px 64px; max-width: 1280px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 4px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; white-space: nowrap; color: var(--text); }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--critical); }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.vote { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-weight: 600; font-variant-numeric: tabular-nums; }
.vote.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.vote svg { width: 13px; height: 13px; }

input[type=text], input[type=url], textarea, select { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface); width: 100%; }
textarea { resize: vertical; min-height: 90px; }
textarea.code { font-family: var(--mono); font-size: 12px; min-height: 240px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label.field { display: flex; flex-direction: column; gap: 5px; font-weight: 500; }
label.field small { font-weight: 400; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 13px; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filters select { width: auto; padding: 5px 8px; font-size: 13px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.low { background: var(--low-soft); color: var(--low); }
.badge.medium { background: var(--medium-soft); color: var(--medium); }
.badge.high { background: var(--high-soft); color: var(--high); }
.badge.critical { background: var(--critical-soft); color: var(--critical); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.grade { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; font-weight: 700; font-size: 13px; }
.grade.A { background: var(--ok-soft); color: var(--ok); }
.grade.B { background: var(--low-soft); color: var(--low); }
.grade.C { background: var(--medium-soft); color: var(--medium); }
.grade.D { background: var(--high-soft); color: var(--high); }
.grade.E { background: var(--critical-soft); color: var(--critical); }
.grade.big { width: 64px; height: 64px; font-size: 32px; border-radius: 14px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.tool-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; color: var(--text); transition: border-color .15s; }
.tool-card:hover { border-color: var(--accent); text-decoration: none; }
.tool-card .head { display: flex; gap: 12px; align-items: flex-start; }
.tool-card h3 { font-size: 15px; }
.tool-card .meta { color: var(--muted); font-size: 12.5px; }
.tool-card .tagline { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 39px; }
.tool-card .foot { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--muted); margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.tool-card .foot .stat { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.tool-card .foot svg { width: 14px; height: 14px; }
.tool-card .foot .grade { margin-left: auto; }
.tile { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; color: #fff; }
.tile.big { width: 56px; height: 56px; font-size: 19px; border-radius: 14px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: 12.5px; }
.kpi .value { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.kpi .value.alert { color: var(--critical); }

.banner { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid transparent; }
.banner svg { width: 20px; height: 20px; flex: none; }
.banner .grow { flex: 1; }
.banner.accent { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
.banner.critical { background: var(--critical-soft); border-color: var(--critical); }
.banner.medium { background: var(--medium-soft); border-color: var(--medium); }
.banner.info { background: var(--info-soft); border-color: var(--info); }

/* ---------- tool page ---------- */
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.tool-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; flex-wrap: wrap; }
.tool-head .info { flex: 1; min-width: 260px; }
.tool-head .info p { color: var(--muted); margin-top: 4px; }
.tool-head .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.tool-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.urlchip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 3px 9px; border-radius: 6px; cursor: pointer; border: 0; }
.urlchip svg { width: 13px; height: 13px; color: var(--ok); }

.lifecycle { display: flex; margin: 0 0 18px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.lifecycle div { flex: 1; padding: 8px 10px; font-size: 12.5px; color: var(--muted); border-right: 1px solid var(--line); text-align: center; }
.lifecycle div:last-child { border-right: 0; }
.lifecycle div.done { color: var(--accent); }
.lifecycle div.current { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.lifecycle div.blocked { background: var(--critical); color: #fff; font-weight: 600; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-color: var(--accent); font-weight: 600; }

.runner { overflow: hidden; }
.runner .bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.runner .bar .addr { flex: 1; font-family: var(--mono); font-size: 12.5px; display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.runner .bar .addr svg { width: 13px; color: var(--ok); flex: none; }
.runner iframe { width: 100%; height: 72vh; border: 0; display: block; background: #fff; }
.runner .placeholder { height: 360px; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 24px; }

.two-col { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.scan-summary { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.scan-summary .txt { flex: 1; min-width: 220px; }
.scan-summary .txt p { color: var(--muted); font-size: 13px; }
.sev-counts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.finding { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); }
.finding:first-of-type { border-top: 0; }
.finding .detail { color: var(--muted); margin-top: 3px; }
.finding .fix { margin-top: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.finding .fix .t { flex: 1; min-width: 200px; }
.finding .fix b { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); display: block; }
.group-title { padding: 12px 16px; font-weight: 600; background: var(--surface-2); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.group-title:not(:first-child) { border-top: 1px solid var(--line); }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 18px; }
.tl-item::before { content: ""; position: absolute; left: -21px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.tl-item:first-child::before { background: var(--accent); }
.tl-item .h { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.tl-item .h b { font-family: var(--mono); }
.tl-item .h span { color: var(--muted); font-size: 12.5px; }
.tl-item p { margin-top: 4px; }
.tl-item .ai { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.sugg { display: flex; gap: 14px; padding: 14px 16px; border-top: 1px solid var(--line); }
.sugg:first-child { border-top: 0; }
.sugg .vote { flex-direction: column; gap: 0; padding: 4px 10px; height: fit-content; }
.sugg .body { flex: 1; }
.sugg .by { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

dl.kv { display: grid; grid-template-columns: 180px minmax(0, 1fr); margin: 0; }
dl.kv dt, dl.kv dd { padding: 10px 16px; border-top: 1px solid var(--line); margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dt:first-of-type, dl.kv dd:first-of-type { border-top: 0; }

.chart { width: 100%; height: 180px; display: block; }
.hbar { display: grid; grid-template-columns: 120px minmax(0, 1fr) 46px; gap: 10px; align-items: center; font-size: 13px; padding: 4px 0; }
.hbar .track { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--accent); border-radius: 99px; }
.hbar .n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- lists / tables ---------- */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
table.list td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.row-tool { display: flex; gap: 10px; align-items: center; }
.row-tool .tile { width: 30px; height: 30px; font-size: 11px; border-radius: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.section { margin-top: 26px; }
.section > .head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.section > .head p { color: var(--muted); font-size: 13px; }

.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; cursor: pointer; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(16px); }
.policy { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-top: 1px solid var(--line); }
.policy:first-child { border-top: 0; }
.policy .t { flex: 1; }
.policy .t small { display: block; color: var(--muted); }

pre.snippet { background: #1d1f1c; color: #e6e6dc; padding: 12px 14px; border-radius: 8px; overflow-x: auto; margin: 10px 0 0; line-height: 1.55; }
pre.snippet .k { color: #9fd1bd; }
pre.snippet .s { color: #e8c07d; }
pre.snippet .c { color: #8a8d84; }

/* ---------- publish ---------- */
.steps { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.steps div { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.steps div .n { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; background: var(--surface); }
.steps div.on { color: var(--text); font-weight: 600; }
.steps div.on .n { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.steps div.done .n { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }
.steps .sep { width: 24px; height: 1px; background: var(--line); }
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); cursor: pointer; }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.scan-steps { list-style: none; padding: 0; margin: 0; }
.scan-steps li { display: flex; gap: 10px; align-items: center; padding: 7px 0; color: var(--muted); }
.scan-steps li.done { color: var(--text); }
.scan-steps li .dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.scan-steps li.run .dot { border-color: var(--accent); border-top-color: transparent; animation: spin .7s linear infinite; }
.scan-steps li.done .dot { background: var(--accent); border-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.preview-frame { width: 100%; height: 300px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.similar { padding: 10px 12px; border-radius: 8px; background: var(--info-soft); margin-top: 8px; display: flex; gap: 10px; align-items: center; }
.similar .grow { flex: 1; }

.empty { padding: 40px; text-align: center; color: var(--muted); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 8px 12px; gap: 2px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 8px 0 0; }
  .brand small, .nav-label, .sidebar .me, .nav a .count { display: none; }
  .nav { display: flex; gap: 2px; }
  .nav a { white-space: nowrap; padding: 6px 10px; }
  .topbar { padding: 10px 16px; position: static; }
  .topbar .btn.primary span, #reset { display: none; }
  .page { padding: 18px 16px 48px; }
  .two-col { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  dl.kv { grid-template-columns: 1fr; }
  dl.kv dd { border-top: 0; padding-top: 0; }
  .finding { grid-template-columns: 1fr; gap: 6px; }
  .lifecycle div { font-size: 11px; padding: 7px 4px; }
  .runner iframe { height: 80vh; }
}

/* ---------- v2 : badges, catalogue en arbre, chat IA, contrôles, statistiques, habillages ---------- */
.badge { width: max-content; max-width: 100%; flex: none; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.title-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.kv-line { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 4px 0; font-size: 13.5px; }
.sugg .end { flex: none; }
.crumbs a + a { margin-left: 0; }

.cat-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.tree { padding: 10px 6px; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.tree-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 4px 10px 8px; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree-row { display: flex; align-items: center; gap: 2px; border-radius: 6px; }
.tree-row.root { padding-left: 6px; margin-bottom: 2px; }
.tree-row:hover { background: var(--surface-2); }
.tree-row.on { background: var(--accent-soft); }
.tree-row.on .tree-name { color: var(--accent); font-weight: 600; }
.tree-toggle { width: 20px; height: 26px; display: grid; place-items: center; border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; flex: none; }
.tree-toggle svg { width: 12px; height: 12px; transition: transform .15s; }
.tree-toggle.open svg { transform: rotate(90deg); }
.tree-name { flex: 1; text-align: left; border: 0; background: none; cursor: pointer; padding: 5px 4px; font-size: 13.5px; color: var(--text); min-width: 0; }
.tree-count { font-size: 12px; color: var(--muted); padding-right: 8px; font-variant-numeric: tabular-nums; }
.search-big { position: relative; margin-bottom: 14px; }
.search-big svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search-big input { width: 100%; padding: 12px 14px 12px 42px; font-size: 15px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }

.create { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 1.5fr); gap: 16px; height: calc(100vh - 170px); min-height: 520px; }
.chat, .preview { display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.msg { max-width: 92%; padding: 10px 13px; border-radius: 12px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.ai { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.msg.ai.note { background: var(--accent-soft); }
.msg .who { display: flex; gap: 5px; align-items: center; font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.msg .ideas { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; align-items: flex-start; }
.msg .ideas .chip { text-align: left; border-radius: 10px; }
.typing { color: var(--muted); font-style: italic; margin-top: 4px; }
.vchip { margin-top: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 2px 10px; font-size: 12px; cursor: pointer; color: var(--text); }
.vchip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-input textarea { min-height: 44px; max-height: 160px; resize: none; flex: 1; }
.chat-input .btn { height: 44px; width: 44px; justify-content: center; padding: 0; }
.preview .bar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.preview .versions { display: flex; gap: 4px; flex-wrap: wrap; }
.preview .versions .vchip { margin: 0; }
#pv { flex: 1; min-height: 0; display: flex; }
#pv iframe { flex: 1; border: 0; width: 100%; background: #fff; }
#pv .placeholder { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 24px; }
#pv .placeholder svg { width: 32px; height: 32px; }
.code-view { flex: 1; margin: 0; padding: 14px; overflow: auto; font-size: 12px; background: #1d1f1c; color: #e6e6dc; white-space: pre; }
.preview-foot { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }

.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px 28px; }
.check-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.check-row:last-child { border-bottom: 0; }
.check-row .lbl { flex: 1; min-width: 0; }
.check-row .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--ok); }
.check-row .dot.info { background: var(--info); }
.check-row .dot.low { background: var(--low); }
.check-row .dot.medium { background: var(--medium); }
.check-row .dot.high { background: var(--high); }
.check-row .dot.critical { background: var(--critical); }
.risk-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 2px 28px; }
.fill.warn { background: var(--medium); }

.delta { font-size: 12px; color: var(--muted); }
.delta.up { color: var(--ok); font-weight: 600; }
.stats-top { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
.me-card { display: flex; flex-direction: column; gap: 6px; }
.me-head { display: flex; gap: 12px; align-items: center; }
.me-head .avatar { width: 44px; height: 44px; font-size: 15px; }
.rank { margin-left: auto; text-align: right; }
.rank b { font-size: 30px; line-height: 1; color: var(--accent); }
.rank sup { font-size: 13px; }
.rank span { display: block; font-size: 12px; color: var(--muted); }
.me-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0 10px; }
.me-nums b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.me-nums span { font-size: 12px; color: var(--muted); }
.next-badge { margin-top: 8px; }
.next-badge .track, .progress, .team-row .track { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.next-badge .fill, .progress .fill, .team-row .fill { height: 100%; background: var(--accent); border-radius: 99px; }
.challenge { display: flex; flex-direction: column; gap: 8px; border-color: var(--accent); }
.challenge .btn { align-self: flex-start; margin-top: 4px; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; display: flex; gap: 6px; align-items: center; }
.board tr.me td { background: var(--accent-soft); }
.board .pos { width: 40px; font-variant-numeric: tabular-nums; }
.medal { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 12px; font-weight: 700; color: #fff; }
.medal.m1 { background: #b8901c; }
.medal.m2 { background: #8a9199; }
.medal.m3 { background: #a06a40; }
.team-row { padding: 4px 0; }
.team-name { display: flex; flex-direction: column; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.badge-card { display: flex; flex-direction: column; gap: 4px; }
.badge-card:not(.got) { opacity: .7; }
.badge-card.got { border-color: var(--accent); }
.medal-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); margin-bottom: 4px; }
.badge-card.got .medal-icon { background: var(--accent); color: var(--accent-ink); }

.skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.skin-card { overflow: hidden; display: flex; flex-direction: column; }
.skin-frame { width: 100%; height: 220px; border: 0; border-bottom: 1px solid var(--line); display: block; pointer-events: none; background: #fff; }
.swatches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
.swatches div { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sw { width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--line); flex: none; }
.swatches code { margin-left: auto; font-size: 11px; color: var(--muted); }
.slug-field { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.slug-field span { padding: 0 8px 0 10px; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.slug-field input { border: 0; border-radius: 0; font-family: var(--mono); font-size: 12.5px; }
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cmp > div { min-width: 0; }
.guarantee { display: flex; gap: 8px; padding: 6px 0; }
.guarantee svg { width: 16px; height: 16px; color: var(--accent); margin-top: 2px; }

/* v6 : en-tête du catalogue (« Que voulez-vous faire ? ») et puces de besoin */
.cat-hero { padding: 20px 24px 16px; border-radius: 16px; margin-bottom: 18px; background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.cat-hero-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.cat-kicker { display: flex; gap: 8px; align-items: center; font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.cat-hero h1 { font-size: 28px; text-wrap: balance; }
.cat-search { display: flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 6px 6px 14px; box-shadow: var(--shadow); }
.cat-search > svg { width: 20px; height: 20px; color: var(--muted); }
.cat-search input { border: 0; background: transparent; font-size: 16px; padding: 8px 4px; flex: 1; min-width: 0; outline: none; width: auto; }
.cat-search:focus-within { border-color: var(--accent); }
.filters { align-items: flex-start; }
.filters .chips { flex: 1; min-width: 0; }
.filters-right { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-sep { width: 1px; align-self: stretch; background: var(--line); margin: 2px 4px; }
.chip.verb { display: inline-flex; align-items: center; gap: 6px; }
.chip.verb .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.chip.verb.on { background: var(--surface); color: var(--text); border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
/* v8 : logo et statistiques engageantes */
.brand-mark svg { width: 19px; height: 19px; }
.cheer { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 20px; align-items: center; padding: 22px 24px; border-radius: 16px; margin-bottom: 18px; border: 1px solid var(--line); background: linear-gradient(120deg, var(--accent-soft), var(--surface) 60%, var(--low-soft)); }
.cheer-emoji { font-size: 58px; line-height: 1; animation: pop .6s ease-out both; }
.cheer-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cheer h1 { font-size: 25px; text-wrap: balance; }
.cheer .hl { color: var(--accent); white-space: nowrap; }
.fun-facts { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.fun-facts > div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.fun-facts span { font-size: 26px; grid-row: span 2; }
.fun-facts b { font-size: 20px; font-variant-numeric: tabular-nums; }
.fun-facts small { color: var(--muted); font-size: 12px; line-height: 1.3; }
@keyframes pop { 0% { transform: scale(.4) rotate(-20deg); opacity: 0; } 70% { transform: scale(1.15) rotate(6deg); opacity: 1; } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .cheer-emoji { animation: none; } }
.journey { display: flex; flex-direction: column; gap: 10px; }
.journey-head { display: flex; gap: 14px; align-items: center; }
.level-badge { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 36px; background: var(--accent-soft); border: 1px solid var(--accent); flex: none; }
.journey h2 { font-size: 20px; }
.lvl-track { height: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.lvl-track div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--ok)); }
.my-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.emoji-badge { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600; }
.ch-steps { display: flex; gap: 6px; font-size: 22px; }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 12px; align-items: end; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 16px 12px; }
.pod .avatar { width: 46px; height: 46px; font-size: 16px; }
.pod1 { order: 2; padding-top: 26px; border-color: #c9a227; box-shadow: 0 0 0 1px #c9a227 inset; }
.pod2 { order: 1; } .pod3 { order: 3; }
.pod.me { background: var(--accent-soft); }
.pod-medal { font-size: 34px; line-height: 1; }
.pod1 .pod-medal { font-size: 44px; }
.pod-pts { font-size: 20px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.track.race { height: 12px; }
.track.race .fill { background: linear-gradient(90deg, var(--accent), var(--ok)); }
.thanks { display: flex; gap: 12px; align-items: flex-start; color: var(--text); }
.thanks:hover { border-color: var(--accent); text-decoration: none; }
.thanks p { margin-bottom: 4px; font-style: italic; }
.thanks-mood { font-size: 28px; line-height: 1; }
.thanks-react { margin-left: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.badge-emoji { font-size: 30px; line-height: 1; margin-bottom: 4px; filter: grayscale(1); opacity: .55; }
.badge-card.got .badge-emoji { filter: none; opacity: 1; }
@media (max-width: 900px) {
  .cheer { grid-template-columns: 1fr; }
  .cheer-emoji { font-size: 44px; }
  .cheer h1 { font-size: 20px; }
  .fun-facts { grid-template-columns: 1fr 1fr; }
  .podium { grid-template-columns: 1fr; }
  .pod1, .pod2, .pod3 { order: 0; }
}

/* v7 : page « Créer avec l'IA » commune */
.create-common { margin-bottom: 16px; display: flex; flex-direction: column; gap: 16px; }
.create-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); }
.kind-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kind { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; color: var(--text); }
.kind > svg { width: 22px; height: 22px; color: var(--muted); margin-top: 2px; }
.kind span { display: flex; flex-direction: column; gap: 2px; }
.kind small { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.kind:hover { border-color: var(--accent); }
.kind.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.kind.on > svg { color: var(--accent); }
.kind:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 900px) { .create-grid, .kind-pick { grid-template-columns: 1fr; } }

.cat-hero .filters { margin: 2px 0 0; }
.cat-hero .chip { background: var(--surface); }
.cat-hero .chip.on { background: var(--text); }
.ai-block { padding: 14px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft); margin-bottom: 24px; }
.ai-block > .head { align-items: center; }
.ai-pick { display: flex; flex-direction: column; gap: 6px; }
.ai-pick .tool-card { flex: 1; }
.ai-why { font-size: 13px; display: flex; gap: 6px; align-items: flex-start; }
.ai-why svg { color: var(--accent); margin-top: 2px; }
@media (max-width: 900px) {
  .cat-hero { padding: 16px; }
  .cat-hero h1 { font-size: 22px; }
  .cat-search { flex-wrap: wrap; }
  .cat-search .btn { width: 100%; justify-content: center; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters-right select { flex: 1; }
}

/* v5 : favoris */
.fav-btn { flex: none; border: 0; background: none; cursor: pointer; color: var(--muted); padding: 4px; margin: -4px -4px 0 0; border-radius: 6px; line-height: 0; }
.fav-btn svg { width: 18px; height: 18px; }
.fav-btn:hover { color: #b8901c; background: var(--surface-2); }
.fav-btn.on { color: #c9a227; }
.fav-btn.on svg { fill: currentColor; }
.fav-btn:focus-visible { outline: 2px solid var(--accent); }
.fav-btn.big { margin: 0; padding: 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.model-link { display: flex; gap: 12px; align-items: flex-start; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.model-link:hover h3 { text-decoration: underline; }
.chip svg { width: 13px; height: 13px; vertical-align: -2px; }
.chip-n { font-size: 11px; opacity: .75; }
.as-card { border-left: 3px solid var(--accent); }

/* v4 : paramètres */
.settings-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.settings-intro { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.url-preview { display: block; margin-top: 5px; padding: 9px 12px; background: var(--surface-2); border-radius: 8px; font-size: 13px; overflow-wrap: anywhere; font-weight: 400; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field > span { font-weight: 500; }
@media (max-width: 900px) { .form-grid.three { grid-template-columns: 1fr; } }

/* v3 : catalogue fusionné, en-tête « Nouvel outil » */
.tree-section { display: flex; align-items: center; gap: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 4px; }
.tree-section svg { width: 12px; height: 12px; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 10px; margin-bottom: 14px; max-width: 100%; }
.segmented button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 13.5px; }
.segmented button span { font-size: 12px; opacity: .8; font-variant-numeric: tabular-nums; }
.segmented button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.result-block + .result-block { margin-top: 28px; }
.result-block > .head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.result-block > .head h2 { display: flex; gap: 8px; align-items: center; }
.result-block > .head h2 svg { width: 16px; height: 16px; color: var(--muted); }
.result-block > .head p { color: var(--muted); font-size: 13px; }
.result-block.lib { padding-top: 22px; border-top: 1px dashed var(--line); }
.model-card { border-style: dashed; }
.model-card .head:hover h3 { text-decoration: underline; }
.model-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.subtabs { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.subtabs a { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.subtabs a:hover { border-color: var(--accent); text-decoration: none; }
.subtabs a > svg { width: 20px; height: 20px; color: var(--muted); }
.subtabs a span { display: flex; flex-direction: column; min-width: 0; }
.subtabs a b { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.subtabs a small { color: var(--muted); font-size: 12.5px; }
.subtabs a.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 -3px 0 var(--accent); }
.subtabs a.on > svg { color: var(--accent); }
.tab-intro { margin: -4px 0 16px; }
.create { height: calc(100vh - 250px); }

@media (max-width: 900px) {
  .subtabs { grid-template-columns: 1fr; gap: 6px; }
  .subtabs a { padding: 9px 12px; }
  .cat-layout { grid-template-columns: 1fr; }
  .tree { position: static; max-height: 280px; }
  .create { grid-template-columns: 1fr; height: auto; }
  .chat { height: 60vh; }
  .preview { height: 70vh; }
  .stats-top { grid-template-columns: 1fr; }
  .me-nums { grid-template-columns: repeat(2, 1fr); }
  .cmp { grid-template-columns: 1fr; }
}
