/* QG de l'équipe : lisible d'abord. Des cartes blanches sur un fond calme, une couleur par sens (fait, en cours, à surveiller, bloqué). */

:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f0f1f5;
  --fg: #1b1e25;
  --muted: #5d6572;
  --border: #e1e4ea;
  --accent: #5146d8;
  --accent-hover: #4338c4;
  --accent-fg: #ffffff;
  --accent-soft: #ecebfc;
  --focus: #5146d8;
  --good: #1d7a3b;  --good-soft: #e3f4e8;
  --info: #2155c4;  --info-soft: #e7eefc;
  --warn: #965500;  --warn-soft: #fcefd9;
  --bad: #b3261e;   --bad-soft: #fce9e7;
  --neutral: #5d6572; --neutral-soft: #edeff3;
  --add: #dcf5e3;
  --del: #fde4e1;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.06), 0 1px 3px rgb(16 24 40 / 0.05);
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1015;
    --surface: #171a21;
    --surface-2: #1f232c;
    --fg: #e7e9ee;
    --muted: #a0a8b4;
    --border: #2b303b;
    --accent: #8f88ff;
    --accent-hover: #a59fff;
    --accent-fg: #0e1015;
    --accent-soft: #262447;
    --focus: #a59fff;
    --good: #63d48f;  --good-soft: #153222;
    --info: #86aaff;  --info-soft: #18243f;
    --warn: #f2b54f;  --warn-soft: #382910;
    --bad: #ff8b80;   --bad-soft: #3d1b19;
    --neutral: #a0a8b4; --neutral-soft: #242833;
    --add: #143522;
    --del: #42191b;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1015;
  --surface: #171a21;
  --surface-2: #1f232c;
  --fg: #e7e9ee;
  --muted: #a0a8b4;
  --border: #2b303b;
  --accent: #8f88ff;
  --accent-hover: #a59fff;
  --accent-fg: #0e1015;
  --accent-soft: #262447;
  --focus: #a59fff;
  --good: #63d48f;  --good-soft: #153222;
  --info: #86aaff;  --info-soft: #18243f;
  --warn: #f2b54f;  --warn-soft: #382910;
  --bad: #ff8b80;   --bad-soft: #3d1b19;
  --neutral: #a0a8b4; --neutral-soft: #242833;
  --add: #143522;
  --del: #42191b;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
code, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9em; }
code { background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 5px; }
pre { overflow-x: auto; background: var(--surface-2); padding: 0.75rem; border-radius: 8px; }
pre code { background: none; padding: 0; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 0.35rem; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 0.95rem; margin: 1rem 0 0.4rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hint { color: var(--muted); font-size: 0.88rem; margin: 0.15rem 0 0; }
.lead { color: var(--muted); font-size: 1.05rem; margin: 0; }
.lead strong { color: var(--fg); }
.count { display: inline-block; min-width: 1.6em; padding: 0 0.45em; border-radius: 999px; background: var(--surface-2); color: var(--muted);
  font-size: 0.8rem; font-weight: 600; text-align: center; vertical-align: 0.1em; }
.empty { color: var(--muted); margin: 0.25rem 0; font-style: italic; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: 0.5rem; z-index: 10; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.t-good { color: var(--good); } .t-info { color: var(--info); } .t-warn { color: var(--warn); } .t-bad { color: var(--bad); } .t-muted { color: var(--muted); }

/* ---------- Header ---------- */
.top { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.top-inner { max-width: 82rem; margin: 0 auto; padding: 0.55rem 1rem; display: flex; align-items: center; gap: 0.5rem 1.5rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--fg); text-decoration: none; font-weight: 700; }
.brand svg { color: var(--accent); }
.main-nav { display: flex; gap: 0.15rem; flex-wrap: wrap; flex: 1; }
.main-nav a { white-space: nowrap; color: var(--muted); text-decoration: none; padding: 0.4rem 0.75rem; border-radius: 8px; font-weight: 500; }
.main-nav a:hover { background: var(--surface-2); color: var(--fg); }
.main-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.top-right { display: flex; align-items: center; gap: 0.75rem; }
.top-search input { width: 13rem; max-width: 40vw; background: var(--surface-2); border-color: transparent; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; display: flex; border-radius: 50%; }
.user-menu summary::-webkit-details-marker { display: none; }
.menu { position: absolute; right: 0; top: calc(100% + 0.5rem); background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.15); min-width: 14rem; padding: 0.4rem; z-index: 20; display: flex; flex-direction: column; }
.menu-who { margin: 0.3rem 0.6rem 0.5rem; line-height: 1.3; }
.menu a, .menu .menu-item { display: block; width: 100%; text-align: left; padding: 0.45rem 0.6rem; border-radius: 6px; color: var(--fg);
  text-decoration: none; background: none; border: none; font: inherit; cursor: pointer; }
.menu a:hover, .menu .menu-item:hover { background: var(--surface-2); }
.menu form { margin: 0; }
@media (max-width: 52rem) {
  .main-nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .top-right { margin-left: auto; }
  .top-search input { width: 9rem; }
}

main { max-width: 56rem; margin: 0 auto; padding: 1.75rem 1rem 4rem; }
main.wide { max-width: 82rem; }
.page-head { margin-bottom: 1.25rem; }
.page-head .bar { margin-top: 0.75rem; max-width: 30rem; }
.title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem 1.5rem; flex-wrap: wrap; }
/* Le titre prend la place, le bouton principal reste à droite (et passe dessous seulement sur un écran étroit). */
.title-row > div { flex: 1 1 22rem; min-width: 0; }
.title-row > .button { flex: none; margin-top: 0.35rem; }
.crumbs { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.9rem; }
.crumbs a { color: var(--muted); }

/* ---------- Controls ---------- */
input, select, textarea, button {
  font: inherit; color: var(--fg); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 0.45rem 0.65rem; max-width: 100%;
}
textarea { width: 100%; line-height: 1.5; }
button, .button {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; background: var(--accent); color: var(--accent-fg);
  border: 1px solid var(--accent); text-decoration: none; border-radius: 8px; padding: 0.45rem 0.9rem; font-weight: 600; line-height: 1.3;
}
button:hover, .button:hover { background: var(--accent-hover); color: var(--accent-fg); }
button.secondary, .button.secondary { background: var(--surface); color: var(--fg); border-color: var(--border); }
button.secondary:hover, .button.secondary:hover { background: var(--surface-2); color: var(--fg); }
button.good, .button.good { background: var(--good); border-color: var(--good); color: #fff; }
:root[data-theme="dark"] button.good { color: #0e1015; }
button.danger, .button.danger { background: var(--surface); color: var(--bad); border-color: var(--bad); }
button.danger:hover, .button.danger:hover { background: var(--bad-soft); color: var(--bad); }
button.link { background: none; border: none; color: var(--accent); padding: 0; font-weight: 500; text-decoration: underline; }

.stack { display: flex; flex-direction: column; gap: 0.3rem; }
.stack > label { font-weight: 600; margin-top: 0.85rem; }
.stack input:not([type="checkbox"]):not([type="radio"]), .stack select { width: 100%; }
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem 1.25rem 1.25rem; box-shadow: var(--shadow); max-width: 44rem; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.25rem; flex-wrap: wrap; }
fieldset { border: none; padding: 0; margin: 0.85rem 0 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 0.35rem; }
.check { display: inline-flex; gap: 0.35rem; align-items: center; margin-right: 1rem; }
.choices { display: grid; gap: 0.5rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 36rem) { .choices { grid-template-columns: 1fr; } }
.choices legend { grid-column: 1 / -1; }
.choice { display: flex; gap: 0.6rem; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0.75rem; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: 0.3rem; }
.more { margin-top: 1rem; border-top: 1px solid var(--border); padding-top: 0.6rem; }
.more summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.more > label { display: block; font-weight: 600; margin: 0.85rem 0 0.3rem; }
.more input { width: 100%; }
.filters { display: flex; flex-wrap: wrap; gap: 0.6rem 0.9rem; align-items: end; margin-bottom: 1.25rem; max-width: 56rem; }
.filters label { display: flex; flex-direction: column; font-size: 0.85rem; color: var(--muted); gap: 0.2rem; flex: 1 1 9rem; min-width: 0; }
.filters label.filter-q { flex: 2 1 15rem; }
.filters input, .filters select { width: 100%; }
@media (max-width: 640px) { .filters label { flex-basis: 40%; } .filters label.filter-q { flex-basis: 100%; } }
.inline-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0; }

/* ---------- Panels, groups, tabs ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.panel > h2:first-child, .panel > summary h2 { margin-top: 0; }
.panel h2 a { color: inherit; text-decoration: none; }
.panel h2 a:hover { color: var(--accent); }
.panel-warn { border-color: var(--warn); }
details > summary { cursor: pointer; }
details > summary h2 { display: inline; }
.group { margin-top: 1.5rem; }
.group > h2, .group > summary h2 { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.6rem; }
details.group > summary { list-style: none; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary h2::after { content: "Afficher"; font-size: 0.8rem; font-weight: 500; color: var(--accent); margin-left: 0.25rem; }
details.group[open] > summary h2::after { content: "Masquer"; }
.tabs { display: flex; gap: 0.25rem; margin: 0 0 1.25rem; border-bottom: 1px solid var(--border); }
.tabs a { padding: 0.5rem 0.9rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.notice { border: 1px solid var(--warn); background: var(--warn-soft); border-radius: 10px; padding: 0.75rem 1rem; margin: 0.75rem 0; }
.notice ul { margin: 0; padding-left: 1.2rem; }
.error { border: 1px solid var(--bad); background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 0.65rem 0.9rem; margin: 0.5rem 0; }
.source { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.88rem;
  display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }

/* ---------- Badges, chips, people ---------- */
.badge { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 0.12rem 0.6rem; border-radius: 999px; white-space: nowrap;
  background: var(--neutral-soft); color: var(--neutral); line-height: 1.5; }
.tone-good.badge, .badge.tone-good { background: var(--good-soft); color: var(--good); }
.badge.tone-info { background: var(--info-soft); color: var(--info); }
.badge.tone-warn { background: var(--warn-soft); color: var(--warn); }
.badge.tone-bad { background: var(--bad-soft); color: var(--bad); }
.chip { display: inline-block; font-size: 0.78rem; padding: 0.05rem 0.5rem; border-radius: 6px; background: var(--surface-2); color: var(--muted);
  text-decoration: none; white-space: nowrap; border: 1px solid var(--border); }
a.chip:hover { color: var(--fg); }
.chip.tone-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.tone-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.avatar { border-radius: 50%; vertical-align: middle; background: var(--surface-2); flex: none; }
.avatar-empty { display: inline-grid; place-items: center; width: 28px; height: 28px; color: var(--muted); }
.person { display: inline-flex; align-items: center; gap: 0.35rem; margin-right: 0.6rem; }
.who { display: inline-flex; }

/* ---------- Task rows (issues, décisions, chantiers) ---------- */
.tasks { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel .tasks { border: none; box-shadow: none; background: none; }
.task { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; padding: 0.6rem 0.9rem; border-top: 1px solid var(--border); }
.task:first-child { border-top: none; }
.panel .task { padding-left: 0; padding-right: 0; }
.task-main { flex: 1 1 18rem; min-width: 0; color: var(--fg); text-decoration: none; display: flex; gap: 0.5rem; align-items: baseline; }
.task-main:hover .task-title { color: var(--accent); text-decoration: underline; }
.task-ref { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; flex: none; }
.task-title { overflow-wrap: anywhere; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.next { flex-basis: 100%; color: var(--muted); font-size: 0.88rem; padding-left: 0; }
.tasks.compact .task { padding-top: 0.4rem; padding-bottom: 0.4rem; }

/* ---------- Home ---------- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 60rem) {
  .home-grid { display: flex; flex-direction: column; gap: 0; align-items: stretch; }
  .home-main, .home-side { display: contents; }
  .home-grid .stuck-first { order: -1; }
}
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.person-card { border-top: 1px solid var(--border); padding-top: 0.8rem; }
.person-card:first-child { border-top: none; padding-top: 0; }
.person-head { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 0.25rem; }
.mini-domains { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.mini-domains li { display: grid; grid-template-columns: 8rem 1fr 2.6rem; align-items: center; gap: 0.6rem; }
.mini-domains a { color: var(--fg); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-domains a:hover { color: var(--accent); }

/* ---------- Activity ---------- */
.acts { list-style: none; margin: 0; padding: 0; }
.act { display: flex; gap: 0.7rem; padding: 0.55rem 0; border-top: 1px solid var(--border); }
.act:first-child { border-top: none; }
.act-body { min-width: 0; }
.act-body p { margin: 0; }
.act-title { color: var(--fg); text-decoration: none; }
.act-title:hover { text-decoration: underline; }
.act-title:hover { color: var(--accent); }
.act-meta { color: var(--muted); font-size: 0.85rem; }
.day { margin-bottom: 1.5rem; }
.day-title { font-size: 0.95rem; color: var(--muted); margin: 0 0 0.4rem; }
.day .acts { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.25rem 1rem; box-shadow: var(--shadow); }

/* ---------- Le jeu ---------- */
.bar { height: 0.5rem; border-radius: 999px; background: var(--surface-2); overflow: hidden; min-width: 3rem; }
.bar span { display: block; height: 100%; background: var(--good); border-radius: 999px; }
.stats { list-style: none; padding: 0; margin: 0 0 0.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.75rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; box-shadow: var(--shadow);
  display: flex; flex-direction: column; border-left: 4px solid var(--neutral); }
.stat.tone-good { border-left-color: var(--good); } .stat.tone-info { border-left-color: var(--info); }
.stat.tone-warn { border-left-color: var(--warn); } .stat.tone-bad { border-left-color: var(--bad); }
.stat-n { font-size: 1.6rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-l { color: var(--muted); font-size: 0.9rem; }
.domains { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.85rem; }
.domain-card { display: flex; flex-direction: column; gap: 0.5rem; height: 100%; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--fg); text-decoration: none; box-shadow: var(--shadow); transition: border-color 0.15s; }
.domain-card:hover { border-color: var(--accent); color: var(--fg); }
.domain-top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.domain-name { font-weight: 700; font-size: 1.05rem; }
.domain-pct { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.domain-open { font-size: 0.9rem; }
.repos { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0.85rem; }
.repo { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.85rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.repo-name { font-weight: 700; }
.systems { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); gap: 0.6rem; }
.system { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0.9rem; }
.system summary { display: flex; justify-content: space-between; gap: 0.5rem; }
.system-name { font-weight: 600; }
.files { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.88rem; }

/* ---------- Chantiers ---------- */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: start; }
@media (max-width: 52rem) { .board { grid-template-columns: 1fr; } }
.column { background: var(--surface-2); border-radius: var(--radius); padding: 0.75rem; }
.column > h2 { margin: 0 0 0.6rem; display: flex; align-items: center; gap: 0.5rem; }
.cards-col { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem 0.9rem; box-shadow: var(--shadow); }
.card-title { font-weight: 600; color: var(--fg); text-decoration: none; }
.card-title:hover { color: var(--accent); text-decoration: underline; }
.card .next { margin: 0.35rem 0 0; }
.card-foot { margin: 0.5rem 0 0; display: flex; align-items: center; gap: 0.35rem; }

/* ---------- Fiche (décision, chantier, nouvelle) ---------- */
.record h1 { font-size: 1.9rem; margin-bottom: 0.9rem; }
.status-box { border-radius: 10px; padding: 0.7rem 1rem; background: var(--neutral-soft); margin-bottom: 1rem; }
.tone-box-good { background: var(--good-soft); } .tone-box-info { background: var(--info-soft); }
.tone-box-warn { background: var(--warn-soft); } .tone-box-bad { background: var(--bad-soft); }
.status-line { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin: 0; }
.status-box .badge { background: var(--surface); }
.facts { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; }
.facts li { display: block; min-width: 0; max-width: 100%; }
/* Le libellé au-dessus, la valeur en texte courant : une liste de liens (« P-2, P-3 ») reste sur une ligne et passe à la ligne entre deux liens. */
.fact-label { display: block; font-size: 0.8rem; color: var(--muted); font-weight: 600; margin-bottom: 0.1rem; }
.ref-list .ref-link { white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: flex-start; justify-content: space-between; margin: 0 0 1.25rem; }
.actions-main, .actions-more { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-start; }
.actions form { margin: 0; }
.pop { position: relative; }
.pop > summary { list-style: none; }
.pop > summary::-webkit-details-marker { display: none; }
.pop[open] > form { position: absolute; z-index: 10; top: calc(100% + 0.4rem); left: 0; width: min(24rem, 85vw); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 0.4rem 1rem 1rem; box-shadow: 0 8px 24px rgb(0 0 0 / 0.15); }
.markdown { overflow-wrap: anywhere; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown img { max-width: 100%; }
.markdown table { border-collapse: collapse; }
.markdown th, .markdown td { border: 1px solid var(--border); padding: 0.3rem 0.5rem; }

.comments { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.9rem; }
.comment { display: flex; gap: 0.7rem; align-items: flex-start; }
.comment > div { flex: 1; min-width: 0; background: var(--surface-2); border-radius: 10px; padding: 0.5rem 0.8rem; }
.comment.objection > div { background: var(--warn-soft); }
.comment .meta { margin: 0 0 0.2rem; font-size: 0.88rem; color: var(--muted); }
.comment .meta strong { color: var(--fg); }
.comment-form { display: grid; gap: 0.5rem; }

.history summary h2 { font-size: 1rem; color: var(--muted); }
.timeline { list-style: none; padding: 0; margin: 0.75rem 0 0; display: grid; gap: 0.5rem; font-size: 0.92rem; }
.timeline li { padding-left: 1rem; border-left: 2px solid var(--border); }
.old-value summary { color: var(--accent); font-size: 0.85rem; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.75rem; }
.cols pre { white-space: pre-wrap; margin: 0; }
.cols h4 { margin: 0.5rem 0 0.25rem; font-size: 0.85rem; color: var(--muted); }

/* ---------- Tables (accès agents), conflit ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
th { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.token { width: 100%; font-family: ui-monospace, monospace; }
.diff { white-space: pre-wrap; }
.diff .dadd { background: var(--add); display: block; }
.diff .ddel { background: var(--del); display: block; }
.diff .dsame { display: block; }

/* ---------- Connexion ---------- */
.login { max-width: 28rem; margin: 10vh auto 0; text-align: center; }
.login .panel { padding: 2rem; }
.login .button { font-size: 1.05rem; padding: 0.6rem 1.2rem; }

/* ---------- Carte : racine, tronc, un rameau par domaine, ses tâches ouvertes ---------- */
.legend { list-style: none; padding: 0; margin: 0 0 1.25rem; display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; color: var(--muted); font-size: 0.9rem; }
.legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.dot { width: 0.75rem; height: 0.75rem; border-radius: 3px; display: inline-block; background: var(--neutral); }
.dot.st-blocked { background: var(--bad); } .dot.st-doing { background: var(--info); } .dot.st-verify { background: var(--warn); }
.dot.st-todo { background: var(--neutral); } .dot.st-done { background: var(--good); }
.dot-record { background: var(--accent); border-radius: 50%; }

.mindmap { --trunk: 2.25rem; --stub: 2rem; --mid: 2.4rem; }
.mm-root { display: inline-flex; flex-direction: column; gap: 0.35rem; min-width: 17rem; padding: 0.9rem 1.1rem; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-fg); box-shadow: var(--shadow); }
.mm-root-name { font-weight: 800; font-size: 1.2rem; }
.mm-root-pct { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.mm-root .bar { background: rgb(255 255 255 / 0.3); }
.mm-root .bar span { background: var(--accent-fg); }
.mm-root .muted { color: inherit; opacity: 0.85; }
.mm-rows { list-style: none; margin: 0 0 0 var(--trunk); padding: 0.5rem 0 0 var(--stub); }
.mm-row { position: relative; display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: 0 var(--stub); padding: 0.6rem 0; align-items: start; }
/* tronc vertical */
.mm-row::after { content: ""; position: absolute; left: calc(-1 * var(--stub)); top: 0; bottom: 0; border-left: 2px solid var(--border); }
.mm-row:first-child::after { top: -0.5rem; }
.mm-row:last-child::after { bottom: calc(100% - 0.6rem - var(--mid)); }
/* rameau vers le domaine */
.mm-row::before { content: ""; position: absolute; left: calc(-1 * var(--stub)); width: var(--stub); top: calc(0.6rem + var(--mid)); border-top: 2px solid var(--border); }
.mm-domain { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.85rem 1rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--fg); text-decoration: none; box-shadow: var(--shadow); min-height: calc(2 * var(--mid)); }
a.mm-domain:hover { border-color: var(--accent); color: var(--fg); }
.mm-domain-plain { background: var(--surface-2); box-shadow: none; }
.mm-row-done .mm-domain { opacity: 0.8; }
.mm-alldone { margin: 0; align-self: center; font-weight: 600; position: relative; }
.mm-leaves { list-style: none; margin: 0; padding: 0; position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.5rem; }
/* rameau du domaine vers ses tâches */
.mm-leaves::before, .mm-alldone::before { content: ""; position: absolute; left: calc(-1 * var(--stub)); width: var(--stub); top: var(--mid); border-top: 2px dashed var(--border); }
.mm-alldone::before { top: 50%; }
.node { display: flex; flex-direction: column; gap: 0.2rem; height: 100%; padding: 0.55rem 0.75rem; background: var(--surface); color: var(--fg); text-decoration: none;
  border: 1px solid var(--border); border-left: 4px solid var(--neutral); border-radius: 10px; box-shadow: var(--shadow); }
a.node:hover { border-color: var(--accent); color: var(--fg); }
.node.st-blocked { border-left-color: var(--bad); } .node.st-doing { border-left-color: var(--info); }
.node.st-verify { border-left-color: var(--warn); } .node.st-done { border-left-color: var(--good); }
.node-record { border-left-color: var(--accent); border-style: dashed; border-left-style: solid; }
.node-top { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.8rem; }
.node-state { font-weight: 600; }
.node-title { line-height: 1.35; overflow-wrap: anywhere; }
.node-foot { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin-top: 0.15rem; }
.node-foot .who { gap: 0.25rem; align-items: center; color: var(--muted); }
.node-more { justify-content: center; align-items: center; color: var(--accent); border-left-color: var(--border); font-weight: 600; box-shadow: none; background: var(--surface-2); }
@media (max-width: 52rem) {
  .mindmap { --stub: 1rem; --trunk: 1rem; }
  .mm-row { grid-template-columns: 1fr; gap: 0.5rem; }
  .mm-leaves, .mm-alldone { margin-left: 1rem; }
  .mm-leaves::before, .mm-alldone::before { display: none; }
  .mm-leaves { border-left: 2px dashed var(--border); padding-left: 0.75rem; }
}

/* ---------- Gérer : messages, sélection, corbeille, fusion ---------- */
.flash { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; border: 1px solid var(--good); background: var(--good-soft);
  border-radius: 10px; padding: 0.65rem 1rem; margin: 0 0 1rem; font-weight: 500; }
.flash form { margin: 0; }
.empty-action { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; font-style: normal; padding: 1rem;
  border: 1px dashed var(--border); border-radius: 10px; }
.empty-action p { margin: 0; }
.picker { border: 1px solid var(--border); border-radius: 10px; padding: 0.5rem 0.75rem; }
.picker-list { max-height: 16rem; overflow-y: auto; display: grid; gap: 0.1rem; }
.picker .check { display: flex; gap: 0.45rem; align-items: baseline; font-weight: 400; margin: 0; padding: 0.2rem 0.3rem; border-radius: 6px; }
.picker .check:hover { background: var(--surface-2); }
.picker .check:has(input:checked) { background: var(--accent-soft); }
.picker .check[hidden] { display: none; }
.picker .check .task-ref { flex: none; min-width: 2.6rem; }
.picker-filter { width: 100%; margin: 0 0 0.4rem; padding: 0.35rem 0.6rem; font-size: 0.9rem; }
.picker legend .count { margin-left: 0.25rem; }
input.select { width: 1.1rem; height: 1.1rem; margin: 0; flex: none; accent-color: var(--accent); }
.bulk-bar { position: sticky; bottom: 0.5rem; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  margin: 1rem 0 0; padding: 0.6rem 0.9rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.bulk-bar label { font-weight: 600; }
.bulk-bar.is-idle { display: none; }
.bulk-count { font-weight: 700; color: var(--accent); }
.bulk-count:empty { display: none; }
.card-top { display: flex; gap: 0.5rem; align-items: baseline; }
.card-foot { flex-wrap: wrap; }
.status-form { margin-left: auto; }
.status-form select { padding: 0.2rem 0.4rem; font-size: 0.85rem; width: auto; }
/* Sur une carte, le statut se lit comme une étiquette ; le cadre n’apparaît qu’au survol. */
.card-foot .status-form select { border-color: transparent; background-color: var(--surface-2); color: var(--muted); font-weight: 600; }
.card-foot .status-form select:hover, .card-foot .status-form select:focus { border-color: var(--border); color: var(--fg); }
/* Sur une fiche, le menu de statut a la taille des boutons à côté. */
.actions-more .status-form { margin-left: 0; }
.actions-more .status-form select { padding: 0.45rem 0.65rem; font-size: 1rem; font-weight: 600; line-height: 1.3; }
.comment-actions { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; align-items: flex-start; margin-top: 0.3rem; font-size: 0.85rem; }
.comment-actions summary { cursor: pointer; color: var(--accent); text-decoration: underline; }
.comment-actions details[open] { flex-basis: 100%; }
.comment-actions form { margin: 0; }
.manage > summary { cursor: pointer; }
.manage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem 1.5rem; margin-top: 0.75rem; }
.manage-grid h3 { margin: 0; font-size: 1rem; }
.bin-banner { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }
.bin-banner form { margin: 0; }
.timeline .revert { display: inline-flex; margin-left: 0.4rem; font-size: 0.85rem; }
.card-progress { display: grid; gap: 0.2rem; margin: 0.4rem 0 0; }
.plan-tasks .bar { margin: 0 0 0.5rem; }
.plan-card .card-title { line-height: 1.35; }
.plan-card .next { font-size: 0.92rem; color: var(--muted); }
.board .column > h2 { font-size: 1rem; }
/* Cartes des chantiers : sur un grand écran, trois colonnes bien larges. */
@media (min-width: 72rem) { main.wide .board { gap: 1.25rem; } }
.facts-wide { flex-direction: column; gap: 0.5rem; }
.facts-wide form.inline-form { display: inline-flex; }
.link-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem 1.5rem; }
.link-facts form.inline-form { display: inline-flex; }
.add-plan { margin-top: 0.25rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.add-plan select { flex: 1 1 14rem; min-width: 0; }
.notice form.inline-form { display: inline; }

/* ---------- Aide ---------- */
.help-link { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; border: 1px solid var(--border);
  color: var(--fg); text-decoration: none; font-weight: 700; flex: none; }
.help-link:hover { background: var(--accent-soft); color: var(--accent); }
.welcome { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; border: 1px solid var(--accent); background: var(--accent-soft);
  border-radius: 10px; padding: 0.7rem 1rem; margin: 0 0 1rem; }
.welcome p { margin: 0; flex: 1 1 20rem; }
.help-toc ol { margin: 0; padding-left: 1.3rem; columns: 2 16rem; }
.help-toc li { margin: 0.15rem 0; }
.help { scroll-margin-top: 5rem; }
.help h3 { margin: 1rem 0 0.4rem; font-size: 1rem; }
.help-dl dt { font-weight: 700; margin-top: 0.75rem; scroll-margin-top: 5rem; }
.help-dl dd { margin: 0.15rem 0 0; color: var(--fg); }
.help-step { border-top: 1px solid var(--border); padding: 0.55rem 0; scroll-margin-top: 5rem; }
.help-step > summary { cursor: pointer; font-weight: 600; }
.help-body { padding: 0.4rem 0 0.2rem 1.1rem; }
.help-body ol, .help-body ul { margin: 0.3rem 0; padding-left: 1.2rem; }
.help-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.help-table td, .help-table th { text-align: left; vertical-align: top; padding: 0.4rem 0.5rem; border-top: 1px solid var(--border); }
.help-table td:first-child { white-space: nowrap; width: 1%; }
.help-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 0 1.5rem; }
.help pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2, var(--bg)); padding: 0.6rem 0.8rem; border-radius: 8px; }
@media (max-width: 640px) { .help-table td:first-child { white-space: normal; } }

/* ---------- Carte : décisions et chantiers hors domaine, repliés ---------- */
.mm-row-loose { grid-template-columns: minmax(0, 1fr); }
.mm-row-loose::before { top: 1.6rem; }
.mm-row-loose:last-child::after { bottom: calc(100% - 1.6rem); }
.mm-loose { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.6rem 1rem; }
.mm-loose > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.5rem; }
.mm-loose > summary::after { content: "Afficher"; margin-left: auto; font-size: 0.85rem; font-weight: 600; color: var(--accent); }
.mm-loose[open] > summary::after { content: "Masquer"; }
.mm-loose-count { font-weight: 600; }
.mm-loose .tasks { margin-top: 0.5rem; background: var(--surface); }

/* ---------- Texte long d'une fiche : le début, puis « Lire la suite » ---------- */
.read-more { margin-top: 1rem; }
.read-more > summary { display: inline-flex; align-items: center; gap: 0.4rem; list-style: none; font-weight: 600; color: var(--accent);
  padding: 0.4rem 0.9rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.read-more > summary::-webkit-details-marker { display: none; }
.read-more > summary::before { content: "▸"; }
.read-more[open] > summary::before { content: "▾"; }
.read-more > summary:hover { border-color: var(--accent); }
.read-more .read-more-open, .read-more[open] .read-more-closed { display: none; }
.read-more[open] .read-more-open { display: inline; }
.read-more-body { margin-top: 1rem; }
.read-more-body > :first-child { margin-top: 0; }

/* ---------- Barre d'avancement en couleurs : faites, à vérifier, en cours, bloquées, à faire ---------- */
:root { --bar-todo: #c3c8d2; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bar-todo: #424856; } }
:root[data-theme="dark"] { --bar-todo: #424856; }
.bar-states { display: flex; gap: 1px; }
.bar-states .seg { display: block; height: 100%; border-radius: 0; flex: none; }
.bar-states .seg:first-child { border-radius: 999px 0 0 999px; }
.bar-states .seg:last-child { border-radius: 0 999px 999px 0; }
.bar-states .seg:only-child { border-radius: 999px; }
.seg-done, .bar .seg-done { background: var(--good); } .seg-verify, .bar .seg-verify { background: var(--warn); }
.seg-doing, .bar .seg-doing { background: var(--info); } .seg-blocked, .bar .seg-blocked { background: var(--bad); }
.seg-todo, .bar .seg-todo { background: var(--bar-todo); }
.bar-legend { list-style: none; padding: 0; margin: 0.5rem 0 0; display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; font-size: 0.8rem; color: var(--muted); }
.bar-legend li { display: inline-flex; align-items: center; gap: 0.3rem; }
.seg-dot { width: 0.7rem; height: 0.7rem; border-radius: 3px; display: inline-block; }

/* ---------- Accueil : « À toi de jouer » en sections compactes ---------- */
.mine-group + .mine-group { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.mine-group h3 { margin: 0 0 0.25rem; font-size: 0.95rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.more-rows > summary { list-style: none; display: inline-block; margin-top: 0.35rem; color: var(--accent); font-weight: 600; font-size: 0.9rem; }
.more-rows > summary::-webkit-details-marker { display: none; }
.more-rows > summary::before { content: "▸ "; }
.more-rows[open] > summary::before { content: "▾ "; }
.more-rows .more-open, .more-rows[open] .more-closed { display: none; }
.more-rows[open] .more-open { display: inline; }
.more-rows[open] > summary { margin-bottom: 0.25rem; }

/* ---------- Journal : plusieurs événements regroupés, dépliables ---------- */
.act-more > summary { list-style: none; display: flex; flex-direction: column; }
.act-more > summary::-webkit-details-marker { display: none; }
.act-toggle { color: var(--accent); font-weight: 600; }
.act-more .more-open, .act-more[open] .more-closed { display: none; }
.act-more[open] .more-open { display: inline; }
.act-more > summary:hover .act-toggle { text-decoration: underline; }
.act-list { list-style: none; margin: 0.35rem 0 0.15rem; padding: 0 0 0 0.75rem; border-left: 2px solid var(--border); display: grid; gap: 0.2rem; font-size: 0.92rem; }

/* ---------- Fiche décision : menu « Plus » (changer le statut, confier) ---------- */
.pop[open] > .pop-panel { position: absolute; z-index: 10; top: calc(100% + 0.4rem); left: 0; width: min(22rem, calc(100vw - 2rem)); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 0.25rem 1rem 1rem; box-shadow: 0 8px 24px rgb(0 0 0 / 0.15); display: grid; gap: 0.25rem; }
.pop-panel form + form { border-top: 1px solid var(--border); margin-top: 0.75rem; padding-top: 0.25rem; }
.pop-panel label { font-weight: 600; margin-top: 0.6rem; }
.pop-panel select { width: 100%; }
/* Sur un téléphone, le panneau s’ouvre dans le flux, sous les boutons, au lieu de flotter hors de l’écran. */
@media (max-width: 40rem) {
  .actions .pop[open] { flex-basis: 100%; }
  .actions .pop[open] > .pop-panel, .actions .pop[open] > form { position: static; width: auto; margin-top: 0.4rem; box-shadow: none; }
}

/* ---------- En-tête sur un téléphone : deux rangées, recherche en icône, menu qui défile avec un fondu au bord ---------- */
.search-link { display: none; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; border: 1px solid var(--border); color: var(--fg); flex: none; }
.search-link:hover { background: var(--accent-soft); color: var(--accent); }
@media (max-width: 640px) {
  .top-inner { padding: 0.4rem 1rem 0.3rem; gap: 0.3rem 0.75rem; }
  .brand svg { width: 24px; height: 24px; }
  .top-right { gap: 0.5rem; }
  .top-search { display: none; }
  .search-link { display: inline-grid; }
  .main-nav {
    --fade-l: 0px; --fade-r: 2.5rem;
    position: relative; margin: 0 -1rem; padding: 0 2.5rem 0.15rem 1rem; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
    mask-image: linear-gradient(to right, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
  }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav:not(.at-start) { --fade-l: 2rem; }
  .main-nav.at-end { --fade-r: 0px; }
  .main-nav.at-start.at-end { -webkit-mask-image: none; mask-image: none; }
  .main-nav a { padding: 0.35rem 0.65rem; }
  main { padding-top: 1.25rem; }
}

/* ---------- Texte GitHub : listes de cases (« - [ ] ») ---------- */
.markdown li.task-item { list-style: none; position: relative; }
.markdown ul:has(> li.task-item) { padding-left: 1.4rem; }
.task-box { display: inline-block; width: 0.95rem; height: 0.95rem; border: 1.5px solid var(--muted); border-radius: 4px; vertical-align: -0.12rem; margin: 0 0.45rem 0 -1.4rem; }
.task-box.done { background: var(--good); border-color: var(--good); position: relative; }
.task-box.done::after { content: ""; position: absolute; left: 0.25rem; top: 0.05rem; width: 0.25rem; height: 0.5rem; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* ---------- Le jeu : un peu d’air entre la légende et les compteurs ---------- */
.bar-legend + .stats { margin-top: 1rem; }
.domain-open > span { white-space: nowrap; }

/* ---------- Textes : références lisibles (D-5, #204, ADR 0005, ligne 372) et « Ce que cite ce texte » ---------- */
.markdown a.ref-rich { text-decoration: underline dotted; text-underline-offset: 0.2em; font-weight: 600; white-space: nowrap; }
.markdown a.ref-rich:hover { text-decoration-style: solid; }
.cited { margin-top: 1.25rem; padding: 0.75rem 1rem; border-radius: 10px; background: var(--surface-2); }
.cited h3 { margin: 0 0 0.4rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.cited ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.cited li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.5rem; }
.cited li > a { color: var(--fg); text-decoration: none; }
.cited li > a:hover .cited-title { text-decoration: underline; color: var(--accent); }
.cited .task-ref { display: inline-block; min-width: 2.8rem; }

/* ---------- Le jeu : compteurs cliquables qui disent ce que veut dire chaque état ---------- */
.stats-links { margin: 1rem 0 0.5rem; }
.stats-links .stat { padding: 0; }
.stats-links .stat > a { display: flex; flex-direction: column; padding: 0.75rem 1rem; color: var(--fg); text-decoration: none; border-radius: inherit; height: 100%; }
.stats-links .stat > a:hover { background: var(--surface-2); }
.stats-links .stat > a:hover .stat-l { color: var(--accent); text-decoration: underline; }
.stat-hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; line-height: 1.3; }
.repo-line { margin: 1.5rem 0 0; }
.page-head h1 .badge { font-size: 1rem; vertical-align: middle; margin-right: 0.4rem; }
.group > summary h2 a, .group > h2 a { color: inherit; text-decoration: none; }
.group > summary h2 a:hover, .group > h2 a:hover { color: var(--accent); text-decoration: underline; }
