/* Ergänzungen zu Pico CSS – kein Inline-CSS (CSP style-src 'self') */
:root { --pico-font-size: 106.25%; }
@media (max-width: 576px) { :root { --pico-font-size: 100%; } }
.brand { text-decoration: none; }
.muted { color: var(--pico-muted-color); }
.error { color: var(--pico-del-color); font-weight: 600; }
.ok { color: var(--pico-ins-color); font-weight: 600; }
.narrow { max-width: 26rem; margin: 3rem auto; }
.mono { font-family: var(--pico-font-family-monospace); font-size: .9em; }
form.inline { display: inline; margin: 0; }
form.inline button { margin: 0; }
button.small { padding: .25rem .6rem; font-size: .85em; margin: 0; }
button.link { background: none; border: none; padding: 0 .3rem; margin: 0; width: auto; color: var(--pico-muted-color); cursor: pointer; }
button.link:hover { color: var(--pico-del-color); }

/* Formularzeilen: auf breiten Bildschirmen nebeneinander */
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-start; }
.row > * { margin-bottom: .5rem; }
.row > input, .row > select { flex: 1 1 12rem; }
.row > button { flex: 0 0 auto; width: auto; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.actions > * { margin-bottom: 0; }
.spaced { margin-top: 2rem; }

.search { display: flex; gap: .5rem; }
.search input { flex: 1; margin: 0; }
.search button { width: auto; margin: 0; }

/* Filter-Chips */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0 .5rem; }
.chips a { padding: .25rem .75rem; border-radius: 999px; border: 1px solid var(--pico-muted-border-color); text-decoration: none; font-size: .9em; }
.chips a[aria-current] { background: var(--pico-primary-background); color: var(--pico-primary-inverse); border-color: var(--pico-primary-background); }
.chips small { opacity: .7; }
.chips.regions a { font-size: .8em; }

/* Karten */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .9rem; margin-top: 1rem; }
.card { display: flex; flex-direction: column; gap: .3rem; padding: 1rem; border-radius: var(--pico-border-radius);
        background: var(--pico-card-background-color); box-shadow: var(--pico-card-box-shadow); text-decoration: none; color: inherit; }
.card:hover { outline: 2px solid var(--pico-primary-border); }
.card strong { color: var(--pico-primary); }
.card .summary { font-size: .88em; color: var(--pico-muted-color); }

/* Art-Kennzeichnung */
.kind { display: inline-block; font-size: .72em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
        padding: .1rem .5rem; border-radius: .3rem; color: #fff; background: #607d8b; }
.kind-krankheitsbild { background: #c0392b; }
.kind-test { background: #8e44ad; }
.kind-uebung { background: #16a085; }
.kind-protokoll { background: #2c6fbb; }
.kind-notiz { background: #7f8c8d; }
.region { font-size: .8em; color: var(--pico-muted-color); }
.lead { font-size: 1.1em; }
.tags a { font-size: .85em; margin-right: .3rem; }
.dosage { padding: .6rem 1rem; border-left: 4px solid #16a085; background: var(--pico-code-background-color); }
.patient { border-top: 1px dashed var(--pico-muted-border-color); margin-top: 1.5rem; padding-top: 1rem; }
.prose table { font-size: .92em; }
.links li { list-style: none; }
.links { padding-left: 0; }
.new-linked a { margin-right: .6rem; font-size: .9em; }
fieldset.exercise { border: 1px dashed var(--pico-muted-border-color); padding: 1rem; border-radius: var(--pico-border-radius); }

/* Medien */
.media { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.media figure { margin: 0; }
.media img, .media video { width: 100%; max-height: 14rem; object-fit: cover; border-radius: var(--pico-border-radius); }
.media .file { display: block; padding: 2rem 1rem; text-align: center; border: 1px dashed var(--pico-muted-border-color); border-radius: var(--pico-border-radius); }
.media figcaption { font-size: .85em; }

/* Handout-Editor */
.item { padding: .8rem 1rem; margin-bottom: .6rem; }
.item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }

/* Löschen */
details.danger summary { color: var(--pico-del-color); font-size: .9em; }
button.danger { background: var(--pico-del-color); border-color: var(--pico-del-color); width: auto; }

/* ---------- JS-abhängige Elemente ---------- */
.js-only { display: none !important; }
.js .js-only { display: inline-flex !important; }
.js .nojs-only { display: none; }

/* ---------- Patienten ---------- */
table.list td, table.list th { vertical-align: top; }
.nowrap { white-space: nowrap; }
.tablewrap { overflow-x: auto; }
.patient-head h1 { margin-bottom: .2rem; }
.session-form { display: grid; grid-template-columns: 10rem 1fr; gap: .5rem; }
.session-form textarea { grid-column: 1 / -1; margin: 0; }
.session-form input { margin: 0; }
.session-form button { grid-column: 1 / -1; width: auto; justify-self: start; }
@media (max-width: 576px) { .session-form { grid-template-columns: 1fr; } }
.session { border-left: 3px solid var(--pico-primary-border); padding: .3rem .8rem; margin: .6rem 0; }
.session-note { white-space: pre-wrap; color: var(--pico-muted-color); font-size: .92em; }
td.pre { white-space: pre-wrap; }
td.delta { font-weight: 700; white-space: nowrap; }

/* ---------- Befund ---------- */
.befund-head { display: grid; grid-template-columns: 1fr 14rem 11rem; gap: .8rem; align-items: end; }
@media (max-width: 768px) { .befund-head { grid-template-columns: 1fr 1fr; } .befund-head > div { grid-column: 1 / -1; } }
.toc { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: .3rem; margin: .5rem 0 1rem; font-size: .8em; }
.toc a { padding: .15rem .55rem; border-radius: 999px; border: 1px solid var(--pico-muted-border-color); text-decoration: none; }
.toc a.filled { border-color: var(--pico-primary-border); background: var(--pico-primary-focus); }
.sec { margin: 1.4rem 0; padding: 1rem 1.2rem; border-radius: var(--pico-border-radius);
       background: var(--pico-card-background-color); box-shadow: var(--pico-card-box-shadow); scroll-margin-top: 1rem; }
.sec > h2, .sec > summary { font-size: 1.25rem; margin-bottom: .6rem; }
details.specialty > summary { font-weight: 700; }
.part { margin: .6rem 0 1rem; }
.part h4, details.part > summary { font-size: 1rem; color: var(--pico-primary); margin: .6rem 0 .4rem; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 0 1rem; }
.fld.wide { grid-column: 1 / -1; }
.fld label { font-size: .88em; margin-bottom: .15rem; }
.fld textarea, .fld input, .fld select { margin-bottom: .7rem; }
.fld.chk label { font-size: .95em; }
.fld.chk { padding: .2rem 0; }
.fgrid:has(.chk) { grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); }
table.etable { margin-bottom: .3rem; }
table.etable td { padding: .15rem; }
table.etable input, table.etable select { margin: 0; padding: .35rem .5rem; height: auto; font-size: .92em; }
table.etable th { font-size: .82em; padding: .3rem; }
.savebar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: .7rem; align-items: center; flex-wrap: wrap;
           padding: .6rem 1rem; margin-top: 1rem; background: var(--pico-background-color);
           border-top: 1px solid var(--pico-muted-border-color); }
.savebar button { width: auto; margin: 0; }

/* Körperschema */
.body-tools { flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .7rem; }
.body-tools .mode-switch { display: inline-flex; gap: .2rem; }
.body-tools .mode { margin: 0; padding: .25rem .6rem; font-size: .85em; background: transparent; color: var(--pico-color); border: 1px solid var(--pico-muted-border-color); border-radius: .3rem 0 0 .3rem; }
.body-tools .mode:last-of-type { border-radius: 0 .3rem .3rem 0; }
.body-tools .mode.active { background: var(--pico-primary); color: var(--pico-primary-inverse); border-color: var(--pico-primary); }
.body-tools .tool-sep { border-left: 1px solid var(--pico-muted-border-color); height: 1.6rem; margin: 0 .2rem; }
.body-tools .arrow { font-size: 1.4rem; line-height: 1; width: 2.4rem; height: 2.4rem; padding: 0; margin: 0; background: transparent; color: var(--pico-color); border: 1px solid var(--pico-muted-border-color); border-radius: .3rem; }
.body-tools .arrow:disabled { opacity: .4; pointer-events: none; }
.body-tools .sym { width: auto; min-width: 2.6rem; padding: .25rem .5rem; margin: 0; background: transparent;
                   color: var(--pico-h2-color); border: 1px solid var(--pico-muted-border-color); font-size: 1.05rem; }
.body-tools .sym.active { color: var(--pico-h1-color); }
.body-tools .sym.active { border-color: var(--pico-primary); background: var(--pico-primary-focus); }
.body-tools input[type=color] { width: 2.6rem; height: 2.3rem; padding: 0; margin: 0; }
.body-tools select { width: auto; margin: 0; padding: .3rem 2rem .3rem .6rem; }
.body-tools button { margin: 0; width: auto; }
/* Körperschema: hochformatige Vorlagen → Höhe steuert die Größe, Breite folgt dem Seitenverhältnis */
.bodies { display: flex; gap: 1.8rem; flex-wrap: wrap; align-items: flex-start; justify-content: space-evenly; }
.body { margin: 0; height: 23rem; display: inline-flex; flex-direction: column; align-items: center; text-align: center; }
.body-canvas { position: relative; height: 100%; background: #fff; border-radius: .4rem; }
.body-canvas img { display: block; height: 100%; width: auto; max-width: 100%; }
.body-canvas svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; cursor: crosshair; touch-action: none; }
/* Beschriftung unter den Körperschemata bewusst entfernt (überlappte den Text darunter) */
.legend { font-size: .82em; color: var(--pico-muted-color); display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-top: .4rem; }

/* ---------- Smartphone ---------- */
.site-footer { padding-top: 0; padding-bottom: 5rem; text-align: right; font-size: .85em; }
@media (max-width: 576px) {
  :root { --pico-spacing: .75rem; }
  body > header.container { padding-top: .25rem; padding-bottom: 0; }
  body > header nav { flex-wrap: wrap; }
  body > header nav > ul:first-child { width: 100%; }
  body > header nav > ul:last-child { width: 100%; justify-content: space-between; margin: 0; }
  body > header nav > ul:last-child > li { padding: .35rem .2rem; font-size: .95em; }
  body > header nav details.dropdown summary { padding: .3rem .6rem; height: auto; }
}

/* Checkbox-Text neben der Box, Folgezeilen eingerückt */
.fld.chk label { display: flex; gap: .5rem; align-items: flex-start; }
.fld.chk input[type=checkbox] { flex: 0 0 auto; margin-top: .15rem; }

@media (max-width: 576px) {
  .hide-sm { display: none !important; }
  h1 { font-size: 1.6rem; }
  nav[aria-label=breadcrumb] li:last-child { display: none; }
  nav[aria-label=breadcrumb] { font-size: .9em; margin-bottom: .3rem; }
  article, .sec { padding: .8rem .75rem; margin-bottom: 1rem; }
  table.list { font-size: .88em; }
  table.list th, table.list td { padding: .35rem .3rem; }

  /* Formularzeilen: Eingaben volle Breite, Knöpfe darunter */
  .row > input, .row > select { flex-basis: 100%; }
  .row > button { flex: 1 1 auto; }
  .actions > * { flex: 1 1 auto; }
  .actions > form.inline button, .actions > a[role=button] { width: 100%; }
  .compare-pick .arrow { display: none; }

  /* Befund kompakter */
  .befund-head { gap: 0 .6rem; }
  .befund input:not([type=checkbox]):not([type=color]), .befund select, .befund textarea {
    padding: .45rem .6rem; font-size: .95rem; margin-bottom: .5rem; }
  .befund select { padding-right: 2rem; }
  .befund textarea { min-height: 3.2rem; }
  .fld label { margin-bottom: .1rem; }
  /* Abschnitts-Sprungmarken als eine wischbare Zeile */
  .toc { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .4rem; margin: .2rem 0 .6rem; scrollbar-width: thin; }
  .toc a { white-space: nowrap; flex: 0 0 auto; }
  /* Kleine Zahlenfelder (NRS) zu dritt nebeneinander */
  .fgrid { grid-template-columns: repeat(6, 1fr); }
  .fgrid > .fld { grid-column: span 6; }
  .fgrid > .fld.small { grid-column: span 2; }
  .fgrid:has(.chk) { grid-template-columns: 1fr; }
  .fgrid:has(.chk) > .fld { grid-column: auto; }
  .fld.small label { font-size: .78em; min-height: 2.1em; }
  /* Körperschema: drei Ansichten nebeneinander */
  .bodies { flex-wrap: nowrap; gap: .4rem; justify-content: space-between; }
  .body { height: 13rem; flex: 0 1 auto; }
  .body-canvas img { max-width: none; }
  .body-tools .sym { min-width: 2.3rem; padding: .2rem .35rem; }
  /* Speicherleiste schmal */
  .savebar { padding: .4rem .5rem; gap: .4rem; margin: 1rem -.75rem 0; }
  .savebar button { flex: 1 1 auto; padding: .5rem .6rem; font-size: .95rem; }
  .etable input, .etable select { min-width: 6.5rem; }
}

/* ---------- Patientendokumente ---------- */
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.doc { margin: 0; }
.doc-preview { display: flex; align-items: center; justify-content: center; height: 8.5rem; overflow: hidden;
               border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius);
               background: var(--pico-code-background-color); text-decoration: none; }
.doc-preview img { width: 100%; height: 100%; object-fit: cover; }
.doc-icon { font-weight: 700; font-size: 1.3rem; color: var(--pico-del-color); padding: .5rem; text-align: center; word-break: break-all; }
.doc figcaption { font-size: .85em; margin-top: .3rem; display: flex; flex-direction: column; gap: .1rem; position: relative; padding-right: 1.4rem; }
.doc figcaption form { position: absolute; right: 0; top: 0; }
.doc-form { display: grid; grid-template-columns: 2fr 1.5fr 1.2fr 9.5rem auto; gap: .5rem; align-items: start; }
.doc-form > * { margin: 0; }
@media (max-width: 768px) { .doc-form { grid-template-columns: 1fr 1fr; } .doc-form input[type=file] { grid-column: 1 / -1; } }
@media (max-width: 576px) { .docs { grid-template-columns: repeat(2, 1fr); } .doc-preview { height: 7rem; } }

/* Zusammenfassungen */
.summaries { padding-left: 0; }
.summaries li { list-style: none; margin: .35rem 0; display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.small-link, button.small-link { font-size: .85em; }
.session-head { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.session-actions { margin-left: auto; display: flex; gap: .3rem; }
.summary-preview { border-left: 4px solid #16a085; }
label.consent { display: flex; gap: .5rem; align-items: flex-start; font-size: .9em; }
label.consent input { flex: 0 0 auto; margin-top: .2rem; }
.maillog { font-size: .88em; padding-left: 0; margin-top: .8rem; }
.maillog li { list-style: none; }

/* ---------- Termine ---------- */
.appt-filter > input, .appt-filter > select { flex: 1 1 10rem; }
.appt-nav { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.appt-day h4 { margin-bottom: .5rem; }
.appt-day.today { border-left: 4px solid var(--pico-primary); }
.appt { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: baseline; padding: .4rem 0; border-bottom: 1px solid var(--pico-muted-border-color); }
.appt:last-child { border-bottom: 0; }
.appt-time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 6.5rem; }
.appt.cancelled { opacity: .6; }
.appt.cancelled .appt-time { text-decoration: line-through; }
.appt-actions { margin-left: auto; display: flex; gap: .6rem; align-items: baseline; }
.appt-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0 .8rem; margin-top: .6rem; }
.appt-fields .wide { grid-column: 1 / -1; }
.appt-fields label { font-size: .88em; }
.measure-picker { display: grid; gap: .35rem; }
.measure-picker > strong { margin-bottom: .15rem; }
.measure-choice { display: flex; align-items: flex-start; gap: .45rem; padding: .3rem .4rem; border: 1px solid var(--pico-muted-border-color); border-radius: .35rem; }
.measure-choice input { flex: 0 0 auto; margin: .2rem 0 0; }
.past-appts { font-size: .88em; }
.cal-share { display: flex; gap: 1.2rem; align-items: flex-start; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--pico-muted-border-color); }
.cal-share .qr { width: 9rem; height: 9rem; flex: 0 0 auto; background: #fff; border-radius: .3rem; }
.cal-share input { font-size: .8em; }
@media (max-width: 576px) { .cal-share { flex-direction: column; align-items: center; } .appt-time { min-width: 0; } .appt-actions { margin-left: 0; } }

/* ---------- Logo, Einstellungen ---------- */
.brand { display: inline-flex; align-items: center; gap: .5rem; }
.brand-logo { width: auto; height: 1.6rem; max-width: 6rem; max-height: 1.6rem; object-fit: contain; object-position: left center; flex: 0 1 auto; }
.settings-link { text-decoration: none; font-size: 1.15em; padding: .2rem .4rem; }
.settings-group summary { font-size: 1.15rem; font-weight: 600; }
.setting { margin-bottom: 1.1rem; }
.setting .help { display: block; font-size: .82em; color: var(--pico-muted-color); margin-top: -.3rem; margin-bottom: .3rem; }
.setting .default { font-size: .78em; color: var(--pico-muted-color); }
.setting .default summary { font-size: 1em; }
.setting .default pre { white-space: pre-wrap; font-size: .95em; padding: .4rem .6rem; margin: .2rem 0 0; }
.custom-badge { font-size: .72em; padding: .05rem .4rem; border-radius: .3rem; background: var(--pico-primary-focus); margin-left: .4rem; }
.logo-preview { width: auto; height: 4rem; max-width: 12rem; max-height: 4rem; object-fit: contain; background: #fff; padding: .3rem; border-radius: .3rem; }
.placeholders code { font-size: .85em; }
.appt-rows input.num { width: 5rem; }
.appt-rows td { min-width: 6rem; }
.appt-bulk-actions { align-items: center; margin-top: .3rem; }
.small-label { font-size: .85em; display: flex; gap: .4rem; align-items: center; flex: 1 1 14rem; }
.small-label input { margin: 0; }

/* ---------- Benutzer, Passkeys ---------- */
.passkeys { padding-left: 0; }
.passkeys li { list-style: none; margin: .35rem 0; }
tr.inactive td { opacity: .55; }
.setup-link { border-left: 4px solid var(--pico-ins-color); }
.passkey-login { text-align: center; margin-top: 1rem; }
.passkey-login button { width: 100%; }

/* ---------- Test von einem Patienten entfernen ---------- */
.confirm-box { border-left: 4px solid var(--pico-del-color); background: var(--pico-code-background-color);
               padding: .8rem 1rem; border-radius: var(--pico-border-radius); margin: 0 0 .8rem; }
.confirm-box p { margin: 0 0 .6rem; }
a.remove-test { display: inline-block; margin-left: .4rem; padding: 0 .3rem; text-decoration: none;
                color: var(--pico-muted-color); border-radius: .3rem; }
a.remove-test:hover, a.remove-test:focus { color: var(--pico-del-color); }

/* ---------- Installationshinweis (PWA) ---------- */
.install-hint { font-size: .85em; margin-top: .8rem; }

/* ---------- Zwei-Faktor-Anmeldung ---------- */
.tosetup { display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: flex-start; margin: 1rem 0; }
.tosetup .qr { background: #fff; border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius); padding: .4rem; }
.tosetup .secret { font-size: 1.05em; letter-spacing: .1em; word-break: break-all; }
.ok-block { border-left: 4px solid var(--pico-ins-color); background: var(--pico-code-background-color); padding: .8rem 1rem; margin-top: 1rem; border-radius: var(--pico-border-radius); }
.ok-block h4 { margin: 0 0 .4rem; }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .3rem .8rem; padding-left: 0; margin: .6rem 0 0; }
.codes li { list-style: none; font-size: 1.05em; letter-spacing: .06em; }

/* ---------- Fragebögen (Punkteskala) ---------- */
.q-list { display: flex; flex-direction: column; gap: .5rem; }
.fragebogen { border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius); padding: .5rem .8rem; }
.fragebogen summary { font-weight: 600; cursor: pointer; }
.qsum { color: var(--pico-primary); }
.prev { font-size: .85em; color: var(--pico-muted-color); border-left: 3px solid var(--pico-primary-border); padding-left: .5rem; margin: .3rem 0; }
.q-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: .4rem 1rem; margin-top: .5rem; }
.q-item { display: flex; align-items: center; gap: .5rem; font-size: .95em; }
.q-item input[type=number] { width: 5rem; margin: 0; }
.q-note { display: block; margin-top: .5rem; font-size: .92em; }
.q-note input { margin-top: .2rem; }
.q-def { margin: .3rem 0; }
.fragebogen-editor { border: 1px dashed var(--pico-muted-border-color); padding: .8rem 1rem; border-radius: var(--pico-border-radius); }
.fragebogen-editor .tablewrap { margin-top: .5rem; }
.fragebogen-editor table.etable input.num { width: 6rem; }
/* Druck-Zusammenfassung */
.qb { margin: .2rem 0 .5rem; }

/* ---------- Demo-Banner (Einwilligung zur Statistik) ---------- */
.demo-consent { position: fixed; z-index: 60; left: 1rem; right: 1rem; bottom: 1rem;
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between;
  background: var(--pico-card-background-color); border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius); box-shadow: var(--pico-card-box-shadow);
  padding: .9rem 1.2rem; max-width: 44rem; margin: 0 auto; }
.demo-consent p { margin: .3rem 0 0; font-size: .9em; }
.demo-consent-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.demo-consent button { width: auto; margin: 0; }
.demo-box { border: 1px solid var(--pico-primary-border); background: var(--pico-primary-focus); padding: .8rem 1.2rem; border-radius: var(--pico-border-radius); margin-bottom: 1rem; }
.demo-box h2 { margin-bottom: .3rem; }
.fld.dep-hidden { display: none !important; }

/* Körperschema: kein Scrollen/Selektieren beim Zeichnen, große Pfeile */
.body-canvas { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.body-tools .arrow { width: 2.8rem; height: 2.8rem; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.body-tools .arrow svg { pointer-events: none; display: block; }

/* Stempel-Werkzeuge: Text und Pfeile immer gut sichtbar */
.body-tools .mode, .body-tools .arrow { color: #222; border-color: #888; background: #fff; }
.body-tools .mode.active { color: #fff; background: var(--pico-primary); border-color: var(--pico-primary); }
.body-tools .arrow svg { display: block; }
.body-tools .arrow svg path { fill: #222; }
.sym-preview { font-size: 1.4rem; text-align: center; min-width: 3rem; }

/* Testsuche im Befund */
.q-add { margin: 0 0 .8rem; position: relative; }
.q-add input[type="search"] { width: 100%; max-width: 32rem; }
.suggest { position: absolute; z-index: 20; list-style: none; margin: .2rem 0 0; padding: .2rem;
           background: var(--pico-card-background-color, #fff); border: 1px solid var(--pico-muted-border-color, #ccc);
           border-radius: .35rem; max-height: 18rem; overflow: auto; width: 100%; max-width: 32rem;
           box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.suggest li { margin: 0; }
.suggest-item { display: block; width: 100%; text-align: left; background: none; border: 0;
                padding: .35rem .5rem; cursor: pointer; color: inherit; }
.suggest-item:hover, .suggest-item:focus, .suggest-item.active { background: var(--pico-primary-focus, #eef2f7); }
.suggest-hint { padding: .35rem .5rem; font-size: .85em; margin: 0; }
.q-remove { margin: .6rem 0 0; }
button.small { padding: .2rem .5rem; font-size: .8rem; }

/* ---------- Testverlauf ---------- */
.chartwrap { margin: .6rem 0 .4rem; }
.chartwrap svg.chart { display: block; width: 100%; height: auto; max-height: 16rem; }
.chart-meta p { margin: .2rem 0; }
.spark { display: inline-block; vertical-align: middle; }
.spark svg.chart { display: block; }
.trend { font-size: .82em; font-weight: 600; white-space: nowrap; }
.trend-good { color: var(--pico-ins-color); }
.trend-bad { color: var(--pico-del-color); }
.trend-neutral, .trend-flat { color: var(--pico-muted-color); }
@media (max-width: 576px) { .chartwrap svg.chart { max-height: 12rem; } }

/* ---------- Grundgerüst: Kopfzeile, Sidebar, Inhalt ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: .55rem 1.25rem; border-bottom: 1px solid var(--pico-muted-border-color); background: var(--pico-card-background-color); }
.topbar .brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; }
.topbar .brand-logo { width: auto; max-height: 1.8rem; }
.topbar-search { flex: 1 1 18rem; max-width: 28rem; margin: 0; }
.topbar-search input { margin: 0; }
.theme-toggle-form { margin: 0; display: flex; }
.theme-toggle-form .icon-moon { display: inline; }
.theme-toggle-form .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle-form .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle-form .icon-sun { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle-form .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle-form .icon-sun { display: inline; }
}
.topbar-menu { display: none; }
.icon-btn { width: auto; margin: 0; padding: .35rem .5rem; background: transparent; border: 1px solid var(--pico-muted-border-color); }
/* Pico setzt auf Buttons --pico-color auf die helle Button-Schrift; die Icon-Knöpfe
   sollen stattdessen der Textfarbe ihrer Umgebung folgen. */
button.icon-btn, button.icon-btn svg { color: inherit; }
button.icon-btn:hover { background: var(--pico-primary-focus); }
.sidebar-toggle-form button, .sidebar-toggle-form button svg { color: inherit; opacity: .7; }
.sidebar-toggle-form button:hover, .sidebar-toggle-form button:hover svg { opacity: 1; }
.shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); align-items: start; min-height: calc(100vh - 3rem); }
.sidebar { position: sticky; top: 0; align-self: start; display: flex; flex-direction: column; min-height: calc(100vh - 3rem); max-height: calc(100vh - 3rem); overflow-y: auto; padding: 1rem .6rem 1.5rem; border-right: 1px solid var(--pico-muted-border-color); background: var(--pico-card-background-color); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 0 .3rem .55rem; margin-bottom: .45rem; border-bottom: 1px solid var(--pico-muted-border-color); }
.sidebar-title { font-size: .78em; letter-spacing: .05em; text-transform: uppercase; color: var(--pico-muted-color); }
.sidebar-head .sidebar-toggle-form button { width: auto; padding: .2rem .35rem; }
.sidebar nav ul { list-style: none; margin: 0; padding: 0; }
.sidebar nav a { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border-radius: .45rem; text-decoration: none; color: var(--pico-color); font-size: .95em; }
.sidebar nav a:hover { background: var(--pico-primary-focus); }
.sidebar nav a[aria-current="page"] { background: var(--pico-primary-focus); font-weight: 600; color: var(--pico-primary); }
.sidebar nav svg { flex: 0 0 auto; }
.sidebar .new-area { margin-top: 1rem; }
.sidebar .new-area summary { font-size: .9em; }
.sidebar .new-area ul { list-style: none; margin: .3rem 0 0; padding: 0; }
.sidebar .new-area a { display: block; padding: .25rem .6rem; font-size: .88em; text-decoration: none; }
.sidebar-foot { margin-top: auto; padding-top: .75rem; }
.sidebar-admin { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border: 1px solid var(--pico-primary); border-radius: .45rem; color: var(--pico-primary); font-weight: 600; text-decoration: none; }
.sidebar-admin:hover, .sidebar-admin[aria-current="page"] { background: var(--pico-primary-focus); }
.sidebar-admin svg { flex: 0 0 auto; }
body.sidebar-collapsed .sidebar-admin { justify-content: center; padding-inline: .3rem; }
.therapist-checklist { border: 0; padding: 0; margin: 0; }
.therapist-checklist legend { font-size: .88em; margin-bottom: .35rem; }
.therapist-options { display: flex; flex-wrap: wrap; gap: .35rem .9rem; }
.therapist-options label { display: inline-flex; align-items: center; gap: .35rem; width: auto; margin: 0; padding: .25rem .4rem; border-radius: .35rem; cursor: pointer; }
.therapist-options label:has(input:checked) { background: var(--pico-primary-focus); }
.therapist-options input[type="checkbox"] { width: auto; margin: 0; }
.sidebar-toggle-form { margin: 0; }
.sidebar-toggle-form button { width: auto; justify-content: flex-start; background: transparent; border: none; color: var(--pico-muted-color); font-size: .85em; padding: .3rem .6rem; }
.sidebar-toggle-form button:hover { color: var(--pico-color); background: var(--pico-primary-focus); }
.main { padding: 1.25rem 1.5rem 3rem; min-width: 0; }
body.sidebar-collapsed .shell { grid-template-columns: 3.9rem minmax(0, 1fr); }
body.sidebar-collapsed .sidebar .label,
body.sidebar-collapsed .sidebar .new-area,
body.sidebar-collapsed .sidebar-toggle-form button .label { display: none; }
body.sidebar-collapsed .sidebar nav a { justify-content: center; padding: .5rem .3rem; }
body.sidebar-collapsed .sidebar-title { display: none; }
body.sidebar-collapsed .sidebar-head { justify-content: center; }
body.sidebar-collapsed .sidebar-toggle-form button { justify-content: center; }
.site-footer { padding: .75rem 1.5rem; border-top: 1px solid var(--pico-muted-border-color); display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; font-size: .9em; }
.site-footer form { margin: 0; }
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 16rem; z-index: 40; min-height: 100vh; transform: translateX(-102%); transition: transform .18s ease; box-shadow: 0 0 2rem rgba(0,0,0,.25); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-collapsed .shell { grid-template-columns: minmax(0, 1fr); }
  body.sidebar-collapsed .sidebar .label,
  body.sidebar-collapsed .sidebar .new-area { display: block; }
  .main { padding: 1rem .9rem 2.5rem; }
  .topbar-search { display: none; }
  .topbar-menu { display: inline-flex; }
  .topbar { padding: .5rem .9rem; }
}

/* ---------- Übersicht (Dashboard) ---------- */
.dash-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.dash-head h1 { margin: 0; }
.dash-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.dash-actions a[role="button"] { margin: 0; }
.dash-search { margin: .75rem 0 1rem; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; }
.dash-grid article { margin: 0; }
.dash-grid h2 { font-size: 1.1rem; margin-bottom: .3rem; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: .35rem 0; border-bottom: 1px solid var(--pico-muted-border-color); display: flex; gap: .5rem; flex-wrap: wrap; align-items: baseline; }
.plain li:last-child { border-bottom: none; }
.plain .when { color: var(--pico-muted-color); font-size: .85em; white-space: nowrap; }
.small { font-size: .88em; }
.dash-cal { margin: 0 0 1.25rem; }
.dash-cal-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; justify-content: space-between; }
.dash-cal-head h2 { margin: 0; }

/* ---------- Kalender ---------- */
.cal-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.cal-head h1 { margin: 0; }
.cal-nav { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: .5rem 0 1rem; }
.cal-nav strong { font-size: 1.05em; }
.cal-jump { display: flex; gap: .35rem; align-items: center; margin: 0; }
.cal-jump input[type=date] { width: auto; margin: 0; padding: .1rem .3rem; border: 1px solid transparent;
  background: transparent; color: inherit; font-size: 1.05rem; font-weight: 600; border-radius: .35rem; }
.cal-jump input[type=date]:hover, .cal-jump input[type=date]:focus { border-color: var(--pico-muted-border-color); background: var(--pico-card-background-color); }
.cal-jump .cal-week-end { font-size: 1.05rem; font-weight: 600; color: var(--pico-muted-color); }
.cal-filter { margin-bottom: .75rem; }
.cal-filter select { max-width: 16rem; }
.seg { display: inline-flex; border: 1px solid var(--pico-muted-border-color); border-radius: .45rem; overflow: hidden; }
.seg a { padding: .35rem .8rem; text-decoration: none; font-size: .9em; }
.seg a[aria-current="page"] { background: var(--pico-primary); color: var(--pico-primary-inverse); }
.calwrap { overflow-x: auto; max-width: 1300px; margin-inline: auto; border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius); background: var(--pico-card-background-color); }
.cal-svg { display: block; width: 100%; min-width: 620px; height: auto; }
.cal-svg text { font-family: var(--pico-font-family); }
/* Langdruck auf Touchgeräten öffnet das eigene Menü statt der Safari-Auswahl. */
.cal-svg, .cal-week { -webkit-touch-callout: none; }
.cal-svg { -webkit-user-select: none; user-select: none; }
.cal-svg .cal-line { stroke: var(--pico-muted-border-color); stroke-width: .6; }
.cal-svg .cal-hour { stroke: var(--pico-muted-border-color); stroke-width: 1; }
.cal-svg .cal-time { font-size: 11px; fill: var(--pico-muted-color); }
.cal-svg .cal-gutter-hl { fill: var(--pico-primary); opacity: 0; pointer-events: none; transition: opacity .12s ease; }
.cal-svg .cal-link:hover .cal-gutter-hl,
.cal-svg .cal-link:focus-visible .cal-gutter-hl { opacity: .22; }
/* Schnellzugriffe oben rechts, sichtbar beim Überfahren des Termins. */
.cal-svg .cal-actions .cal-patient,
.cal-svg .cal-actions .cal-delete { opacity: 0; pointer-events: none; transition: opacity .12s ease; }
.cal-svg .cal-link:hover + .cal-actions .cal-patient,
.cal-svg .cal-link:hover + .cal-actions .cal-delete,
.cal-svg .cal-actions .cal-patient:hover,
.cal-svg .cal-actions .cal-delete:hover,
.cal-svg .cal-actions .cal-patient:focus-visible,
.cal-svg .cal-actions .cal-delete:focus-visible { opacity: 1; pointer-events: all; }
.cal-svg .cal-actions .cal-patient circle { fill: var(--pico-primary); stroke: var(--pico-primary-inverse); stroke-width: 1; }
.cal-svg .cal-actions .cal-delete circle { fill: var(--pico-del-color); stroke: var(--pico-primary-inverse); stroke-width: 1; }
.cal-svg .cal-actions text { fill: var(--pico-primary-inverse); font-size: 9px; font-weight: 700; }
.cal-svg .cal-colhead { font-size: 12px; font-weight: 600; fill: var(--pico-color); }
.cal-svg .cal-colsep { stroke: var(--pico-muted-border-color); stroke-width: .8; }
.cal-svg .cal-block rect { fill: var(--pico-card-background-color); stroke: var(--pico-primary); stroke-width: 1.2; }
.cal-svg .cal-block text { fill: var(--pico-color); font-size: 10px; }
.cal-svg .cal-block .cal-bname { font-weight: 600; font-size: 11px; }
.cal-svg .cal-cancelled rect { stroke-dasharray: 4 3; fill: transparent; }
.cal-svg .cal-cancelled text { text-decoration: line-through; opacity: .7; }
.cal-svg .cal-conflict rect { stroke: var(--pico-del-color); stroke-width: 2; }
.cal-svg .cal-blocked rect { fill: var(--pico-code-background-color); stroke: var(--pico-muted-color); stroke-dasharray: 5 3; }
.cal-svg .cal-blocked text { font-style: italic; }
.cal-svg .cal-now { stroke: var(--pico-del-color); stroke-width: 1.4; stroke-dasharray: 6 4; }
.cal-svg a { cursor: pointer; }
.cal-svg .cal-drag { opacity: .45; }
.cal-legend { font-size: .82em; margin-top: .4rem; }
.cal-menu { position: fixed; z-index: 80; min-width: 12rem; padding: .25rem; border-radius: .45rem;
  background: var(--pico-card-background-color); border: 1px solid var(--pico-muted-border-color);
  box-shadow: var(--pico-card-box-shadow); display: flex; flex-direction: column; }
.cal-menu button { width: 100%; margin: 0; padding: .45rem .6rem; text-align: left; background: none; border: 0;
  border-radius: .3rem; color: inherit; font-size: .9em; cursor: pointer; }
.cal-menu button:hover, .cal-menu button:focus-visible { background: var(--pico-primary-focus); color: var(--pico-primary); }
.cal-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin: 0 .2rem 0 .6rem; vertical-align: middle; }
.cal-dot.cancelled { border: 2px dashed var(--pico-muted-color); }
.cal-dot.conflict { border: 2px solid var(--pico-del-color); }
.cal-editor { margin-top: 1rem; }
.cal-editor h2 { font-size: 1.2rem; }
.cal-quick { display: flex; flex-wrap: wrap; gap: .35rem; margin: .25rem 0 .75rem; }
.cal-quick form { margin: 0; }
.cal-week { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .75rem; }
.cal-week article { margin: 0; padding: .8rem; }
.cal-week h3 { font-size: 1rem; margin-bottom: .4rem; }
.cal-week .today { border-color: var(--pico-primary); }
.cal-card { display: block; position: relative; padding: .35rem .5rem; margin-bottom: .35rem; border-radius: .35rem; border: 1px solid var(--pico-muted-border-color); text-decoration: none; font-size: .9em; }
.cal-card:hover { border-color: var(--pico-primary); }
.cal-card.cancelled { text-decoration: line-through; opacity: .7; }
.cal-card strong { display: block; }
.cal-card-body { display: block; text-decoration: none; color: inherit; padding-right: 1.2rem; }
.cal-card-edit { display: inline-block; margin-top: .25rem; color: var(--pico-primary); font-size: .78em; font-weight: 600; }
.patient-pages { display: flex; align-items: center; justify-content: center; gap: .75rem; margin: .75rem 0 1.25rem; }
.patient-pages [aria-disabled="true"] { pointer-events: none; opacity: .45; }
[data-patient-list][aria-busy="true"] { opacity: .6; }
.patient-pages [data-patient-page-label] { min-width: 10rem; text-align: center; font-size: .9em; }
.admin-auth-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; }
.admin-auth-actions label { flex: 1 1 12rem; }
.cal-card-patient { position: absolute; top: .15rem; right: .25rem; padding: .1rem .25rem; border-radius: .25rem; text-decoration: none; font-size: .95em; line-height: 1; color: var(--pico-muted-color); }
.cal-card-patient:hover, .cal-card-patient:focus-visible { background: var(--pico-primary-focus); color: var(--pico-primary); }
.cal-card.blocked { border-style: dashed; }
.block-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0 .8rem; margin-top: .6rem; }
.block-fields .wide { grid-column: 1 / -1; }
.block-fields label { font-size: .88em; }
.block-fields select[multiple] { min-height: 5rem; }
.cal-card-delete { position: absolute; top: .15rem; right: 1.6rem; padding: .1rem .25rem; border-radius: .25rem; text-decoration: none; font-size: .95em; line-height: 1; color: var(--pico-muted-color); }
.cal-card-delete:hover, .cal-card-delete:focus-visible { background: var(--pico-card-background-color); color: var(--pico-del-color); }
.cal-card .cal-card-time { color: var(--pico-muted-color); font-size: .85em; }

/* Ganztägige Einträge: Band über dem Zeitraster */
.cal-band rect { fill: var(--pico-secondary-background, #d8e2ef); stroke: var(--pico-secondary, #7f8ea3); stroke-width: 1; }
.cal-band-blocked rect { fill: #e6e0f5; stroke: #7c6bb0; }
.cal-band-note rect { fill: #fff3d6; stroke: #b08948; }
.cal-bandtext { font-size: 11px; fill: var(--pico-color, #1c1c1c); }
.cal-band .cal-bandtext { pointer-events: none; }
.cal-card.allday { border-left: 3px solid var(--pico-secondary, #7f8ea3); }
.cal-card.allday.blocked { border-left-color: #7c6bb0; }
.cal-card.allday.note { border-left-color: #b08948; }
/* Ganztägig: Uhrzeit/Dauer ausblenden, solange das Häkchen gesetzt ist – reines CSS,
   damit die Formulare auch ohne JavaScript funktionieren. */
.when-row { display: contents; }
form:has([data-allday-toggle]:checked) [data-when="timed"] { display: none; }
form:not(:has([data-allday-toggle]:checked)) [data-when="allday"] { display: none; }

/* Schnell-Anlage („+ Neu“): Dialog auf jeder Seite */
dialog.quick { width: min(38rem, 94vw); padding: 1rem 1.1rem 1.2rem; border: 1px solid var(--pico-muted-border-color); border-radius: .6rem; }
dialog.quick::backdrop { background: rgb(0 0 0 / .45); }
.quick-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 0 0 .6rem; }
.quick-head h2 { margin: 0; font-size: 1.1rem; }
.quick-tabs { display: flex; gap: .3rem; margin: 0 0 .9rem; }
.quick-tabs button { flex: 1; padding: .4rem .5rem; font-size: .9rem; background: var(--pico-secondary-background); color: var(--pico-secondary-inverse, inherit); border: 1px solid transparent; }
.quick-tabs button[aria-selected="true"] { background: var(--pico-primary); color: var(--pico-primary-inverse); }
.quick-pane[hidden] { display: none; }
.quick-pane { margin: 0; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .8rem; align-items: end; }
.quick-grid > label { margin: 0; font-size: .88em; }
.quick-grid > label.wide, .quick-grid > .when-row.wide, .quick-grid > fieldset.wide { grid-column: 1 / -1; }
.quick-grid input, .quick-grid select { margin-bottom: 0; }
.quick-grid label.consent { display: flex; align-items: center; gap: .35rem; font-size: .88em; }
.quick-actions { display: flex; justify-content: flex-end; margin-top: .9rem; }
.quick-hint { color: var(--pico-del-color); font-size: .85em; margin: .4rem 0 0; }
@media (max-width: 32rem) { .quick-grid { grid-template-columns: 1fr; } }

/* Verordnungen und abrechnungsfähige Wert-Snapshots */
.prescription-summary .grid { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .25rem .8rem; }
.prescription-summary .grid p { margin: .2rem 0; }
.prescription-measures { display: grid; gap: .7rem; }
.prescription-measure { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .45rem .7rem; padding: .7rem; border: 1px solid var(--pico-muted-border-color); border-radius: .4rem; }
.prescription-measure label { margin: 0; font-size: .88em; }
.prescription-details { display: grid; grid-template-columns: minmax(9rem, .35fr) 1fr; gap: .25rem .7rem; }
.prescription-details dt { font-weight: 700; }
.prescription-details dd { margin: 0; }
