/* DOCTAGO – Ausfüllseite am Tablet. Ruhig und hell, große Schrift, große Trefferflächen. Keine fremden Schriften oder Bibliotheken. */

:root {
  --blau: #015792;
  --blau-dunkel: #01416d;
  --blau-hell: #e7f0f7;
  --blau-mittel: #b9d2e5;
  --cyan: #53cde2;
  --text: #14212b;
  --text-leise: #4a5b68;
  --linie: #c9d4dc;
  --flaeche: #f4f7f9;
  --weiss: #ffffff;
  --fehler: #b3261e;
  --fehler-hell: #fdeceb;
  --ok: #1e6b3a;
  --radius: 14px;
  --schatten: 0 1px 3px rgba(1, 40, 70, .08), 0 4px 16px rgba(1, 40, 70, .06);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--flaeche);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 20px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

[hidden] { display: none !important; }

/* ------------------------------------------------------------ Kopf */

.kopf {
  position: sticky; top: 0; z-index: 5;
  background: var(--blau);
  color: var(--weiss);
  border-bottom: 4px solid var(--cyan);
  padding-top: env(safe-area-inset-top);
}
.kopf-innen {
  max-width: 820px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 64px; padding: 0 16px;
}
.marke {
  font-weight: 700; letter-spacing: .12em; font-size: 20px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.marke.praxis { letter-spacing: .02em; }
/* Praxislogo: auf weißem Schild (Logos sind meist für hellen Grund gemacht), feste Höhe – der Kopf springt nicht.
   width/height-Attribute = Pixelmaße des Logos: der Platz steht schon, bevor das Bild geladen ist; object-fit hält das Seitenverhältnis. */
.kopf-links { display: flex; align-items: center; gap: 14px; min-width: 0; }
.kopf-logo {
  flex: none; display: flex; align-items: center; justify-content: center;
  height: 48px; padding: 4px 10px; border-radius: 8px; background: var(--weiss);
}
.kopf-logo img { display: block; height: 40px; width: auto; max-width: 200px; object-fit: contain; }
.kopf-aktion .knopf { min-height: 48px; padding: 8px 16px; font-size: 18px; }

/* ------------------------------------------------------------ Inhalt */

.inhalt {
  max-width: 820px; margin: 0 auto;
  padding: 24px 16px calc(140px + env(safe-area-inset-bottom));
  outline: none;
}
.inhalt.ohne-leiste { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }

h1 { font-size: 30px; line-height: 1.25; margin: 8px 0 16px; color: var(--blau-dunkel); }
h2 { font-size: 24px; line-height: 1.3; margin: 0 0 12px; }
p { margin: 0 0 16px; }
.leise { color: var(--text-leise); }
.mitte { text-align: center; }

.karte {
  background: var(--weiss);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 24px;
  margin-bottom: 20px;
}

.symbolkreis {
  width: 96px; height: 96px; margin: 8px auto 20px;
  border-radius: 50%;
  background: var(--blau-hell); color: var(--blau);
  display: flex; align-items: center; justify-content: center;
}
.symbolkreis .icon { width: 52px; height: 52px; stroke-width: 1.8; }
.symbolkreis.ok { background: #e3f3e8; color: var(--ok); }

.icon {
  width: 1.2em; height: 1.2em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: middle;
}

/* ------------------------------------------------------------ Knöpfe */

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 60px; min-width: 48px; padding: 12px 24px;
  border-radius: 12px; border: 2px solid var(--blau);
  background: var(--weiss); color: var(--blau);
  font: inherit; font-weight: 600; font-size: 20px; line-height: 1.2;
  cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.knopf:active { transform: translateY(1px); }
.knopf.haupt { background: var(--blau); color: var(--weiss); }
.knopf.haupt:active { background: var(--blau-dunkel); }
.knopf.hell { border-color: rgba(255, 255, 255, .8); background: transparent; color: var(--weiss); }
.knopf.breit { width: 100%; }
.knopf.klein { min-height: 48px; padding: 8px 16px; font-size: 18px; }
.knopf[disabled] { opacity: .55; cursor: default; }

:focus-visible { outline: 3px solid var(--blau); outline-offset: 3px; }
.kopf :focus-visible { outline-color: var(--cyan); }

.knopfreihe { display: flex; flex-wrap: wrap; gap: 12px; }
.knopfreihe > .knopf { flex: 1 1 220px; }

/* Leiste unten mit Zurück / Weiter */
.leiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4;
  background: var(--weiss);
  border-top: 1px solid var(--linie);
  box-shadow: 0 -4px 16px rgba(1, 40, 70, .08);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.leiste-innen { max-width: 820px; margin: 0 auto; display: flex; gap: 12px; }
.leiste-innen .knopf { flex: 1 1 0; }
.leiste-innen .knopf.haupt { flex-grow: 2; }

/* ------------------------------------------------------------ Felder */

label, .beschriftung { display: block; font-weight: 600; margin-bottom: 8px; }

.feld {
  display: block; width: 100%;
  min-height: 60px; padding: 12px 16px;
  border: 2px solid var(--linie); border-radius: 12px;
  background: var(--weiss); color: var(--text);
  font: inherit; font-size: 22px;
}
.feld:focus { border-color: var(--blau); outline: 3px solid var(--blau-mittel); outline-offset: 0; }
textarea.feld { min-height: 140px; resize: vertical; line-height: 1.4; }
.feld-code { font-size: 32px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; max-width: 320px; margin: 0 auto; }
.feldgruppe { margin-bottom: 20px; }

.datum { display: flex; gap: 12px; flex-wrap: wrap; }
.datum > div { flex: 1 1 90px; }
.datum > div.jahr { flex: 2 1 130px; }
.datum label { font-weight: 400; color: var(--text-leise); font-size: 18px; margin-bottom: 4px; }
.datum .feld { text-align: center; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ Fragen */

.fortschritt { margin: 0 0 20px; }
.fortschritt-text { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; font-size: 18px; color: var(--text-leise); margin-bottom: 8px; }
.fortschritt-balken { height: 10px; border-radius: 5px; background: #dfe7ed; overflow: hidden; }
.fortschritt-balken > span { display: block; height: 100%; background: var(--blau); border-radius: 5px; transition: width .25s ease; }

.frage {
  background: var(--weiss);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  border-left: 6px solid transparent;
  padding: 20px;
  margin-bottom: 16px;
}
.frage.hinweis { background: var(--blau-hell); box-shadow: none; display: flex; gap: 14px; align-items: flex-start; }
.frage.hinweis .icon { color: var(--blau); width: 28px; height: 28px; margin-top: 2px; }
.frage.hinweis p { margin: 0; }
.frage.hat-fehler { border-left-color: var(--fehler); }
.frage-text { font-weight: 600; font-size: 22px; line-height: 1.35; margin: 0 0 12px; display: block; }
.pflicht { display: inline-block; font-size: 16px; font-weight: 600; color: var(--blau); background: var(--blau-hell); border-radius: 6px; padding: 1px 8px; margin-left: 6px; vertical-align: 2px; }
.hilfe { color: var(--text-leise); font-size: 18px; margin: -4px 0 12px; }
.frage-fehler {
  display: flex; gap: 10px; align-items: flex-start;
  color: var(--fehler); background: var(--fehler-hell);
  border-radius: 10px; padding: 10px 14px; margin: 12px 0 0; font-weight: 600;
}
.frage-fehler .icon { margin-top: 3px; }
.zusatz { margin-top: 16px; }

/* Ja/Nein: zwei große Schaltflächen */
.janein { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wahl {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 64px; padding: 12px 18px;
  border: 2px solid var(--linie); border-radius: 12px;
  background: var(--weiss); color: var(--text);
  font: inherit; font-size: 21px; text-align: left; line-height: 1.3;
  cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.janein .wahl { justify-content: center; font-weight: 700; font-size: 22px; min-height: 72px; }
.wahl[aria-pressed="true"], .wahl[aria-checked="true"] { border-color: var(--blau); background: var(--blau-hell); color: var(--blau-dunkel); box-shadow: inset 0 0 0 1px var(--blau); }
.optionen { display: flex; flex-direction: column; gap: 10px; }
/* Textfeld unter einer gewählten Antwort: eingerückt bis zum Antworttext (Rahmen 2 + Innenabstand 18 + Marker 34 + Abstand 14) */
.option-zusatz { margin: 8px 0 4px 68px; }
.option-zusatz label { font-weight: 400; color: var(--text-leise); font-size: 18px; margin-bottom: 4px; }
@media (max-width: 520px) { .option-zusatz { margin-left: 24px; } }

/* Markierung links in Auswahl-, Mehrfach- und Bestätigungsfeldern */
.marker {
  flex: none; width: 34px; height: 34px;
  border: 2px solid var(--text-leise); background: var(--weiss);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--weiss);
}
.marker.rund { border-radius: 50%; }
.marker.eckig { border-radius: 8px; }
.marker .icon { width: 24px; height: 24px; stroke-width: 3; visibility: hidden; }
.wahl[aria-checked="true"] .marker, .wahl[aria-pressed="true"] .marker { border-color: var(--blau); background: var(--blau); }
.wahl[aria-checked="true"] .marker .icon, .wahl[aria-pressed="true"] .marker .icon { visibility: visible; }
.janein .icon { visibility: hidden; }
.janein .wahl[aria-pressed="true"] .icon { visibility: visible; }

/* ------------------------------------------------------------ Zusammenfassung */

.abschnitt-kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.abschnitt-kopf h2 { margin: 0; font-size: 22px; }
.liste { margin: 0; }
.liste > div { padding: 12px 0; border-top: 1px solid #e4eaee; }
.liste > div:first-child { border-top: 0; }
.liste dt { color: var(--text-leise); font-size: 18px; }
.liste dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; white-space: pre-line; }
.liste dd.ohne { font-weight: 400; color: var(--text-leise); font-style: italic; }

/* ------------------------------------------------------------ Unterschrift */

.unterschrift-rahmen {
  position: relative;
  border: 2px dashed var(--blau-mittel); border-radius: 12px;
  background: var(--weiss);
  aspect-ratio: 2 / 1;
  width: 100%;
  overflow: hidden;
}
.unterschrift-rahmen.aktiv { border-style: solid; border-color: var(--blau); }
.unterschrift-rahmen canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.unterschrift-linie { position: absolute; left: 6%; right: 6%; bottom: 22%; border-bottom: 2px solid var(--linie); pointer-events: none; }
.unterschrift-x { position: absolute; left: 6%; bottom: calc(22% + 6px); color: var(--text-leise); pointer-events: none; }
.unterschrift-werkzeug { display: flex; justify-content: flex-end; margin-top: 12px; }

/* ------------------------------------------------------------ Meldungen und Überlagerung */

.meldung { display: flex; gap: 12px; align-items: flex-start; background: var(--blau-hell); color: var(--blau-dunkel); border-radius: 12px; padding: 14px 16px; margin-bottom: 20px; }
.meldung .icon { margin-top: 3px; }
.meldung-fehler { display: flex; gap: 10px; align-items: flex-start; color: var(--fehler); background: var(--fehler-hell); border-radius: 12px; padding: 12px 16px; margin: 16px 0 0; font-weight: 600; }
.meldung-fehler:empty { display: none; }
.meldung-fehler .icon { margin-top: 3px; }

.trenner { display: flex; align-items: center; gap: 16px; color: var(--text-leise); margin: 28px 0 20px; font-size: 18px; }
.trenner::before, .trenner::after { content: ""; flex: 1; border-top: 1px solid var(--linie); }

.patient {
  display: flex; align-items: center; gap: 18px;
  background: var(--blau-hell); border-radius: var(--radius); padding: 20px 22px; margin: 8px 0 20px;
}
.patient .icon { width: 44px; height: 44px; color: var(--blau); stroke-width: 1.8; }
.patient strong { font-size: 28px; line-height: 1.25; color: var(--blau-dunkel); overflow-wrap: anywhere; }

.bogenliste { margin: 0 0 24px; padding: 0; list-style: none; }
.bogenliste li { display: flex; gap: 12px; align-items: center; padding: 8px 0; }
.bogenliste .icon { color: var(--blau); }

.fuss { margin-top: 32px; font-size: 16px; color: var(--text-leise); text-align: center; }
.zahl-gross { font-size: 56px; font-weight: 700; color: var(--blau); text-align: center; font-variant-numeric: tabular-nums; margin: 8px 0 16px; }

.ueberlagerung {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(10, 30, 45, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.dialog {
  background: var(--weiss); border-radius: 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
  width: 100%; max-width: 560px; max-height: 100%; overflow: auto;
  padding: 28px 24px;
}
.dialog h2 { font-size: 26px; color: var(--blau-dunkel); }
.dialog .knopfreihe { margin-top: 20px; }

.laden { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 60px 0; color: var(--text-leise); }
.kreisel { width: 48px; height: 48px; border-radius: 50%; border: 5px solid var(--blau-hell); border-top-color: var(--blau); animation: drehen 1s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .kreisel { animation-duration: 3s; }
  .fortschritt-balken > span { transition: none; }
}

/* Schmale Geräte (ab 360 px) */
@media (max-width: 480px) {
  body { font-size: 19px; }
  h1 { font-size: 26px; }
  .karte, .frage { padding: 16px; }
  .knopf { padding: 12px 16px; }
  .leiste-innen .knopf.haupt { flex-grow: 1.5; }
  .patient strong { font-size: 24px; }
  .kopf-logo img { max-width: 100px; }   /* Platz für Praxisname und „Abbrechen“ */
  .kopf-links { gap: 10px; }
}

/* Querformat mit wenig Höhe: Leiste flacher */
@media (orientation: landscape) and (max-height: 520px) {
  .kopf-innen { min-height: 52px; }
  .kopf-logo { height: 44px; padding: 4px 8px; }
  .kopf-logo img { height: 36px; }
  .leiste { padding-top: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .leiste .knopf { min-height: 52px; }
  .inhalt { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  .unterschrift-rahmen { max-width: 640px; margin: 0 auto; }
}
