/* Chat Work Manager — l'idée visuelle : on « surligne » la discussion au feutre
   jaune, et ce qui est surligné devient une carte. Le jaune n'apparaît que là. */

:root {
  --paper: #F1F4F8;
  --surface: #FFFFFF;
  --surface-2: #E7ECF2;
  --ink: #1B2333;
  --ink-2: #5A6476;
  --line: #D8DEE7;
  --marker: #FFD84D;
  --marker-ink: #4A3A00;
  --mine: #1B2333;
  --mine-ink: #F4F6FA;
  --done: #17845A;
  --danger: #C4321C;
  --focus: #2F6FED;

  --radius-s: 6px;
  --radius-m: 12px;
  --radius-l: 18px;
  --shadow-sheet: 0 -8px 40px rgb(15 22 36 / 0.18);

  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-meta: 0.8125rem;   /* 13px */
  --fs-body: 1rem;        /* 16px : évite le zoom auto d'iOS dans les champs */
  --fs-title: 1.1875rem;  /* 19px */
  --fs-h1: 1.5rem;        /* 24px */

  --topbar-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12161E;
    --surface: #1B212C;
    --surface-2: #242C39;
    --ink: #E8ECF3;
    --ink-2: #9BA5B6;
    --line: #2C3443;
    --marker: #F2C94C;
    --marker-ink: #2A2000;
    --mine: #33415C;
    --mine-ink: #F4F6FA;
    --done: #3DBE84;
    --danger: #F0705A;
    --focus: #7EA6FF;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: var(--fs-body)/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font-weight: 700; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-marker { background: var(--marker); border-color: var(--marker); color: var(--marker-ink); }
.btn-danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn-ghost { background: transparent; border-color: transparent; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg, .btn svg { width: 22px; height: 22px; }

/* ---------- Champs ---------- */
.field { display: grid; gap: 6px; }
.field > span { font-size: var(--fs-meta); font-weight: 700; color: var(--ink-2); }
.field small { color: var(--ink-2); font-size: var(--fs-meta); }
.input, .textarea, .select {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface);
}
.textarea { resize: vertical; min-height: 88px; line-height: 1.45; }
.error { color: var(--danger); font-size: var(--fs-meta); min-height: 1.2em; margin: 0; }

/* ---------- Connexion ---------- */
.login {
  min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
}
.login form {
  width: min(380px, 100%); display: grid; gap: 16px;
}
.login h1 { font-size: 2rem; line-height: 1.1; margin: 0 0 4px; letter-spacing: -0.01em; }
.login h1 mark, .brand mark {
  background: linear-gradient(100deg, transparent 2%, var(--marker) 4%, var(--marker) 96%, transparent 98%);
  color: inherit; padding: 0 0.15em; border-radius: 3px;
}
.login p { margin: 0 0 8px; color: var(--ink-2); }

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 4px;
  min-height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) 6px 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar h1 {
  flex: 1; min-width: 0; margin: 0 6px;
  font-size: var(--fs-title); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand { font-weight: 700; }

.tabs {
  display: flex; gap: 2px; padding: 3px; margin-right: 4px;
  background: var(--surface-2); border-radius: 999px;
}
.tabs a {
  padding: 7px 14px; border-radius: 999px;
  color: var(--ink-2); text-decoration: none; font-weight: 700; font-size: 0.9375rem;
}
.tabs a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }

/* ---------- Liste des projets ---------- */
.page { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(32px + var(--safe-bottom)); }
.notice {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 14px 16px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--marker);
  border-radius: var(--radius-s);
}
.notice p { flex: 1 1 220px; margin: 0; }
.project-list { list-style: none; margin: 0 0 24px; padding: 0; border-top: 1px solid var(--line); }
.project-list a {
  display: grid; gap: 2px; padding: 14px 4px;
  border-bottom: 1px solid var(--line); color: inherit; text-decoration: none;
}
.project-list a:hover { background: var(--surface); }
.project-list strong { font-size: var(--fs-title); }
.project-list span { color: var(--ink-2); font-size: 0.9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { color: var(--ink-2); padding: 24px 0; }
.inline-form { display: flex; gap: 8px; }
.inline-form .input { flex: 1; }

/* ---------- Vue projet ---------- */
.project-view { display: flex; flex-direction: column; height: 100dvh; }
.project-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---------- Chat ---------- */
.chat-scroll { flex: 1; overflow-y: auto; padding: 12px 12px 8px; overscroll-behavior: contain; }
.chat-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 2px; }
.day { align-self: center; margin: 14px 0 8px; font-size: var(--fs-meta); color: var(--ink-2); font-weight: 700; }
.load-more { align-self: center; margin-bottom: 8px; }

.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 86%; margin-top: 2px; }
.msg.first { margin-top: 10px; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg .who { font-size: var(--fs-meta); color: var(--ink-2); margin: 0 10px 3px; }
.msg .who time { margin-left: 6px; font-weight: 400; }
.msg .who b { color: var(--ink); }
.bubble {
  position: relative;
  padding: 9px 13px; border-radius: var(--radius-l);
  background: var(--surface); border: 1px solid var(--line);
  white-space: pre-wrap; overflow-wrap: anywhere;
  user-select: text; -webkit-user-select: text;
}
.msg.mine .bubble { background: var(--mine); border-color: var(--mine); color: var(--mine-ink); }

/* Mode surlignage */
.selecting .bubble { cursor: pointer; user-select: none; -webkit-user-select: none; }
.msg.selected .bubble {
  background: var(--marker); border-color: var(--marker); color: var(--marker-ink);
}
.msg.flash .bubble { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 4px var(--marker); } 100% { box-shadow: 0 0 0 0 transparent; } }

.card-links { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 6px 0; }
.card-link {
  border: 0; background: none; padding: 2px 4px;
  font-size: var(--fs-meta); color: var(--ink-2); text-align: left;
  text-decoration: underline; text-decoration-color: var(--marker); text-decoration-thickness: 3px; text-underline-offset: 2px;
}

.composer, .selection-bar {
  border-top: 1px solid var(--line); background: var(--paper);
  padding: 8px 10px calc(8px + var(--safe-bottom));
}
.composer form, .selection-bar .row { max-width: 760px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; max-height: 160px; min-height: 44px;
  padding: 10px 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface);
  line-height: 1.4;
}
.send { background: var(--ink); color: var(--paper); flex-shrink: 0; }
.send:hover { background: var(--ink); opacity: 0.9; }
.selection-bar { background: var(--surface); }
.selection-bar .row { align-items: center; flex-wrap: wrap; }
.selection-bar p { flex: 1 1 160px; margin: 0; font-weight: 700; }
.selection-bar p small { display: block; font-weight: 400; color: var(--ink-2); }

/* ---------- Tableau ---------- */
.board-scroll { flex: 1; overflow: auto; padding-bottom: calc(24px + var(--safe-bottom)); }
.board { min-width: 340px; max-width: 1100px; margin: 0 auto; padding: 0 12px; }
.board-head {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 10px 0 8px; background: var(--paper);
}
.board-head h2 { margin: 0; font-size: 0.9375rem; display: flex; align-items: center; gap: 8px; }
.board-head h2 .dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink-2); }
.board-head h2.done .dot { background: var(--done); border-color: var(--done); }
.board-head h2 small { color: var(--ink-2); font-weight: 400; }

.lane { margin-top: 14px; }
/* L'en-tête de ligne reste visible pendant qu'on fait défiler ses cartes. */
.lane-head {
  position: sticky; top: 44px; z-index: 4;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 8px 12px; margin-bottom: 8px;
  border-radius: var(--radius-s);
  background: color-mix(in srgb, var(--cat) 14%, var(--surface));
  border-left: 5px solid var(--cat);
}
.lane-head h3 { flex: 1; margin: 0; font-size: var(--fs-body); }
.lane-head h3 small { font-weight: 400; color: var(--ink-2); margin-left: 6px; }
.lane-head .icon-btn { width: 36px; height: 36px; }
.lane-cells { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cell {
  min-height: 64px; padding: 6px; border-radius: var(--radius-m);
  background: var(--surface-2); display: flex; flex-direction: column; gap: 6px;
}
.cell:empty::after {
  content: "Déposez une carte ici"; margin: auto; padding: 8px;
  font-size: var(--fs-meta); color: var(--ink-2); text-align: center;
}

.card {
  display: block; width: 100%; text-align: left;
  padding: 10px 11px; border-radius: var(--radius-s);
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--cat, var(--line));
  touch-action: manipulation;
}
.card .cat { font-size: 0.75rem; font-weight: 700; color: var(--ink-2); display: block; margin-bottom: 2px; }
.card strong { display: block; line-height: 1.3; overflow-wrap: anywhere; }
.card p {
  margin: 4px 0 0; font-size: 0.875rem; color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .meta { display: flex; flex-wrap: wrap; column-gap: 10px; white-space: nowrap; margin-top: 6px; font-size: 0.75rem; color: var(--ink-2); }
.card.validee strong::before { content: "✓ "; color: var(--done); }
.sortable-ghost { opacity: 0.35; }
.sortable-chosen { box-shadow: 0 8px 24px rgb(15 22 36 / 0.2); }

/* ---------- Divers ---------- */
.banner.loading { display: flex; gap: 10px; align-items: center; }
.banner.loading b { font-weight: 400; color: var(--ink-2); margin-left: 4px; }
.hint { margin: 0; color: var(--ink-2); font-size: 0.9375rem; }
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
.stack { display: grid; gap: 24px; }
.stack .field p { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Feuilles (dialogues) ---------- */
dialog.sheet {
  width: min(640px, 100%); max-width: 100%; max-height: min(92dvh, 900px);
  margin: auto auto 0; padding: 0; border: 0;
  border-radius: var(--radius-l) var(--radius-l) 0 0;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sheet);
}
@media (min-width: 700px) {
  dialog.sheet { margin: auto; border-radius: var(--radius-l); }
}
dialog.sheet::backdrop { background: rgb(10 14 22 / 0.45); }
dialog.sheet[open] { animation: sheet-in 0.22s ease-out; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
.sheet-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 8px 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.sheet-head h2 { flex: 1; margin: 0; font-size: var(--fs-title); }
.sheet-body { padding: 16px 20px; display: grid; gap: 16px; }
.sheet-foot {
  position: sticky; bottom: 0;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end;
  padding: 12px 20px calc(12px + var(--safe-bottom)); background: var(--surface); border-top: 1px solid var(--line);
}
.sheet-foot .spacer { flex: 1; }
.banner {
  padding: 10px 12px; border-radius: var(--radius-s); font-size: 0.9375rem;
  background: color-mix(in srgb, var(--marker) 35%, var(--surface)); color: var(--ink);
}
.status-toggle { display: flex; gap: 6px; }
.status-toggle label {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; border: 1px solid var(--line); border-radius: var(--radius-s); font-weight: 700;
}
.status-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.status-toggle label:has(input:checked) { border-color: var(--ink); background: var(--surface-2); }
.status-toggle label:has(input[value="validee"]:checked) { border-color: var(--done); color: var(--done); }
.status-toggle label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }

.sources { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.sources button {
  width: 100%; text-align: left; padding: 8px 10px;
  border: 0; border-left: 3px solid var(--marker); border-radius: 0 var(--radius-s) var(--radius-s) 0;
  background: var(--surface-2); font-size: 0.9375rem;
}
.sources b { font-size: var(--fs-meta); display: block; color: var(--ink-2); }

.cat-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.cat-row { display: flex; gap: 6px; align-items: center; }
.cat-row input[type="color"] {
  width: 40px; height: 40px; padding: 2px; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface);
}
.cat-row .input { flex: 1; min-width: 0; }
.cat-row .icon-btn { width: 36px; height: 36px; flex-shrink: 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--safe-bottom)); z-index: 100;
  transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); text-align: center;
  box-shadow: 0 6px 20px rgb(15 22 36 / 0.25);
  padding: 10px 16px; border-radius: 999px;
  background: var(--ink); color: var(--paper); font-weight: 700; font-size: 0.9375rem;
}
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.offline {
  background: var(--danger); color: #fff; text-align: center; font-size: var(--fs-meta); font-weight: 700; padding: 4px;
}

/* Téléphone : les onglets passent sur une 2e ligne pleine largeur pour laisser le nom du projet lisible. */
@media (max-width: 560px) {
  .project-view .topbar { flex-wrap: wrap; padding-bottom: 8px; }
  .project-view .topbar h1 { flex: 1 1 0; }
  .project-view .tabs { order: 3; flex: 1 0 calc(100% - 12px); margin: 0 6px; }
  .project-view .tabs a { flex: 1; text-align: center; }
}

@media (max-width: 520px) {
  .board { padding: 0 8px; }
  .lane-cells, .board-head { gap: 6px; }
  .cell { padding: 4px; }
  .card { padding: 8px 9px; }
}

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

/* ---------- Création d'idées en arrière-plan ---------- */

/* Onglets : badges */
.tabs a { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tab-jobs, .tab-count {
  display: inline-flex; align-items: center; gap: 4px;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--marker); color: var(--marker-ink);
  font-size: 0.75rem; font-weight: 700; line-height: 1;
}
.tab-jobs .spinner { width: 10px; height: 10px; border-width: 2px; }
.tab-count { justify-content: center; }

/* Messages en cours de traitement */
.job-pending {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px;
  font-size: var(--fs-meta); color: var(--ink-2);
}
.job-pending .spinner { width: 11px; height: 11px; border-width: 2px; color: var(--marker-ink); }
@media (prefers-color-scheme: dark) { .job-pending .spinner { color: var(--marker); } }

/* Choix de la catégorie */
.cat-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-choice {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer;
}
.cat-choice::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--cat, var(--ink-2));
}
.cat-choice.other::before { display: none; }
.cat-choice.other { border-style: dashed; font-weight: 400; }
.cat-choice input { position: absolute; opacity: 0; pointer-events: none; }
.cat-choice:has(input:checked) {
  border: 2px solid var(--cat, var(--ink)); padding: 0 13px;
  background: color-mix(in srgb, var(--cat, var(--ink)) 12%, var(--surface));
}
.cat-choice:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Cartes nouvelles ou mises à jour */
.card { position: relative; }
.card.fresh { box-shadow: 0 0 0 2px var(--marker); }
.new-flag {
  float: right; margin: -2px -3px 2px 6px; padding: 1px 7px; border-radius: 999px;
  background: var(--marker); color: var(--marker-ink); font-size: 0.6875rem; font-weight: 700;
}

.danger-zone { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- Dossiers de catégories ---------- */
.folder-tabs {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 10px 12px 8px; border-bottom: 1px solid var(--line); background: var(--paper);
}
.folder-tabs::-webkit-scrollbar { display: none; }
.folder-tab {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 700;
}
.folder-tab[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.add-cat { margin: 14px 0 4px; }
.lane-tag {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; vertical-align: 2px;
  border: 1px solid var(--cat); color: var(--ink); font-size: 0.6875rem; font-weight: 700;
}

/* Cartes remplacées / hors mémoire */
.card.replaced { opacity: 0.55; border-left-style: dashed; }
.card.replaced strong { text-decoration: line-through; text-decoration-thickness: 1px; }
.state-flag {
  padding: 0 6px; border-radius: 4px; background: var(--surface-2); color: var(--ink-2); font-weight: 700;
}

/* Réglages */
.group-title { margin: 10px 0 0; font-size: var(--fs-meta); font-weight: 700; color: var(--ink-2); }
.folder-row { display: flex; gap: 6px; align-items: center; }
.folder-row .input { flex: 1; min-width: 0; }
.folder-row .icon-btn { width: 36px; height: 36px; flex-shrink: 0; }
.default-pick { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; }
.default-pick input { width: 18px; height: 18px; accent-color: var(--ink); }
.cat-row { display: grid; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.cat-row:last-child { border-bottom: 0; }
.cat-line { display: flex; gap: 6px; align-items: center; }
.cat-opts { flex-wrap: wrap; gap: 6px 16px; padding-left: 46px; font-size: 0.9375rem; }
.mini-field { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.mini-field .select { min-height: 36px; padding: 4px 8px; width: auto; }
.check-inline { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check-inline input { width: 18px; height: 18px; accent-color: var(--ink); }
.empty-row { color: var(--ink-2); font-size: 0.9375rem; padding: 4px 0; list-style: none; }
.new-cat-form { display: flex; gap: 8px; flex-wrap: wrap; }
.new-cat-form .input { flex: 1 1 180px; }
.new-cat-form .select { flex: 0 1 auto; width: auto; }

/* Validation : remplacement */
.replace-list { display: grid; gap: 6px; }
.check-row {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius-s);
}
.check-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--ink); flex-shrink: 0; }
.check-row small { display: block; color: var(--ink-2); font-size: var(--fs-meta); }
.check-row:has(input:checked) { border-color: var(--ink); background: var(--surface-2); }

/* Mémoire du projet */
.row-end { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.status-line { flex: 1 1 200px; display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: var(--fs-meta); }
.status-line .spinner { width: 12px; height: 12px; border-width: 2px; }
.mem-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mem-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.mem-list li:last-child { border-bottom: 0; }
.mem-list small { color: var(--ink-2); font-size: var(--fs-meta); white-space: nowrap; }
.mem-title { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 0; font-weight: 700; }
button.mem-title { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.mem-list li.warn { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--marker); border-radius: var(--radius-s); background: color-mix(in srgb, var(--marker) 14%, var(--surface)); }
.mem-list li.warn p { margin: 0; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: var(--fs-meta); }
details.field summary { cursor: pointer; font-weight: 700; font-size: var(--fs-meta); color: var(--ink-2); }
.preview {
  margin: 0; padding: 12px; max-height: 320px; overflow: auto; white-space: pre-wrap;
  background: var(--surface-2); border-radius: var(--radius-s); font: 0.8125rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- Résumés ---------- */
.board-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding-top: 10px; }
.btn.small svg { width: 16px; height: 16px; }
.view-toggle { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 999px; justify-self: start; }
.view-toggle button {
  border: 0; background: transparent; padding: 7px 16px; border-radius: 999px; font-weight: 700; color: var(--ink-2);
}
.view-toggle button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }

.summary-text { display: grid; gap: 14px; line-height: 1.5; }
.summary-lead { margin: 0; font-size: 1.0625rem; }
.summary-text section { padding-left: 12px; border-left: 3px solid var(--cat, var(--line)); }
.summary-text h3 { margin: 0 0 4px; font-size: var(--fs-body); }
.summary-text ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
.summary-text .open-points { border-left-style: dashed; border-left-color: var(--ink-2); }

/* Schéma : carte mentale en arbre (lisible aussi sur téléphone) */
.mindmap { overflow-x: auto; padding-bottom: 4px; }
.mm-root {
  display: inline-block; padding: 10px 16px; border-radius: var(--radius-m);
  background: var(--ink); color: var(--paper); font-weight: 700;
  border-left: 6px solid var(--cat, var(--marker));
}
.mindmap ul { list-style: none; margin: 0; padding-left: 20px; }
.mindmap li { position: relative; padding: 10px 0 0 22px; }
.mindmap li::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 2px solid var(--line); }
.mindmap li:last-child::before { bottom: auto; height: 30px; }
.mindmap li::after { content: ""; position: absolute; left: 0; top: 30px; width: 20px; border-top: 2px solid var(--line); }
.mm-theme {
  display: inline-block; padding: 8px 14px; border-radius: 999px; font-weight: 700;
  border: 2px solid var(--cat, var(--line)); background: color-mix(in srgb, var(--cat, var(--line)) 14%, var(--surface));
}
.mm-theme.open { border-style: dashed; }
.mm-leaf {
  display: inline-block; max-width: 520px; padding: 7px 11px; border-radius: var(--radius-s);
  background: var(--surface); border: 1px solid var(--line); font-size: 0.9375rem; line-height: 1.35;
}
.mindmap li li::after { top: 26px; }
.mindmap li li:last-child::before { height: 26px; }
