/* ===========================================================================
   Klausur-Kompass — clinical exam compendium
   Design: calm "paper" neutrals + clinical teal accent, per-subject hues.
   ========================================================================= */

/* ---------- Tokens ---------- */
:root{
  --paper:#faf9f6;
  --surface:#ffffff;
  --surface-2:#f4f3ef;
  --ink:#1b2127;
  --ink-2:#4c5763;
  --ink-3:#7a8590;
  --line:#e7e5de;
  --line-2:#d9d7cf;
  --accent:#0e8a8f;
  --accent-ink:#0a6a6e;
  --accent-wash:#e5f2f2;
  --good:#2f8f5b;
  --warn:#b9791b;
  --warn-wash:#fbf1de;
  --crit:#c2453d;
  --crit-wash:#faeae8;
  --hy:#0e8a8f;              /* high-yield hue, overridden per subject */
  --subject:#0e8a8f;         /* active subject accent, set by JS */
  --subject-wash:#e5f2f2;

  --shadow-1:0 1px 2px rgba(20,28,36,.04), 0 1px 3px rgba(20,28,36,.06);
  --shadow-2:0 4px 14px rgba(20,28,36,.08), 0 2px 6px rgba(20,28,36,.05);
  --radius:14px;
  --radius-sm:9px;

  --sans:"Segoe UI Variable Text","Segoe UI",system-ui,-apple-system,"Helvetica Neue",Arial,sans-serif;
  --serif:"Iowan Old Style","Charter","Palatino Linotype","Book Antiqua",Georgia,serif;
  --mono:"Cascadia Code",ui-monospace,"SF Mono","Segoe UI Mono",Menlo,Consolas,monospace;

  --maxw:820px;
  --sidebar-w:302px;
}
@media (prefers-color-scheme: dark){
  :root{
    --paper:#0f1417; --surface:#161c21; --surface-2:#1b232a;
    --ink:#e8edf0; --ink-2:#aeb9c2; --ink-3:#7f8b95;
    --line:#242d34; --line-2:#2f3941;
    --accent:#40b7bd; --accent-ink:#5fcace; --accent-wash:#12312f;
    --good:#4fb37f; --warn:#d99a3f; --warn-wash:#2c2415; --crit:#e0685f; --crit-wash:#2e1a18;
    --shadow-1:0 1px 2px rgba(0,0,0,.3); --shadow-2:0 6px 22px rgba(0,0,0,.4);
  }
}
:root[data-theme="light"]{
  --paper:#faf9f6; --surface:#ffffff; --surface-2:#f4f3ef;
  --ink:#1b2127; --ink-2:#4c5763; --ink-3:#7a8590;
  --line:#e7e5de; --line-2:#d9d7cf;
  --accent:#0e8a8f; --accent-ink:#0a6a6e; --accent-wash:#e5f2f2;
  --good:#2f8f5b; --warn:#b9791b; --warn-wash:#fbf1de; --crit:#c2453d; --crit-wash:#faeae8;
  --shadow-1:0 1px 2px rgba(20,28,36,.04),0 1px 3px rgba(20,28,36,.06);
  --shadow-2:0 4px 14px rgba(20,28,36,.08),0 2px 6px rgba(20,28,36,.05);
}
:root[data-theme="dark"]{
  --paper:#0f1417; --surface:#161c21; --surface-2:#1b232a;
  --ink:#e8edf0; --ink-2:#aeb9c2; --ink-3:#7f8b95;
  --line:#242d34; --line-2:#2f3941;
  --accent:#40b7bd; --accent-ink:#5fcace; --accent-wash:#12312f;
  --good:#4fb37f; --warn:#d99a3f; --warn-wash:#2c2415; --crit:#e0685f; --crit-wash:#2e1a18;
  --shadow-1:0 1px 2px rgba(0,0,0,.3); --shadow-2:0 6px 22px rgba(0,0,0,.4);
}

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0; background:var(--paper); color:var(--ink);
  font-family:var(--sans); font-size:16px; line-height:1.5;
  -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
}
a{color:inherit}
button{font-family:inherit}
:focus-visible{outline:2.5px solid var(--accent); outline-offset:2px; border-radius:6px}
::selection{background:var(--subject-wash); color:var(--ink)}

/* ---------- Top bar ---------- */
.topbar{
  position:sticky; top:0; z-index:40;
  display:flex; align-items:center; gap:14px;
  height:60px; padding:0 18px;
  background:color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter:saturate(1.4) blur(10px);
  border-bottom:1px solid var(--line);
}
.brand{display:flex; align-items:center; gap:10px; text-decoration:none; color:var(--ink); font-weight:650}
.brand-mark{color:var(--accent); display:grid; place-items:center}
.brand-name{font-size:16.5px; letter-spacing:-.01em; white-space:nowrap}
.search{
  position:relative; flex:1; max-width:560px; margin:0 auto; display:flex; align-items:center;
}
.search svg{position:absolute; left:13px; color:var(--ink-3)}
.search input{
  width:100%; height:40px; padding:0 40px 0 38px;
  background:var(--surface-2); border:1px solid var(--line); border-radius:11px;
  color:var(--ink); font-size:15px;
}
.search input::placeholder{color:var(--ink-3)}
.search input:focus{border-color:var(--accent); background:var(--surface); outline:none}
.searchhint{
  position:absolute; right:11px; color:var(--ink-3); font-family:var(--mono); font-size:12px;
  border:1px solid var(--line-2); border-radius:5px; padding:1px 6px; background:var(--surface);
}
.iconbtn{
  display:grid; place-items:center; width:40px; height:40px; flex:0 0 auto;
  background:transparent; border:1px solid transparent; border-radius:10px;
  color:var(--ink-2); cursor:pointer;
}
.iconbtn:hover{background:var(--surface-2); color:var(--ink)}
.menu-toggle{display:none}
.ico-moon{display:none}
:root[data-theme="dark"] .ico-sun,@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .ico-sun{display:none}}
:root[data-theme="dark"] .ico-moon{display:block}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .ico-moon{display:block}}

/* ---------- Shell / layout ---------- */
.shell{display:flex; align-items:flex-start; max-width:1220px; margin:0 auto}
.sidebar{
  position:sticky; top:60px; align-self:flex-start;
  width:var(--sidebar-w); flex:0 0 var(--sidebar-w);
  height:calc(100vh - 60px); overflow-y:auto; overscroll-behavior:contain;
  border-right:1px solid var(--line); padding:16px 12px 40px;
  scrollbar-width:thin;
}
.subjnav{display:flex; flex-direction:column; gap:2px; margin-bottom:14px}
.subj{
  display:flex; align-items:center; gap:10px; width:100%;
  padding:8px 10px; border:none; background:transparent; border-radius:10px;
  color:var(--ink-2); cursor:pointer; text-align:left; font-size:14.5px;
}
.subj:hover{background:var(--surface-2); color:var(--ink)}
.subj[aria-current="true"]{background:var(--surface-2); color:var(--ink); font-weight:600}
.subj .dot{width:9px; height:9px; border-radius:50%; flex:0 0 auto; background:var(--sc,#888)}
.subj .subj-name{flex:1}
.subj .subj-count{font-size:12px; color:var(--ink-3); font-variant-numeric:tabular-nums}
.subj[aria-current="true"] .subj-count{color:var(--sc)}

.topiclist-head{
  padding:10px 10px 6px; font-size:11.5px; text-transform:uppercase; letter-spacing:.09em;
  color:var(--ink-3); font-weight:650; display:flex; justify-content:space-between; align-items:center;
}
.topiclist{list-style:none; margin:0; padding:0; counter-reset:t}
.tlink{
  display:flex; gap:9px; align-items:baseline; width:100%; text-align:left;
  padding:7px 10px; border:none; background:transparent; border-radius:9px; cursor:pointer;
  color:var(--ink-2); font-size:14px; line-height:1.35;
}
.tlink:hover{background:var(--surface-2); color:var(--ink)}
.tlink[aria-current="true"]{background:var(--subject-wash); color:var(--ink); font-weight:600}
.tlink .tnum{font-family:var(--mono); font-size:11.5px; color:var(--ink-3); min-width:1.4em; font-variant-numeric:tabular-nums}
.tlink[aria-current="true"] .tnum{color:var(--subject)}
.tlink .tt{flex:1}
.tlink .rel{width:6px; height:6px; border-radius:50%; align-self:center; flex:0 0 auto}
.rel.high{background:var(--crit)} .rel.med{background:var(--warn)} .rel.low{background:var(--ink-3)}
.tlink.done .tt{color:var(--ink-3)}
.tlink .check{color:var(--good); opacity:0; font-size:12px}
.tlink.done .check{opacity:1}

/* ---------- Main ---------- */
.main{flex:1; min-width:0; padding:30px clamp(18px,4vw,54px) 96px; max-width:calc(var(--maxw) + 120px)}
.wrap{max-width:var(--maxw); margin:0 auto}

/* ----- Home ----- */
.home-hero{margin:12px 0 30px}
.home-eyebrow{font-size:12.5px; text-transform:uppercase; letter-spacing:.14em; color:var(--accent-ink); font-weight:650}
.home-hero h1{font-family:var(--serif); font-weight:600; font-size:clamp(28px,4.4vw,40px); line-height:1.1; letter-spacing:-.015em; margin:.34em 0 .28em; text-wrap:balance}
.home-hero p{color:var(--ink-2); font-size:16.5px; max-width:60ch; margin:0}
.home-stats{display:flex; flex-wrap:wrap; gap:22px; margin-top:20px}
.stat{display:flex; flex-direction:column}
.stat b{font-size:23px; font-variant-numeric:tabular-nums; letter-spacing:-.01em}
.stat span{font-size:12.5px; color:var(--ink-3); text-transform:uppercase; letter-spacing:.06em}

.subject-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:14px; margin-top:8px}
.scard{
  position:relative; display:flex; flex-direction:column; gap:10px;
  padding:18px 18px 16px; background:var(--surface); border:1px solid var(--line);
  border-radius:var(--radius); box-shadow:var(--shadow-1); cursor:pointer; text-align:left;
  transition:transform .13s ease, box-shadow .13s ease, border-color .13s;
}
.scard:hover{transform:translateY(-2px); box-shadow:var(--shadow-2); border-color:var(--sc)}
.scard::before{content:""; position:absolute; left:0; top:14px; bottom:14px; width:3px; border-radius:3px; background:var(--sc)}
.scard .sc-top{display:flex; align-items:center; gap:10px}
.scard .sc-ic{width:34px; height:34px; border-radius:9px; display:grid; place-items:center; color:#fff; background:var(--sc); flex:0 0 auto}
.scard h3{margin:0; font-size:16.5px; letter-spacing:-.01em}
.scard .sc-meta{font-size:12.5px; color:var(--ink-3)}
.scard.prio .sc-badge{
  position:absolute; top:12px; right:12px; font-size:10.5px; font-weight:700; letter-spacing:.05em;
  text-transform:uppercase; color:var(--sc); background:color-mix(in srgb,var(--sc) 13%, transparent);
  padding:2px 7px; border-radius:20px;
}
.progress{height:5px; background:var(--surface-2); border-radius:5px; overflow:hidden; margin-top:2px}
.progress > i{display:block; height:100%; background:var(--sc); border-radius:5px; transition:width .3s}

/* ----- Topic view ----- */
.topic-head{margin-bottom:18px}
.crumb{display:flex; align-items:center; gap:8px; font-size:13px; color:var(--ink-3); margin-bottom:12px}
.crumb .c-subj{color:var(--subject); font-weight:600}
.badges{display:inline-flex; gap:7px; vertical-align:middle}
.badge{font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; padding:3px 9px; border-radius:20px}
.badge.high{color:var(--crit); background:var(--crit-wash)}
.badge.med{color:var(--warn); background:var(--warn-wash)}
.badge.low{color:var(--ink-3); background:var(--surface-2)}
.topic-head h1{font-family:var(--serif); font-weight:600; font-size:clamp(26px,3.8vw,34px); line-height:1.12; letter-spacing:-.015em; margin:.1em 0 0; text-wrap:balance}
.kernaussage{
  margin:16px 0 4px; padding:15px 18px; font-family:var(--serif); font-size:18px; line-height:1.5;
  color:var(--ink); background:var(--subject-wash); border-radius:12px;
  border:1px solid color-mix(in srgb,var(--subject) 22%, transparent);
}
.kernaussage b{font-weight:700}

/* section blocks */
.section{margin:24px 0}
.section > h2{
  font-size:13px; text-transform:uppercase; letter-spacing:.08em; color:var(--ink-2);
  font-weight:700; margin:0 0 10px; padding-bottom:7px; border-bottom:1px solid var(--line);
  display:flex; align-items:center; gap:8px;
}
.section > h2::before{content:""; width:7px; height:7px; border-radius:2px; background:var(--subject); flex:0 0 auto}
ul.points{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:9px}
ul.points > li{position:relative; padding-left:20px; color:var(--ink); line-height:1.52}
ul.points > li::before{content:""; position:absolute; left:3px; top:9px; width:6px; height:6px; border-radius:50%; background:var(--subject); opacity:.55}
ul.points > li b, ul.points > li strong{font-weight:650}
.ns{font-family:var(--mono); font-size:.92em; font-variant-numeric:tabular-nums; background:color-mix(in srgb,var(--subject-wash) 70%, transparent); padding:0 3px; border-radius:4px; white-space:nowrap}
.note{
  margin-top:10px; padding:9px 13px; font-size:14px; border-radius:9px; color:var(--ink-2);
  background:var(--surface-2); border-left:3px solid var(--line-2);
}
.note.cave{color:var(--crit); background:var(--crit-wash); border-left-color:var(--crit)}
.note b{color:inherit}

/* tables */
.tablecard{margin:16px 0; border:1px solid var(--line); border-radius:12px; overflow:hidden; box-shadow:var(--shadow-1)}
.tablecard .tcap{padding:10px 14px; font-size:13.5px; font-weight:650; background:var(--surface-2); border-bottom:1px solid var(--line)}
.tablescroll{overflow-x:auto}
table.data{border-collapse:collapse; width:100%; font-size:14px; background:var(--surface)}
table.data th, table.data td{padding:9px 14px; text-align:left; vertical-align:top; border-bottom:1px solid var(--line)}
table.data thead th{font-size:12px; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-2); background:color-mix(in srgb,var(--subject-wash) 60%, var(--surface)); position:sticky; top:0}
table.data tbody tr:last-child td{border-bottom:none}
table.data tbody tr:hover{background:var(--surface-2)}
table.data td:first-child{font-weight:600}
table.data.nums td{font-variant-numeric:tabular-nums}

/* drug cards */
.drugs{display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:12px; margin:16px 0; align-items:start}
.drug{min-width:0; border:1px solid var(--line); border-radius:12px; padding:14px 16px; background:var(--surface); box-shadow:var(--shadow-1); display:flex; flex-direction:column}
.drug .dn{display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:10px}
.drug .dn b{font-size:15px; letter-spacing:-.01em; overflow-wrap:anywhere}
.drug .dn .dg{font-size:11px; color:#fff; background:var(--subject); padding:2px 9px; border-radius:20px; font-weight:600; line-height:1.5}
.drug dl{margin:0; display:grid; grid-template-columns:max-content minmax(0,1fr); gap:7px 11px; font-size:13.5px; align-items:start}
.drug dt{color:var(--ink-3); font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; padding-top:2px; white-space:nowrap}
.drug dt.uaw{color:var(--crit)}
.drug dd{margin:0; color:var(--ink); overflow-wrap:break-word; line-height:1.45}
.drug .dmerke{margin-top:9px; padding-top:9px; border-top:1px dashed var(--line-2); font-size:13px; color:var(--accent-ink)}
.drug .dmerke::before{content:"Merke · "; font-weight:700; color:var(--accent)}

/* high-yield */
.highyield{
  margin:24px 0; padding:16px 18px 16px; border-radius:14px;
  background:linear-gradient(180deg, color-mix(in srgb,var(--subject-wash) 80%, var(--surface)), var(--surface));
  border:1.5px solid color-mix(in srgb,var(--subject) 30%, transparent);
}
.highyield h2{display:flex; align-items:center; gap:9px; margin:0 0 12px; font-size:14px; letter-spacing:.02em; color:var(--subject)}
.highyield h2 .hy-ic{width:22px; height:22px; border-radius:6px; background:var(--subject); color:#fff; display:grid; place-items:center; font-size:13px}
.highyield ol{margin:0; padding-left:0; list-style:none; counter-reset:hy; display:flex; flex-direction:column; gap:9px}
.highyield ol > li{position:relative; padding-left:30px; counter-increment:hy; line-height:1.5}
.highyield ol > li::before{content:counter(hy); position:absolute; left:0; top:1px; width:21px; height:21px; border-radius:6px; background:color-mix(in srgb,var(--subject) 16%, transparent); color:var(--subject); font-size:12px; font-weight:700; display:grid; place-items:center; font-variant-numeric:tabular-nums}

/* merksätze */
.merke-list{display:flex; flex-direction:column; gap:8px; margin:16px 0}
.merke-item{display:flex; gap:10px; align-items:flex-start; padding:11px 14px; background:var(--surface-2); border-radius:10px; font-size:14.5px}
.merke-item .m-ic{flex:0 0 auto; color:var(--warn); font-size:15px; line-height:1.4}

/* images / gallery */
.gallery{display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:12px; margin:16px 0}
figure.shot{margin:0; border:1px solid var(--line); border-radius:11px; overflow:hidden; background:var(--surface); box-shadow:var(--shadow-1); cursor:zoom-in; display:flex; flex-direction:column}
figure.shot img{width:100%; height:150px; object-fit:cover; object-position:center; display:block; background:var(--surface-2)}
figure.shot figcaption{padding:8px 11px; font-size:12.5px; color:var(--ink-2); line-height:1.35}
figure.shot .fp{color:var(--ink-3); font-family:var(--mono); font-size:11px}

/* topic footer nav */
.topic-foot{display:flex; justify-content:space-between; gap:12px; margin-top:40px; padding-top:22px; border-top:1px solid var(--line)}
.navbtn{
  display:flex; flex-direction:column; gap:2px; flex:1; max-width:48%;
  padding:12px 16px; background:var(--surface); border:1px solid var(--line); border-radius:12px;
  cursor:pointer; text-decoration:none; color:var(--ink); box-shadow:var(--shadow-1);
}
.navbtn:hover{border-color:var(--subject); box-shadow:var(--shadow-2)}
.navbtn.next{text-align:right; align-items:flex-end}
.navbtn small{font-size:11.5px; color:var(--ink-3); text-transform:uppercase; letter-spacing:.06em}
.navbtn span{font-weight:600; font-size:14.5px; line-height:1.3}
.navbtn.disabled{opacity:.4; pointer-events:none}

.donebar{display:flex; align-items:center; gap:12px; margin:26px 0 0}
.donebtn{
  display:inline-flex; align-items:center; gap:9px; padding:9px 16px; border-radius:11px; cursor:pointer;
  background:var(--surface); border:1.5px solid var(--line-2); color:var(--ink-2); font-size:14.5px; font-weight:600;
}
.donebtn:hover{border-color:var(--good); color:var(--ink)}
.donebtn.on{background:color-mix(in srgb,var(--good) 14%, transparent); border-color:var(--good); color:var(--good)}
.donebtn .ck{width:19px; height:19px; border-radius:50%; border:2px solid currentColor; display:grid; place-items:center; font-size:11px}
.donebtn.on .ck{background:var(--good); color:#fff; border-color:var(--good)}

/* ---------- Search panel ---------- */
.searchpanel{
  position:fixed; top:60px; left:50%; transform:translateX(-50%);
  width:min(640px,94vw); max-height:70vh; overflow-y:auto; z-index:45;
  background:var(--surface); border:1px solid var(--line); border-radius:14px;
  box-shadow:var(--shadow-2); padding:8px;
}
.sr{display:flex; gap:11px; align-items:baseline; padding:10px 12px; border-radius:10px; cursor:pointer}
.sr:hover,.sr.sel{background:var(--surface-2)}
.sr .sr-dot{width:8px; height:8px; border-radius:50%; align-self:center; flex:0 0 auto}
.sr .sr-t{flex:1; font-weight:600; font-size:14.5px}
.sr .sr-t em{font-style:normal; background:color-mix(in srgb,var(--accent) 22%, transparent); border-radius:3px; padding:0 2px}
.sr .sr-s{font-size:12px; color:var(--ink-3)}
.sr-empty{padding:24px; text-align:center; color:var(--ink-3)}
.sr-hint{padding:6px 12px 8px; font-size:11.5px; color:var(--ink-3); border-top:1px solid var(--line); margin-top:4px}
.sr-hint kbd{font-family:var(--mono); border:1px solid var(--line-2); border-radius:4px; padding:0 5px; font-size:11px}

/* ---------- Lightbox ---------- */
.lightbox{position:fixed; inset:0; z-index:80; background:rgba(10,14,17,.86); display:grid; place-items:center; padding:36px}
.lightbox[hidden]{display:none}
.lightbox figure{margin:0; max-width:min(1000px,94vw); max-height:90vh; display:flex; flex-direction:column; gap:10px}
.lightbox img{max-width:100%; max-height:78vh; object-fit:contain; border-radius:10px; background:#fff}
.lightbox figcaption{color:#e8edf0; text-align:center; font-size:14px}
.lightbox-close{position:fixed; top:18px; right:22px; width:44px; height:44px; border-radius:50%; border:none; background:rgba(255,255,255,.12); color:#fff; font-size:26px; cursor:pointer; line-height:1}
.lightbox-close:hover{background:rgba(255,255,255,.22)}

/* ---------- Scrim (mobile) ---------- */
.scrim{display:none}

/* ---------- Responsive ---------- */
@media (max-width:940px){
  :root{--sidebar-w:280px}
  .menu-toggle{display:grid}
  .sidebar{
    position:fixed; top:60px; left:0; z-index:38; background:var(--surface);
    transform:translateX(-100%); transition:transform .22s ease; box-shadow:var(--shadow-2);
  }
  #app.nav-open .sidebar{transform:translateX(0)}
  #app.nav-open .scrim{display:block; position:fixed; inset:60px 0 0 0; z-index:37; background:rgba(10,14,17,.4)}
  .searchhint{display:none}
}
@media (max-width:560px){
  .brand-name{display:none}
  .main{padding:22px 16px 90px}
  figure.shot img{height:130px}
  .topic-foot{flex-direction:column}
  .navbtn{max-width:100%}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important; animation:none!important}}

/* =========================================================================
   Visual language v2 — typed sections, callouts, stat tiles, diagrams
   ========================================================================= */

/* ---- semantic section types (color + icon) ---- */
.section[data-type]{ --st:var(--subject); --stw:color-mix(in srgb, var(--st) 12%, transparent); }
.section[data-type="grundlagen"]{ --st:#6d5ce0; }
.section[data-type="klinik"]{     --st:#c77d1a; }
.section[data-type="diagnostik"]{ --st:#1187a8; }
.section[data-type="therapie"]{   --st:#1f9d6b; }
.section[data-type="risiko"]{     --st:#d24a44; }
.section[data-type="prognose"]{   --st:#6a7787; }
.section[data-type="recht"]{      --st:#a37a2c; }
:root[data-theme="dark"] .section[data-type="grundlagen"]{--st:#9b8dfa}
:root[data-theme="dark"] .section[data-type="klinik"]{--st:#e5a24a}
:root[data-theme="dark"] .section[data-type="diagnostik"]{--st:#45b8d6}
:root[data-theme="dark"] .section[data-type="therapie"]{--st:#4fc496}
:root[data-theme="dark"] .section[data-type="risiko"]{--st:#ef7169}
:root[data-theme="dark"] .section[data-type="prognose"]{--st:#93a2b3}
:root[data-theme="dark"] .section[data-type="recht"]{--st:#cCA05a}
@media (prefers-color-scheme:dark){
 :root:not([data-theme="light"]) .section[data-type="grundlagen"]{--st:#9b8dfa}
 :root:not([data-theme="light"]) .section[data-type="klinik"]{--st:#e5a24a}
 :root:not([data-theme="light"]) .section[data-type="diagnostik"]{--st:#45b8d6}
 :root:not([data-theme="light"]) .section[data-type="therapie"]{--st:#4fc496}
 :root:not([data-theme="light"]) .section[data-type="risiko"]{--st:#ef7169}
 :root:not([data-theme="light"]) .section[data-type="prognose"]{--st:#93a2b3}
 :root:not([data-theme="light"]) .section[data-type="recht"]{--st:#cca05a}
}
.section[data-type]{
  position:relative; padding:2px 0 2px 16px; margin:22px 0;
  border-left:2.5px solid color-mix(in srgb, var(--st) 55%, transparent);
}
.section[data-type] > h2{ border-bottom-color:color-mix(in srgb,var(--st) 22%, var(--line)); color:var(--ink); }
.section[data-type] > h2::before{ display:none; }
.section[data-type] > h2 .sec-ic{
  width:24px; height:24px; border-radius:7px; flex:0 0 auto; display:grid; place-items:center;
  color:#fff; background:var(--st); box-shadow:0 1px 2px color-mix(in srgb,var(--st) 40%, transparent);
}
.section[data-type] ul.points > li::before{ background:var(--st); opacity:.7; }
.section[data-type] .note{ border-left-color:var(--st); }
.section[data-type="risiko"] .note{ background:var(--crit-wash); color:var(--crit); border-left-color:var(--crit); }
.section[data-type="risiko"] ul.points > li::before{ background:var(--crit); }

/* ---- key-fact stat tiles ---- */
.kf-row{ display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; margin:18px 0 6px; }
.kf{
  position:relative; padding:14px 16px; border-radius:13px; background:var(--surface);
  border:1px solid var(--line); box-shadow:var(--shadow-1); overflow:hidden;
}
.kf::before{ content:""; position:absolute; left:0; top:0; bottom:0; width:4px; background:var(--kf,var(--subject)); }
.kf .kf-v{ font-size:26px; font-weight:700; letter-spacing:-.02em; line-height:1.05; color:var(--kf,var(--ink)); font-variant-numeric:tabular-nums; }
.kf .kf-l{ margin-top:4px; font-size:12.5px; color:var(--ink-2); line-height:1.3; }
.kf[data-tone="crit"]{ --kf:var(--crit); } .kf[data-tone="warn"]{ --kf:var(--warn); }
.kf[data-tone="good"]{ --kf:var(--good); } .kf[data-tone="neutral"]{ --kf:var(--subject); }

/* ---- callouts ---- */
.callouts{ display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:12px; margin:22px 0; }
.callout{
  --c:var(--subject); --cw:color-mix(in srgb,var(--c) 11%, var(--surface));
  position:relative; padding:13px 15px 13px 15px; border-radius:12px;
  background:var(--cw); border:1px solid color-mix(in srgb,var(--c) 30%, transparent);
}
.callout .co-head{ display:flex; align-items:center; gap:8px; margin-bottom:5px; }
.callout .co-ic{ width:22px; height:22px; border-radius:6px; flex:0 0 auto; display:grid; place-items:center; color:#fff; background:var(--c); font-size:13px; }
.callout .co-t{ font-weight:700; font-size:13.5px; color:var(--c); letter-spacing:.01em; }
.callout .co-b{ font-size:14px; line-height:1.5; color:var(--ink); }
.callout[data-kind="cave"]{ --c:var(--crit); }
.callout[data-kind="merke"]{ --c:var(--accent); }
.callout[data-kind="klinik"]{ --c:#1f9d6b; }
.callout[data-kind="falle"]{ --c:#8a5cd6; }
:root[data-theme="dark"] .callout[data-kind="klinik"]{--c:#4fc496}
:root[data-theme="dark"] .callout[data-kind="falle"]{--c:#a98bf0}
@media (prefers-color-scheme:dark){
 :root:not([data-theme="light"]) .callout[data-kind="klinik"]{--c:#4fc496}
 :root:not([data-theme="light"]) .callout[data-kind="falle"]{--c:#a98bf0}
}
.band-label{ font-size:11.5px; text-transform:uppercase; letter-spacing:.1em; color:var(--ink-3); font-weight:700; margin:26px 0 -6px; }

/* ---- SVG diagram ---- */
.diagram{
  margin:20px 0; padding:18px 18px 14px; border-radius:14px; background:var(--surface);
  border:1px solid var(--line); box-shadow:var(--shadow-1);
}
.diagram .dg-title{ display:flex; align-items:center; gap:8px; font-size:12.5px; text-transform:uppercase; letter-spacing:.08em; color:var(--ink-2); font-weight:700; margin-bottom:12px; }
.diagram .dg-title::before{ content:""; width:14px; height:14px; border-radius:4px; background:linear-gradient(135deg,var(--subject),color-mix(in srgb,var(--subject) 40%, #fff)); }
.diagram svg{ display:block; width:100%; height:auto; max-width:640px; margin:0 auto; }
.diagram .dg-cap{ margin-top:10px; font-size:12.5px; color:var(--ink-3); text-align:center; }
/* diagram palette hooks (SVGs use these vars so they follow the theme) */
.diagram{ --d-ink:var(--ink); --d-mut:var(--ink-3); --d-line:var(--line-2); --d-surf:var(--surface-2);
  --d-a:var(--subject); --d-good:var(--good); --d-warn:var(--warn); --d-crit:var(--crit); --d-blue:#1187a8; --d-violet:#6d5ce0; }
.diagram svg text{ fill:var(--d-ink); font-family:var(--sans); }
.diagram svg .dg-mut{ fill:var(--d-mut); }

/* ---- inline term chips ---- */
.chip{ display:inline-block; padding:1px 8px; border-radius:20px; font-size:12.5px; font-weight:600;
  background:var(--subject-wash); color:var(--subject); border:1px solid color-mix(in srgb,var(--subject) 25%, transparent); }

/* drug card: class-colored accent stripe */
.drug{ border-left:3px solid var(--subject); }

/* ---- inline figure grid (curated clinical photos + charts) ---- */
.fig-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(clamp(220px,30%,300px),1fr)); gap:14px; margin:18px 0; align-items:start; }
.fig-grid .diagram{ grid-column:1/-1; margin:0; }      /* hand-built schemata span full width */
.fig-grid figure.figure-inline{ margin:0; }
.fig-grid:has(> figure.figure-inline:only-child){ grid-template-columns:minmax(0,1fr); }
figure.figure-inline{
  margin:18px 0; border:1px solid var(--line); border-radius:14px; overflow:hidden;
  background:var(--surface); box-shadow:var(--shadow-1);
}
figure.figure-inline img{
  display:block; width:100%; height:auto; max-height:340px; object-fit:contain;
  background:#fff; cursor:zoom-in; padding:6px;
}
figure.figure-inline figcaption{
  padding:10px 15px; font-size:13px; color:var(--ink-2); line-height:1.45;
  border-top:1px solid var(--line); background:var(--surface-2);
}
