/* ==========================================================================
   Item 232 · Fibrillation atriale — styles spécifiques
   2ᵉ item Cardiologie · architecture hybride urgence/chronique long cours
   Composants nouveaux : calculateur CHA₂DS₂-VA + schéma cycle physiopath animé
   ========================================================================== */

: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);

  /* Familles thématiques (cardio-blueprint, étendue 232) */
  --fam-cardio:   var(--spe-cardio);
  --fam-cardio2:  #6b8a99;          /* bleu pâle pour physiopath */
  --fam-paracli:  var(--spe-mir);
  --fam-infectio: var(--spe-infectio);
  --fam-urg:      var(--alert-red);
  --fam-warn:     var(--warn);
  --fam-ok:       var(--ok);
  --fam-info:     var(--accent-blue);
  --fam-mir:      var(--spe-interne);
}

.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
   ========================================================= */
.fam-cardio    { --fam: var(--fam-cardio);    --fam-bg: #cfdde0; }
.fam-cardio2   { --fam: var(--fam-cardio2);   --fam-bg: #dde7eb; }
.fam-paracli   { --fam: var(--fam-paracli);   --fam-bg: var(--bg-2); }
.fam-infectio  { --fam: var(--fam-infectio);  --fam-bg: #f3dccf; }
.fam-urg       { --fam: var(--fam-urg);       --fam-bg: #fbeee3; }
.fam-warn      { --fam: var(--fam-warn);      --fam-bg: #f3e9cc; }
.fam-ok        { --fam: var(--fam-ok);        --fam-bg: #dde2c8; }
.fam-info      { --fam: var(--fam-info);      --fam-bg: #d5e3e7; }
.fam-mir       { --fam: var(--fam-mir);       --fam-bg: #ede1ce; }

/* =========================================================
   Lane / step / flow-row
   ========================================================= */
.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; }

.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); }

.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: 12px; }
table.matrix.compact tbody th { font-size: 13px; }
table.matrix ul { margin: 0; padding-left: 18px; line-height: 1.7; }
table.matrix ul li { margin: 4px 0; }

/* =========================================================
   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 > 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-cardio);
  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-cardio); 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);
}

/* =========================================================
   Cartes définitions
   ========================================================= */
.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-cardio); 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-cardio);
}
.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-cardio); font-weight: 600;
}
#keypoints ol li b { color: var(--ink); font-weight: 600; }

/* =========================================================
   Alertes cliniques (CLAUDE.md règle B)
   ========================================================= */
.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; }

/* =========================================================
   CALCULATEUR CHA₂DS₂-VA INTERACTIF
   ========================================================= */
.cha2ds2va-calculator {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--fam-cardio);
  border-radius: 6px;
  padding: 20px 24px;
  margin: 18px 0;
}
.cha2ds2va-calculator h3 {
  font-family: var(--font-serif); font-weight: 500; font-size: 22px;
  margin: 0 0 4px; color: var(--fam-cardio); letter-spacing: -.01em;
}
.cha-sub {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 14px;
}
.cha-grid {
  display: grid; gap: 8px;
}
.cha-field {
  border: 1px solid var(--rule); border-radius: 4px;
  padding: 10px 14px; margin: 0;
  background: var(--paper-2);
}
.cha-field legend {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); padding: 0 6px;
}
.cha-field label,
.cha-cb {
  display: block; padding: 6px 8px; cursor: pointer;
  font-size: 13px; color: var(--ink-2);
  border-radius: 3px; transition: background-color .15s;
  line-height: 1.5;
}
.cha-field label:hover,
.cha-cb:hover { background: color-mix(in oklab, var(--fam-cardio) 8%, var(--paper)); }
.cha-cb {
  border: 1px solid var(--rule); background: var(--paper-2);
  margin: 4px 0;
}
.cha-cb input,
.cha-field label input { margin-right: 10px; transform: scale(1.1); accent-color: var(--fam-cardio); }
.cha-cb b { color: var(--fam-cardio); font-weight: 700; margin-right: 4px; }

.cha-result {
  margin-top: 18px;
  padding: 14px 18px;
  background: var(--bg-2);
  border-radius: 6px;
  border: 1px solid var(--rule);
}
.cha-score {
  font-family: var(--font-serif); font-size: 24px; font-weight: 500;
  color: var(--ink); text-align: center;
  margin-bottom: 10px;
}
.cha-score [data-cha-score] {
  font-size: 36px; font-weight: 600; color: var(--fam-cardio);
  display: inline-block; min-width: 40px;
}
.cha-recommandation {
  padding: 12px 16px; border-radius: 6px;
  margin-top: 8px; font-weight: 500; font-size: 13.5px;
  line-height: 1.5;
  text-align: center;
}
.cha-reco-vert {
  background: #dde2c8; color: var(--ok);
  border-left: 4px solid var(--ok);
}
.cha-reco-orange {
  background: #f4e0cf; color: var(--warn);
  border-left: 4px solid var(--warn);
}
.cha-reco-rouge {
  background: #f3dccf; color: var(--danger);
  border-left: 4px solid var(--danger);
}

/* =========================================================
   Schéma cycle physiopath animé (5 étapes × 1.5s)
   ========================================================= */
.cycle-wrap {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 18px;
  margin: 12px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: center;
}
.physio-cycle-svg {
  width: 100%; height: auto; max-height: 400px;
}
.physio-cycle-svg .cycle-circle {
  fill: var(--paper-2);
  stroke: var(--fam-cardio);
  stroke-width: 1.5;
  transition: fill .3s, stroke-width .3s;
}
.physio-cycle-svg .cycle-num {
  fill: var(--fam-cardio);
  font-family: var(--font-serif);
  transition: fill .3s;
}
.physio-cycle-svg .cycle-arrow {
  stroke: var(--fam-cardio);
  opacity: 0.45;
}
/* Animation séquentielle 5 étapes × 1.5s = 7.5s total */
@keyframes cycle-highlight {
  0%, 14%   { fill: var(--paper-2); stroke-width: 1.5; }
  16%, 28%  { fill: var(--warn); stroke-width: 3; }
  30%, 100% { fill: var(--paper-2); stroke-width: 1.5; }
}
@keyframes cycle-num-color {
  0%, 14%   { fill: var(--fam-cardio); }
  16%, 28%  { fill: #fff; }
  30%, 100% { fill: var(--fam-cardio); }
}
.cycle-step-1 .cycle-circle { animation: cycle-highlight 7.5s ease-in-out infinite; animation-delay: 0s; }
.cycle-step-2 .cycle-circle { animation: cycle-highlight 7.5s ease-in-out infinite; animation-delay: 1.5s; }
.cycle-step-3 .cycle-circle { animation: cycle-highlight 7.5s ease-in-out infinite; animation-delay: 3s; }
.cycle-step-4 .cycle-circle { animation: cycle-highlight 7.5s ease-in-out infinite; animation-delay: 4.5s; }
.cycle-step-5 .cycle-circle { animation: cycle-highlight 7.5s ease-in-out infinite; animation-delay: 6s; }
.cycle-step-1 .cycle-num { animation: cycle-num-color 7.5s ease-in-out infinite; animation-delay: 0s; }
.cycle-step-2 .cycle-num { animation: cycle-num-color 7.5s ease-in-out infinite; animation-delay: 1.5s; }
.cycle-step-3 .cycle-num { animation: cycle-num-color 7.5s ease-in-out infinite; animation-delay: 3s; }
.cycle-step-4 .cycle-num { animation: cycle-num-color 7.5s ease-in-out infinite; animation-delay: 4.5s; }
.cycle-step-5 .cycle-num { animation: cycle-num-color 7.5s ease-in-out infinite; animation-delay: 6s; }

.cycle-legend {
  list-style: none; padding: 0; margin: 0;
  font-size: 12px; line-height: 1.5;
  counter-reset: cycle;
}
.cycle-legend-item {
  padding: 8px 12px;
  margin-bottom: 6px;
  border-left: 3px solid var(--rule);
  background: var(--paper-2);
  color: var(--ink-2);
  border-radius: 0 4px 4px 0;
  transition: background-color .3s, border-left-color .3s;
}
.cycle-legend-item b { color: var(--fam-cardio); }
.cycle-legend-item span { color: var(--ink-2); }

/* Highlight séquentiel des items de légende synchronisé avec le cycle */
@keyframes legend-highlight {
  0%, 14%   { background: var(--paper-2); border-left-color: var(--rule); }
  16%, 28%  { background: var(--fam-bg, #cfdde0); border-left-color: var(--warn); }
  30%, 100% { background: var(--paper-2); border-left-color: var(--rule); }
}
.cycle-legend-1 { animation: legend-highlight 7.5s ease-in-out infinite; animation-delay: 0s; }
.cycle-legend-2 { animation: legend-highlight 7.5s ease-in-out infinite; animation-delay: 1.5s; }
.cycle-legend-3 { animation: legend-highlight 7.5s ease-in-out infinite; animation-delay: 3s; }
.cycle-legend-4 { animation: legend-highlight 7.5s ease-in-out infinite; animation-delay: 4.5s; }
.cycle-legend-5 { animation: legend-highlight 7.5s ease-in-out infinite; animation-delay: 6s; }

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .cycle-step-1 .cycle-circle, .cycle-step-2 .cycle-circle, .cycle-step-3 .cycle-circle,
  .cycle-step-4 .cycle-circle, .cycle-step-5 .cycle-circle,
  .cycle-step-1 .cycle-num, .cycle-step-2 .cycle-num, .cycle-step-3 .cycle-num,
  .cycle-step-4 .cycle-num, .cycle-step-5 .cycle-num,
  .cycle-legend-1, .cycle-legend-2, .cycle-legend-3, .cycle-legend-4, .cycle-legend-5 {
    animation: none !important;
  }
}

/* =========================================================
   ECG schema (FA classique)
   ========================================================= */
.ecg-schema-wrap {
  background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  padding: 18px 20px; margin: 14px 0;
}
.ecg-schema-wrap svg.ecg-schema { width: 100%; height: auto; display: block; margin: 6px 0 8px; }
.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; }

/* =========================================================
   Profils étiologiques / cas particuliers (cards)
   ========================================================= */
#prof-grid,
#cas-grid,
#ry-profils-aar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 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: 18px;
  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; border-bottom: 1px dashed var(--rule);
}
.profil-section:last-child { border-bottom: none; }
.profil-section h6 {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--fam, var(--ink-3));
  margin: 0 0 4px; font-weight: 500;
}
.profil-section ul { margin: 0; padding-left: 18px; font-size: 12px; 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: 12px; color: var(--ink-2); line-height: 1.55; }
.profil-section p b { color: var(--ink); font-weight: 600; }
.profil-section.profil-pieges {
  background: #fbf5e9;
  border-top: 1px solid color-mix(in oklab, var(--warn) 30%, var(--rule));
}
.profil-section.profil-pieges h6 { color: var(--warn); }

/* =========================================================
   Mindmap
   ========================================================= */
.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; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 720px) {
  .mmwrap { height: 600px; }
  .cycle-wrap { grid-template-columns: 1fr; }
  .flow-row.r-2, .flow-row.r-3 { grid-template-columns: 1fr; }
  .def-grid { grid-template-columns: 1fr; }
  #prof-grid, #cas-grid, #ry-profils-aar { grid-template-columns: 1fr; }
}

/* =========================================================
   MODE NUIT
   ========================================================= */
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 .ecg-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-section.profil-pieges { background: #2a2418; }

/* Calculateur en mode nuit */
body.dark-mode .cha2ds2va-calculator { background: var(--paper); }
body.dark-mode .cha-field { background: var(--paper-2); }
body.dark-mode .cha-cb { background: var(--paper-2); }
body.dark-mode .cha-cb,
body.dark-mode .cha-field label { color: var(--ink-2); }
body.dark-mode .cha-result { background: var(--bg-2); }
body.dark-mode .cha-score { color: var(--ink-2); }
body.dark-mode .cha-reco-vert {
  background: rgba(78, 106, 47, 0.25); color: #b6cb86; border-left-color: #b6cb86;
}
body.dark-mode .cha-reco-orange {
  background: rgba(138, 90, 18, 0.30); color: #e9b766; border-left-color: #e9b766;
}
body.dark-mode .cha-reco-rouge {
  background: rgba(165, 42, 26, 0.30); color: #f0a896; border-left-color: #f0a896;
}

/* Cycle animé en mode nuit */
body.dark-mode .cycle-wrap { background: var(--paper); }
body.dark-mode .physio-cycle-svg .cycle-circle { fill: var(--paper-2); }
body.dark-mode .cycle-legend-item { background: var(--paper-2); color: var(--ink-2); }
body.dark-mode .cycle-legend-item span { color: var(--ink-2); }

/* Mindmap en mode nuit */
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); }

/* Decision-tree racine — fix piège 2 classes */
.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; }
