/* ==========================================================================
   Item 253 · Obésité de l'enfant et de l'adulte — styles spécifiques
   2ème item Endocrinologie · architecture chronique avec recos HAS 2024
   14 onglets visibles + Mes erreurs · 2 decision-trees · 10 schémas SVG · 6 alertes
   ========================================================================== */

: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:   var(--alert-red);
  --warn:     #8a5a12;
  --ok:       #4e6a2f;
  --info:     var(--accent-blue);

  --fam-endocrino: var(--spe-endocrino);
  --fam-dx:        var(--accent-blue);
  --fam-fdr:       var(--accent-orange);
  --fam-th:        #3c5523;
  --fam-pec:       #4e6a2f;
  --fam-urg:       var(--alert-red);
  --fam-info:      var(--accent-blue);
  --fam-warn:      #8a5a12;
  --fam-ok:        #4e6a2f;
  --fam-mir:       var(--spe-mir);
}

.content { max-width: 1400px; }

@keyframes pc-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.content-panel.active { animation: pc-fadeIn .35s ease-out; }

.mono   { font-family: var(--font-mono); }
.danger { color: var(--danger); }
.warn   { color: var(--warn); }
.ok     { color: var(--ok); }

/* Sec-title + rang-tag */
.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);
  vertical-align: middle;
}
.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); }

/* Familles couleur */
.fam-endocrino { --fam: var(--fam-endocrino); --fam-bg: #f1e0c4; }
.fam-dx        { --fam: var(--fam-dx);        --fam-bg: #d5e3e7; }
.fam-fdr       { --fam: var(--fam-fdr);       --fam-bg: #f5e4cf; }
.fam-th        { --fam: var(--fam-th);        --fam-bg: #d4e0c4; }
.fam-pec       { --fam: var(--fam-pec);       --fam-bg: #dde2c8; }
.fam-urg       { --fam: var(--fam-urg);       --fam-bg: #fbeee3; }
.fam-info      { --fam: var(--fam-info);      --fam-bg: #d5e3e7; }
.fam-warn      { --fam: var(--fam-warn);      --fam-bg: #f3e9cc; }
.fam-ok        { --fam: var(--fam-ok);        --fam-bg: #dde2c8; }
.fam-mir       { --fam: var(--fam-mir);       --fam-bg: var(--bg-2); }

/* Lane */
.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: 16px 18px; margin: 14px 0;
}
.lane .lane-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.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; letter-spacing: -.005em; }
.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 > p { font-size: 13px; color: var(--ink-2); }
.lane > ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.lane > ul li { margin: 5px 0; }
.lane > ul li b { color: var(--ink); font-weight: 600; }

.flow-row     { display: grid; gap: 14px; }
.flow-row.r-2 { grid-template-columns: repeat(2, 1fr); }
.flow-row.r-3 { grid-template-columns: repeat(3, 1fr); }
.flow-row.r-4 { grid-template-columns: repeat(4, 1fr); }

/* Step (frise histoire naturelle) */
.step { background: #fff; border: 1px solid var(--rule); border-radius: 3px; padding: 14px 16px; position: relative; }
.step .sn { position: absolute; top: -10px; left: 14px; background: var(--paper); padding: 0 8px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; color: var(--ink-3); text-transform: uppercase; }
.step h5 { font-family: var(--font-serif); font-weight: 500; font-size: 16px; margin: 2px 0 6px; }
.step p { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }
.step ul { margin: 4px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.step ul li { margin: 4px 0; }
.step ul li b { color: var(--ink); font-weight: 600; }

/* Tables */
table.matrix { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--rule); }
table.matrix th, table.matrix td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; font-size: 12.5px; }
table.matrix 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; border-bottom: 1px solid var(--rule-2); }
table.matrix tbody th { font-family: var(--font-serif); font-weight: 500; font-size: 14.5px; color: var(--ink); border-right: 1px solid var(--rule); }
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.compact th, table.matrix.compact td { padding: 8px 10px; font-size: 11.5px; }
table.matrix.compact tbody th { font-size: 12.5px; }
table.matrix ul { margin: 0; padding-left: 18px; line-height: 1.7; }
table.matrix ul li { margin: 4px 0; }

/* Hbox */
.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 > ul li b { color: var(--ink); font-weight: 600; }
.hbox > p b { color: var(--ink); }

/* Vignette */
.vignette {
  background: var(--paper); border: 1px solid var(--rule);
  border-left: 4px solid var(--fam-endocrino);
  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(--fam-endocrino); 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-size: 12.5px; font-style: italic; color: var(--ink-2); }

/* Definitions */
.def-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.def-card {
  background: var(--paper); border: 1px solid var(--rule);
  border-top: 3px solid var(--fam-endocrino); border-radius: 4px;
  padding: 16px 18px;
}
.def-card h3 { font-family: var(--font-serif); font-weight: 500; font-size: 18px; letter-spacing: -.01em; margin: 0 0 4px; color: var(--fam-endocrino); }
.def-card .def-sub { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); display: block; margin-bottom: 8px; }
.def-card p { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; margin: 0; }
.def-card p b { color: var(--ink); font-weight: 600; }

/* Keypoints */
#keypoints ol {
  list-style: decimal-leading-zero;
  padding: 18px 20px 18px 56px;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
}
#keypoints ol li { font-size: 13.5px; line-height: 1.6; color: var(--ink-2); margin: 8px 0; padding-left: 4px; }
#keypoints ol li::marker { font-family: var(--font-mono); font-size: 11px; color: var(--fam-endocrino); font-weight: 600; }
#keypoints ol li b { color: var(--ink); font-weight: 600; }

/* Alertes */
.alert-clinical {
  background: #f3dccf; border: 1px solid var(--danger);
  border-radius: 4px; padding: 16px 20px;
  display: grid; grid-template-columns: 44px 1fr; gap: 16px; align-items: start;
  margin: 18px 0;
}
.alert-clinical .alert-icon { font-family: var(--font-serif); font-size: 32px; line-height: 1; color: var(--danger); font-style: italic; font-weight: 500; }
.alert-clinical h4 { font-family: var(--font-serif); font-weight: 500; font-size: 18px; letter-spacing: -.005em; color: var(--danger); margin: 0 0 8px; }
.alert-clinical p { font-size: 13px; color: var(--ink-2); line-height: 1.55; margin: 4px 0 0; }
.alert-clinical ul { margin: 4px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.alert-clinical ul li { margin: 4px 0; }
.alert-clinical ul li b { color: var(--ink); font-weight: 600; }

/* Schémas SVG */
.schema-wrap {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  padding: 16px 18px; margin: 12px 0;
}
.schema-wrap svg { width: 100%; height: auto; display: block; }
.schema-legend { font-size: 12px; color: var(--ink-3); line-height: 1.5; font-style: italic; margin: 8px 0 0; max-width: 1100px; }
.schema-legend b { color: var(--ink); font-weight: 600; }

/* Profil cards */
#etio-grid, #pec-medocs-grid, #chir-tech-grid, #phenotypes-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px; margin-top: 14px;
}
.profil-card {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  border-top: 4px solid var(--fam, var(--ink));
  padding: 0; overflow: hidden; display: flex; flex-direction: column;
}
.profil-head {
  background: var(--fam-bg, var(--bg-2));
  padding: 14px 16px;
  border-bottom: 1px solid color-mix(in oklab, var(--fam, var(--ink)) 30%, var(--rule));
}
.profil-head h4 { font-family: var(--font-serif); font-weight: 500; font-size: 17px; letter-spacing: -.005em; margin: 0 0 4px; color: var(--fam, var(--ink)); }
.profil-tag { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.profil-section { padding: 10px 16px; }
.profil-section ul { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }
.profil-section ul li { margin: 3px 0; }
.profil-section ul li b { color: var(--ink); font-weight: 600; }
.profil-section p { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }
.profil-block { padding: 10px 16px; border-top: 1px dashed var(--rule); }
.profil-block:first-child { border-top: none; }
.profil-block b { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; font-weight: 500; }
.profil-block p { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }
.profil-block p b { display: inline; font-family: inherit; font-size: inherit; letter-spacing: 0; text-transform: none; color: var(--ink); margin: 0; font-weight: 600; }

/* ============================================================
   Ladder IMC vertical (onglet 04) — 10 lignes colorées
   ============================================================ */
.imc-ladder {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  padding: 0; margin: 14px 0;
  overflow: hidden;
}
.imc-row {
  display: grid; grid-template-columns: 1fr 200px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.imc-row:last-child { border-bottom: none; }
.imc-row .imc-cat {
  padding: 12px 18px;
  font-family: var(--font-serif); font-weight: 500; font-size: 14.5px;
  color: var(--ink); display: flex; align-items: center;
  border-right: 1px solid var(--rule);
}
.imc-row .imc-val {
  padding: 12px 18px;
  font-family: var(--font-mono); font-size: 13px;
  color: var(--ink-2); display: flex; align-items: center;
  background: var(--imc-bg, transparent);
}
.imc-row.imc-denut5 { --imc-bg: color-mix(in oklab, var(--info) 25%, var(--paper)); }
.imc-row.imc-denut4 { --imc-bg: color-mix(in oklab, var(--info) 18%, var(--paper)); }
.imc-row.imc-denut3 { --imc-bg: color-mix(in oklab, var(--info) 12%, var(--paper)); }
.imc-row.imc-denut2 { --imc-bg: color-mix(in oklab, var(--info) 8%, var(--paper)); }
.imc-row.imc-denut1 { --imc-bg: color-mix(in oklab, var(--info) 4%, var(--paper)); }
.imc-row.imc-normal { --imc-bg: color-mix(in oklab, var(--ok) 12%, var(--paper)); border-top: 1px solid var(--ok); border-bottom: 1px solid var(--ok); }
.imc-row.imc-surp   { --imc-bg: color-mix(in oklab, var(--warn) 14%, var(--paper)); }
.imc-row.imc-ob1    { --imc-bg: color-mix(in oklab, var(--danger) 14%, var(--paper)); }
.imc-row.imc-ob2    { --imc-bg: color-mix(in oklab, var(--danger) 24%, var(--paper)); }
.imc-row.imc-ob3    { --imc-bg: color-mix(in oklab, var(--danger) 38%, var(--paper)); }

.imc-ladder .imc-row.imc-normal .imc-cat,
.imc-ladder .imc-row.imc-ob1 .imc-cat,
.imc-ladder .imc-row.imc-ob2 .imc-cat,
.imc-ladder .imc-row.imc-ob3 .imc-cat { font-weight: 600; }

/* ============================================================
   Frise histoire naturelle (onglet 04) — 4 boîtes successives
   ============================================================ */
.frise-hist {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0; margin: 16px 0; position: relative;
}
.frise-hist .frise-step {
  position: relative;
  background: var(--paper); border: 1px solid var(--rule);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.frise-hist .frise-step:not(:last-child)::after {
  content: '';
  position: absolute; top: 50%; right: -8px; transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 8px solid var(--fam-endocrino);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  z-index: 2;
}
.frise-hist .frise-num {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--fam-endocrino);
}
.frise-hist .frise-title {
  font-family: var(--font-serif); font-weight: 500; font-size: 14.5px;
  color: var(--ink); margin: 0;
}
.frise-hist .frise-desc {
  font-size: 12px; color: var(--ink-2); line-height: 1.5;
}
.frise-hist .frise-desc b { color: var(--ink); font-weight: 600; }

/* ============================================================
   Courbe en J de mortalité (onglet 03) — SVG natif
   ============================================================ */
.courbe-j-wrap {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  padding: 18px 20px; margin: 14px 0;
}
.courbe-j-wrap svg {
  width: 100%; max-width: 720px; height: auto; display: block; margin: 0 auto;
}
.courbe-j-wrap .courbe-j-axis    { stroke: var(--ink-3); stroke-width: 1; }
.courbe-j-wrap .courbe-j-tick    { stroke: var(--ink-3); stroke-width: 1; }
.courbe-j-wrap .courbe-j-grid    { stroke: var(--rule); stroke-width: .5; stroke-dasharray: 2 4; }
.courbe-j-wrap .courbe-j-curve   { stroke: var(--fam-endocrino); stroke-width: 2.4; fill: none; }
.courbe-j-wrap .courbe-j-zone-ok { fill: color-mix(in oklab, var(--ok) 15%, transparent); }
.courbe-j-wrap .courbe-j-zone-warn { fill: color-mix(in oklab, var(--warn) 15%, transparent); }
.courbe-j-wrap .courbe-j-zone-danger { fill: color-mix(in oklab, var(--danger) 15%, transparent); }
.courbe-j-wrap text {
  font-family: var(--font-mono); font-size: 10px; fill: var(--ink-2); letter-spacing: .04em;
}
.courbe-j-wrap text.courbe-j-label-axis {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; fill: var(--ink-3);
}
.courbe-j-wrap text.courbe-j-annot {
  font-family: var(--font-serif); font-size: 11px; fill: var(--ink); font-style: italic;
}

/* ============================================================
   Courbe IMC pédiatrique (onglet 06) — SVG natif
   ============================================================ */
.courbe-ped-wrap {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  padding: 18px 20px; margin: 14px 0;
}
.courbe-ped-wrap svg {
  width: 100%; max-width: 760px; height: auto; display: block; margin: 0 auto;
}
.courbe-ped-wrap .ped-axis      { stroke: var(--ink-3); stroke-width: 1; }
.courbe-ped-wrap .ped-grid      { stroke: var(--rule); stroke-width: .5; stroke-dasharray: 2 4; }
.courbe-ped-wrap .ped-physio    { stroke: var(--ok); stroke-width: 2.2; fill: none; }
.courbe-ped-wrap .ped-absence   { stroke: var(--danger); stroke-width: 2; fill: none; stroke-dasharray: 5 4; }
.courbe-ped-wrap .ped-precoce   { stroke: var(--warn); stroke-width: 2; fill: none; }
.courbe-ped-wrap .ped-croisement { stroke: var(--accent-blue); stroke-width: 2; fill: none; stroke-dasharray: 3 5; }
.courbe-ped-wrap text {
  font-family: var(--font-mono); font-size: 10px; fill: var(--ink-2); letter-spacing: .04em;
}
.courbe-ped-wrap .ped-legend {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-top: 14px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3);
}
.courbe-ped-wrap .ped-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.courbe-ped-wrap .ped-legend-line { width: 28px; height: 2.5px; }
.courbe-ped-wrap .ped-legend-physio { background: var(--ok); }
.courbe-ped-wrap .ped-legend-absence { background: var(--danger); }
.courbe-ped-wrap .ped-legend-precoce { background: var(--warn); }
.courbe-ped-wrap .ped-legend-croisement { background: var(--accent-blue); }

/* ============================================================
   Schémas anatomiques chirurgies (onglet 12) — SVG natif
   ============================================================ */
.chir-schemas-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px; margin: 14px 0;
}
.chir-schema {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.chir-schema h5 {
  margin: 0; font-family: var(--font-serif); font-weight: 500; font-size: 14.5px;
  color: var(--fam-endocrino);
}
.chir-schema .chir-sub {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3);
}
.chir-schema svg {
  width: 100%; max-width: 240px; height: auto; display: block; margin: 0 auto;
}
.chir-schema .chir-stomach   { fill: #f5e2c5; stroke: var(--ink); stroke-width: 1.4; }
.chir-schema .chir-stomach-cut { fill: var(--bg-2); stroke: var(--ink-3); stroke-width: 1.2; stroke-dasharray: 4 3; }
.chir-schema .chir-tube      { fill: #f5e2c5; stroke: var(--ink); stroke-width: 1.4; }
.chir-schema .chir-anneau    { fill: var(--fam-endocrino); stroke: var(--ink); stroke-width: 1; }
.chir-schema .chir-tube-link { stroke: var(--fam-endocrino); stroke-width: 1.6; fill: none; }
.chir-schema .chir-box       { fill: var(--fam-endocrino); }
.chir-schema .chir-bol       { stroke: var(--ok); stroke-width: 2; fill: none; marker-end: url(#chir-arrow-bol); }
.chir-schema .chir-bile      { stroke: var(--info); stroke-width: 1.6; fill: none; stroke-dasharray: 4 3; marker-end: url(#chir-arrow-bile); }
.chir-schema text {
  font-family: var(--font-mono); font-size: 9.5px; fill: var(--ink-2); letter-spacing: .04em;
}

/* ============================================================
   Galaxie complications (onglet 07) — tableau natif géant
   ============================================================ */
#complications-table table.matrix tbody th {
  font-size: 13px;
  background: var(--bg-3);
  width: 18%;
}
#complications-table table.matrix tbody td:first-of-type { width: 60%; }
#complications-table table.matrix tbody td:last-of-type {
  font-style: italic; color: var(--ink-2);
}

/* ============================================================
   Mindmap (copie pattern 247)
   ============================================================ */
.mmwrap {
  position: relative; width: 100%;
  border: 1px solid var(--rule); border-radius: 4px;
  background: linear-gradient(180deg, var(--paper-2) 0%, var(--paper) 100%);
  height: 800px; overflow: hidden;
}
.mmwrap .zctl { position: absolute; top: 14px; right: 14px; z-index: 10; display: flex; gap: 4px; }
.mmwrap .zctl button { width: 32px; height: 32px; background: var(--paper); border: 1px solid var(--rule); border-radius: 3px; font-family: var(--font-mono); font-size: 14px; color: var(--ink-2); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.mmwrap .zctl button:hover { background: var(--bg-2); }
.mmwrap .zhint { position: absolute; bottom: 14px; left: 14px; z-index: 5; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; color: var(--ink-3); background: var(--paper); padding: 4px 10px; border-radius: 2px; border: 1px solid var(--rule); }
.mmwrap svg.canvas { width: 100%; height: 100%; cursor: grab; }
.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,
.mmwrap svg.canvas .node-sat:hover .sat-sub { fill: var(--paper); }
.mmwrap svg.canvas .sat-bg { fill: var(--bg-2); stroke: var(--ink); stroke-width: 1; }
.mmwrap svg.canvas .sat-title { fill: var(--ink); font-family: var(--font-serif); font-weight: 500; font-size: 12.5px; }
.mmwrap svg.canvas .sat-sub { fill: var(--ink-2); font-size: 9.5px; font-family: var(--font-mono); letter-spacing: .04em; }

/* Tour de taille — petit tableau visuel */
#tour-taille-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0;
}
.tt-card {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  padding: 12px 16px;
}
.tt-card h6 {
  margin: 0 0 6px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3);
}
.tt-card .tt-niv1 { font-family: var(--font-mono); font-size: 14px; color: var(--warn); margin: 4px 0; }
.tt-card .tt-niv2 { font-family: var(--font-mono); font-size: 14px; color: var(--danger); margin: 4px 0; font-weight: 600; }

/* Responsive */
@media (max-width: 720px) {
  .mmwrap { height: 600px; }
  .flow-row.r-2, .flow-row.r-3, .flow-row.r-4 { grid-template-columns: 1fr; }
  .def-grid { grid-template-columns: 1fr; }
  #etio-grid, #pec-medocs-grid, #chir-tech-grid, #phenotypes-grid { grid-template-columns: 1fr; }
  .frise-hist { grid-template-columns: 1fr; }
  .frise-hist .frise-step:not(:last-child)::after {
    top: auto; bottom: -8px; right: 50%; transform: translateX(50%) rotate(90deg);
  }
  table.matrix.compact th, table.matrix.compact td { padding: 6px 8px; font-size: 11px; }
  .imc-row { grid-template-columns: 1fr; }
  .imc-row .imc-cat { border-right: none; border-bottom: 1px solid var(--rule); }
  #tour-taille-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   MODE NUIT (body.dark-mode — pas body.dark)
   ============================================================ */
body.dark-mode {
  --paper:    #1f1c17;
  --paper-2:  #251f17;
  --rule:     #4a4232;
  --rule-2:   #6b5e45;
  --bg-2:     #2a241c;
  --bg-3:     #322a20;
  --ink-2:    #d7ccb4;
  --ink-3:    #a89c7d;
  --ink-4:    #786a52;
}
body.dark-mode .vignette { background: var(--paper); }
body.dark-mode .vignette p { color: var(--ink-2); }
body.dark-mode .vignette .vg-trap { background: var(--bg-2); color: var(--ink-3); }
body.dark-mode .def-card { background: var(--paper); }
body.dark-mode .def-card p { color: var(--ink-2); }
body.dark-mode #keypoints ol { background: var(--paper); }
body.dark-mode #keypoints ol li { color: var(--ink-2); }
body.dark-mode .step { background: var(--paper-2); }
body.dark-mode .step p, body.dark-mode .step ul { color: var(--ink-2); }
body.dark-mode .hbox { background: var(--paper); }
body.dark-mode .hbox > p, body.dark-mode .hbox > ul { color: var(--ink-2); }
body.dark-mode table.matrix { background: var(--paper); }
body.dark-mode table.matrix tbody tr:hover td { background: var(--bg-2); }
body.dark-mode .alert-clinical { background: #3a1a14; border-color: #c9624c; }
body.dark-mode .alert-clinical h4 { color: #f0a896; }
body.dark-mode .alert-clinical p, body.dark-mode .alert-clinical ul { color: #f0d5c9; }
body.dark-mode .alert-clinical ul li b { color: #fff8e1; }
body.dark-mode .schema-wrap { background: var(--paper); }
body.dark-mode .profil-card { background: var(--paper); }
body.dark-mode .profil-section ul { color: var(--ink-2); }
body.dark-mode .profil-block p { color: var(--ink-2); }
body.dark-mode .profil-block { border-top-color: var(--rule); }
body.dark-mode .imc-ladder { background: var(--paper); }
body.dark-mode .imc-row .imc-cat { color: var(--ink-2); }
body.dark-mode .imc-row .imc-val { color: var(--ink-3); }
body.dark-mode .frise-hist .frise-step { background: var(--paper); }
body.dark-mode .frise-hist .frise-desc { color: var(--ink-2); }
body.dark-mode .courbe-j-wrap { background: var(--paper); }
body.dark-mode .courbe-ped-wrap { background: var(--paper); }
body.dark-mode .chir-schema { background: var(--paper); }
body.dark-mode .tt-card { background: var(--paper); }

body.dark-mode .mmwrap { background: linear-gradient(180deg, var(--paper-2), var(--paper)); }
body.dark-mode .mmwrap .zctl button { background: var(--paper); color: var(--ink-2); border-color: var(--rule); }
body.dark-mode .mmwrap .zhint { background: var(--paper); color: var(--ink-3); border-color: var(--rule); }
body.dark-mode .mmwrap svg.canvas .node-bg { fill: var(--paper); stroke: var(--rule-2); }
body.dark-mode .mmwrap svg.canvas .node-title { fill: var(--ink-2); }
body.dark-mode .mmwrap svg.canvas .node-sub { fill: var(--ink-3); }
body.dark-mode .mmwrap svg.canvas .node-chip { fill: var(--paper-2); stroke: var(--rule); }
body.dark-mode .mmwrap svg.canvas .node-chip-t { fill: var(--ink-3); }
body.dark-mode .mmwrap svg.canvas .sat-bg { fill: var(--bg-2); stroke: var(--ink-2); }
body.dark-mode .mmwrap svg.canvas .sat-title { fill: var(--ink-2); }
body.dark-mode .mmwrap svg.canvas .sat-sub { fill: var(--ink-3); }
body.dark-mode .mmwrap svg.canvas .root-circle { fill: var(--ink-2); }
body.dark-mode .mmwrap svg.canvas .root-text { fill: var(--paper); }

body.dark-mode .lane {
  background: var(--paper-2);
  border-color: color-mix(in oklab, var(--fam, var(--ink-3)) 35%, var(--rule));
}
body.dark-mode .lane .lane-h h3 { color: var(--ink); }
body.dark-mode .lane .lane-h .kind { color: var(--ink-3); }
body.dark-mode .lane > p { color: var(--ink-2); }
body.dark-mode .lane > ul, body.dark-mode .lane > ul li { color: var(--ink-2); }
body.dark-mode .lane > ul li b { color: var(--ink); }
body.dark-mode .lane .hbox { background: var(--paper); border-color: var(--rule); }

/* Decision-tree racine — fix B-FIX-247 (pour ne pas écraser .dt-root) */
.dt-svg .dt-node.dt-root rect { fill: var(--ink); }
.dt-svg .dt-node.dt-root text { fill: var(--paper-2, #faf6ec); }
body.dark-mode .dt-svg .dt-node.dt-root rect { fill: var(--ink-2) !important; }
body.dark-mode .dt-svg .dt-node.dt-root text { fill: var(--paper) !important; }
