/* box-xund – Styling übernommen aus box-booking (das seinerseits box-os folgt:
   MUI-Theme theme/door.ts). Design-Tokens (Teal-Primary, Gelb-Secondary,
   Montserrat) 1:1 aus box-os, hier als plain CSS statt MUI. Fonts vendored
   (kein CDN) — vgl. HTMX.

   Der gemeinsame Teil ist bewusst kopiert statt geteilt: ADR-002 nennt "vier
   Frontends ohne gemeinsame Basis" als bekannte Konsequenz. Ein geteiltes Paket
   wäre eine eigene Entscheidung, nicht der Nebeneffekt dieses Repos. Mitgenommen
   wurde nur, was box-xund tatsächlich benutzt — Kalender, PIN-Pad, Slot-Raster
   und Unterschriften-Pad aus box-booking stehen hier nicht. */

/* --- Montserrat (vendored, latin) --- */
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("/static/vendor/fonts/montserrat-latin-300-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/vendor/fonts/montserrat-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/vendor/fonts/montserrat-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/vendor/fonts/montserrat-latin-700-normal.woff2") format("woff2");
}

/* --- Design-Tokens (aus box-os palette) --- */
:root {
  --primary-light: #337c80;
  --primary-main: #005c61;
  --primary-dark: #004043;
  --primary-contrast: #ffffff;

  --secondary-light: #fce286;
  --secondary-main: #fcdb68;
  --secondary-dark: #b09948;
  --secondary-contrast: #000000;

  --error: #ba1a1a;

  --text: #1a1c1c;
  --text-muted: #5a6060;
  --border: #d5dbdb;
  --surface: #ffffff;
  --bg: #f4f7f7;

  /* Urgency Classification (XUND: green / orange / red). Bewusst kräftiger als
     die Markenfarben — sie ist die einzige Stelle, an der Farbe Bedeutung trägt.
     Nie allein: der Text daneben nennt die Stufe ebenfalls (Farbfehlsichtigkeit). */
  --urgency-green: #2e7d32;
  --urgency-green-bg: #e6f0e7;
  --urgency-orange: #b45309;
  --urgency-orange-bg: #fbeedd;
  --urgency-red: #ba1a1a;
  --urgency-red-bg: #fbe6e6;

  --radius: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;               /* kein horizontales Scrollen auf Mobil */
}
img, input, select, textarea { max-width: 100%; }

/* --- Layout --- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
}
.logo-link { justify-self: start; display: inline-flex; align-items: center; }
.topbar img.logo { height: 32px; width: auto; display: block; }
.topbar .navprogress { justify-self: end; }
.navprogress {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 12px;
}

.wrap { max-width: 640px; margin: 0 auto; padding: 2.5rem 1.5rem 1rem; }

.sitefoot {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  font-size: 0.9rem;
}
.sitefoot a { color: var(--text-muted); }

/* --- Typography --- */
h1 { font-size: 2rem; font-weight: 500; margin: 0 0 1rem; letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; font-weight: 500; color: var(--primary-main); margin: 1.5rem 0 0.75rem; }
h3 { font-size: 1.25rem; font-weight: 500; margin: 1.5rem 0 0.75rem; }
a { color: var(--primary-main); }
a:hover { color: var(--primary-dark); }

.lead { font-size: 1.05rem; }
.lead-sub { font-size: 1rem; color: var(--text-muted); margin: -0.25rem 0 1rem; }
.muted { color: var(--text-muted); font-size: 0.9rem; }
code {
  background: #e7eeee;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.85em;
}

/* Für Screenreader sichtbar, visuell nicht (fieldset-legend im Fragefluss). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* --- Schritt-Kennung + Fortschritt --- */
.step-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary-main);
  background: #e2eded;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  margin: 0 0 0.5rem;
}
.progress-seg {
  width: 18px;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  transition: background .2s;
}
.progress-seg.on { background: var(--primary-main); }
.progress-num {
  margin-left: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 400px) { .progress-seg { width: 14px; } }

/* --- Formular --- */
.field { display: block; margin: 1.15rem 0; }
.field-label { display: block; font-weight: 500; margin-bottom: 0.45rem; }

form input[type="search"], form input[type="text"] {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 16px;                  /* >=16px verhindert Auto-Zoom auf iOS */
  background: var(--surface);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
form input[type="search"]:focus, form input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-main);
  box-shadow: 0 0 0 3px rgba(0, 92, 97, 0.15);
}

.err { display: block; color: var(--error); font-weight: 400; font-size: 0.95rem; margin-top: 0.3rem; }

/* Action-Button – aus box-os "action"-Variante (Teal, Radius 10, kein Uppercase). */
button[type="submit"], .btn-primary {
  display: block;
  width: 100%;
  margin-top: 1.5rem;
  min-height: 60px;
  padding: 1rem 1.6rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary-main);
  color: var(--primary-contrast);
  font: inherit;
  font-weight: 500;
  font-size: 1.15rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
button[type="submit"]:active, .btn-primary:active { background: var(--primary-dark); }
@media (hover: hover) {
  button[type="submit"]:hover, .btn-primary:hover { background: var(--primary-dark); color: var(--primary-contrast); }
}
/* Sekundäre Aktion (z.B. "Symptome bearbeiten") — erbt die submit-Regeln NICHT. */
.linkish {
  display: block;
  width: auto;
  margin: 1.25rem auto 0;
  padding: 0.4rem 0.2rem;
  min-height: 44px;                 /* Touch-Target */
  border: 0;
  background: none;
  color: var(--primary-main);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: underline;
}
.linkish:active { color: var(--primary-dark); }
@media (hover: hover) { .linkish:hover { color: var(--primary-dark); } }

/* --- Info- und Hinweisblöcke --- */
.infobox {
  background: #e2eded;
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
}
.infobox p { margin: 0 0 0.6rem; }
.infobox p:last-child { margin-bottom: 0; }
.doc-link {
  display: inline-block;
  font-weight: 500;
  text-decoration: underline;
  min-height: 44px;
  line-height: 44px;
}
.notice {
  border-radius: var(--radius);
  border-left: 4px solid var(--border);
  background: var(--surface);
  padding: 1rem 1.1rem;
  margin: 1rem 0 1.5rem;
}
.notice p { margin: 0 0 0.6rem; }
.notice p:last-child { margin-bottom: 0; }
.notice-warn { border-left-color: var(--secondary-dark); background: #fdf6e0; }
.notice-error { border-left-color: var(--error); background: var(--urgency-red-bg); }

/* --- Consent-Häkchen --- */
.check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 1.5rem 0 0.25rem;
  padding: 0.5rem 0;
  font-weight: 400;
  cursor: pointer;
}
/* Eigenes Kästchen (appearance:none) statt nativem Rendering — manche
   Kiosk-Browser zeichnen native Checkboxen unsichtbar/uneinheitlich. */
.check input {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  min-height: 28px;
  margin: 0.1rem 0 0;
  padding: 0;
  flex: none;
  border: 2px solid var(--primary-main);
  border-radius: 6px;
  background: var(--surface);
  position: relative;
  cursor: pointer;
}
.check input:checked { background: var(--primary-main); border-color: var(--primary-main); }
.check input:checked::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 3px;
  width: 7px;
  height: 13px;
  border: solid var(--primary-contrast);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}
.check input:focus-visible { outline: 3px solid rgba(0, 92, 97, 0.35); outline-offset: 2px; }
.check.consent { align-items: flex-start; margin: 0.9rem 0; }
.check.consent span { font-size: 0.98rem; }
.privacy { margin-top: 0.75rem; }

/* ===========================================================================
   Ab hier box-xund-spezifisch: Symptom Overview, Fragefluss, Report.
   =========================================================================== */

/* --- Gewählte Symptome (Chips mit Entfernen) --- */
.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0 0 1.25rem;
}
.chip {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.4rem 0.4rem 0.9rem;
  background: #e2eded;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--primary-dark);
  font-weight: 500;
}
.chip-text { line-height: 1.3; }
/* Bearbeiten/Entfernen sind 44er-Touch-Targets — auf dem Tablet werden sie mit
   dem Finger getroffen, nicht mit der Maus. Welche davon erscheinen, sagt die
   API über actionInfo.actions. */
.chip-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -0.4rem 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--primary-main);
  font-size: 1.4rem;
  line-height: 1;
}
.chip-action:active { background: rgba(0, 92, 97, 0.15); }
@media (hover: hover) { .chip-action:hover { background: rgba(0, 92, 97, 0.1); } }

/* --- Fragetext (lokalisiertes HTML vom Provider) --- */
.question-text {
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--primary-main);
  margin: 0.5rem 0 1rem;
}
.question-text p { margin: 0 0 0.6rem; }
.question-text p:last-child { margin-bottom: 0; }

/* Sekundäraktionen unter der Frage (Keine Angabe / Zurück). */
.step-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  margin-top: 1.5rem;
}

/* --- Suche über die Antwortoptionen --- */
.option-search { margin-bottom: 0.5rem; }
.results { list-style: none; padding: 0; margin: 0.25rem 0 0; }
.results li { margin: 0.4rem 0; }
.result-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-height: 56px;
  padding: 0.85rem 1.1rem;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1.05rem;
  transition: border-color .15s, box-shadow .15s;
}
.result-add { color: var(--primary-main); font-size: 1.4rem; font-weight: 500; }
/* Bereits gewählte EXTENDING-Option: nochmaliges Tippen wählt sie ab. */
.result-btn.is-selected { border-color: var(--primary-main); background: #e2eded; }
.result-btn:active { background: var(--primary-main); color: var(--primary-contrast); }
.result-btn:active .result-add { color: var(--primary-contrast); }
@media (hover: hover) {
  .result-btn:hover { border-color: var(--primary-main); box-shadow: 0 2px 8px rgba(0, 92, 97, 0.12); }
}

/* --- Antwortoptionen (Radio/Checkbox als große Flächen) --- */
.options { border: 0; padding: 0; margin: 1rem 0 0; }
.option {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 60px;
  padding: 0.85rem 1.1rem;
  margin: 0.55rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1.05rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.option input {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 26px;
  height: 26px;
  margin: 0;
  border: 2px solid var(--primary-main);
  background: var(--surface);
  position: relative;
  cursor: pointer;
}
.option input[type="radio"] { border-radius: 50%; }
.option input[type="checkbox"] { border-radius: 6px; }
.option input:checked { background: var(--primary-main); }
.option input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--primary-contrast);
}
.option input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 2px;
  width: 6px;
  height: 12px;
  border: solid var(--primary-contrast);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}
.option input:focus-visible { outline: 3px solid rgba(0, 92, 97, 0.35); outline-offset: 2px; }
/* :has() trägt die Auswahl auf die ganze Fläche; ohne Unterstützung bleibt nur
   das Kästchen markiert — die Auswahl ist dann trotzdem erkennbar. */
.option:has(input:checked) { border-color: var(--primary-main); background: #e2eded; }
@media (hover: hover) { .option:hover { border-color: var(--primary-main); } }

/* --- Urgency Classification --- */
.urgency {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius);
  border-left: 6px solid var(--border);
  margin: 0.5rem 0 1.5rem;
}
.urgency-dot {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: currentColor;
}
.urgency-label { margin: 0; font-weight: 600; font-size: 1.15rem; }
.urgency-text { margin: 0.35rem 0 0; color: var(--text); font-size: 1rem; }
.urgency-green { color: var(--urgency-green); background: var(--urgency-green-bg); border-left-color: var(--urgency-green); }
.urgency-orange { color: var(--urgency-orange); background: var(--urgency-orange-bg); border-left-color: var(--urgency-orange); }
.urgency-red { color: var(--urgency-red); background: var(--urgency-red-bg); border-left-color: var(--urgency-red); }

/* --- Report --- */
.report-list { margin: 0.25rem 0 1.25rem; padding-left: 1.25rem; }
.report-list li { margin: 0.3rem 0; }
.disclaimer { margin-top: 1.5rem; }

/* Ein Befund. Bewusst ohne Rangabzeichen und ohne Hervorhebung des ersten
   Eintrags: „Do not highlight, hide or reorder individual results". */
.finding {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin: 0.6rem 0;
}
.finding-name {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.35rem;
  font-weight: 600;
  font-size: 1.1rem;
}
.finding-score {
  flex: none;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.finding-text p { margin: 0 0 0.5rem; }
.finding-treatment {
  margin: 0.5rem 0 0;
  font-weight: 500;
  color: var(--primary-main);
}
.quick-solution { margin-top: 0.6rem; }
.quick-solution summary {
  cursor: pointer;
  min-height: 44px;
  line-height: 44px;
  color: var(--primary-main);
  font-weight: 500;
}

/* --- Impressum --- */
.imprint-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 1rem;
  margin: 0.5rem 0 1rem;
  font-size: 0.98rem;
}
.imprint-facts dt { color: var(--text-muted); }
.imprint-facts dd { margin: 0; font-variant-numeric: tabular-nums; }
@media (max-width: 460px) {
  .imprint-facts { grid-template-columns: 1fr; gap: 0 0; }
  .imprint-facts dd { margin-bottom: 0.5rem; }
}
.imprint-company { font-weight: 600; margin-bottom: 0.2rem; }
.imprint-links { list-style: none; padding: 0; margin: 0.5rem 0 1.5rem; }
.imprint-links li { margin: 0.35rem 0; }
.ce-mark { display: block; height: 48px; width: auto; margin: 0.5rem 0 1rem; }
