/* Sujets (mind map) et Règles (cartes par domaine). Couleurs d'état : à faire, en production, rédigé, en ligne, écarté. */
:root {
  --st-a_faire: #cc8a0e; --st-lancement: #8b918e; --st-en_production: #2f6fd6; --st-redige: #7a52c7; --st-en_ligne: #188554; --st-ecarte: #8b918e;
  --st-page: #5d6b66; --st-site: #188554;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --st-a_faire: #e3aa45; --st-lancement: #9aa09d; --st-en_production: #7ab0f5; --st-redige: #b595f0; --st-en_ligne: #62cd94; --st-ecarte: #7d827f; --st-page: #a1a6a3; --st-site: #62cd94;
  }
}
:root[data-theme='dark'] {
  --st-a_faire: #e3aa45; --st-lancement: #9aa09d; --st-en_production: #7ab0f5; --st-redige: #b595f0; --st-en_ligne: #62cd94; --st-ecarte: #7d827f; --st-page: #a1a6a3; --st-site: #62cd94;
}
[data-state] { --st: var(--st-page); }
[data-state='a_faire'] { --st: var(--st-a_faire); }
[data-state='lancement'] { --st: var(--st-lancement); }
[data-state='en_production'] { --st: var(--st-en_production); }
[data-state='redige'] { --st: var(--st-redige); }
[data-state='en_ligne'] { --st: var(--st-en_ligne); }
[data-state='ecarte'] { --st: var(--st-ecarte); }
[data-state='site'] { --st: var(--st-site); }
.mm-node[data-state='lancement'], .mm-list-row[data-state='lancement'] { opacity: 0.65; }
.mm-node[data-state='lancement'] .mm-dot, .mm-list-row[data-state='lancement'] .mm-dot { animation: pulse 1.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .mm-node[data-state='lancement'] .mm-dot, .mm-list-row[data-state='lancement'] .mm-dot { animation: none; }
}

.os-modal { width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; }
.os-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.os-modal .input { width: 100%; }
.os-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.os-check input { margin-top: 3px; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }

/* Barre : légende, affichage, import */
.mm-card { padding-bottom: 0; overflow: hidden; }
.mm-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding-bottom: 12px; }
.mm-legend { display: flex; gap: 6px 14px; flex-wrap: wrap; }
.mm-state { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-meta); color: var(--body); white-space: nowrap; }
.mm-state i { width: 10px; height: 10px; border-radius: 50%; background: var(--st); flex: none; }
.mm-state b { color: var(--muted); font-weight: 600; }
.mm-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mm-locked { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Carte */
.mm-wrap { position: relative; margin: 0 calc(var(--pad, 16px) * -1); border-top: 1px solid var(--rule); background: var(--ground); }
.mm-zoom { display: flex; align-items: center; justify-content: flex-end; gap: 4px; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--rule); }
.mm-zoom .icon-btn { width: 32px; height: 32px; font-size: 18px; color: var(--text); }
.mm-zoom .text-btn { font-size: 13px; padding: 0 6px; }
.mm-viewport { overflow: auto; max-height: 72vh; min-height: 280px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.mm-viewport:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mm-sizer { position: relative; }
.mm-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.mm-lines { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.mm-lines path { fill: none; stroke: var(--st); stroke-width: 2; opacity: 0.45; }
.mm-node { position: absolute; display: flex; align-items: stretch; background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--st); border-radius: 10px; box-shadow: 0 1px 2px rgba(16, 24, 20, 0.06); }
.mm-node.is-page { background: color-mix(in srgb, var(--st) 9%, var(--surface)); font-weight: 600; }
.mm-node.is-open { border-color: var(--st); box-shadow: 0 0 0 2px color-mix(in srgb, var(--st) 35%, transparent); }
.mm-node.is-root { background: var(--accent); border-color: var(--accent); color: var(--accent-on); border-radius: 14px; }
.mm-node[data-state='ecarte'] { opacity: 0.6; }
.mm-node[data-state='ecarte'] .mm-title { text-decoration: line-through; }
.mm-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0 30px 0 10px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: inherit; }
.mm-main:focus-visible, .mm-add:focus-visible, .mm-fold:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mm-dot { display: none; }
.mm-title { font-size: 13.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.mm-node.is-root .mm-title { font-size: 15px; font-weight: 700; -webkit-line-clamp: 2; }
.mm-add { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 22px; height: 22px; display: grid; place-items: center; padding: 0; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; }
.mm-add:hover { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }
.mm-node.is-root .mm-add { color: var(--text); }
.mm-fold { position: absolute; right: -11px; bottom: -9px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 99px; border: 1px solid var(--border); background: var(--raised); color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer; }
.mm-fold:hover { border-color: var(--accent); }

/* Liste (téléphone) */
.mm-list { list-style: none; margin: 0 calc(var(--pad, 16px) * -1); padding: 0; border-top: 1px solid var(--rule); }
.mm-list > li { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--rule); padding: 4px var(--pad, 16px) 4px calc(var(--pad, 16px) + var(--depth, 0) * 18px); min-height: 52px; }
.mm-list-site { justify-content: space-between; background: var(--accent-soft); padding-left: var(--pad, 16px) !important; }
.mm-list-name { display: grid; gap: 1px; min-width: 0; overflow-wrap: anywhere; }
.mm-list-name small { color: var(--muted); font-size: var(--fs-meta); }
.mm-list-name .is-page { font-weight: 600; }
.mm-list-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 0; background: none; border: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.mm-list-main .mm-dot { display: block; width: 12px; height: 12px; border-radius: 50%; background: var(--st); flex: none; }
.mm-list-row[data-state='ecarte'] .mm-list-name > span { text-decoration: line-through; color: var(--muted); }
.mm-list-row.is-open { background: var(--raised); }
.mm-list-gap { width: 40px; flex: none; }
.mm-list-fold { transform: rotate(-90deg); }
.mm-list-fold[aria-expanded='true'] { transform: none; }

/* Panneau d'un sujet */
.mm-panel { position: fixed; z-index: 40; top: 0; right: 0; bottom: 0; width: min(380px, 100vw); overflow: auto; display: grid; align-content: start; gap: 12px; padding: 18px; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--float-shadow, -8px 0 24px rgba(0, 0, 0, 0.12)); animation: mm-in var(--medium, 200ms) var(--ease-out, ease-out); }
@keyframes mm-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.mm-panel-head { display: flex; justify-content: space-between; align-items: center; }
.mm-panel .mm-state { font-weight: 600; font-size: 13px; }
.mm-panel-title { font-size: 20px; line-height: 1.3; font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.mm-panel-facts { display: grid; gap: 4px; margin: 0; }
.mm-panel-facts dt { font-size: var(--fs-meta); font-weight: 600; color: var(--muted); margin-top: 6px; }
.mm-panel-facts dd { margin: 0; overflow-wrap: anywhere; }
.mm-reason { margin: 0; padding: 10px 12px; border-radius: var(--radius-control); background: var(--raised); border-left: 3px solid var(--st-ecarte); }
.mm-panel-actions { display: grid; gap: 8px; justify-items: start; }
.mm-panel-actions p { margin: 0; }
.mm-panel-actions .btn { max-width: 100%; }

/* Règles */
.rl-top { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.rl-search { position: relative; flex: 1 1 280px; display: block; }
.rl-search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.rl-search .input { padding-left: 36px; }
.os-quota { display: flex; gap: 4px 16px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; font-size: var(--fs-small); color: var(--body); }
.os-quota.is-full { color: var(--pill-warning-ink, var(--text)); }
.rl-cards { list-style: none; margin: 0 0 var(--gap, 16px); padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.rl-card { position: relative; width: 100%; height: 100%; display: grid; gap: 4px; align-content: start; text-align: left; padding: 16px 40px 16px 16px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); color: inherit; font: inherit; cursor: pointer; transition: border-color var(--fast), background var(--fast); }
.rl-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.rl-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rl-card-title { font-weight: 600; font-size: 16px; }
.rl-card-count { font-size: 14px; }
.rl-card-count b { font-size: 22px; font-weight: 600; margin-right: 4px; }
.rl-card-sub { font-size: var(--fs-meta); color: var(--muted); }
.rl-card.is-empty .rl-card-count b { color: var(--faint); }
.rl-card-go { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.rl-back { margin-bottom: 8px; }

@media (max-width: 640px) {
  .mm-panel { top: auto; width: 100%; max-height: 82dvh; border-left: 0; border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; animation-name: mm-up; }
  .mm-viewport { max-height: 62vh; }
  .mm-bar { align-items: flex-start; }
  .mm-tools { width: 100%; }
  .rl-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .rl-card { padding: 12px 34px 12px 12px; }
  .rl-card-go { right: 10px; }
  .rl-top .btn { width: 100%; justify-content: center; }
}
@keyframes mm-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .mm-panel { animation: none; } }
