/* Kompendium – App-Oberfläche. Mobil zuerst, große Touch-Ziele, Tag/Nacht. */
:root {
  --bg: #f5f7f9;
  --karte: #ffffff;
  --text: #14181d;
  --leise: #5b6570;
  --linie: #d7dde3;
  --flaeche: #eef1f4;
  --akzent: #0f2a43;
  --akzent-text: #ffffff;
  --rot: #c62828;
  --rot-flaeche: #fdecea;
  --warn: #8a5a00;
  --warn-flaeche: #fff4d6;
  --gruen: #1b6e3a;
  --gruen-flaeche: #e3f4e8;
  --markiert: #fff3b0;
  --schatten: 0 1px 2px rgba(15, 42, 67, .08), 0 2px 8px rgba(15, 42, 67, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --karte: #161b22; --text: #e6edf3; --leise: #9aa7b4; --linie: #2d3640; --flaeche: #1f2630;
    --akzent: #1c3d5e; --rot: #ff6b6b; --rot-flaeche: #3a1d1d; --warn: #ffcf66; --warn-flaeche: #3a2e10;
    --gruen: #7ee2a0; --gruen-flaeche: #15301f;
    --markiert: #4a4110; --schatten: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --karte: #161b22; --text: #e6edf3; --leise: #9aa7b4; --linie: #2d3640; --flaeche: #1f2630;
  --akzent: #1c3d5e; --rot: #ff6b6b; --rot-flaeche: #3a1d1d; --warn: #ffcf66; --warn-flaeche: #3a2e10;
  --gruen: #7ee2a0; --gruen-flaeche: #15301f;
  --markiert: #4a4110; --schatten: none; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* auch bei Klassen mit eigener display-Regel (z. B. .felder) */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "tnum" 1;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
a { color: inherit; }
button { font: inherit; }

/* ---------- Kopfzeile */
.kopf {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--akzent); color: var(--akzent-text);
}
.marke { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; flex: none; }
.logo { width: 34px; height: 34px; flex: none; display: block; border-radius: 9px; box-shadow: 0 0 0 1px rgba(255,255,255,.28); }
.marke-text { font-weight: 800; letter-spacing: -.01em; }
.suche-feld { flex: 1; min-width: 0; }
#suche {
  width: 100%; height: 40px; border-radius: 10px; border: 0; padding: 0 12px;
  font: inherit; font-size: 16px; background: rgba(255,255,255,.14); color: #fff; outline: none;
}
#suche::placeholder { color: rgba(255,255,255,.7); }
#suche:focus { background: #fff; color: #14181d; }
.knopf {
  min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--linie);
  background: var(--karte); color: var(--text); cursor: pointer; font-weight: 600;
}
.kopf .knopf { background: rgba(255,255,255,.14); border-color: transparent; color: #fff; }
.knopf.rund { width: 40px; padding: 0; }
.sprache-knopf { font-size: 13px; font-weight: 800; letter-spacing: .03em; flex: none; }
.knopf.gewicht { white-space: nowrap; }
.knopf.gewicht.aktiv { background: #fff; color: var(--akzent); }
.knopf.primaer { background: var(--akzent); color: #fff; border-color: var(--akzent); }
.knopf:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 560px) {
  .marke-text { display: none; }
}

.probe-banner { background: var(--navy, #0f2a43); color: #fff; font-size: 14px; font-weight: 700; text-align: center; padding: 8px 12px; }
.probe-banner a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.probe-banner a:hover { color: #ffd7d7; }
.lizenz-banner { background: var(--warn-flaeche); color: var(--warn); font-size: 14px; font-weight: 600; text-align: center; padding: 8px 12px; border-bottom: 1px solid var(--linie); }
/* Englische Ausgabe: Übersetzungshinweise oben auf Inhaltsseiten (Stil wie die Info-Banner) */
.uebersetzung { display: grid; gap: 6px; margin: 0 0 12px; }
.uebersetzung-hinweis { margin: 0; padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; line-height: 1.4;
  background: var(--flaeche); color: var(--leise); border-left: 4px solid var(--linie); }
.uebersetzung-hinweis.fehlt { background: var(--warn-flaeche); color: var(--warn); border-left-color: var(--warn); font-size: 14px; }
.uebersetzung-hinweis.entwurf { background: var(--rot-flaeche); color: var(--rot); border-left-color: var(--rot); font-size: 14px; }
.entwurf-banner { background: #b71c1c; color: #fff; font-size: 13px; font-weight: 700; text-align: center; padding: 6px 12px; }

/* ---------- Suchtreffer */
.treffer {
  position: sticky; top: 56px; z-index: 19; max-height: 70vh; overflow: auto;
  background: var(--karte); border-bottom: 1px solid var(--linie); box-shadow: var(--schatten);
}
.treffer a { display: block; padding: 10px 16px; text-decoration: none; border-bottom: 1px solid var(--linie); }
.treffer a:focus, .treffer a.aktiv { background: var(--flaeche); outline: none; }
.treffer .t-titel { font-weight: 700; }
.treffer .t-info { font-size: 13px; color: var(--leise); }
.treffer mark { background: var(--markiert); color: inherit; border-radius: 2px; }
.treffer .leer { padding: 16px; color: var(--leise); }

/* ---------- Hauptbereich */
main { max-width: 860px; margin: 0 auto; padding: 16px; outline: none; }
.leise { color: var(--leise); }

.schnell { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 0 0 22px; }
.schnell a {
  display: flex; flex-direction: column; justify-content: flex-end; min-height: 84px; padding: 12px;
  border-radius: 14px; text-decoration: none; color: #fff; font-weight: 800; line-height: 1.2;
  background: var(--farbe); box-shadow: var(--schatten);
}
.schnell a small { font-weight: 600; opacity: .85; }
.schnell a.buch-kachel { justify-content: space-between; gap: 6px; color: #0f2a43; background: linear-gradient(135deg, #fff6d6, #ffe08a);
  border: 2px solid #e0b43a; }
.schnell a.buch-kachel svg { width: 26px; height: 26px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.schnell a.buch-kachel span { display: flex; flex-direction: column; min-width: 0; }
.schnell a.buch-kachel small { font-weight: 600; opacity: .8; }
.abschnitt-titel { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--leise); margin: 22px 0 8px; font-weight: 700; }
.kapitel-liste { display: grid; gap: 8px; }
.kapitel-liste a {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; text-decoration: none;
  background: var(--karte); box-shadow: var(--schatten); border: 1px solid var(--linie);
}
.kapitel-liste .nr { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-weight: 800; background: var(--farbe); flex: none; }
.kapitel-liste .anzahl { margin-left: auto; color: var(--leise); font-size: 14px; }

/* ---------- Seiten */
.seitenkopf { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 14px; color: var(--leise); }
.seitenkopf .streifen { width: 6px; align-self: stretch; border-radius: 3px; background: var(--farbe); }
.seitenkopf a { text-decoration: none; font-weight: 600; }
.favorit { margin-left: auto; background: none; border: 0; font-size: 24px; cursor: pointer; color: var(--leise); min-width: 44px; min-height: 44px; }
.favorit.an { color: #f5a400; }

article { background: var(--karte); border-radius: 16px; padding: 18px; box-shadow: var(--schatten); border: 1px solid var(--linie); }
article h1 { font-size: 24px; line-height: 1.2; margin: 0 0 14px; letter-spacing: -.01em; }
article h2 { font-size: 19px; margin: 24px 0 8px; }
article h3 { font-size: 16px; margin: 18px 0 6px; }
blockquote.sofort { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: var(--rot-flaeche); border-left: 6px solid var(--rot); }
blockquote.sofort p { margin: 0; }

.tabelle-rahmen { overflow-x: auto; margin: 0 0 16px; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { border: 1px solid var(--linie); padding: 7px 8px; text-align: left; vertical-align: top; }
thead th { background: var(--flaeche); }
.tab-titel { font-weight: 700; padding: 0 0 6px; }
.tab-titel small, th small { font-weight: 500; color: var(--leise); }
.gewichtstabelle td, .gewichtstabelle thead th { text-align: center; }
.gewichtstabelle tbody th { white-space: nowrap; }
tr.markiert td, tr.markiert th { background: var(--markiert) !important; }
.ml { color: var(--leise); }
.max { font-size: 11px; font-weight: 800; color: var(--warn); }

.dosisbox { border: 1px solid var(--linie); border-radius: 12px; padding: 10px 12px 2px; margin: 0 0 14px; }
.dosisbox-kopf { font-weight: 700; margin-bottom: 4px; }
.dosisbox-kopf a { color: var(--akzent); }
:root[data-theme="dark"] .dosisbox-kopf a { color: #8cc4ff; }
.dosisbox-kopf span { font-weight: 500; color: var(--leise); }
.dosen { list-style: none; padding: 0; margin: 0 0 8px; }
.dos { margin: 0 0 8px; padding-left: 16px; position: relative; }
.dos::before { content: "▸"; position: absolute; left: 0; color: var(--rot); }
.dos-zusatz { color: var(--leise); font-size: 14px; }
.dos-rechner { margin-top: 4px; padding: 6px 10px; border-radius: 8px; background: var(--markiert); font-size: 15px; }
.dos-rechner small { display: block; color: var(--leise); font-size: 12px; }
.hinweis { background: var(--flaeche); padding: 8px 10px; border-radius: 8px; font-size: 15px; }
.warnung { background: var(--warn-flaeche); color: var(--warn); font-weight: 700; padding: 8px 10px; border-radius: 8px; }
sup.q { font-size: 11px; color: var(--leise); margin-left: 2px; }
.namen { margin: 2px 0 0; color: var(--leise); }
.klasse { margin: 2px 0 12px; font-weight: 600; }
.med-kopf h2 { font-size: 24px; margin: 0; }
.zubereitungen span { font-weight: 700; }
.seiten-fuss { margin-top: 20px; padding-top: 10px; border-top: 1px solid var(--linie); font-size: 12px; color: var(--leise); }
.entwurf { color: var(--rot); font-weight: 800; }
.marke-druck { display: none; }

.blaettern { display: flex; justify-content: space-between; gap: 10px; margin: 14px 0; }
.blaettern a { flex: 1; padding: 12px; border-radius: 12px; background: var(--karte); border: 1px solid var(--linie); text-decoration: none; font-weight: 600; }
.blaettern a.weiter { text-align: right; }
.blaettern small { display: block; color: var(--leise); font-weight: 500; }

/* ---------- Rechner */
.rechner-karte { background: var(--karte); border: 1px solid var(--linie); border-radius: 16px; padding: 16px; margin: 0 0 14px; box-shadow: var(--schatten); }
.rechner-karte h2 { margin: 0 0 4px; font-size: 18px; }
.rechner-warnung { background: var(--warn-flaeche); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 0 0 14px; }
.felder { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 10px 0; }
.felder label { display: grid; gap: 4px; font-size: 14px; color: var(--leise); }
.felder input, .felder select { width: 100%; min-width: 0; height: 44px; border-radius: 10px; border: 1px solid var(--linie); padding: 0 10px; font: inherit; background: var(--bg); color: var(--text); }
.felder textarea { width: 100%; min-width: 0; border-radius: 10px; border: 1px solid var(--linie); padding: 10px; font: inherit; font-size: 16px; line-height: 1.4; background: var(--bg); color: var(--text); resize: vertical; }
.ergebnis { background: var(--flaeche); border-radius: 10px; padding: 10px 12px; font-size: 15px; }
.ergebnis strong { font-size: 18px; }
.installieren { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 6px 0 10px; }
.installieren img { border-radius: 10px; border: 1px solid var(--linie); background: #fff; }
.installieren p { flex: 1; min-width: 200px; margin: 0; }
.app-adresse { word-break: break-all; }
.anleitung { border: 1px solid var(--linie); border-radius: 12px; padding: 8px 12px; margin: 8px 0; }
.anleitung summary { font-weight: 700; cursor: pointer; }
.anleitung ol { margin: 8px 0 4px; padding-left: 20px; }
.anleitung li { margin: 4px 0; }
.hinweis-persoenlich { background: var(--warn-flaeche); color: var(--text); border-left: 5px solid var(--warn); border-radius: 10px; padding: 10px 12px; }
.code-eingabe { font: 800 24px/1 ui-monospace, Menlo, Consolas, monospace !important; letter-spacing: .3em; text-align: center; }
.fehler-melden { margin: 18px 0 6px; font-size: 14px; }
.fehler-melden a { color: var(--leise); text-decoration: underline; text-underline-offset: 2px; }
.bestell-uebersicht { background: var(--flaeche); border-radius: 12px; padding: 4px 14px; margin: 0 0 12px; }
.bestellknopf { font-size: 17px; padding: 12px 18px; }
.ergebnis.ok { background: var(--gruen-flaeche); color: var(--gruen); border-left: 5px solid var(--gruen); font-weight: 600; }
.ergebnis.fehler { background: var(--rot-flaeche); color: var(--rot); border-left: 5px solid var(--rot); font-weight: 600; }
.auswahl { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.auswahl label { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--linie); border-radius: 10px; font-size: 14px; cursor: pointer; }

/* ---------- Abo, Konto, Recht */
.abo-hinweis { display: flex; flex-direction: column; gap: 2px; margin: 0 0 8px; padding: 14px 16px; border-radius: 14px;
  background: var(--akzent); color: #fff; text-decoration: none; box-shadow: var(--schatten); }
.abo-hinweis span { font-size: 14px; opacity: .9; }
.schloss { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--flaeche); color: var(--leise); vertical-align: middle; }
.gesperrt { text-align: left; }
a.knopf { display: inline-flex; align-items: center; text-decoration: none; }
.notruf { background: var(--rot-flaeche); border-left: 6px solid var(--rot); border-radius: 10px; padding: 10px 12px; margin: 0 0 10px; }
.rechtsfuss { margin: 28px 0 8px; font-size: 13px; color: var(--leise); text-align: center; line-height: 2; }
.rechtsfuss a { color: inherit; }
.paypal-bereich { margin: 14px 0; min-height: 48px; }
.land-frage { margin: 14px 0 4px; }

/* ---------- Fußleiste */
.fussleiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  background: var(--karte); border-top: 1px solid var(--linie); padding-bottom: env(safe-area-inset-bottom);
}
.fussleiste a { flex: 1; text-align: center; padding: 12px 4px; text-decoration: none; font-weight: 700; font-size: 14px; min-height: 48px; }
.fussleiste a.aktiv { color: var(--rot); }

/* ---------- Dialoge */
.dialog { border: 0; border-radius: 18px; padding: 20px; max-width: min(520px, calc(100vw - 32px)); width: 100%; background: var(--karte); color: var(--text); }
.dialog::backdrop { background: rgba(5, 12, 20, .55); }
.dialog h2 { margin: 0 0 4px; }
.gewicht-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; margin: 12px 0; }
.gewicht-raster button { min-height: 44px; border-radius: 10px; border: 1px solid var(--linie); background: var(--bg); color: var(--text); font-weight: 700; cursor: pointer; }
.gewicht-raster button.aktiv { background: var(--akzent); color: #fff; border-color: var(--akzent); }
.gewicht-raster .gruppe { grid-column: 1 / -1; font-size: 12px; color: var(--leise); text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }
.gewicht-frei { display: flex; align-items: center; gap: 8px; color: var(--leise); }
.gewicht-frei input { width: 100px; height: 44px; border-radius: 10px; border: 1px solid var(--linie); padding: 0 10px; font: inherit; background: var(--bg); color: var(--text); }
.dialog-knoepfe { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.hinweis-dialog { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); padding: 16px 18px; overflow: hidden; }
/* Text scrollt, Land + Bestätigung + Weiter bleiben immer sichtbar (auch bei langem Disclaimer, kleinen Bildschirmen) */
.hinweis-dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 56px); max-height: calc(100dvh - 56px); }
.hinweis-dialog #hinweis-text, .hinweis-dialog #kauf-hinweis-text { flex: 1 1 auto; min-height: 96px; overflow: auto; font-size: 15px; padding-right: 6px;
  border-bottom: 1px solid var(--linie); -webkit-overflow-scrolling: touch; }
.hinweis-dialog .dialog-sprache { flex: none; display: flex; justify-content: flex-end; margin: 0 0 6px; }
.dialog-sprache .knopf { min-height: 32px; padding: 0 10px; font-size: 13px; }
.hinweis-dialog .land-frage { flex: none; margin: 10px 0 2px; font-size: 15px; }
.hinweis-dialog #hinweis-land { flex: none; margin: 4px 0; }
#kauf-hinweis-titel { margin: 0 0 6px; font-size: 20px; }
#kauf-hinweis-titel:focus { outline: none; }
.kauf-einleitung { margin: 0 0 10px; font-size: 13.5px; }
#kauf-hinweis-text:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; }
.link-knopf { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; font-weight: 700; }
.hinweis-dialog .bestaetigung { flex: none; margin-top: 8px; font-size: 14.5px; line-height: 1.35; }
.hinweis-dialog .dialog-knoepfe { flex: none; margin-top: 10px; align-items: center; justify-content: space-between; }
.hinweis-dialog .dialog-knoepfe .leise { font-size: 13px; }
.bestaetigung { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; font-weight: 600; }
.bestaetigung input { width: 22px; height: 22px; flex: none; margin-top: 2px; }

@media print {
  .kopf, .fussleiste, .treffer, .entwurf-banner { display: none; }
}
/* Sprachumschalter nur, wenn der Build Englisch anbietet (html[data-sprachen]) */
html:not([data-sprachen*=" "]) [data-sprache-wechsel]{display:none!important}
select.sprache-knopf{appearance:none;-webkit-appearance:none;text-align:center;text-align-last:center;padding:0 6px;cursor:pointer;font:inherit;font-size:13px;font-weight:800;color:inherit}
.dialog-sprache{gap:6px;flex-wrap:wrap}
