/* ==========================================================================
   Item 316 · Syndromes myélodysplasiques (Hématologie)
   Pattern hématologique (palette --spe-hemato, classe mat-hemato), inspiré
   des items 317 (SMP) / 318 (LLC) / 315 (LA).
   - Mindmap radiale 7 branches × 4 satellites = 28 satellites
   - 3 schémas SVG natifs (physiopath, PNN, sidéroblaste)
   - 2 rails rubriques-toggle (étiologies × 5, classification × 3)
   - 1 arbre décisionnel (decision-tree.js)
   - 5 alertes rouges
   ========================================================================== */

:root {
  --paper:    var(--bg-card);
  --paper-2:  #fffcf5;
  --rule:     #d7ccb4;
  --rule-2:   var(--accent-dash);
  --bg-2:     #ece5d6;
  --bg-3:     #e4dcc8;
  --ink-2:    #524a3e;
  --ink-3:    #8a8270;
  --ink-4:    #b2a98f;
  --danger:   #a52a1a;
  --warn:     #8a5a12;
  --ok:       #4e6a2f;
  --info:     #2f5e7a;

  /* Familles mindmap SMD (7 branches) — couleurs spécifiques */
  --branch-physiopath: #2a3e5a;             /* Bleu profond — physiopath */
  --branch-etio:       #8a5a12;             /* Ocre — étiologies */
  --branch-clinique:   #4e6a2f;             /* Vert sapin — clinique */
  --branch-hemo:       #a52a1a;             /* Terre rouge — hémogramme */
  --branch-myelo:      #6a1a0e;             /* Terracotta sombre — myélogramme (accentuée) */
  --branch-classif:    #6e3f8a;             /* Violet feutré — classification */
  --branch-pec:        #1a3e54;             /* Bleu marine — pronostic + PEC */
}

/* Élargissement local */
.content { max-width: 1400px; }

/* Fade léger */
@keyframes smd316-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.content-panel.active { animation: smd316-fadeIn .35s ease-out; }

/* Utilitaires */
.mono   { font-family: var(--font-mono); font-feature-settings: "ss01"; }
.serif  { font-family: var(--font-serif); font-optical-sizing: auto; }
.muted  { color: var(--ink-3); }
.danger { color: var(--danger); }
.warn   { color: var(--warn); }
.ok     { color: var(--ok); }

/* =========================================================
   Sec-titles + chips Rang
   ========================================================= */
.sec-title       { display: flex; align-items: baseline; gap: 16px; margin: 36px 0 18px; flex-wrap: wrap; }
.sec-num         { font-family: var(--font-mono); font-size: 11px; letter-spacing: .18em; color: var(--ink-3); text-transform: uppercase; }
.sec-title h2    { font-family: var(--font-serif); font-weight: 500; font-size: 30px; letter-spacing: -.01em; margin: 0; line-height: 1; }
.sec-title .rule { flex: 1; height: 1px; background: var(--rule); margin-bottom: 8px; min-width: 40px; }
.sec-title .hint { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); letter-spacing: .06em; }

.rang-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 2px;
  border: 1px solid var(--rule-2); color: var(--ink-2); background: var(--paper);
}
.rang-tag.rang-a { color: var(--ok);    border-color: color-mix(in oklab, var(--ok) 40%, var(--rule-2)); }
.rang-tag.rang-b { color: var(--ink-3); border-color: var(--rule-2); }
.rang-tag.rang-c { color: var(--ink-4); border-color: var(--ink-4); font-style: italic; }

/* =========================================================
   Familles utilitaires
   ========================================================= */
.fam-hema     { --fam: var(--spe-hemato);   --fam-bg: #ead8e4; }
.fam-warn     { --fam: var(--warn);         --fam-bg: #f1e0c4; }
.fam-danger   { --fam: var(--danger);       --fam-bg: #f3dccf; }
.fam-ok       { --fam: var(--ok);           --fam-bg: #e1e5c6; }
.fam-info     { --fam: var(--info);         --fam-bg: #d4e0e3; }

/* Mindmap branches SMD (7 branches) */
.fam-physiopath { --fam: var(--branch-physiopath); --fam-bg: #d4dee8; }
.fam-etiologies { --fam: var(--branch-etio);       --fam-bg: #f1e0c4; }
.fam-clinique   { --fam: var(--branch-clinique);   --fam-bg: #e1e5c6; }
.fam-hemo       { --fam: var(--branch-hemo);       --fam-bg: #f3dccf; }
.fam-myelo      { --fam: var(--branch-myelo);      --fam-bg: #f3dccf; }
.fam-classif    { --fam: var(--branch-classif);    --fam-bg: #ead8e4; }
.fam-pec        { --fam: var(--branch-pec);        --fam-bg: #d4dee8; }

/* Définitions (8 cards) — couleurs par clé */
.fam-smd                   { --fam: var(--spe-hemato); --fam-bg: #ead8e4; }
.fam-dysmyelo              { --fam: var(--branch-myelo); --fam-bg: #f3dccf; }
.fam-blastes               { --fam: var(--danger); --fam-bg: #f3dccf; }
.fam-sideroblastes         { --fam: var(--info); --fam-bg: #d4e0e3; }
.fam-sideroblastes-couronne { --fam: var(--info); --fam-bg: #d4e0e3; }
.fam-pseudo-pelger         { --fam: var(--warn); --fam-bg: #f1e0c4; }
.fam-hematopoïese          { --fam: var(--spe-hemato); --fam-bg: #ead8e4; }
.fam-transformation        { --fam: var(--danger); --fam-bg: #f3dccf; }

/* =========================================================
   Hbox · hstack
   ========================================================= */
.hstack             { display: flex; flex-direction: column; gap: 10px; }
.hbox {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 3px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 4px 16px;
  align-items: baseline;
}
.hbox > .n {
  grid-column: 1; grid-row: 1 / -1;
  align-self: start; padding-top: 2px;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); font-weight: 500;
  word-break: break-word; line-height: 1.3;
}
.hbox > h5 {
  grid-column: 2;
  font-family: var(--font-serif); font-weight: 500; font-size: 15px; margin: 0 0 4px;
}
.hbox > p,
.hbox > ul {
  grid-column: 2; margin: 0;
  font-size: 12.5px; color: var(--ink-2); line-height: 1.6;
}
.hbox > ul { padding-left: 18px; }
.hbox > ul li { margin: 6px 0; }
.hbox > p ul { padding-left: 18px; margin: 4px 0 0; }
.hbox > p ul li { margin: 6px 0; }
.hbox > table { grid-column: 2; }

/* =========================================================
   Lanes
   ========================================================= */
.lane {
  background: var(--fam-bg, var(--bg-2));
  border: 1px solid color-mix(in oklab, var(--fam, var(--ink)) 30%, var(--rule));
  border-radius: 3px; padding: 14px;
  margin: 0 0 14px;
}
.lane .lane-h        { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.lane .lane-h .dot   { width: 10px; height: 10px; border-radius: 50%; background: var(--fam, var(--ink)); }
.lane .lane-h h3     { font-family: var(--font-serif); font-weight: 500; font-size: 18px; margin: 0; }
.lane .lane-h .kind  { margin-left: auto; font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; color: var(--ink-3); text-transform: uppercase; }
.lane > ul, .lane > ol {
  margin: 0; padding-left: 22px;
  font-size: 13px; color: var(--ink-2); line-height: 1.6;
}
.lane > ul li, .lane > ol li { margin: 6px 0; }

/* =========================================================
   Tables (ic-table + matrix)
   ========================================================= */
.ic-table             { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--rule); margin: 6px 0; }
.ic-table th,
.ic-table td          { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; font-size: 12.5px; line-height: 1.5; }
.ic-table thead th    { background: var(--bg-2); font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); font-weight: 500; }
.ic-table tbody th    { font-family: var(--font-serif); font-weight: 500; font-size: 14px; color: var(--ink); border-right: 1px solid var(--rule); }
.ic-table tbody tr:last-child th,
.ic-table tbody tr:last-child td { border-bottom: none; }
.ic-table tbody tr:hover td      { background: #fff; }
.ic-table ul          { margin: 0; padding-left: 18px; }
.ic-table ul li       { margin: 5px 0; }

/* Matrix : tableau comparatif géant (2-3 colonnes) */
table.matrix              { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--rule); margin: 14px 0; }
table.matrix th,
table.matrix td           { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; font-size: 12.5px; line-height: 1.55; word-wrap: break-word; }
table.matrix thead th     { background: var(--bg-2); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); font-weight: 600; border-bottom: 1px solid var(--rule-2); }
table.matrix thead th:first-child { background: transparent; }
table.matrix tbody th     { font-family: var(--font-serif); font-weight: 500; font-size: 13px; color: var(--ink); border-right: 1px solid var(--rule); background: var(--bg-2); width: 22%; }
table.matrix tbody tr:nth-child(even) td { background: var(--paper-2); }
table.matrix tbody tr:last-child th,
table.matrix tbody tr:last-child td { border-bottom: none; }
table.matrix tbody tr:hover td      { background: #fff; }
table.matrix ul           { margin: 0; padding-left: 18px; }
table.matrix ul li        { margin: 5px 0; }

/* =========================================================
   Vignette + keypoints
   ========================================================= */
.vignette {
  background: var(--paper); border: 1px solid var(--rule);
  border-left: 4px solid var(--spe-hemato);
  border-radius: 4px; padding: 20px 24px; margin-bottom: 24px;
}
.vignette .vg-tag {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--spe-hemato); margin-bottom: 8px;
}
.vignette p {
  font-family: var(--font-serif); font-size: 15px; line-height: 1.55; color: var(--ink); margin: 0;
}
.vignette p b { font-weight: 600; }
.vignette .vg-trap {
  margin-top: 14px; padding: 10px 14px; background: var(--bg-2); border-radius: 3px;
  font-family: var(--font-sans); font-size: 12.5px; font-style: italic; color: var(--ink-2);
}

.kp-list { margin: 0; padding-left: 24px; counter-reset: kp; }
.kp-list li {
  list-style: none; counter-increment: kp; position: relative;
  margin: 10px 0; padding-left: 32px;
  font-size: 13.5px; color: var(--ink-2); line-height: 1.55;
}
.kp-list li::before {
  content: counter(kp);
  position: absolute; left: 0; top: 1px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--spe-hemato); color: #fff;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}

/* =========================================================
   Cards définitions (8)
   ========================================================= */
.def-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.def-card {
  background: var(--paper); border: 1px solid var(--rule);
  border-top: 4px solid var(--fam, var(--ink));
  border-radius: 4px; padding: 18px 20px;
}
.def-card .def-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.def-card h3 {
  font-family: var(--font-serif); font-weight: 500; font-size: 19px;
  margin: 0; color: var(--fam, var(--ink));
}
.def-card .def-sub {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3);
}
.def-card p { font-size: 13px; color: var(--ink-2); line-height: 1.55; margin: 0 0 10px; }
.def-card p b { color: var(--ink); }
.def-card .def-pillar {
  margin-top: 12px; padding: 10px 12px; background: var(--bg-2); border-radius: 3px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; color: var(--ink);
}
@media (max-width: 800px) { .def-grid { grid-template-columns: 1fr; } }

/* =========================================================
   Notes communes
   ========================================================= */
.commun-note {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: var(--bg-2); border-radius: 3px;
  font-size: 13px; color: var(--ink-2); line-height: 1.55;
}
.commun-note b { color: var(--ink); }

.rxt-intro {
  background: var(--paper); border: 1px solid var(--rule);
  border-left: 3px solid var(--spe-hemato);
  padding: 12px 16px; border-radius: 3px;
  font-size: 13px; color: var(--ink-2); line-height: 1.55; margin: 0 0 12px;
}

/* =========================================================
   SVG figures natives (Safari-friendly)
   ========================================================= */
.svg-fig {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  padding: 14px; text-align: center; margin: 14px 0;
  overflow-x: auto;
}
.svg-fig svg { max-width: 100%; height: auto; display: inline-block; }
.svg-fig .svg-cap {
  display: block; margin: 10px 8px 0;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em;
  color: var(--ink-3); font-style: italic; line-height: 1.55; text-align: left;
}
.svg-fig .svg-cap b { color: var(--ink-2); }

/* =========================================================
   Alerte rouge
   ========================================================= */
.alerte-rouge {
  background: #f3dccf; border: 2px solid var(--danger); border-radius: 4px;
  padding: 14px 16px; margin: 14px 0;
  display: grid; grid-template-columns: 40px 1fr; gap: 12px;
  align-items: start;
}
.alerte-rouge .ar-icon { font-size: 22px; color: var(--danger); font-weight: 600; line-height: 1; }
.alerte-rouge .ar-body h4 {
  font-family: var(--font-serif); font-weight: 600; font-size: 16px;
  margin: 0 0 6px; color: var(--danger);
}
.alerte-rouge .ar-body p { margin: 0; font-size: 13px; color: var(--ink); line-height: 1.55; }
.alerte-rouge .ar-body p b { color: var(--ink); font-weight: 600; }

/* =========================================================
   Mindmap (pattern 317/318/315)
   ========================================================= */
.mmwrap {
  position: relative; background: var(--paper); border: 1px solid var(--rule);
  border-radius: 4px; overflow: hidden; height: 760px;
}
.mmwrap .zctl { position: absolute; top: 14px; right: 14px; z-index: 10; display: flex; gap: 4px; }
.mmwrap .zctl button {
  width: 34px; height: 34px; border: 1px solid var(--rule-2); background: var(--paper);
  border-radius: 3px; font-family: var(--font-mono); font-size: 14px; color: var(--ink-2);
  cursor: pointer;
}
.mmwrap .zctl button:hover { background: var(--bg-2); }
.mmwrap .zhint {
  position: absolute; left: 14px; bottom: 14px; z-index: 10;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em;
  color: var(--ink-3); background: rgba(255, 252, 245, .85);
  padding: 6px 10px; border-radius: 3px; border: 1px solid var(--rule);
}
.mmwrap svg.canvas {
  width: 100%; height: 100%; display: block; cursor: grab;
  background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,.035) 1px, transparent 0);
  background-size: 24px 24px;
}
.mmwrap svg.canvas:active { cursor: grabbing; }
.mmwrap svg.canvas .root-circle  { fill: var(--ink); }
.mmwrap svg.canvas .root-text    { fill: var(--paper); font-family: var(--font-serif); font-weight: 500; }
.mmwrap svg.canvas .node-card    { cursor: pointer; }
.mmwrap svg.canvas .node-card:hover .node-bg { stroke-width: 2; }
.mmwrap svg.canvas .node-bg      { fill: #fff; stroke: var(--rule-2); stroke-width: 1; }
.mmwrap svg.canvas .node-accent  { fill: var(--fam, var(--ink)); }
.mmwrap svg.canvas .node-title   { fill: var(--ink); font-family: var(--font-serif); font-weight: 500; font-size: 15px; }
.mmwrap svg.canvas .node-sub     { fill: var(--ink-2); font-size: 11px; }
.mmwrap svg.canvas .node-chip    { fill: #fff; stroke: var(--rule); stroke-width: 1; }
.mmwrap svg.canvas .node-chip-t  { fill: var(--ink-2); font-family: var(--font-mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.mmwrap svg.canvas path.link     { fill: none; stroke: var(--rule-2); stroke-width: 1.2; stroke-dasharray: 3 4; }
.mmwrap svg.canvas path.link.main   { stroke-width: 1.4; }
.mmwrap svg.canvas path.link.sat    { stroke: var(--rule-2); stroke-width: 1; stroke-dasharray: 1 5; opacity: .55; }
.mmwrap svg.canvas .ring         { fill: none; stroke: var(--rule); stroke-width: 1; stroke-dasharray: 2 5; }
.mmwrap svg.canvas .node-sat                 { cursor: pointer; }
.mmwrap svg.canvas .node-sat:hover .sat-bg   { fill: var(--ink); }
.mmwrap svg.canvas .node-sat:hover .sat-title { fill: var(--paper); }
.mmwrap svg.canvas .sat-bg                   { fill: var(--bg-2); stroke: color-mix(in oklab, var(--fam, var(--ink)) 60%, var(--ink)); stroke-width: 1; }
.mmwrap svg.canvas .sat-title                { fill: var(--ink); font-family: var(--font-serif); font-weight: 500; font-size: 12px; }

/* Couleurs branches mindmap par famille SMD (7 branches) */
.mmwrap svg.canvas .node-card.fam-physiopath .node-accent { fill: var(--branch-physiopath); }
.mmwrap svg.canvas .node-card.fam-etiologies .node-accent { fill: var(--branch-etio); }
.mmwrap svg.canvas .node-card.fam-clinique   .node-accent { fill: var(--branch-clinique); }
.mmwrap svg.canvas .node-card.fam-hemo       .node-accent { fill: var(--branch-hemo); }
.mmwrap svg.canvas .node-card.fam-myelo      .node-accent { fill: var(--branch-myelo); }
.mmwrap svg.canvas .node-card.fam-classif    .node-accent { fill: var(--branch-classif); }
.mmwrap svg.canvas .node-card.fam-pec        .node-accent { fill: var(--branch-pec); }

/* Branche myélogramme accentuée (⭐⭐⭐⭐⭐) — bordure plus marquée */
.mmwrap svg.canvas .node-card.fam-myelo .node-bg { stroke: var(--branch-myelo); stroke-width: 1.5; }

/* =========================================================
   Décision tree — invariant Kevin :
   racine = sélecteur à 2 classes .dt-svg .dt-node.dt-root rect
   ========================================================= */
/* (Les styles globaux sont dans assets/decision-tree.css —
   pas d'override local nécessaire pour cet item.) */

/* =========================================================
   Dark mode (variantes ciblées)
   ========================================================= */
body.dark-mode .svg-fig { background: #2a2520; border-color: #443d33; }
body.dark-mode .svg-fig .svg-cap { color: #b2a98f; }
body.dark-mode .def-card { background: #2a2520; border-color: #443d33; }
body.dark-mode .alerte-rouge { background: #4a2018; border-color: #c33; color: #fce0d8; }
body.dark-mode .alerte-rouge .ar-body p,
body.dark-mode .alerte-rouge .ar-body p b { color: #fce0d8; }

body.dark-mode .ic-table                { background: #2a2520; border-color: #443d33; }
body.dark-mode .ic-table thead th       { background: #3a342c; color: #d7ccb4; }
body.dark-mode .ic-table tbody th       { color: #f4efe6; border-right-color: #443d33; }
body.dark-mode .ic-table td,
body.dark-mode .ic-table th             { border-bottom-color: #443d33; color: #d7ccb4; }
body.dark-mode .ic-table tbody tr:hover td { background: #3a342c; }

body.dark-mode table.matrix             { background: #2a2520; border-color: #443d33; }
body.dark-mode table.matrix thead th    { background: #3a342c; color: #d7ccb4; }
body.dark-mode table.matrix tbody th    { background: #3a342c; color: #f4efe6; border-right-color: #443d33; }
body.dark-mode table.matrix td,
body.dark-mode table.matrix th          { border-bottom-color: #443d33; color: #d7ccb4; }
body.dark-mode table.matrix tbody tr:nth-child(even) td { background: #322c25; }
body.dark-mode table.matrix tbody tr:hover td { background: #4a3f33; }

body.dark-mode .vignette                { background: #2a2520; border-color: #443d33; }
body.dark-mode .vignette p              { color: #f4efe6; }
body.dark-mode .vignette .vg-trap       { background: #3a342c; color: #d7ccb4; }

body.dark-mode .hbox                    { background: #2a2520; border-color: #443d33; }
body.dark-mode .hbox > h5               { color: #f4efe6; }
body.dark-mode .hbox > p,
body.dark-mode .hbox > ul,
body.dark-mode .hbox > p ul li,
body.dark-mode .hbox > ul li            { color: #d7ccb4; }

body.dark-mode .commun-note             { background: #3a342c; color: #d7ccb4; }
body.dark-mode .commun-note b           { color: #f4efe6; }
body.dark-mode .rxt-intro               { background: #2a2520; border-color: #443d33; color: #d7ccb4; }

/* Schémas SVG natifs : adapter fond + texte en mode sombre */
body.dark-mode .schema-smd-vs-la rect[fill="#ead8e4"] { fill: #4a3957; }
body.dark-mode .schema-smd-vs-la rect[fill="#e1e5c6"] { fill: #3e4928; }
body.dark-mode .schema-smd-vs-la rect[fill="#f1e0c4"] { fill: #4a3a1c; }
body.dark-mode .schema-smd-vs-la rect[fill="#f3dccf"] { fill: #4a2018; }
body.dark-mode .schema-smd-vs-la rect[fill="#faf6ec"] { fill: #2a2520; }
body.dark-mode .schema-smd-vs-la text,
body.dark-mode .schema-pnn text,
body.dark-mode .schema-sidero text     { fill: #f4efe6; }
body.dark-mode .schema-pnn ellipse[fill="#fdf0dc"] { fill: #3a342c; }
body.dark-mode .schema-sidero circle[fill="#fce0d8"] { fill: #4a2018; }

/* =========================================================
   Print
   ========================================================= */
@media print {
  .mmwrap .zctl, .mmwrap .zhint { display: none !important; }
  .content-panel { display: block !important; page-break-after: always; animation: none; }
  body { background: #fff; }
}
