/* Station F Match — base noir & blanc Station F, accents ludiques, fond glacier animé. */
:root {
  --bg: #f7fafd;
  --surface: #ffffff;
  --surface-2: #f3f5f9;
  --fg: #0b0b0f;
  --fg-2: #3a3a46;
  --muted: #5d6170;          /* 6:1 sur blanc */
  --border: #e6e9f0;
  --border-strong: #0b0b0f;
  --ring: #4f6bff;

  --c-blue: #4f8cff; --c-violet: #a66cff; --c-pink: #ff6fb5; --c-orange: #ffa94d; --c-teal: #2fd3c0;
  --glow: conic-gradient(from var(--glow-angle), var(--c-blue), var(--c-violet), var(--c-pink), var(--c-orange), var(--c-teal), var(--c-blue));

  --font-display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;
  --r-sm: 8px; --r: 14px; --r-lg: 20px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
  --shadow-hover: 0 2px 4px rgba(16, 24, 40, .05), 0 12px 32px rgba(16, 24, 40, .09);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --wrap: 1240px;
  color-scheme: light;
}

@property --glow-angle { syntax: "<angle>"; inherits: true; initial-value: 0deg; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--s-4); top: -60px; background: var(--fg); color: #fff; padding: var(--s-2) var(--s-4); border-radius: var(--r-sm); z-index: 30; }
.skip:focus { top: var(--s-2); }
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(16px, 4vw, 40px); }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
/* Les icônes 3D ont un fond blanc opaque : multiply le fond dans le décor clair */
.i3d { mix-blend-mode: multiply; flex: none; object-fit: contain; }

/* ---------- Fond "tide" ---------- */
.tide { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1; display: block; }
.no-tide body {
  background:
    radial-gradient(60vw 50vh at 15% 0%, #d6e6f2 0%, transparent 70%),
    radial-gradient(50vw 50vh at 100% 30%, #e4ecf8 0%, transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

/* ---------- Barre du haut ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: rgba(255, 255, 255, .55); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); border-bottom: 1px solid rgba(15, 23, 42, .05); }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: var(--s-2); text-decoration: none; font-family: var(--font-display); font-weight: 700; letter-spacing: .02em; }
.brand__mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--fg); color: #fff; font-size: 19px; line-height: 1; }
.brand__product { font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--fg); color: #fff; font-size: 13px; letter-spacing: .04em; }

.nav { display: flex; align-items: center; gap: var(--s-1); font-size: 14px; }
.nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s-3); border-radius: 999px; text-decoration: none; color: var(--fg-2); font-weight: 500; transition: background-color .15s var(--ease), color .15s var(--ease); }
.nav a:hover { background: rgba(255, 255, 255, .7); color: var(--fg); }
.nav a[aria-current="page"] { color: var(--fg); background: rgba(255, 255, 255, .85); }
.nav .updated { gap: 6px; margin-left: var(--s-2); font-size: 12px; font-weight: 400; color: var(--muted); background: none; }
.nav .updated:hover { background: none; color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.updated__dot { width: 6px; height: 6px; border-radius: 50%; background: #a1a1aa; }
.updated[data-state="ok"] .updated__dot { background: #22c55e; }
.updated[data-state="warn"] .updated__dot { background: #f59e0b; }
.updated[data-state="stale"] .updated__dot { background: #ef4444; }

/* ---------- Hero + barre de recherche façon Google ---------- */
.hero { padding-block: clamp(72px, 18vh, 180px) clamp(48px, 10vh, 96px); transition: padding .35s var(--ease); }
.has-results .hero { padding-block: var(--s-7) var(--s-6); }
.hero__inner { display: grid; justify-items: center; gap: var(--s-6); text-align: center; }
h1 { font: 700 clamp(36px, 6vw, 64px)/1.05 var(--font-display); letter-spacing: -.035em; margin: 0; }
.has-results h1 { font-size: clamp(28px, 4vw, 40px); }

.search { position: relative; width: min(720px, 100%); isolation: isolate; }
/* Halo dégradé diffus autour de l'input */
.search::before {
  content: ""; position: absolute; inset: -6px; z-index: -1; border-radius: 999px;
  background: var(--glow); filter: blur(24px); opacity: .45;
  transition: opacity .3s var(--ease), inset .3s var(--ease);
  animation: spin 14s linear infinite;
}
.search:focus-within::before { opacity: .7; inset: -12px; }
@keyframes spin { to { --glow-angle: 360deg; } }

.search__bar {
  display: flex; align-items: center; gap: var(--s-2); min-height: 76px; padding: 10px 10px 10px 24px;
  border-radius: 38px; border: 1.5px solid transparent;
  background: linear-gradient(#fff, #fff) padding-box, var(--glow) border-box;
  box-shadow: 0 1px 6px rgba(32, 33, 36, .12);
  animation: spin 14s linear infinite;
  transition: box-shadow .2s var(--ease);
}
.search__bar:hover, .search:focus-within .search__bar { box-shadow: 0 2px 10px rgba(32, 33, 36, .18); }
.search__icon { font-size: 22px; color: var(--muted); }
.search textarea {
  flex: 1; min-width: 0; border: 0; padding: 14px 4px; background: transparent; color: var(--fg); resize: none; overflow: hidden;
  font: 400 18px/1.5 var(--font-body); max-height: 180px;
}
.search textarea:focus { outline: none; }
.search textarea::placeholder { color: #80868b; }
.search__clear, .search__go { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer; flex: none; align-self: flex-end; }
.search__clear { background: transparent; color: var(--muted); font-size: 20px; }
.search__clear:hover { background: var(--surface-2); color: var(--fg); }
.search__go { background: var(--fg); color: #fff; font-size: 20px; transition: transform .15s var(--ease), background-color .15s var(--ease); }
.search__go:hover { transform: scale(1.05); background: #26262e; }
.search__go:active { transform: scale(.97); }
.search__go:disabled { opacity: .35; cursor: progress; transform: none; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: 44px; padding: 0 var(--s-5);
  font: 600 15px/1 var(--font-display); border-radius: 999px; cursor: pointer; border: 1px solid transparent;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--fg); color: #fff; }
.btn--primary:hover { background: #26262e; }
.btn--soft { background: var(--surface); color: var(--fg); border-color: var(--border); box-shadow: var(--shadow); }
.btn--soft:hover { border-color: #c9cfdb; }
.link-btn { background: none; border: 0; padding: 0; min-height: 32px; color: var(--ring); font: 500 14px var(--font-body); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--fg); color: #fff; font: 600 12px/1 var(--font-body); }

/* ---------- Résultats : facettes + liste ---------- */
.results { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: var(--s-5); align-items: start; padding-bottom: var(--s-8); }
.results:focus { outline: none; }
.results { scroll-margin-top: 76px; }

.facets {
  position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow);
}
.facets__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: var(--s-4); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.facets__head h2 { margin: 0; font: 700 17px/1.2 var(--font-display); }
.facets__close, .facets__foot { display: none; }

.facet { padding: var(--s-3) var(--s-4); margin: 0; min-width: 0; border: 0; border-bottom: 1px solid var(--border); }
.facet:last-child { border-bottom: 0; }
.facet h3 { margin: 0; }
.facet__toggle {
  display: flex; align-items: center; gap: var(--s-2); width: 100%; min-height: 40px; padding: 0; border: 0; background: none; cursor: pointer;
  font: 600 15px/1.2 var(--font-display); color: var(--fg); text-align: left;
}
.facet__toggle .i3d { width: 24px; height: 24px; }
.facet__toggle span { flex: 1; }
.facet__toggle .badge { flex: none; }
.facet__chev { color: var(--muted); font-size: 18px; transition: transform .2s var(--ease); }
.facet__toggle[aria-expanded="false"] .facet__chev { transform: rotate(-90deg); }
.facet__body { margin: 0; padding: var(--s-2) 0 0; border: 0; min-width: 0; }
.facets__group { margin: 0; padding: var(--s-4) var(--s-4) 0; font: 600 11px/1 var(--font-display); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.facets__group + .facet { border-top: 0; }
.kw input {
  width: 100%; min-height: 40px; padding: 0 var(--s-3); border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2);
  font: 400 14px var(--font-body); color: var(--fg); transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.kw input:focus { outline: none; border-color: var(--fg); background: var(--surface); }
.facet ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.opt { display: flex; align-items: center; gap: var(--s-2); min-height: 36px; padding: 2px 6px; margin-inline: -6px; border-radius: var(--r-sm); cursor: pointer; font-size: 14px; transition: background-color .12s var(--ease); }
.opt:hover { background: var(--surface-2); }
.opt input { width: 18px; height: 18px; margin: 0; accent-color: var(--fg); flex: none; cursor: pointer; }
.opt .i3d { width: 22px; height: 22px; }
.opt__label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.opt__count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.opt--empty { opacity: .45; cursor: default; }
.opt--empty:hover { background: none; }
.facet__more { margin-top: var(--s-1); }

.results__head { margin-bottom: var(--s-4); }
.results__bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s-3) var(--s-4); }
.results__title { font: 700 clamp(20px, 2.4vw, 26px)/1.2 var(--font-display); letter-spacing: -.02em; margin: 0 0 var(--s-2); }
.results__concepts { flex: 1 1 320px; min-width: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); }
.concept { padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .85); border: 1px solid var(--border); color: var(--fg); font-weight: 500; }
.concept--missing { text-decoration: line-through; color: var(--muted); }
.results__tools { display: flex; gap: var(--s-2); align-items: center; margin-left: auto; }
.facets-toggle { display: none; }
.sort select {
  min-height: 44px; padding: 0 36px 0 var(--s-4); border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--fg);
  font: 500 14px var(--font-body); cursor: pointer; box-shadow: var(--shadow); appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d6170' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}

.active { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-4); }
.active button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px 0 12px; border-radius: 999px;
  border: 1px solid var(--fg); background: var(--surface); color: var(--fg); font: 500 13px var(--font-body); cursor: pointer;
}
.active button:hover { background: var(--fg); color: #fff; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }

/* ---------- Carte ---------- */
.card {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(240px, 300px); gap: var(--s-5);
  padding: var(--s-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow);
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
  animation: rise .35s var(--ease) both;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.logo { width: 64px; height: 64px; border-radius: var(--r); border: 1px solid var(--border); background: #fff; display: grid; place-items: center; overflow: hidden; }
.logo img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.logo--dark { background: #18181b; border-color: #18181b; }
.logo--fallback { color: #fff; border: 0; font: 700 22px/1 var(--font-display); letter-spacing: -.02em; }

.card__main { min-width: 0; display: grid; gap: var(--s-2); align-content: start; }
/* Hauteurs fixes : chaque bloc commence au même endroit d'une carte à l'autre */
.card__name { margin: 0; font: 700 20px/1.2 var(--font-display); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__activity { margin: 0; color: var(--fg-2); font-size: 15px; line-height: 1.45; min-height: calc(2 * 1.45em); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-2) var(--s-4); margin: var(--s-1) 0 0; padding: var(--s-3) 0; border-block: 1px solid var(--border); }
.fact { min-width: 0; }
.fact--wide { grid-column: 1 / -1; }
.fact dt { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fact dt .i3d { width: 18px; height: 18px; }
.fact dd { margin: 3px 0 0; font-size: 14px; font-weight: 500; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.na { color: var(--muted); font-weight: 400; font-style: italic; }

.links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-4); font-size: 14px; }
.links a { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; font-weight: 500; text-decoration: none; color: var(--fg); }
.links a:hover { text-decoration: underline; text-underline-offset: 3px; }
.links svg { color: var(--muted); }
.links__na { display: inline-flex; align-items: center; min-height: 32px; font-size: 14px; }

.breakdown { font-size: 14px; }
.breakdown summary { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; min-height: 32px; color: var(--muted); font-weight: 500; list-style: none; }
.breakdown summary::-webkit-details-marker { display: none; }
.breakdown summary svg { transition: transform .15s var(--ease); }
.breakdown[open] summary svg { transform: rotate(90deg); }
.breakdown summary:hover { color: var(--fg); }
.metrics { display: grid; gap: var(--s-2); margin: var(--s-1) 0 0; padding: var(--s-3) var(--s-4); background: var(--surface-2); border-radius: var(--r); }
.metric { display: grid; grid-template-columns: 116px 1fr 32px; align-items: center; gap: var(--s-3); }
.metric__bar { height: 6px; background: #e3e7ef; border-radius: 3px; overflow: hidden; }
.metric__bar span { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--c-blue), var(--c-violet)); }
.metric__val { text-align: right; font-variant-numeric: tabular-nums; }
.metrics__matched { margin: 0; color: var(--muted); }

/* Colonne de droite */
.card__side { border-left: 1px solid var(--border); padding-left: var(--s-5); display: grid; gap: var(--s-3); align-content: start; }
.score { display: flex; align-items: center; gap: var(--s-3); }
.score__ring { position: relative; width: 60px; height: 60px; flex: none; }
.score__ring svg { width: 60px; height: 60px; transform: rotate(-90deg); stroke-width: 6; }
.score__track { stroke: #edf0f5; }
.score__value { stroke: url(#score-grad); transition: stroke-dashoffset .6s var(--ease); }
.score[data-level="good"] .score__value { stroke: var(--c-blue); }
.score[data-level="partial"] .score__value, .score[data-level="low"] .score__value { stroke: #a1a7b5; }
.score[data-level="none"] .score__value { display: none; }
.score[data-level="none"] .score__num { color: var(--muted); }
.score[data-level="none"] .score__label strong { color: var(--muted); }
.score__num { position: absolute; inset: 0; display: grid; place-items: center; font: 700 19px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.score__label { display: grid; gap: 2px; }
.score__label strong { display: inline-flex; align-items: center; gap: 4px; font: 600 15px/1.2 var(--font-display); }
.score__label strong .i3d { width: 20px; height: 20px; }
.score__label span { font-size: 13px; color: var(--muted); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tag { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 999px; background: var(--surface-2); font: 500 12px/1 var(--font-body); color: var(--fg-2); white-space: nowrap; }
.tag[data-c="blue"]   { background: #e8f0ff; color: #1d4ed8; }
.tag[data-c="violet"] { background: #f1e9ff; color: #6d28d9; }
.tag[data-c="teal"]   { background: #ddf7f2; color: #0f766e; }
.tag[data-c="pink"]   { background: #ffe8f3; color: #be185d; }
.tag[data-c="orange"] { background: #fff0e1; color: #c2410c; }
.tag[data-c="amber"]  { background: #fff5d1; color: #a16207; }
.tag[data-c="slate"]  { background: #e9edf3; color: #334155; }
.tag[data-c="green"]  { background: #e3f6e8; color: #15803d; }
.tag[data-c="red"]    { background: #ffe7e7; color: #b91c1c; }
.tag--na { background: transparent; border: 1px dashed #c9cfdb; color: var(--muted); font-style: italic; }
.tag--warn { background: #fff5d1; color: #92400e; }

.tip { display: flex; gap: var(--s-2); align-items: flex-start; margin: 0; padding: var(--s-2) var(--s-3); border-radius: var(--r); background: linear-gradient(135deg, #fffbea, #fff4f9); font-size: 14px; line-height: 1.45; color: var(--fg); }
.tip .i3d { width: 24px; height: 24px; margin-top: 1px; }
.tip p { margin: 0; min-height: calc(3 * 1.45em); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.more { display: flex; justify-content: center; margin-top: var(--s-5); }

/* États vides */
.state:empty { display: none; }
.state { display: grid; justify-items: center; text-align: center; padding: var(--s-7) var(--s-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.state .i3d { width: 88px; height: 88px; }
.state h2 { font: 700 22px/1.2 var(--font-display); margin: var(--s-3) 0 var(--s-2); }
.state p { color: var(--muted); margin: 0 0 var(--s-4); max-width: 52ch; }

/* ---------- Documentation ---------- */
.docs { display: grid; grid-template-columns: 200px minmax(0, 720px); gap: var(--s-7); justify-content: center; padding-block: var(--s-7) var(--s-8); }
.docs__toc { position: sticky; top: 92px; align-self: start; font-size: 14px; }
.docs__toc-title { margin: 0 0 var(--s-2); font: 600 11px/1 var(--font-display); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.docs__toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.docs__toc a { display: block; padding: 6px 10px; margin-left: -10px; border-radius: var(--r-sm); text-decoration: none; color: var(--fg-2); }
.docs__toc a:hover { background: rgba(255, 255, 255, .8); color: var(--fg); }
.docs__body { background: rgba(255, 255, 255, .86); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: clamp(24px, 4vw, 48px); }
.docs__intro h1 { font-size: clamp(32px, 4vw, 44px); margin: 0 0 var(--s-2); }
.docs__intro p { margin: 0; color: var(--muted); font-size: 17px; }
.docs__body section { padding-top: var(--s-7); scroll-margin-top: 76px; }
.docs__body h2 { font: 700 24px/1.2 var(--font-display); letter-spacing: -.02em; margin: 0 0 var(--s-3); }
.docs__body h3 { font: 600 16px/1.3 var(--font-display); margin: var(--s-5) 0 var(--s-2); }
.docs__body p, .docs__body li { color: var(--fg-2); }
.docs__body p { margin: 0 0 var(--s-3); }
.docs__body ul { margin: 0 0 var(--s-3); padding-left: 20px; display: grid; gap: 6px; }
.docs__body strong { color: var(--fg); font-weight: 600; }
.docs__body code { font: 500 13px/1 ui-monospace, "SF Mono", Menlo, monospace; padding: 2px 6px; border-radius: 4px; background: var(--surface-2); }
.docs__body .muted { color: var(--muted); font-size: 14px; }
.formula { padding: var(--s-3) var(--s-4); border-radius: var(--r); background: var(--surface-2); font: 500 14px/1.5 ui-monospace, "SF Mono", Menlo, monospace; color: var(--fg) !important; overflow-x: auto; }
.doc-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); margin-top: var(--s-4); }
.doc-card { padding: var(--s-4); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.doc-card .i3d { width: 40px; height: 40px; }
.doc-card__w { margin: var(--s-2) 0 2px !important; font: 700 26px/1 var(--font-display); letter-spacing: -.03em; color: var(--fg) !important; }
.doc-card h3 { margin: 0 0 var(--s-1); }
.doc-card p:last-child { margin: 0; font-size: 14px; }
.table-wrap { overflow-x: auto; margin: 0 0 var(--s-3); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.docs__body table { width: 100%; border-collapse: collapse; font-size: 14px; }
.docs__body th, .docs__body td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.docs__body tr:last-child > * { border-bottom: 0; }
.docs__body thead th { font: 600 12px/1.2 var(--font-display); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: var(--surface-2); }
.docs__body tbody th { font-weight: 500; color: var(--fg); }
.docs__body td:last-child { font-variant-numeric: tabular-nums; }
.levels { list-style: none; padding: 0 !important; }
.level { display: inline-block; min-width: 72px; margin-right: var(--s-2); padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--fg); font: 600 12px/1.4 var(--font-display); text-align: center; }
.level--strong { background: linear-gradient(90deg, var(--c-blue), var(--c-violet), var(--c-pink)); color: #fff; }
.level--good { background: var(--c-blue); color: #fff; }

/* ---------- Connexion et Mon espace ---------- */
.muted { color: var(--muted); }
.field { display: grid; gap: 6px; }
.field__label { font: 600 14px/1.2 var(--font-display); color: var(--fg); }
.field__help { font-size: 13px; color: var(--muted); }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface);
  font: 400 16px/1.45 var(--font-body); color: var(--fg); transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field textarea { resize: vertical; min-height: 88px; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent); }
.field input::placeholder, .field textarea::placeholder { color: #9aa0ad; }
.field__code { font: 600 28px/1 var(--font-display) !important; letter-spacing: .4em; text-align: center; }

.auth { display: grid; place-items: center; min-height: calc(100vh - 60px); padding-block: var(--s-7); }
.auth__card {
  width: min(440px, 100%); display: grid; gap: var(--s-4); padding: clamp(24px, 5vw, 40px);
  background: rgba(255, 255, 255, .92); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-hover);
}
.auth__card h1 { font-size: clamp(28px, 4vw, 36px); margin: 0; }
.auth__lead, .auth__sent { margin: 0; color: var(--fg-2); }
.auth__form { display: grid; gap: var(--s-4); }
.auth__submit { width: 100%; min-height: 48px; }
.auth__form .link-btn { justify-self: center; }
.auth__pending { display: grid; justify-items: center; text-align: center; gap: var(--s-2); }
.auth__pending h2 { margin: 0; font: 700 20px/1.2 var(--font-display); }
.auth__pending p { margin: 0; color: var(--fg-2); }
.auth__error { margin: 0; padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: #fff1f1; color: #b42318; font-size: 14px; }
.auth__note { margin: 0; padding-top: var(--s-3); border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }

.space { max-width: 860px; padding-block: var(--s-7) var(--s-8); display: grid; gap: var(--s-4); }
.space__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--s-3); }
.space__head h1 { margin: 0; font-size: clamp(28px, 4vw, 40px); }
.space__who { margin: var(--s-1) 0 0; color: var(--muted); }
.space__lead { margin: 0; color: var(--fg-2); max-width: 70ch; }
#startups { display: grid; gap: var(--s-4); }
.space__card { display: grid; gap: var(--s-4); padding: var(--s-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.space__card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--s-2) var(--s-4); }
.space__card-head h2 { margin: 0; font: 700 22px/1.2 var(--font-display); }
.space__card-head p { margin: 2px 0 0; font-size: 13px; }
.space__card-head a { font-size: 14px; font-weight: 500; }
.space__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.space__status { font-size: 14px; color: var(--muted); }
.space__form { display: grid; gap: var(--s-4); }

/* Historique des modifications : une entrée par envoi de formulaire, la plus récente en haut */
.history { display: grid; gap: var(--s-3); padding-top: var(--s-4); border-top: 1px solid var(--border); }
.history h3 { margin: 0; font: 600 16px/1.2 var(--font-display); }
.history__list { list-style: none; margin: 0; padding: 0; display: grid; }
.history__item { position: relative; display: grid; gap: 2px; padding: 0 0 var(--s-4) var(--s-5); font-size: 14px; }
.history__item::before { content: ""; position: absolute; left: 5px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--fg); }
.history__item:not(:last-child)::after { content: ""; position: absolute; left: 8.5px; top: 18px; bottom: 2px; width: 1px; background: var(--border); }
.history__when { font-weight: 600; color: var(--fg); }
.history__who { color: var(--fg-2); overflow-wrap: anywhere; }
.history__what { color: var(--muted); }
.history__item details summary { cursor: pointer; display: inline-flex; min-height: 28px; align-items: center; color: var(--muted); font-weight: 500; }
.history__item details summary:hover { color: var(--fg); }
.history__diff { margin: var(--s-1) 0 0; display: grid; gap: var(--s-2); padding: var(--s-3); border-radius: var(--r-sm); background: var(--surface-2); }
.history__diff dt { font-weight: 600; color: var(--fg); }
.history__diff dd { margin: 2px 0 0; display: grid; gap: 2px; color: var(--fg-2); white-space: pre-line; overflow-wrap: anywhere; }
.history__diff del { color: var(--muted); }
.history__diff ins { text-decoration: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .card { grid-template-columns: 56px minmax(0, 1fr); }
  .logo { width: 56px; height: 56px; }
  .card__side { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--border); padding: var(--s-4) 0 0; }
}
@media (max-width: 860px) {
  .results { grid-template-columns: 1fr; }
  .facets-toggle { display: inline-flex; }
  /* Facettes en panneau plein écran */
  .facets {
    position: fixed; inset: auto 0 0 0; top: auto; max-height: 88vh; z-index: 40; border-radius: var(--r-lg) var(--r-lg) 0 0;
    transform: translateY(105%); transition: transform .28s var(--ease); visibility: hidden;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .facets.is-open { transform: none; visibility: visible; }
  .facets-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(11, 11, 15, .35); }
  .facets__close { display: grid; place-items: center; width: 44px; height: 44px; margin-left: auto; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--fg); font-size: 18px; cursor: pointer; }
  .facets__foot { display: block; position: sticky; bottom: 0; padding: var(--s-3) var(--s-4); background: var(--surface); border-top: 1px solid var(--border); }
  .facets__foot .btn { width: 100%; }
  .docs { grid-template-columns: 1fr; gap: var(--s-4); padding-top: var(--s-5); }
  .docs__toc { display: none; }
}
@media (max-width: 560px) {
  .brand__name { display: none; }
  .card { grid-template-columns: 44px minmax(0, 1fr); padding: var(--s-4); gap: var(--s-3); }
  .logo { width: 44px; height: 44px; border-radius: 10px; }
  .logo img { padding: 4px; }
  .logo--fallback { font-size: 16px; }
  .card__name { font-size: 18px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { grid-template-columns: 104px 1fr 32px; gap: var(--s-2); }
  .doc-cards { grid-template-columns: 1fr; }
  .nav a { padding: 0 var(--s-2); }
  .nav a[href="./"] { display: none; }
  .updated__prefix { display: none; }
  .nav .updated { margin-left: 0; }
  .search__bar { padding-left: 14px; }
  .search textarea { font-size: 16px; }
}

/* ---------- Assistant de recherche (agent.js) ---------- */
/* Sous le voile des filtres mobiles (35) : le panneau de filtres garde la main quand il est ouvert */
.agent, .agent-launcher { z-index: 30; }
.agent-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 var(--s-4); padding: var(--s-2) var(--s-4); border-radius: var(--r); background: linear-gradient(135deg, #eef4ff, #f6efff); font-size: 14px; color: var(--fg-2); }
.agent-hint .link-btn { min-height: 28px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #c9d6f5; border-top-color: var(--c-violet); animation: turn .8s linear infinite; flex: none; }
@keyframes turn { to { transform: rotate(360deg); } }

.agent {
  position: fixed; right: var(--s-5); bottom: var(--s-5); width: min(400px, calc(100vw - 32px)); height: min(600px, calc(100vh - 110px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: 0 8px 24px rgba(16, 24, 40, .10), 0 24px 64px rgba(16, 24, 40, .14);
  animation: pop .25s var(--ease) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.agent__head { position: relative; display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); }
.agent__head::after { content: ""; position: absolute; inset: auto 0 -1px; height: 2px; background: linear-gradient(90deg, var(--c-blue), var(--c-violet), var(--c-pink)); }
.agent__avatar { width: 32px; height: 32px; }
.agent__titles { flex: 1; min-width: 0; }
.agent__titles h2 { margin: 0; font: 700 16px/1.2 var(--font-display); }
.agent__titles p { margin: 0; font-size: 12px; color: var(--muted); }
.agent__close { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--fg); font-size: 18px; cursor: pointer; }
.agent__close:hover { background: #e8ebf2; }

.agent__log { flex: 1; overflow-y: auto; overscroll-behavior: contain; display: grid; align-content: start; gap: var(--s-3); padding: var(--s-4); background: var(--bg); }
.log__item { display: flex; flex-direction: column; }
.log__item:empty { display: none; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.45; }
.msg p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.msg--user { align-self: flex-end; background: var(--fg); color: #fff; border-bottom-right-radius: 4px; }
.msg--bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; box-shadow: var(--shadow); }
.msg--bot .link-btn { margin-top: 4px; }
.msg--error { align-self: flex-start; background: #fff5f5; border: 1px solid #fecaca; color: #991b1b; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s-2); }
.chip { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--fg); background: var(--surface); color: var(--fg); font: 500 13px var(--font-body); cursor: pointer; transition: background-color .15s var(--ease), color .15s var(--ease); }
.chip:hover:not(:disabled) { background: var(--fg); color: #fff; }
.chip:disabled { cursor: default; opacity: .4; }
.chip.is-chosen { opacity: 1; background: var(--fg); color: #fff; }
.steps { font-size: 13px; color: var(--muted); }
.steps ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.steps li { position: relative; padding-left: 18px; overflow-wrap: anywhere; }
.steps li::before { content: "✓"; position: absolute; left: 0; color: #16a34a; font-weight: 700; }
.steps li.is-live { color: var(--fg-2); }
.steps li.is-live::before { content: ""; top: 4px; width: 8px; height: 8px; border-radius: 50%; border: 2px solid #c9d6f5; border-top-color: var(--c-violet); animation: turn .8s linear infinite; }
.steps summary { display: inline-flex; align-items: center; min-height: 28px; cursor: pointer; }
.steps[open] summary { margin-bottom: 4px; }

.agent__form { display: flex; align-items: flex-end; gap: var(--s-2); padding: var(--s-3); border-top: 1px solid var(--border); background: var(--surface); }
.agent__form textarea {
  flex: 1; min-width: 0; min-height: 44px; max-height: 140px; padding: 11px 14px; resize: none; overflow-y: hidden;
  border: 1px solid var(--border); border-radius: 22px; background: var(--surface-2); color: var(--fg); font: 400 14px/1.45 var(--font-body);
}
.agent__form textarea:focus { outline: none; border-color: var(--fg); background: var(--surface); }
.agent__form textarea:disabled { opacity: .6; }
.agent__form button { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--fg); color: #fff; font-size: 18px; cursor: pointer; }
.agent__form button:disabled { opacity: .3; cursor: default; }

.agent-launcher {
  position: fixed; right: var(--s-5); bottom: var(--s-5); display: inline-flex; align-items: center; gap: var(--s-2); min-height: 52px; padding: 0 var(--s-5) 0 var(--s-3);
  border-radius: 999px; border: 1.5px solid transparent; background: linear-gradient(#fff, #fff) padding-box, var(--glow) border-box;
  box-shadow: var(--shadow-hover); font: 600 15px/1 var(--font-display); color: var(--fg); cursor: pointer; animation: spin 14s linear infinite;
}
.agent-launcher .i3d { width: 28px; height: 28px; }
.agent-launcher.is-busy .i3d { animation: bob 1.2s var(--ease) infinite; }
@keyframes bob { 50% { transform: translateY(-3px); } }
.agent-launcher .badge { background: var(--c-pink); }

/* Liste : sélection de l'assistant */
.list__divider { display: flex; align-items: center; gap: var(--s-3); margin: var(--s-4) 0 var(--s-1); font: 600 12px/1.2 var(--font-display); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.list__divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.concept--essentiel { border-color: var(--fg); font-weight: 600; }
.concept--secondaire { color: var(--muted); }
.metrics__ai { margin: 0; color: var(--fg); }
.metrics__sub { margin: var(--s-2) 0 0; font: 600 11px/1 var(--font-display); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.subneeds { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; color: var(--muted); }
.subneeds li { display: flex; gap: 6px; }
.subneeds li.is-ok { color: var(--fg); }
.subneeds li.is-ok > span:first-child { color: #16a34a; font-weight: 700; }

@media (max-width: 560px) {
  .agent { right: 0; left: 0; bottom: 0; width: 100%; height: min(78vh, 640px); border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .agent-launcher { right: var(--s-4); bottom: var(--s-4); }
}

.restoring *, .restoring *::before, .restoring *::after { animation: none !important; transition: none !important; }

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

/* ---------- Historique (page) ---------- */
.history__startup { font: 600 15px/1.3 var(--font-display); color: var(--fg); }
.history__filter { min-width: min(320px, 100%); }
.history__filter select, .admin select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface);
  font: 400 15px/1.4 var(--font-body); color: var(--fg);
}
.space__history-link { font-size: 14px; font-weight: 500; }

/* ---------- Administration ---------- */
.admin #admin { display: grid; gap: var(--s-4); }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.run__idle { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); }
.run__idle p { margin: 0; }
.run__go { min-height: 48px; }
.run__live { display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4); border-radius: var(--r); background: var(--surface-2); }
.run__live p { margin: 2px 0 0; }
.run__live .spinner { width: 32px; height: 32px; border-width: 3px; }
.spinner--sm { width: 10px; height: 10px; border-width: 2px; }

/* Timeline des étapes : un point par étape, relié au suivant ; couleur = état dans la dernière exécution */
.pipeline { list-style: none; margin: 0; padding: 0; display: grid; }
.pipeline__step { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: var(--s-3); padding-bottom: var(--s-4); }
.pipeline__step:not(:last-child)::after { content: ""; position: absolute; left: 9.5px; top: 22px; bottom: 0; width: 1px; background: var(--border); }
.pipeline__dot { display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; border: 2px solid #c9cfdb; background: var(--surface); }
.pipeline__step--ok .pipeline__dot { border-color: #15803d; background: #15803d; }
.pipeline__step--ko .pipeline__dot { border-color: #b91c1c; background: #b91c1c; }
.pipeline__step--run .pipeline__dot { border-color: var(--c-violet); }
.pipeline__step--off .pipeline__dot { border-style: dashed; }
.pipeline__step.is-off .pipeline__body { opacity: .55; }
.pipeline__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--s-2); }
.pipeline__key { font: 600 12px/1 ui-monospace, "SF Mono", Menlo, monospace; padding: 3px 6px; border-radius: 4px; background: var(--surface-2); color: var(--fg-2); }
.pipeline__state { font-size: 13px; color: var(--muted); }
.pipeline__step--ok .pipeline__state { color: #15803d; }
.pipeline__step--ko .pipeline__state { color: #b91c1c; font-weight: 600; }
.pipeline__body p { margin: 2px 0 0; font-size: 14px; }
.pipeline__summary { font: 400 12.5px/1.45 ui-monospace, "SF Mono", Menlo, monospace; color: var(--fg-2); overflow-wrap: anywhere; }
.pipeline__note { margin: 0; font-size: 14px; }

/* Interrupteur : case à cocher (role="switch") restylée, utilisable au clavier */
.switch { position: relative; display: inline-flex; align-items: center; min-height: 32px; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: inherit; }
.switch__track { width: 40px; height: 22px; border-radius: 999px; background: #c9cfdb; transition: background .15s var(--ease); position: relative; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s var(--ease); }
.switch input:checked + .switch__track { background: var(--fg); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent); }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + .switch__track { opacity: .45; }

.runs, .requests, .admins { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.runs__item, .requests__item, .admins__item { display: grid; gap: 2px; padding: var(--s-3); border: 1px solid var(--border); border-radius: var(--r); font-size: 14px; }
.runs__item p { margin: 0; }
.runs__item--failed { border-color: #f3c4c4; }
.runs__log { margin: var(--s-2) 0 0; padding: var(--s-3); border-radius: var(--r-sm); background: var(--surface-2); font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 280px; overflow: auto; }
.requests__item, .admins__item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s-2); overflow-wrap: anywhere; }
.requests__actions { display: flex; gap: var(--s-2); }
.requests + details, #requests details { margin-top: var(--s-3); }
#requests summary, .runs__item summary { cursor: pointer; color: var(--muted); font-weight: 500; min-height: 28px; display: inline-flex; align-items: center; }
.admins__add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-3); }
.admins__add .field { flex: 1 1 260px; }
#llm-model { min-height: 180px; }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
}
.space__card > .history { border-top: 0; padding-top: 0; }
