/*! © 2026 Prof. Dr. med. Serge C. Thal – pubmed.info. Alle Rechte vorbehalten. Nutzung, Vervielfältigung und Weitergabe nur mit schriftlicher Genehmigung. */
/* pubmed.info – ruhiges, helles/dunkles Layout nach Systemeinstellung */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #111418;
  --muted: #3e4652;
  --border: #b9c0ca;
  --accent: #1f6f8b;
  --accent-text: #ffffff;
  --accent-soft: #e3f0f4;
  --danger: #b3261e;
  --mark: #fff3bf;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 6%);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}
:root[data-theme=light] { color-scheme: light; }
:root[data-theme=dark] { color-scheme: dark; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #14171c;
    --surface: #1c2027;
    --surface-2: #242a33;
    --text: #f2f4f7;
    --muted: #c0c7d2;
    --border: #4a5361;
    --accent: #5fb3cf;
    --accent-text: #0d1a20;
    --accent-soft: #1d3440;
    --danger: #f2b8b5;
    --mark: #5c4d00;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: clip; }
body {
  margin: 0;
  font: .9375rem/1.5 var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 4px 8px 16px; min-height: 100vh; } /* Platz fürs Raster reservieren: sonst schiebt es beim Start Linkleiste/Fußzeile aus dem Bild (Layout-Verschiebung, CLS) */
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.25; }
h3 { font-size: 1rem; margin: 1.2em 0 .4em; }
.small { font-size: .85rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .9em; }
.error { color: var(--danger); }
mark, .ph { background: var(--mark); color: inherit; padding: 0 .2em; border-radius: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 6px 10px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------------- Kopfzeile */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1440px; width: 100%; margin: 0 auto; padding: 12px 16px 8px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 1.15rem; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.brand .tld { color: var(--accent); }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: url(../favicon.svg) center/cover; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.menu-wrap { position: relative; }
.popover {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 260px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(0 0 0 / 15%); padding: 12px; display: grid; gap: 8px;
}
.vis-table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.vis-table th, .vis-table td { padding: 4px 6px; text-align: center; }
.vis-table th[scope=row], .vis-table thead th:first-child { text-align: left; font-weight: 500; }
.vis-table thead th { font-size: .8rem; color: var(--muted); font-weight: 500; }

/* ---------------- Bedienelemente */
.btn {
  font: inherit; font-size: .9rem; line-height: 1.2; cursor: pointer;
  padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
#btn-sync.on::before { content: "●"; color: #2e9d5b; margin-right: 5px; font-size: .7em; vertical-align: .15em; }
.btn-danger { color: var(--danger); }
.btn-icon { padding: 7px 10px; }
.link { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-align: left; text-decoration: underline; text-underline-offset: 2px; }
.input {
  font: inherit; color: var(--text); background: var(--surface); width: 100%;
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
.input-sm { width: auto; padding: 5px 8px; font-size: .9rem; }
textarea.input { resize: vertical; min-height: 2.6em; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.row .input { flex: 1 1 160px; width: auto; }
.badge { font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.check { display: flex; gap: 6px; align-items: baseline; padding: 2px 0; }

/* ---------------- Kacheln */
.grid-stack { min-height: 200px; }
.grid-stack-item-content { inset: 0; }
.tile {
  height: 100%; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.tile-head {
  display: flex; align-items: center; gap: 6px; padding: 8px 10px 6px 14px;
  border-bottom: 1px solid var(--border); flex: none;
}
body[data-device=desktop] .tile-head, body.edit-mode .tile-head { cursor: move; }
.tile-title { font-size: var(--tile-title, .95rem); font-weight: 600; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-actions { display: flex; gap: 2px; }
.tile-btn {
  font: inherit; font-size: 1.05rem; line-height: 1; width: 30px; height: 30px; flex: none;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer;
}
.tile-btn:hover { background: var(--surface-2); color: var(--text); }
.tile-close { display: inline-block; }
.tile-body { padding: 10px 14px 14px; overflow: auto; flex: 1; min-height: 0; }
.tile-settings { border: 1px solid var(--border); border-radius: 8px; margin: 0 0 10px; padding: 6px 10px 8px; background: var(--surface-2); }
.grid-stack > .grid-stack-item > .ui-resizable-se { opacity: .5; }
/* Größe ändern: Ränder beim Überfahren der Kachel als Griff andeuten, beim Überfahren des Randes deutlich */
.grid-stack-item > .ui-resizable-e::after, .grid-stack-item > .ui-resizable-w::after, .grid-stack-item > .ui-resizable-s::after {
  content: ''; position: absolute; background: var(--accent); border-radius: 2px; opacity: 0; transition: opacity .15s;
}
.grid-stack-item > .ui-resizable-e::after { top: calc(50% - 24px); height: 48px; right: 1px; width: 4px; }
.grid-stack-item > .ui-resizable-w::after { top: calc(50% - 24px); height: 48px; left: 1px; width: 4px; }
.grid-stack-item > .ui-resizable-s::after { left: calc(50% - 24px); width: 48px; bottom: 1px; height: 4px; }
.grid-stack-item:hover > .ui-resizable-handle::after { opacity: .35; }
.grid-stack-item > .ui-resizable-handle:hover::after { opacity: .9; }
.grid-stack-placeholder > .placeholder-content { background: var(--accent-soft); border-radius: var(--radius); border: 1px dashed var(--accent); }

/* Mobil */
.edit-bar { display: none; }
body.edit-mode .edit-bar {
  display: flex; position: sticky; top: 0; z-index: 40; gap: 10px; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: var(--accent-soft); font-size: .85rem;
}
@media (max-width: 760px) {
  body { font-size: 1rem; }
  .topbar { padding: 10px 12px 6px; gap: 6px; flex-wrap: wrap; } /* lieber umbrechen als über den Rand ragen (sonst zoomt der Browser heraus) */
  .brand { font-size: 1.05rem; gap: 6px; }
  .top-actions { gap: 0; min-width: 0; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
  .top-actions .btn-ghost { padding: 6px 7px; }
  .top-actions .input-sm { padding: 4px 4px; max-width: 96px; }
  main { padding: 0 4px 12px; }
  .popover { position: fixed; left: 8px; right: 8px; top: 56px; max-height: calc(100dvh - 68px - var(--tb, 0px)); overflow-y: auto; overscroll-behavior: contain; }
}

/* ---------------- Suche */
.search-form .row { margin-bottom: 4px; }
.query-form { margin-top: 2px; }
.query-form .input { font-size: 1rem; }
.ai-form { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); }
.ai-form { margin-top: 8px; padding-top: 6px; }
.ai-row { margin: 0; flex-wrap: nowrap; align-items: flex-start; }
.ai-row textarea { font-size: .9rem; resize: none; min-height: 0; line-height: 1.35; overflow-y: auto; }
.ai-row .btn { white-space: nowrap; }
.ai-meta { display: flex; gap: 8px; align-items: center; min-height: 0; }
.ai-meta:empty, .ai-meta:not(:has(.badge)):has(.remaining:empty) { display: none; }
.query-form .row { margin-top: 2px; }
.status { margin: 6px 0; }
.note { margin: 4px 0; }
.busy .status::after { content: " …"; }
.saved summary { cursor: pointer; font-size: .9rem; color: var(--muted); margin-top: 6px; }
.saved-list { list-style: none; padding: 0; margin: 6px 0; }
.saved-list li { display: flex; align-items: center; gap: 6px; justify-content: space-between; padding: 2px 0; }
.saved-list .link { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- News, Tools, Sponsoring */
.news-list, .tool-list { list-style: none; padding: 0; margin: 0; }
.news-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.news-item:last-child { border-bottom: 0; }
.news-title { font-weight: 500; text-decoration: none; }
.news-summary { margin: 4px 0 0; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tool { display: flex; flex-direction: column; padding: 7px 0; border-bottom: 1px solid var(--border); }
.tool:last-child { border-bottom: 0; }
.tool-name { font-weight: 550; text-decoration: none; }
.tool.placeholder .tool-name { color: var(--muted); }
.tile-sponsor .tile-title { font-weight: 500; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.ad-placeholder { height: 100%; min-height: 80px; display: grid; place-items: center; border: 1px dashed var(--border); border-radius: 8px; }

/* ---------------- Fußzeile, Fenster, Banner */
.footer { border-top: 1px solid var(--border); padding: 14px 16px 18px; font-size: .85rem; color: var(--muted); }
.footer nav { max-width: 1440px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.footer a, .footer .link { color: var(--muted); }

.modal {
  padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
  width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 48px);
}
.modal::backdrop { background: rgb(0 0 0 / 45%); }
.modal-inner { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px 20px; border-bottom: 1px solid var(--border); }
.modal-title { margin: 0; font-size: 1.1rem; flex: 1; }
.modal-body { padding: 8px 20px 20px; overflow: auto; }
/* Handy: Griff oben (Fenster lässt sich nach unten wegwischen, swipeclose.js) und fester Knopf „Fertig“ unten */
.modal-foot { display: none; }
@media (max-width: 600px) {
  .modal-inner::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 8px auto 0; flex: none; }
  .modal-foot { display: block; flex: none; padding: 10px 20px 12px; border-top: 1px solid var(--border); }
  .modal-done { width: 100%; justify-content: center; padding: 10px; }
}
.tile-settings-done { display: block; width: 100%; margin-top: 10px; padding: 9px; }
.modal-body h2 { font-size: 1.05rem; margin-top: 1.4em; }

.pair-box { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.qr { width: 172px; height: 172px; background: #fff; border-radius: 8px; padding: 4px; flex: none; }
.qr svg { width: 100%; height: 100%; display: block; }
.code { font-size: 1.2rem; letter-spacing: .08em; }
.device-list { padding-left: 1.2em; }
.device-list li { padding: 2px 0; }
.mail-form { margin-top: 10px; }

.consent {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 60; max-width: 720px; margin: 0 auto;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 8px 30px rgb(0 0 0 / 18%);
}
.consent-text { flex: 1 1 320px; }
.consent-text p { margin: 4px 0; }
.consent-actions { display: flex; gap: 8px; }

/* ---------------- Rechtliche Seiten */
.legal-page main { max-width: 820px; padding: 8px 20px 40px; }
.legal h1 { font-size: 1.6rem; }
.legal h2 { font-size: 1.15rem; margin-top: 1.8em; }
.legal .draft { border-left: 4px solid var(--mark); padding: 6px 12px; background: var(--surface-2); border-radius: 4px; }
.noscript { padding: 20px; }

/* Werkzeug-Adressen (werkzeug.php): Einleitung über dem Raster – knapp sichtbar, Details aufklappbar. Der Platz entscheidet:
   schmal nur Überschrift + Kurztext, die Links rücken darunter. */
.intro { position: relative; margin: 6px 8px 4px; padding: 12px 44px 10px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); }
.intro[hidden] { display: none; }
.intro h1 { margin: 0 0 4px; font-size: 1.25rem; line-height: 1.3; }
.intro-lead { margin: 0 0 8px; color: var(--muted); max-width: 75ch; }
.intro-links { margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.intro-more summary { cursor: pointer; color: var(--accent); width: max-content; }
.intro-more p { max-width: 75ch; margin: 8px 0; }
.intro-x { position: absolute; top: 8px; right: 8px; }
@media (max-width: 600px) {
  .intro { padding: 10px 40px 8px 12px; } .intro h1 { font-size: 1.1rem; }
  .intro-lead { font-size: .92rem; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
}

/* Linkleiste unten (#toolnav, _landing.php): Bereiche nebeneinander, so viele wie Platz ist; Sprachen der Seite darunter */
.toolnav { width: 100%; box-sizing: border-box; max-width: 1440px; margin: 0 auto; padding: 8px 16px 12px; font-size: .9rem; color: var(--muted); }
.toolnav h2 { display: inline; font-size: 1rem; margin: 0 12px 0 0; color: var(--text); }
.toolnav a { color: var(--accent); }
.tn-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 24px; margin-top: 6px; }
.tn-group h3 { font-size: .9rem; margin: 6px 0 2px; color: var(--text); }
.tn-group ul { list-style: none; margin: 0; padding: 0; }
.tn-group li { margin: 2px 0; }
.tn-langs { margin: 8px 0 0; }
.tn-langs a { margin-left: 8px; }
.intro-list { columns: 3 260px; margin: 4px 0 10px; padding-left: 18px; }
.intro-list li { break-inside: avoid; margin: 2px 0; }
.intro-list-long { columns: 1; max-width: 100ch; }
.intro-more h2 { font-size: 1.05rem; margin: 12px 0 4px; }
.intro-more h3 { font-size: .98rem; margin: 10px 0 2px; }
.intro-privacy { font-size: .85rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: 6px; max-width: 75ch; }
.tile-body > p:empty { display: none; }

/* ---------------- Trefferdarstellung (nach pubmed.de „Treffervorschau“; Titel/Abstracts im Original) */
:root {
  --pmr-title: #1e3a8a; --pmr-link: #1d4ed8; --pmr-meta: #475569; --pmr-abs-bg: #f8fafc; --pmr-abs-border: #cbd5e1;
  --pmr-abs-text: #334155; --pmr-rel-border: #93c5fd; --pmr-free: #065f46; --pmr-free-border: #6ee7b7;
  --b-ma-bg: #dcfce7; --b-ma: #166534; --b-rct-bg: #dbeafe; --b-rct: #1e40af; --b-gl-bg: #ffedd5; --b-gl: #9a3412;
  --b-rev-bg: #ede9fe; --b-rev: #5b21b6; --b-ct-bg: #ccfbf1; --b-ct: #115e59; --b-obs-bg: #e0f2fe; --b-obs: #075985;
  --b-gray-bg: #f3f4f6; --b-gray: #4b5563; --b-lang-bg: #fef9c3; --b-lang: #854d0e; --b-pre-bg: #fef3c7; --b-pre: #92400e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --pmr-title: #9cc3ff; --pmr-link: #8ab4ff; --pmr-meta: #a3adbb; --pmr-abs-bg: #232932; --pmr-abs-border: #3b4452;
    --pmr-abs-text: #d4d9e1; --pmr-rel-border: #3f6aa8; --pmr-free: #6ee7b7; --pmr-free-border: #2f7d62;
    --b-ma-bg: #14361f; --b-ma: #86efac; --b-rct-bg: #172b4d; --b-rct: #93c5fd; --b-gl-bg: #3b2410; --b-gl: #fdba74;
    --b-rev-bg: #2a2147; --b-rev: #c4b5fd; --b-ct-bg: #10332f; --b-ct: #5eead4; --b-obs-bg: #0f2c3d; --b-obs: #7dd3fc;
    --b-gray-bg: #2a2f37; --b-gray: #cbd2db; --b-lang-bg: #3a3410; --b-lang: #fde68a; --b-pre-bg: #3a2c0c; --b-pre: #fcd34d;
  }
}
.results-box { margin-top: 8px; }
.pmr-bar { display: flex; gap: 4px 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; font-size: .85rem; color: var(--pmr-meta); border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.pmr-bar select { font: inherit; font-size: .85rem; padding: 2px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); }
.pmr-err { margin: 8px 0; padding: 8px 12px; border-radius: 6px; border: 1px solid rgb(180 83 9 / 50%); background: rgb(245 158 11 / 12%); font-size: .88rem; }
.pmr-list { list-style: none; margin: 0; padding: 0; }
.pmr-item { border-bottom: 1px solid var(--border); padding: 10px 0; }
.pmr-item:last-child { border-bottom: 0; }
.pmr-empty { padding: 12px 0; color: var(--pmr-meta); }
.pmr-n, .pmr-small { font-size: .8rem; color: var(--muted); }
.pmr-badges { margin-bottom: 2px; line-height: 1.9; }
.pmr-badge { display: inline-block; font-size: .7rem; font-weight: 600; padding: 1px 7px; border-radius: 5px; margin-right: 4px; vertical-align: middle; letter-spacing: .01em; }
a.pmr-badge { text-decoration: none; }
.b-ma { background: var(--b-ma-bg); color: var(--b-ma); }
.b-rct { background: var(--b-rct-bg); color: var(--b-rct); }
.b-gl { background: var(--b-gl-bg); color: var(--b-gl); }
.b-rev { background: var(--b-rev-bg); color: var(--b-rev); }
.b-ct { background: var(--b-ct-bg); color: var(--b-ct); }
.b-obs { background: var(--b-obs-bg); color: var(--b-obs); }
.b-case, .b-com { background: var(--b-gray-bg); color: var(--b-gray); }
.b-lang { background: var(--b-lang-bg); color: var(--b-lang); }
.b-pre { background: var(--b-pre-bg); color: var(--b-pre); border: 1px solid currentColor; }
.b-ret { background: #dc2626; color: #fff; }
.b-free { background: transparent; color: var(--pmr-free); border: 1px solid var(--pmr-free-border); }
a.b-free:hover { border-color: var(--pmr-free); }
.pmr-title { font-size: .98rem; margin: 0; line-height: 1.35; }
.pmr-title a { font-weight: 600; color: var(--pmr-title); text-decoration: none; cursor: pointer; }
.pmr-title a:hover { text-decoration: underline; }
.pmr-title a::before { content: "\25B8"; display: inline-block; width: 1.1em; color: var(--muted); transition: transform .15s; }
.pmr-title a[aria-expanded=true]::before { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .pmr-title a::before { transition: none; } }
.pmr-meta { font-size: .82rem; color: var(--pmr-meta); margin: 2px 0 0; }
.pmr-meta a { color: var(--pmr-meta); }
.pmr-met a { color: var(--pmr-free); font-weight: 600; }
.pmr-act { display: flex; gap: 2px 14px; flex-wrap: wrap; margin-top: 4px; }
.pmr-act button, .pmr-act a { background: none; border: 0; padding: 0; color: var(--pmr-link); font: inherit; font-size: .82rem; cursor: pointer; text-decoration: none; }
.pmr-act button:hover, .pmr-act a:hover { text-decoration: underline; }
.pmr-abs { font-size: .88rem; background: var(--pmr-abs-bg); border-left: 3px solid var(--pmr-abs-border); padding: 8px 12px; margin: 6px 0 2px; color: var(--pmr-abs-text); }
.pmr-abs p { margin: 0 0 6px; }
.pmr-abs b { color: var(--text); }
.pmr mark { background: var(--mark); color: inherit; padding: 0 1px; border-radius: 2px; }
.pmr-relp { margin: 8px 0 2px 4px; padding: 6px 0 2px 12px; border-left: 3px solid var(--pmr-rel-border); }
.pmr-relh { font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.pmr-rellist { list-style: none; margin: 0; padding: 0; }
.pmr-relp .pmr-item { padding: 8px; background: var(--pmr-abs-bg); border-bottom: 1px solid var(--border); }
.pmr-relp .pmr-rel, .pmr-relp .pmr-cit { display: none; }
.pmr-relmore { margin: 6px 0; font-size: .82rem; }
.pmr-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pmr-foot { font-size: .74rem; color: var(--muted); margin: 10px 0 0; border-top: 1px solid var(--border); padding-top: 6px; }

/* ---------------- Merkliste und gespeicherte Suchen */
.pmr-act button.saved { color: var(--b-ma); font-weight: 600; }
.marks-sec + .marks-sec { margin-top: 14px; padding-top: 4px; border-top: 1px solid var(--border); }
.marks-h { font-size: .92rem; margin: 6px 0; }
.marks-add { margin: 4px 0; }
.marks-bar { justify-content: space-between; margin: 4px 0 6px; }
.marks-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.btn-sm { padding: 4px 9px; font-size: .8rem; }
a.btn { text-decoration: none; display: inline-block; }
.marks-list, .ss-list { list-style: none; margin: 0; padding: 0; }
.mark, .ss { display: flex; gap: 6px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--border); }
.mark:last-child, .ss:last-child { border-bottom: 0; }
.mark-main, .ss-main { flex: 1; min-width: 0; }
.mark-title { font-weight: 500; text-decoration: none; color: var(--pmr-title); }
.mark-title:hover { text-decoration: underline; }
.ss-run { font-size: .92rem; text-decoration: none; }
.ss-run:hover { text-decoration: underline; }
.ss-query { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-ext { display: inline-grid; place-items: center; text-decoration: none; }
.ss-new summary { cursor: pointer; font-size: .85rem; color: var(--muted); margin-top: 8px; }
.ss-form { display: grid; gap: 6px; margin-top: 6px; justify-items: start; }
.marks-bar .input-sm { flex: 0 0 auto; width: auto; }

/* Manuell gewähltes Farbschema (Einstellungen → Darstellung) */
:root[data-theme=dark] {
    --bg: #14171c;
    --surface: #1c2027;
    --surface-2: #242a33;
    --text: #f2f4f7;
    --muted: #c0c7d2;
    --border: #4a5361;
    --accent: #5fb3cf;
    --accent-text: #0d1a20;
    --accent-soft: #1d3440;
    --danger: #f2b8b5;
    --mark: #5c4d00;
    --shadow: none;
}
:root[data-theme=dark] {
    --pmr-title: #9cc3ff; --pmr-link: #8ab4ff; --pmr-meta: #a3adbb; --pmr-abs-bg: #232932; --pmr-abs-border: #3b4452;
    --pmr-abs-text: #d4d9e1; --pmr-rel-border: #3f6aa8; --pmr-free: #6ee7b7; --pmr-free-border: #2f7d62;
    --b-ma-bg: #14361f; --b-ma: #86efac; --b-rct-bg: #172b4d; --b-rct: #93c5fd; --b-gl-bg: #3b2410; --b-gl: #fdba74;
    --b-rev-bg: #2a2147; --b-rev: #c4b5fd; --b-ct-bg: #10332f; --b-ct: #5eead4; --b-obs-bg: #0f2c3d; --b-obs: #7dd3fc;
    --b-gray-bg: #2a2f37; --b-gray: #cbd2db; --b-lang-bg: #3a3410; --b-lang: #fde68a; --b-pre-bg: #3a2c0c; --b-pre: #fcd34d;
}

/* ---------------- Darstellung: Schriftgröße, Schriftart, Akzentfarbe, Kachelfarben */
:root[data-size=xs] { font-size: 80%; }
:root[data-size=s] { font-size: 90%; }
:root[data-size=l] { font-size: 112.5%; }
:root[data-size=xl] { font-size: 125%; }
:root[data-size=xxl] { font-size: 140%; }
:root[data-font=serif] { --font: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, "Times New Roman", serif; }
:root[data-font=readable] { --font: Verdana, "Atkinson Hyperlegible", Tahoma, "DejaVu Sans", sans-serif; }
:root[data-font=rounded] { --font: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", Nunito, "Varela Round", Quicksand, system-ui, sans-serif; }
:root[data-font=humanist] { --font: Seravek, "Gill Sans Nova", "Gill Sans", Ubuntu, Calibri, "Trebuchet MS", "DejaVu Sans", sans-serif; }
:root[data-font=mono] { --font: var(--mono); }
/* Zeilenabstand und Innenabstand */
:root[data-density=compact] body { line-height: 1.35; }
:root[data-density=compact] .tile-body { padding: 6px 10px 10px; }
:root[data-density=compact] .tile-head { padding-top: 4px; padding-bottom: 4px; }
:root[data-density=airy] body { line-height: 1.7; }
:root[data-density=airy] .tile-body { padding: 14px 20px 20px; }
/* Kacheltitel */
:root[data-tsize=s] { --tile-title: .85rem; }
:root[data-tsize=l] { --tile-title: 1.1rem; }
:root[data-tsize=xl] { --tile-title: 1.3rem; }
:root[data-tstyle=bold] .tile-title { font-weight: 800; }
:root[data-tstyle=light] .tile-title { font-weight: 400; }
:root[data-tstyle=caps] .tile-title { text-transform: uppercase; letter-spacing: .07em; font-size: calc(var(--tile-title, .95rem) * .88); }
/* Rahmen, Ecken, Schatten */
.tile { border-width: var(--tile-bw, 1px); border-color: var(--tile-bc, var(--border)); }
:root[data-bw="0"] { --tile-bw: 0px; }
:root[data-bw="2"] { --tile-bw: 2px; }
:root[data-bw="3"] { --tile-bw: 3px; }
:root[data-bc=accent] { --tile-bc: var(--accent); }
:root[data-bc=strong] { --tile-bc: var(--text); }
:root[data-bc=tile] { --tile-bc: var(--accent); }
:root[data-bc=tile] .tile[data-color] { --tile-bc: var(--tc); }
:root[data-radius=square] { --radius: 0px; }
:root[data-radius=small] { --radius: 4px; }
:root[data-radius=round] { --radius: 18px; }
:root[data-shadow=none] .tile { box-shadow: none; }
:root[data-shadow=strong] .tile { box-shadow: 0 10px 24px rgb(16 24 40 / 14%), 0 2px 6px rgb(16 24 40 / 10%); }
:root[data-theme=dark][data-shadow=strong] .tile { box-shadow: 0 10px 26px rgb(0 0 0 / 55%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light])[data-shadow=strong] .tile { box-shadow: 0 10px 26px rgb(0 0 0 / 55%); } }
/* Kachelfarbe: nur Kopf (Standard), ganze Fläche oder nur Rahmen */
:root[data-tfill=full] .tile[data-color] { background: var(--tc-soft); }
:root[data-tfill=full] .tile[data-color] .tile-head { background: color-mix(in srgb, var(--tc) 22%, var(--tc-soft)); }
:root[data-tfill=frame] .tile[data-color] { --tile-bc: var(--tc); border-width: max(var(--tile-bw, 1px), 2px); }
:root[data-tfill=frame] .tile[data-color] .tile-head { background: none; }
/* Eingabefelder: kräftig, nur Linie unten, gefüllt */
:root[data-inputs=strong] :is(input:not([type=checkbox],[type=radio],[type=range],[type=color],[type=file]), textarea, select) { border: 2px solid var(--accent); }
:root[data-inputs=line] :is(input:not([type=checkbox],[type=radio],[type=range],[type=color],[type=file]), textarea, select) { border: 0; border-bottom: 2px solid var(--border); border-radius: 0; background: transparent; }
:root[data-inputs=line] :is(input, textarea, select):focus { border-bottom-color: var(--accent); }
:root[data-inputs=filled] :is(input:not([type=checkbox],[type=radio],[type=range],[type=color],[type=file]), textarea, select) { border: 1px solid transparent; background: var(--surface-2); border-radius: 12px; }
/* Hintergrund */
:root[data-bg=tinted] body { background: color-mix(in srgb, var(--accent) 9%, var(--bg)); }
:root[data-bg=dots] body { background: radial-gradient(color-mix(in srgb, var(--text) 18%, transparent) 1px, transparent 1.6px) 0 0 / 18px 18px, var(--bg); }
:root[data-bg=gradient] body { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 18%, var(--bg)), var(--bg) 55%, color-mix(in srgb, var(--accent) 8%, var(--bg))) fixed; }
:root[data-accent=green] { --accent: #2e7d4f; --accent-soft: #e3f2e8; --accent-text: #fff; }
:root[data-theme=dark][data-accent=green] { --accent: #6cc995; --accent-soft: #16352a; --accent-text: #0d1a20; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light])[data-accent=green] { --accent: #6cc995; --accent-soft: #16352a; --accent-text: #0d1a20; } }
:root[data-accent=blue] { --accent: #2563eb; --accent-soft: #e6eefc; --accent-text: #fff; }
:root[data-theme=dark][data-accent=blue] { --accent: #7aa7ff; --accent-soft: #18284a; --accent-text: #0d1a20; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light])[data-accent=blue] { --accent: #7aa7ff; --accent-soft: #18284a; --accent-text: #0d1a20; } }
:root[data-accent=purple] { --accent: #6d4fc2; --accent-soft: #efeafb; --accent-text: #fff; }
:root[data-theme=dark][data-accent=purple] { --accent: #b29cf5; --accent-soft: #2a2147; --accent-text: #0d1a20; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light])[data-accent=purple] { --accent: #b29cf5; --accent-soft: #2a2147; --accent-text: #0d1a20; } }
:root[data-accent=red] { --accent: #b4233c; --accent-soft: #fbe7ea; --accent-text: #fff; }
:root[data-theme=dark][data-accent=red] { --accent: #f28b9b; --accent-soft: #3d1a22; --accent-text: #0d1a20; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light])[data-accent=red] { --accent: #f28b9b; --accent-soft: #3d1a22; --accent-text: #0d1a20; } }
:root[data-accent=orange] { --accent: #b45309; --accent-soft: #fdf0e1; --accent-text: #fff; }
:root[data-theme=dark][data-accent=orange] { --accent: #f5b15e; --accent-soft: #3b2710; --accent-text: #0d1a20; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light])[data-accent=orange] { --accent: #f5b15e; --accent-soft: #3b2710; --accent-text: #0d1a20; } }
:root[data-accent=gray] { --accent: #4b5563; --accent-soft: #eceef1; --accent-text: #fff; }
:root[data-theme=dark][data-accent=gray] { --accent: #b5bdc9; --accent-soft: #2a2f37; --accent-text: #0d1a20; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light])[data-accent=gray] { --accent: #b5bdc9; --accent-soft: #2a2f37; --accent-text: #0d1a20; } }
.tile[data-color] { border-top: 3px solid var(--tc); }
.tile[data-color] .tile-head { background: var(--tc-soft); }
.tile[data-color=blue] { --tc: #3b82f6; --tc-soft: #eaf1fe; }
:root[data-theme=dark] .tile[data-color=blue] { --tc: #5b8fe8; --tc-soft: #1b2740; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .tile[data-color=blue] { --tc: #5b8fe8; --tc-soft: #1b2740; } }
.tile[data-color=green] { --tc: #22a06b; --tc-soft: #e6f5ec; }
:root[data-theme=dark] .tile[data-color=green] { --tc: #3fb27f; --tc-soft: #16302a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .tile[data-color=green] { --tc: #3fb27f; --tc-soft: #16302a; } }
.tile[data-color=yellow] { --tc: #d4a106; --tc-soft: #fdf6dc; }
:root[data-theme=dark] .tile[data-color=yellow] { --tc: #c9a227; --tc-soft: #33300f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .tile[data-color=yellow] { --tc: #c9a227; --tc-soft: #33300f; } }
.tile[data-color=orange] { --tc: #ea7a1c; --tc-soft: #fdeedf; }
:root[data-theme=dark] .tile[data-color=orange] { --tc: #e08a3c; --tc-soft: #3a2614; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .tile[data-color=orange] { --tc: #e08a3c; --tc-soft: #3a2614; } }
.tile[data-color=red] { --tc: #dc4c64; --tc-soft: #fce8eb; }
:root[data-theme=dark] .tile[data-color=red] { --tc: #e06a7f; --tc-soft: #3b1c24; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .tile[data-color=red] { --tc: #e06a7f; --tc-soft: #3b1c24; } }
.tile[data-color=purple] { --tc: #8b5cf6; --tc-soft: #f1ebfe; }
:root[data-theme=dark] .tile[data-color=purple] { --tc: #9f80f2; --tc-soft: #2a2147; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .tile[data-color=purple] { --tc: #9f80f2; --tc-soft: #2a2147; } }
.tile[data-color=gray] { --tc: #7b8494; --tc-soft: #eef0f3; }
:root[data-theme=dark] .tile[data-color=gray] { --tc: #8a93a3; --tc-soft: #272c34; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .tile[data-color=gray] { --tc: #8a93a3; --tc-soft: #272c34; } }

/* Einstellungsfenster */
.set-group { border: 0; padding: 0; margin: 0 0 16px; }
.set-group legend { font-weight: 600; font-size: .92rem; margin-bottom: 6px; padding: 0; }
.set-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 0 8px; }
.set-sub-l { min-width: 9em; font-size: .88rem; color: var(--muted); }
.set-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.set-preset { font-weight: 600; }
.set-preset-modern { border-radius: 18px; box-shadow: 0 4px 10px rgb(16 24 40 / 15%); }
.set-preset-paper { font-family: Charter, Cambria, Georgia, serif; border-radius: 0; border-color: var(--text); }
.set-preset-compact { text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; }
.set-preset-contrast { border: 3px solid var(--text); font-weight: 800; }
.set-preset-colorful { border: 2px solid transparent; border-radius: 18px; background: linear-gradient(var(--surface), var(--surface)) padding-box, linear-gradient(90deg, #3b82f6, #22a06b, #d4a106, #ea7a1c, #dc4c64, #8b5cf6) border-box; }
.set-note { margin: 6px 0 0; }
.modal-settings::backdrop { background: rgb(0 0 0 / 12%); }

/* ---------------- Volle Breite (nur Desktop) und Seiten */
body[data-device=mobile] .tile-wide { display: none; }
.tile-btn.tile-wide { font-size: .95rem; }
.page-bar { display: flex; align-items: center; gap: 4px; margin: 2px 8px 2px; flex-wrap: wrap; }
.page-bar .page-add { border: 1px dashed var(--accent); border-radius: 999px; color: var(--accent); font-weight: 700; width: 32px; height: 32px; }
.page-bar .page-add:hover { background: var(--accent-soft); }
.page-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 0 1 auto; min-width: 0; }
.page-tab { font: inherit; font-size: .9rem; padding: 5px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
.page-tab[aria-selected=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.page-bar .tile-btn:disabled { opacity: .35; cursor: default; }
.page-tools { display: inline-flex; margin-left: auto; }
.page-dots { display: none; width: 100%; justify-content: center; gap: 6px; padding-top: 2px; }
.page-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.page-dots span.on { background: var(--accent); }
body[data-device=mobile] .page-dots { display: flex; }
.page-empty { text-align: center; padding: 40px 16px; }
.page-sel { font: inherit; font-size: .85rem; max-width: 9em; }
.page-in-r { animation: page-in-r .25s ease-out; }
.page-in-l { animation: page-in-l .25s ease-out; }
@keyframes page-in-r { from { opacity: .2; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes page-in-l { from { opacity: .2; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .page-in-r, .page-in-l { animation: none; } }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: .88rem; background: var(--surface); }
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; padding: 0; position: relative; }
.swatch[aria-pressed=true] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.swatch.none { background: linear-gradient(135deg, var(--surface) 45%, var(--muted) 47%, var(--muted) 53%, var(--surface) 55%); }
.swatch-sm { width: 24px; height: 24px; }
.tile-colors { width: 100%; border-collapse: collapse; }
.tile-colors th { text-align: left; font-weight: 500; font-size: .9rem; padding: 6px 8px 6px 0; white-space: nowrap; }
.tile-colors td { padding: 4px 0; }
.tile-colors .swatches { gap: 6px; }
/* Der Platz entscheidet: im schmalen Fenster (Handy) Name oben, alle Farben in einer Reihe darunter – statt einer schmalen
   Spalte neben dem Namen, in der die Farben untereinander stehen */
.modal-body { container-type: inline-size; }
@container (max-width: 520px) {
  .tile-colors, .tile-colors tbody, .tile-colors tr, .tile-colors th, .tile-colors td { display: block; }
  .tile-colors tr { padding: 4px 0 6px; border-bottom: 1px solid var(--border); }
  .tile-colors tr:last-child { border-bottom: 0; }
  .tile-colors th { padding: 2px 0 4px; white-space: normal; }
  .tile-colors td { padding: 0; }
}
.swatch[data-a=default] { background: #1f6f8b; }
.swatch[data-a=green] { background: #2e7d4f; }
.swatch[data-a=blue] { background: #2563eb; }
.swatch[data-a=purple] { background: #6d4fc2; }
.swatch[data-a=red] { background: #b4233c; }
.swatch[data-a=orange] { background: #b45309; }
.swatch[data-a=gray] { background: #4b5563; }
.swatch[data-c=blue] { background: #3b82f6; }
.swatch[data-c=green] { background: #22a06b; }
.swatch[data-c=yellow] { background: #d4a106; }
.swatch[data-c=orange] { background: #ea7a1c; }
.swatch[data-c=red] { background: #dc4c64; }
.swatch[data-c=purple] { background: #8b5cf6; }
.swatch[data-c=gray] { background: #7b8494; }
.btn-gear { font-size: 1.1rem; line-height: 1; padding: 6px 9px; }

/* ---------------- Verwaltung (/admin/) */
.admin-page main { max-width: 1000px; }
.admin-login { display: grid; gap: 8px; max-width: 320px; margin-top: 12px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 16px 0; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; }
.kpi-l { font-size: .8rem; color: var(--muted); }
.kpi-v { font-size: 1.5rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.kpi-s { font-size: .78rem; color: var(--muted); }
.budget { height: 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; max-width: 520px; }
.budget span { display: block; height: 100%; background: var(--accent); }
.budget span.warn { background: #d97706; }
.budget span.over { background: #dc2626; }
.admin-scroll { overflow-x: auto; }
.admin-table { border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; margin: 6px 0 12px; }
.admin-table th, .admin-table td { border-bottom: 1px solid var(--border); padding: 6px 12px 6px 0; text-align: left; white-space: nowrap; }
.admin-table thead th { color: var(--muted); font-weight: 500; font-size: .8rem; }
.admin-table tbody th { font-weight: 500; }

/* ---------------- Rechner */
.calc-select { margin-bottom: 10px; font-weight: 500; }
.calc-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; align-items: end; }
.calc-field { display: grid; gap: 2px; }
.calc-field label { color: var(--muted); }
.calc-input { display: flex; align-items: center; gap: 6px; }
.calc-input .input { min-width: 0; }
.calc-unit { white-space: nowrap; }
.calc-check { grid-column: 1 / -1; font-size: .9rem; }
.calc-out { margin-top: 12px; padding: 8px 12px; background: var(--accent-soft); border-radius: 8px; }
.calc-result { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.calc-result th { text-align: left; font-weight: 400; color: var(--muted); padding: 3px 12px 3px 0; font-size: .88rem; vertical-align: top; }
.calc-result td { padding: 3px 0; font-size: .92rem; }
.calc-result tr.strong td { font-weight: 650; }
.calc-note { margin-top: 8px; }
.calc-note summary { cursor: pointer; color: var(--muted); }
.calc-note p { margin: 6px 0 0; }
.calc-disclaimer { margin: 6px 0 0; }

/* ---------------- Referenzen-Check (CSS von pubmed.de, Element 118; Präfix rc statt pmr) */
.rc-intro { margin: 0 0 8px; font-size: .9rem; }
.rc textarea{width:100%;min-height:9rem;font:inherit;font-size:.9rem;padding:.6rem;border:1px solid rgba(127,127,127,.5);border-radius:.4rem;background:transparent;color:inherit;box-sizing:border-box}
.rc-actions{display:flex;flex-wrap:wrap;gap:.5rem;margin:.6rem 0}
.rc button{font:inherit;font-size:.88rem;padding:.4rem .85rem;border:1px solid rgba(127,127,127,.6);border-radius:.4rem;background:rgba(127,127,127,.12);color:inherit;cursor:pointer}
.rc button.rc-main{font-weight:700;background:rgba(40,120,200,.22);border-color:rgba(40,120,200,.8)}
.rc button:disabled{opacity:.5;cursor:default}
.rc-note{font-size:.82rem;opacity:.85;margin:.4rem 0}
.rc-prog{margin:.6rem 0;font-size:.9rem}
.rc-bar{height:.45rem;border-radius:.3rem;background:rgba(127,127,127,.25);overflow:hidden;margin-top:.3rem}
.rc-bar span{display:block;height:100%;width:0;background:rgba(40,120,200,.85);transition:width .3s}
.rc-sum{display:flex;flex-wrap:wrap;gap:.5rem;margin:.6rem 0}
.rc-chip{padding:.2rem .65rem;border-radius:1rem;font-size:.85rem;border:1px solid rgba(127,127,127,.4)}
.rc-item{border:1px solid rgba(127,127,127,.35);border-left-width:.4rem;border-radius:.4rem;padding:.6rem .8rem;margin:.6rem 0;break-inside:avoid}
.rc-item.ok{border-left-color:rgba(46,160,67,.9)}
.rc-item.warn{border-left-color:rgba(210,153,34,.95)}
.rc-item.bad{border-left-color:rgba(218,54,51,.95)}
.rc-item.grey{border-left-color:rgba(127,127,127,.8)}
.rc-h{display:flex;flex-wrap:wrap;gap:.5rem;align-items:baseline;margin-bottom:.3rem}
.rc-badge{font-weight:700;font-size:.82rem;padding:.1rem .55rem;border-radius:.3rem}
.rc-badge.ok{background:rgba(46,160,67,.2)}
.rc-badge.warn{background:rgba(210,153,34,.25)}
.rc-badge.bad{background:rgba(218,54,51,.22)}
.rc-badge.grey{background:rgba(127,127,127,.22)}
.rc-raw{font-size:.88rem;opacity:.9;word-break:break-word}
.rc-item ul{margin:.3rem 0 .3rem 1.1rem;padding:0;font-size:.88rem}
.rc-j{font-size:.82rem;margin:.3rem 0}
.rc-tag{display:inline-block;padding:0 .45rem;margin:0 .3rem .2rem 0;border-radius:.3rem;border:1px solid rgba(127,127,127,.45);font-size:.78rem}
.rc-l{font-size:.85rem}
.rc-l a{margin-right:.8rem}
.rc-tools{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center;margin:.6rem 0}
.rc-small{font-size:.8rem;opacity:.85}
.rc-profile ul{margin:.3rem 0 .3rem 1.1rem;padding:0}
#rc-report h2{font-size:1.05rem;margin:.6rem 0 .3rem}
.rc-info { margin-top: 10px; font-size: .85rem; }
.rc-info summary { cursor: pointer; color: var(--muted); }
.rc-info ul { padding-left: 1.2em; }
.footer-copy { margin-left: auto; }
@media (max-width: 760px) { .footer-copy { margin-left: 0; } }
/* Höhe des Rasters nicht animieren – sonst liegt die Fußzeile beim Laden kurz hinter den Kacheln */
#grid.grid-stack-animate { transition: none; }
.marks-count { margin: 0 0 6px; }

/* Platzhaltertexte in Eingabefeldern gut lesbar */
::placeholder { color: var(--muted); opacity: .85; }

/* Newsfeed-Kachel: Einstellungen (Titel, Feeds, Löschen) */
.news-title-label { display: block; margin: 2px 0 3px; }
.tile-settings .news-title-label + .input { width: 100%; }
.news-choose { margin: 10px 0 2px; font-weight: 600; }
.news-remove { margin-top: 10px; color: var(--danger); }
.menu-add { margin-top: 6px; }

/* Rechner-Kachel: Auswahl der angezeigten Rechner */
.calc-pick-head { margin: 6px 0 2px; font-weight: 600; }

/* Kacheln einklappen: Klick auf den Titel oder den Pfeil */
.tile-chev { flex: none; width: 16px; text-align: center; color: var(--muted); cursor: pointer; transition: transform .15s; font-size: .85rem; }
.tile.collapsed .tile-chev { transform: rotate(-90deg); }
.tile-title { cursor: pointer; }
.tile-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.tile.collapsed .tile-body { display: none; }
.tile.collapsed .tile-head { border-bottom: 0; }
.tile-head { padding-left: 8px; }
.news-plus { font-size: 1.25rem; font-weight: 600; }
.tile-btn.on { background: var(--surface-2); color: var(--text); }

/* Randomisierungsliste (besonderer Rechner in „Statistik-Rechner“) */
.rnd { grid-column: 1 / -1; display: grid; gap: 8px; }
.rnd-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; align-items: end; }
.rnd-strata textarea { width: 100%; font: inherit; }
.rnd-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rnd-warn { border-left: 4px solid #d97706; padding: 6px 10px; margin: 4px 0; background: rgb(217 119 6 / 10%); border-radius: 4px; }
.rnd-err { color: var(--danger); margin: 0; }
.rnd-head { font-weight: 600; margin: 8px 0 2px; }
.rnd-out { padding: 8px 12px; background: var(--accent-soft); border-radius: 8px; }
.rnd-out:empty { display: none; }
.rnd-scroll { max-height: 18rem; overflow: auto; }
.rnd-t th, .rnd-t td { padding: 3px 10px 3px 0; text-align: left; }

/* Rechner-Auswahl als Kombinationsfeld (calc/picker.js) */
.cbx { margin-bottom: 10px; }
.cbx-row { position: relative; display: flex; }
.cbx-input { width: 100%; padding-right: 32px; font-weight: 500; text-overflow: ellipsis; }
.cbx-toggle { position: absolute; right: 2px; top: 2px; bottom: 2px; width: 28px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: .9rem; }
.cbx-list { list-style: none; margin: 4px 0 0; padding: 4px 0; max-height: 16rem; overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.cbx-head { padding: 6px 10px 2px; font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.cbx-opt { display: flex; align-items: center; gap: 4px; padding: 5px 8px 5px 4px; cursor: pointer; }
.cbx-opt.active, .cbx-opt:hover { background: var(--accent-soft); }
.cbx-opt.cur .cbx-label { font-weight: 600; }
.cbx-star { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem; width: 26px; flex: none; }
.cbx-star.on { color: #d29922; }
.cbx-empty { padding: 8px 10px; color: var(--muted); font-size: .9rem; }
body[data-device=mobile] .cbx-opt { padding-top: 9px; padding-bottom: 9px; }
.cbx-cat { color: var(--accent); }

/* Rechner: Datenreihen (Feldtyp data) */
.calc-field-data { grid-column: span 2; }
.calc-data { width: 100%; font-family: var(--mono); font-size: .85rem; resize: vertical; }
.calc-count { color: var(--muted); font-weight: 400; }
@media (max-width: 760px) { .calc-field-data { grid-column: 1 / -1; } }

/* Kachel „Tabelle 1 erstellen“ (tiles/table1.js) */
.t1 { container-type: inline-size; }
.t1-p { margin: 0 0 8px; }
.t1-g { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px 20px; }
@container (min-width: 720px) { .t1-g { grid-template-columns: minmax(0, 21rem) minmax(0, 1fr); } }
.t1-col { min-width: 0; }
.t1-l, .t1-f label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 2px; }
.t1-data { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; white-space: pre; overflow: auto; box-sizing: border-box; }
.t1-txt { width: 100%; font-size: .88rem; box-sizing: border-box; }
.t1-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.t1-f { margin: 0 0 8px; min-width: 0; }
.t1-f .input { width: 100%; }
.t1-o { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0 12px; margin-top: 8px; }
.t1-sec { margin: 8px 0; border-top: 1px solid var(--border); padding-top: 6px; }
.t1-sec > summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.t1-sc { overflow-x: auto; margin: 6px 0; }
.t1-t { border-collapse: collapse; font-size: .82rem; }
.t1-t th, .t1-t td { padding: 3px 5px; vertical-align: middle; text-align: left; }
.t1-t thead th { color: var(--muted); font-weight: 500; }
.t1-t th[scope=row] { font-weight: 600; white-space: nowrap; }
.t1-t select { min-width: 10rem; }
.t1-t input[type=text] { min-width: 8rem; }
.t1-state { margin: 0 0 6px; font-weight: 500; }
.t1-bad { color: var(--danger) !important; }
.t1-pv { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px; overflow: auto; }
.t1-pv:empty { display: none; }
.t1-pv svg { display: block; width: 100%; height: auto; margin: 0 auto; }
.t1-help ul { padding-left: 1.2rem; margin: 6px 0; }
.t1-help p { margin: 8px 0 2px; }

/* Kachel „Übersicht“ (tiles/overview.js) und Home-Knopf */
.tile-overview .tile-body { padding: 8px 10px; }
.ov-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ov-btn { font: inherit; font-size: .85rem; padding: 4px 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); cursor: pointer; white-space: nowrap; }
.ov-btn:hover, .ov-btn:focus-visible { background: var(--accent-soft); border-color: var(--accent); }
.ov-off { background: transparent; border-style: dashed; color: var(--muted); }
.ov-sep { margin-left: 8px; }
.grid-stack-item { scroll-margin-top: 10px; }
@keyframes tile-flash { from { box-shadow: 0 0 0 3px var(--accent); } to { box-shadow: var(--shadow); } }
.tile.tile-flash { animation: tile-flash 1.4s ease-out; }
.home-btn {
  position: fixed; left: 18px; bottom: 18px; z-index: 60; width: 50px; height: 50px; border-radius: 50%;
  display: grid; place-items: center; padding: 0;
  border: 2px solid var(--surface); background: var(--accent); color: var(--accent-text); box-shadow: 0 3px 12px rgb(0 0 0 / 28%);
  cursor: pointer;
}
.home-btn svg { width: 26px; height: 26px; }
.home-btn:hover, .home-btn:focus-visible { filter: brightness(1.1); outline: 3px solid var(--accent-soft); }
.home-btn[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .tile.tile-flash { animation: none; } }

/* ---------------- Handy: Kachel gedrückt halten und auf eine andere Seite ziehen (tilegrab.js) */
body[data-device=mobile] .tile-head { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.grid-stack-item.tile-lifted { z-index: 40; }
.grid-stack-item.tile-lifted > .grid-stack-item-content { transform: scale(1.03); box-shadow: 0 16px 40px rgb(0 0 0 / 28%); border-radius: var(--radius); transition: transform .15s; }
.grab-hint {
  position: fixed; top: 50%; z-index: 60; transform: translateY(-50%); max-width: 40vw; padding: 10px 12px;
  background: var(--surface); color: var(--muted); border: 2px dashed var(--border); font-size: .9rem; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: background .15s, color .15s, border-color .15s;
}
.grab-left { left: 0; border-left: 0; border-radius: 0 12px 12px 0; }
.grab-right { right: 0; border-right: 0; border-radius: 12px 0 0 12px; }
.grab-hint.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); border-style: solid; }
.toast {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 70; width: max-content; max-width: calc(100vw - 24px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 14px; border-radius: 12px;
  background: var(--text); color: var(--bg); box-shadow: 0 8px 24px rgb(0 0 0 / 25%); font-size: .9rem;
}
.toast[hidden] { display: none; }
.toast-btn { font: inherit; font-weight: 700; background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: 4px; }
.sheet {
  margin: auto auto 0; width: 100%; max-width: 560px; border: 0; border-radius: 18px 18px 0 0; padding: 8px 18px 22px;
  background: var(--surface); color: var(--text); box-shadow: 0 -8px 30px rgb(0 0 0 / 25%);
}
.sheet[open] { animation: sheet-up .2s ease-out; }
@keyframes sheet-up { from { transform: translateY(40%); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet[open] { animation: none; } }
.sheet::backdrop { background: rgb(0 0 0 / 35%); }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 0 auto 10px; }
.sheet-title { font-size: 1.05rem; margin: 0 0 8px; }
.sheet-label { margin: 0 0 6px; }
.sheet-pages { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.sheet-pages .page-tab[aria-current] { background: var(--accent-soft); border-color: var(--accent); opacity: .8; }
.page-tab-new { border-style: dashed; color: var(--accent); }
.sheet-actions { display: grid; gap: 6px; }
.sheet-btn { width: 100%; justify-content: center; padding: 10px; }
.sheet-danger { color: var(--danger); }
.sheet-tip { margin: 12px 0 8px; }
.sheet-cancel { margin-top: 2px; font-weight: 600; }

/* ---------------- App: offline-Hinweis, Anleitung, Ziehen zum Aktualisieren (News), Wischen (Merkliste) */
.offline-pill {
  position: fixed; right: 12px; bottom: 12px; z-index: 65; padding: 5px 12px; border-radius: 999px; white-space: nowrap; max-width: calc(100vw - 90px); overflow: hidden; text-overflow: ellipsis;
  background: var(--text); color: var(--bg); font-size: .82rem; font-weight: 600; box-shadow: 0 4px 14px rgb(0 0 0 / 20%);
}
.offline-pill[hidden] { display: none; }
.btn-app { font-weight: 600; }
.app-steps li { margin: 6px 0; }
.news-pull { height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: .85rem; transition: height .2s; }
.news-pull-ic { display: inline-block; font-size: 1.2rem; }
.news-pull.ready { color: var(--accent); font-weight: 600; }
.news-pull.busy .news-pull-ic { animation: pull-spin .8s linear infinite; }
@keyframes pull-spin { to { transform: rotate(360deg); } }
.mark[data-uid] { position: relative; overflow: hidden; }
.mark.mark-swiping > * { transform: translateX(var(--sx, 0)); }
.mark.mark-swiping { background: var(--surface-2); }
.mark.mark-swiping::before {
  position: absolute; top: 0; bottom: 0; display: flex; align-items: center; padding: 0 14px; font-weight: 700; font-size: .85rem; color: var(--muted);
}
.mark.mark-swiping[data-dir=del]::before { content: attr(data-l-del); right: 0; }
.mark.mark-swiping[data-dir=share]::before { content: attr(data-l-share); left: 0; }
.mark.mark-armed[data-dir=del] { background: var(--danger); }
.mark.mark-armed[data-dir=share] { background: var(--accent); }
.mark.mark-armed::before { color: #fff; }
.mark-share { font-size: 1rem; }

/* ---------------- Handy: Schnellzugriff-Leiste unten (tabbar.js) */
.tabbar { display: none; }
body.has-tabbar[data-device=mobile] { --tb: calc(60px + env(safe-area-inset-bottom, 0px)); padding-bottom: var(--tb); }
body.has-tabbar[data-device=mobile].edit-mode, body.has-tabbar[data-device=mobile].kb-open { --tb: 0px; }
body[data-device=mobile] .tabbar {
  display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 62; height: var(--tb); padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -2px 12px rgb(0 0 0 / 10%);
}
body.edit-mode .tabbar, body.kb-open .tabbar { display: none !important; }
body.has-tabbar[data-device=mobile] .home-btn { display: none; }
.tb-btn {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px 2px;
  font: inherit; font-size: .7rem; line-height: 1.15; background: none; border: 0; color: var(--muted); cursor: pointer;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.tb-btn .tb-ic svg { width: 24px; height: 24px; display: block; }
.tb-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-btn.on { color: var(--accent); font-weight: 700; }
.tb-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; border-radius: 8px; }
.tb-btn:active .tb-ic { transform: scale(.9); }
body.has-tabbar[data-device=mobile] .toast, body.has-tabbar[data-device=mobile] .offline-pill, body.has-tabbar[data-device=mobile] .consent { bottom: calc(var(--tb) + 12px); }
.tb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 14px; max-height: 50vh; overflow-y: auto; }
.tb-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; font: inherit; font-size: .8rem; text-align: center;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
}
.tb-tile > span:not(.tb-ic) { max-width: 100%; overflow-wrap: anywhere; hyphens: auto; }
.tb-tile .tb-ic { color: var(--accent); }
.tb-tile.tb-off { background: transparent; border-style: dashed; color: var(--muted); }
.tb-slots { display: grid; gap: 8px; margin: 6px 0 14px; }
.tb-slot { display: flex; align-items: center; gap: 10px; }
.tb-slot-n { flex: 0 0 4.5em; font-weight: 600; font-size: .9rem; }
.tb-slot select { flex: 1; min-width: 0; font: inherit; padding: 7px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.tb-page { margin: 0 0 4px; font-weight: 600; color: var(--accent); }
.tb-btn.tb-add { color: var(--muted); opacity: .8; }
.tb-sub { font-size: .7rem; color: var(--muted); line-height: 1.2; }
/* Fenster unten nie höher als der wirklich sichtbare Bereich (Safari: vh zählt die Adressleiste nicht ab → oben verdeckt);
   der Inhalt scrollt dann im Fenster */
.sheet { max-height: 80vh; max-height: calc(100dvh - 48px); overflow-y: auto; overscroll-behavior: contain; }
.tb-sheet .tb-grid { max-height: none; overflow: visible; }
.sheet .sheet-cancel { position: sticky; bottom: 0; background: var(--surface); box-shadow: 0 -10px 12px var(--surface); }
.tb-tile.tb-newpage { background: transparent; border-style: dashed; border-color: var(--accent); color: var(--accent); font-weight: 600; }
.ai-row textarea:placeholder-shown { white-space: nowrap; overflow: hidden; }
.ai-row textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Suchkachel nach Platz – entscheidend ist die Breite der Kachel selbst (container query), nicht das Gerät:
   breit = Beschriftung + Erklärzeile, mittel = nur Beschriftung, schmal = nur kurze Platzhalter (Beschriftungen bleiben für Screenreader) */
.tile-search .tile-body { container: srch / inline-size; }
.ai-label, .q-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@container srch (min-width: 420px) {
  .q-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; display: block; }
}
@container srch (min-width: 640px) {
  .ai-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; display: block; margin-bottom: 3px; }
}


/* ---------------- Flussdiagramm (tiles/flow.js, figures/flow-engine.js) */
/* Kachel Flussdiagramm (tiles/flow.js) – „Der Platz entscheidet“: maßgeblich ist die Breite der Kachel (container query).
   Schmal: alles untereinander, Typ-Knöpfe ohne Jahreszahl (< 400 px), Export-Knöpfe zweispaltig, Vorschau vor den Eingaben, nur nicht erfüllte Prüfungen, Erklärtexte eingeklappt.
   Ab 520 px: Einleitung und alle Prüfungen sichtbar. Ab 760 px: zwei Spalten Eingaben | Prüfung + Vorschau. */
.tile-flow .tile-body { container: flow / inline-size; }
.fl-p { margin: 0 0 8px; }
.fl-wide { display: none; }
.fl-types { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.fl-type { flex: 1 1 0; min-width: 0; padding: 5px 6px; line-height: 1.25; }
.fl-type b { font-weight: 600; white-space: nowrap; }
.fl-tyear { display: none; }
.fl-tsub { display: none; font-weight: 400; font-size: .78rem; }
.fl-g { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px 20px; }
.fl-col { min-width: 0; }
.fl-out { order: -1; }
.fl-h { margin: 0 0 6px; font-size: .95rem; }
.fl-state { margin: 0 0 4px; font-weight: 600; }
.fl-ok { color: var(--text); }
.fl-no, .fl-bad { color: var(--danger) !important; }
.fl-c { list-style: none; padding: 0; margin: 0 0 8px; }
.fl-c li { position: relative; padding: 1px 0 1px 1.3rem; }
.fl-c li::before { position: absolute; left: 0; font-weight: 700; }
.fl-c li.fl-ok { display: none; color: var(--muted); }
.fl-c li.fl-ok::before { content: "\2713"; color: var(--accent); }
.fl-c li.fl-no::before { content: "\2717"; }
.fl-pv { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px; overflow: auto; }
.fl-pv svg { display: block; margin: 0 auto; }
.fl-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.fl-btns .btn { min-width: 0; }
.fl-o { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0 12px; margin-top: 6px; }
.fl-f { margin: 0 0 8px; min-width: 0; }
.fl-f label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 2px; }
.fl-f .input { width: 100%; }
.fl-sec { margin: 8px 0; border-top: 1px solid var(--border); padding-top: 6px; }
.fl-sec > summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.fl-help ul { padding-left: 1.2rem; margin: 6px 0; }
.fl-help li { margin: 0 0 4px; }
/* Eingaben */
.fl-box { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; margin: 0 0 8px; background: var(--surface); }
.fl-bh { font-weight: 600; font-size: .9rem; margin: 0 0 4px; }
.fl-fn { display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem; gap: 6px; align-items: center; font-size: .85rem; margin: 0 0 4px; }
.fl-fn .input { width: 100%; box-sizing: border-box; }
.fl-fname { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
.fl-list { margin: 4px 0 6px; padding-left: 8px; border-left: 3px solid var(--accent-soft); }
.fl-lh { font-size: .82rem; color: var(--muted); margin: 0 0 3px; }
.fl-r { display: grid; grid-template-columns: minmax(0, 1fr) 4.8rem 1.9rem; gap: 4px; margin: 0 0 3px; }
.fl-r2 { grid-template-columns: minmax(0, 1fr) 5.5rem; }
.fl-r .input { width: 100%; min-width: 0; box-sizing: border-box; }
.fl-n { text-align: right; }
.fl-x { padding: 2px 0; font-size: 1rem; line-height: 1; }
.fl-add { padding: 2px 6px; font-size: .8rem; color: var(--accent); }
.fl-chkl { margin: 0 0 8px; cursor: pointer; }
@container flow (min-width: 400px) { .fl-tyear { display: inline; } }
@container flow (min-width: 520px) {
  .fl-wide { display: block; }
  .fl-narrow { display: none; }
  .fl-tsub, .fl-tyear { display: inline; }
  .fl-type { flex: 0 1 auto; padding: 4px 10px; }
  .fl-c li.fl-ok { display: block; }
  .fl-btns { display: flex; }
}
@container flow (min-width: 760px) {
  .fl-g { grid-template-columns: minmax(0, 23rem) minmax(0, 1fr); }
  .fl-out { order: 2; }
  .fl-in { order: 1; }
}


/* ---------------- Gantt-Diagramm (tiles/gantt.js, figures/gantt-engine.js) */
/* Kachel Gantt-Diagramm (Zeitplan), tiles/gantt.js – „Der Platz entscheidet“: maßgeblich ist die Breite der Kachel */
.tile-gantt .tile-body { container: gantt / inline-size; }
.gt-p { margin: 0 0 8px; }
.gt-g { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px 20px; }
.gt-col { min-width: 0; }
.gt-wide { display: none; }
.gt-l, .gt-f label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 2px; }
.gt-data { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; white-space: pre; overflow: auto; box-sizing: border-box; }
.gt-txt { width: 100%; font-size: .88rem; box-sizing: border-box; white-space: pre-wrap; }
.gt-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.gt-f { margin: 0 0 8px; min-width: 0; }
.gt-f .input { width: 100%; }
.gt-o { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0 12px; margin-top: 8px; }
.gt-chk { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0 12px; }
.gt-sec { margin: 8px 0; border-top: 1px solid var(--border); padding-top: 6px; }
.gt-sec > summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.gt-state { margin: 0 0 6px; font-weight: 500; }
.gt-bad { color: var(--danger) !important; }
.gt-pv { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px; overflow: auto; }
.gt-pv:empty { display: none; }
.gt-pv svg { display: block; width: 100%; height: auto; margin: 0 auto; }
.gt-wh, .gt-th { margin: 8px 0 2px; font-weight: 600; }
.gt-sc { overflow-x: auto; margin: 4px 0 8px; }
.gt-t { border-collapse: collapse; font-size: .82rem; white-space: nowrap; }
.gt-t th, .gt-t td { padding: 3px 6px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.gt-t thead th { color: var(--muted); font-weight: 500; }
.gt-t th[scope=row] { font-weight: 600; white-space: normal; min-width: 9rem; }
.gt-help ul { padding-left: 1.2rem; margin: 6px 0; }
.gt-help li { margin: 2px 0; }
/* breite Kachel: zwei Spalten Daten | Ergebnis, Erklärzeilen sichtbar */
@container gantt (min-width: 760px) {
  .gt-g { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); }
  .gt-wide { display: block; }
  .gt-data { font-size: .8rem; min-height: 15rem; }
}
/* Gantt: Einleitungssatz erst, wenn Platz ist (wie beim Flussdiagramm) */
.gt-intro { display: none; }
@container gantt (min-width: 520px) { .gt-intro { display: block; } }


/* ---------------- Bland-Altman-Diagramm (tiles/bland.js, figures/ba-engine.js) */
/* Kachel Bland-Altman-Diagramm, tiles/bland.js – „Der Platz entscheidet“: maßgeblich ist die Breite der Kachel */
.tile-bland .tile-body { container: bland / inline-size; }
.ba-p { margin: 0 0 8px; }
.ba-g { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px 20px; }
.ba-col { min-width: 0; }
.ba-wide { display: none; }
.ba-l, .ba-f label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 2px; }
.ba-data { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; white-space: pre; overflow: auto; box-sizing: border-box; }
.ba-txt { width: 100%; font-size: .88rem; box-sizing: border-box; white-space: pre-wrap; }
.ba-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.ba-f { margin: 0 0 8px; min-width: 0; }
.ba-f .input { width: 100%; }
.ba-o { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0 12px; margin-top: 8px; }
.ba-chk { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0 12px; }
.ba-sec { margin: 8px 0; border-top: 1px solid var(--border); padding-top: 6px; }
.ba-sec > summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.ba-state { margin: 0 0 6px; font-weight: 500; }
.ba-bad { color: var(--danger) !important; }
.ba-pv { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px; overflow: auto; }
.ba-pv:empty { display: none; }
.ba-pv svg { display: block; width: 100%; height: auto; margin: 0 auto; }
.ba-wh, .ba-th { margin: 8px 0 2px; font-weight: 600; }
.ba-sc { overflow-x: auto; margin: 4px 0 8px; }
.ba-t { border-collapse: collapse; font-size: .82rem; white-space: nowrap; }
.ba-t th, .ba-t td { padding: 3px 6px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.ba-t thead th { color: var(--muted); font-weight: 500; }
.ba-t th[scope=row] { font-weight: 600; white-space: normal; min-width: 9rem; }
.ba-help ul { padding-left: 1.2rem; margin: 6px 0; }
.ba-help li { margin: 2px 0; }
.ba-o .ba-f label { min-height: 1.2em; }
/* breite Kachel: zwei Spalten Daten | Ergebnis, Erklärzeilen sichtbar */
@container bland (min-width: 760px) {
  .ba-g { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); }
  .ba-wide { display: block; }
  .ba-data { font-size: .8rem; min-height: 16rem; }
}
/* Bland-Altman: Einleitung erst, wenn Platz ist */
.ba-intro { display: none; }
@container bland (min-width: 520px) { .ba-intro { display: block; } }


/* ---------------- ROC-Kurve und AUC (tiles/roc.js, figures/roc-engine.js) */
/* Kachel ROC-Kurve und AUC, tiles/roc.js – „Der Platz entscheidet“: maßgeblich ist die Breite der Kachel */
.tile-roc .tile-body { container: roc / inline-size; }
.roc-p { margin: 0 0 8px; }
.roc-g { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px 20px; }
.roc-col { min-width: 0; }
.roc-wide { display: none; }
.roc-l, .roc-f label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 2px; }
.roc-data { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; white-space: pre; overflow: auto; box-sizing: border-box; }
.roc-txt { width: 100%; font-size: .88rem; box-sizing: border-box; white-space: pre-wrap; }
.roc-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.roc-f { margin: 0 0 8px; min-width: 0; }
.roc-f[hidden] { display: none; }
.roc-f .input { width: 100%; }
.roc-o { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0 12px; margin-top: 8px; }
.roc-chk { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0 12px; }
.roc-sec { margin: 8px 0; border-top: 1px solid var(--border); padding-top: 6px; }
.roc-sec > summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.roc-state { margin: 0 0 6px; font-weight: 500; }
.roc-bad { color: var(--danger) !important; }
.roc-pv { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px; overflow: auto; }
.roc-pv:empty { display: none; }
.roc-pv svg { display: block; width: 100%; height: auto; margin: 0 auto; }
.roc-th { margin: 8px 0 2px; font-weight: 600; }
.roc-sc { overflow-x: auto; margin: 4px 0 8px; }
.roc-cuts { max-height: 22rem; overflow: auto; }
.roc-t { border-collapse: collapse; font-size: .82rem; white-space: nowrap; }
.roc-t th, .roc-t td { padding: 3px 6px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.roc-t td { font-variant-numeric: tabular-nums; }
.roc-t thead th { color: var(--muted); font-weight: 500; }
.roc-t th[scope=row] { font-weight: 600; }
.roc-help ul { padding-left: 1.2rem; margin: 6px 0; }
.roc-help li { margin: 2px 0; }
/* breite Kachel: zwei Spalten Daten | Ergebnis+Vorschau, Erklärzeilen sichtbar statt eingeklappt */
@container roc (min-width: 760px) {
  .roc-g { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); }
  .roc-wide { display: block; }
  .roc-hintsec { display: none; }
  .roc-data { font-size: .8rem; min-height: 15rem; }
}
/* ROC: Einleitung erst, wenn Platz ist */
.roc-intro { display: none; }
@container roc (min-width: 520px) { .roc-intro { display: block; } }


/* ---------------- Kaplan-Meier-Kurve (tiles/km.js, figures/km-engine.js) */
/* Kachel Kaplan-Meier-Kurve, tiles/km.js – „Der Platz entscheidet“: maßgeblich ist die Breite der Kachel */
.tile-km .tile-body { container: km / inline-size; }
.km-p { margin: 0 0 8px; }
.km-g { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px 20px; }
.km-col { min-width: 0; }
.km-wide { display: none; }
.km-l, .km-f label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 2px; }
.km-data { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; white-space: pre; overflow: auto; box-sizing: border-box; }
.km-txt { width: 100%; font-size: .88rem; box-sizing: border-box; white-space: pre-wrap; }
.km-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.km-f { margin: 0 0 8px; min-width: 0; }
.km-f[hidden] { display: none; }
.km-f .input { width: 100%; }
.km-o { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0 12px; margin-top: 8px; }
.km-chk { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0 12px; }
.km-sec { margin: 8px 0; border-top: 1px solid var(--border); padding-top: 6px; }
.km-sec > summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.km-state { margin: 0 0 6px; font-weight: 500; }
.km-bad { color: var(--danger) !important; }
.km-pv { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px; overflow: auto; }
.km-pv:empty { display: none; }
.km-pv svg { display: block; width: 100%; height: auto; margin: 0 auto; }
.km-th { margin: 8px 0 2px; font-weight: 600; }
.km-sc { overflow-x: auto; margin: 4px 0 8px; }
.km-t { border-collapse: collapse; font-size: .82rem; white-space: nowrap; }
.km-t th, .km-t td { padding: 3px 6px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.km-t td { font-variant-numeric: tabular-nums; }
.km-t thead th { color: var(--muted); font-weight: 500; }
.km-t th[scope=row] { font-weight: 600; }
.km-help ul { padding-left: 1.2rem; margin: 6px 0; }
.km-help li { margin: 2px 0; }
/* breite Kachel: zwei Spalten Daten | Ergebnis+Vorschau, Erklärzeilen sichtbar statt eingeklappt */
@container km (min-width: 760px) {
  .km-g { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); }
  .km-wide { display: block; }
  .km-hintsec { display: none; }
  .km-data { font-size: .8rem; min-height: 15rem; }
}
/* Kaplan-Meier: Einleitung erst, wenn Platz ist */
.km-intro { display: none; }
@container km (min-width: 520px) { .km-intro { display: block; } }


/* ---------------- Forest-Plot (tiles/forest.js, figures/fp-engine.js) */
/* Kachel Forest-Plot (Metaanalyse), tiles/forest.js – „Der Platz entscheidet“: maßgeblich ist die Breite der Kachel */
.tile-forest .tile-body { container: forest / inline-size; }
.fp-p { margin: 0 0 8px; }
.fp-intro { display: none; }
.fp-g { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px 20px; }
.fp-col { min-width: 0; }
.fp-wide { display: none; }
.fp-l, .fp-f label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 2px; }
.fp-data { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; white-space: pre; overflow: auto; box-sizing: border-box; }
.fp-txt { width: 100%; font-size: .88rem; box-sizing: border-box; white-space: pre-wrap; }
.fp-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.fp-f { margin: 0 0 8px; min-width: 0; }
.fp-f[hidden], .fp-chk [hidden] { display: none; }
.fp-f .input { width: 100%; }
.fp-o { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0 12px; margin-top: 8px; }
.fp-chk { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0 12px; }
.fp-sec { margin: 8px 0; border-top: 1px solid var(--border); padding-top: 6px; }
.fp-sec > summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.fp-state { margin: 0 0 6px; font-weight: 500; }
.fp-bad { color: var(--danger) !important; }
.fp-pv { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px; overflow: auto; }
.fp-pv:empty { display: none; }
.fp-pv svg { display: block; width: 100%; height: auto; margin: 0 auto; }
.fp-th { margin: 8px 0 2px; font-weight: 600; }
.fp-sc { overflow-x: auto; margin: 4px 0 8px; }
.fp-t { border-collapse: collapse; font-size: .82rem; white-space: nowrap; }
.fp-t th, .fp-t td { padding: 3px 6px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.fp-t td { font-variant-numeric: tabular-nums; }
.fp-t thead th { color: var(--muted); font-weight: 500; }
.fp-t th[scope=row] { font-weight: 600; }
.fp-help ul { padding-left: 1.2rem; margin: 6px 0; }
.fp-help li { margin: 2px 0; }
/* Einleitung erst, wenn Platz ist */
@container forest (min-width: 520px) { .fp-intro { display: block; } }
/* breite Kachel: zwei Spalten Daten | Ergebnis+Vorschau, Erklärzeilen sichtbar statt eingeklappt */
@container forest (min-width: 760px) {
  .fp-g { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); }
  .fp-wide { display: block; }
  .fp-hintsec { display: none; }
  .fp-data { font-size: .8rem; min-height: 15rem; }
}


/* ---------------- Testwahl-Assistent (tiles/testwahl.js) */
/* Kachel Testwahl-Assistent, tiles/testwahl.js – „Der Platz entscheidet“: maßgeblich ist die Breite der Kachel */
.tile-testwahl .tile-body { container: testwahl / inline-size; }
.tw-p { margin: 0 0 8px; }
.tw-intro { display: none; }
.tw-g { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px 24px; }
.tw-col { min-width: 0; }
.tw-q { border: 0; margin: 0 0 12px; padding: 0; min-width: 0; }
.tw-q legend { font-weight: 600; font-size: .95rem; margin-bottom: 4px; padding: 0; }
.tw-o { display: flex; gap: 6px; align-items: baseline; margin: 2px 0; padding: 4px 6px; border-radius: 6px; cursor: pointer; line-height: 1.35; }
.tw-o:hover { background: var(--surface-2); }
.tw-o input { flex: none; margin: 0; transform: translateY(1px); }
.tw-o:has(input:checked) { background: var(--accent-soft); }
.tw-hd { margin: 0 0 4px; }
.tw-hd > summary { cursor: pointer; color: var(--muted); width: max-content; max-width: 100%; }
.tw-hd > p { margin: 2px 0 4px; }
.tw-out { border-top: 1px solid var(--border); padding-top: 8px; }
.tw-rec { margin: 0 0 2px; font-weight: 600; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.tw-test { margin: 0 0 6px; font-size: 1.08rem; line-height: 1.3; }
.tw-ul { margin: 0 0 8px; padding-left: 1.2em; }
.tw-ul li { margin: 2px 0; }
.tw-sw { font-size: .88rem; overflow-wrap: anywhere; }
.tw-warn { border-left: 4px solid #d97706; padding: 6px 10px; margin: 6px 0 8px; background: rgb(217 119 6 / 10%); border-radius: 4px; font-size: .92rem; }
.tw-tools-l { margin-bottom: 4px; }
.tw-tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.tw-tool { text-align: left; }
.tw-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 10px; }
.tw-sec { margin: 8px 0; border-top: 1px solid var(--border); padding-top: 6px; }
.tw-sec > summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.tw-sec .tw-ul { margin-top: 6px; }
.tw-a { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.tw-disc { margin-top: 8px; }
@container testwahl (min-width: 520px) {
  .tw-intro { display: block; }
}
@container testwahl (min-width: 760px) {
  .tw-g { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
  .tw-out { border-top: 0; border-left: 1px solid var(--border); padding: 0 0 0 16px; }
  .tw-btns { padding-left: 16px; }
}


/* ---------------- ICC und Kappa (tiles/icc.js, figures/rl-engine.js) */
/* Kachel ICC und Kappa, tiles/icc.js – „Der Platz entscheidet“: maßgeblich ist die Breite der Kachel */
.tile-icc .tile-body { container: icc / inline-size; }
.rl-p { margin: 0 0 8px; }
.rl-g { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px 20px; }
.rl-col { min-width: 0; }
.rl-intro, .rl-wide { display: none; }
.rl-l, .rl-f label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 2px; }
.rl-th { margin: 10px 0 2px; font-weight: 600; font-size: .9rem; }
.rl-data { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; white-space: pre; overflow: auto; box-sizing: border-box; }
.rl-txt { width: 100%; font-size: .88rem; box-sizing: border-box; white-space: pre-wrap; }
.rl-btns { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.rl-f { margin: 0 0 8px; min-width: 0; }
.rl-f .input { width: 100%; }
.rl-o { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0 12px; margin-top: 8px; }
.rl-o[hidden] { display: none; }
.rl-cols { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 0 0 4px; }
.rl-cb { overflow-wrap: anywhere; }
.rl-chk { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0 12px; }
.rl-sec { margin: 8px 0; border-top: 1px solid var(--border); padding-top: 6px; }
.rl-sec[hidden] { display: none; }
.rl-sec > summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.rl-state { margin: 0 0 6px; font-weight: 500; }
.rl-bad { color: var(--danger) !important; }
.rl-pv { background: #fff; color: #000; border: 1px solid var(--border); border-radius: 8px; padding: 6px; overflow: auto; }
.rl-pv:empty { display: none; }
.rl-pv svg { display: block; width: 100%; height: auto; margin: 0 auto; }
.rl-sc { overflow-x: auto; margin: 4px 0 8px; }
.rl-t { border-collapse: collapse; font-size: .82rem; }
.rl-t th, .rl-t td { padding: 3px 6px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.rl-t td { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: center; }
.rl-t thead th { color: var(--muted); font-weight: 500; }
.rl-t thead th + th { text-align: center; }
.rl-t th[scope=row] { font-weight: 400; min-width: 8rem; }
.rl-t .rl-sel th, .rl-t .rl-sel td { font-weight: 700; background: var(--accent-soft); }
.rl-warn { margin: 6px 0; padding: 4px 10px; border-left: 4px solid #d97706; background: rgb(217 119 6 / 10%); border-radius: 4px; }
.rl-help ul { padding-left: 1.2rem; margin: 6px 0; }
.rl-help li { margin: 2px 0; }
.rl-help p { margin: 8px 0 2px; }
@container icc (min-width: 520px) {
  .rl-intro { display: block; }
}
/* breite Kachel: zwei Spalten Daten | Ergebnis+Vorschau, Erklärzeilen sichtbar statt eingeklappt */
@container icc (min-width: 760px) {
  .rl-g { grid-template-columns: minmax(0, 24rem) minmax(0, 1fr); }
  .rl-wide { display: block; }
  .rl-hintsec { display: none; }
  .rl-data { font-size: .8rem; min-height: 15rem; }
  .rl-t th[scope=row] { min-width: 12rem; }
}

/* Schmale Handys: Knöpfe der Kopfzeile immer in eigener Zeile – sonst bricht sie erst nach dem Start um (Texte/Sprachwahl
   werden breiter) und schiebt die Seite nach unten (Layout-Verschiebung, CLS) */
@media (max-width: 430px) {
  .top-actions { flex-basis: 100%; }
}
