/* Professional, accessible medical UI (senior-friendly) */
:root{
  --bg:#f4f8ff;
  --card:#ffffff;
  --text:#0b1324;
  --muted:#42526b;
  --line:#dbe6f6;
  --brand:#1f6feb;
  --brand2:#1249b9;
  --ok:#148a3b;
  --danger:#b42318;
  --shadow: 0 12px 28px rgba(2, 6, 23, .10);
  --radius: 18px;
  --focus: 0 0 0 5px rgba(31,111,235,.18);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  background: radial-gradient(1200px 600px at 10% 0%, rgba(31,111,235,.10), transparent 60%),
              radial-gradient(1200px 600px at 90% 0%, rgba(18,73,185,.08), transparent 60%),
              var(--bg);
  color: var(--text);
  font-size: 16px;
}

.header{
  position: sticky;
  top:0;
  z-index:10;
  background: rgba(244,248,255,.92);
  backdrop-filter: blur(12px);
  border-bottom:1px solid var(--line);
}

.container{
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 14px;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-width: 0;
  flex:1;
}
.brand .logo{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  flex: 0 0 auto;
  font-weight: 900;
  color: var(--brand2);
}
.brand .logo img{
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.brand .titlewrap{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
}
.brand .title{
  font-weight: 900;
  letter-spacing:.2px;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}
.brand .subtitle{
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}

.badge{
  font-size:13px;
  color: var(--muted);
  border:1px solid var(--line);
  padding:8px 12px;
  border-radius: 999px;
  background:#fff;
}

.progress{
  margin-top:12px;
  display:flex;
  gap:12px;
  align-items:center;
}
.progressbar{
  height:12px;
  flex:1;
  background:#e8f0ff;
  border-radius:999px;
  overflow:hidden;
  border:1px solid var(--line);
}
.progressbar > div{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, var(--brand), var(--brand2));
  border-radius:999px;
  transition: width .25s ease;
}

.card{
  background: var(--card);
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:14px;
}
@media (max-width: 860px){
  .grid{grid-template-columns:1fr}
}

h1{
  font-size: 20px;
  margin:0;
}
h2{
  font-size: 18px;
  margin: 0 0 12px 0;
}
p.help{
  margin:8px 0 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height:1.45;
}

.section{
  margin-top: 16px;
  padding-top: 16px;
  border-top:1px dashed var(--line);
}

details{
  border:1px solid var(--line);
  border-radius: 16px;
  background:#fff;
  padding: 12px 14px;
}
details + details{ margin-top:12px; }
summary{
  cursor:pointer;
  list-style:none;
  font-weight: 900;
  font-size: 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
summary::-webkit-details-marker{display:none}
.summaryhint{
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.field{ margin-top:12px; }
.field label,
.question-card > label{
  display:block;
  font-weight:900;
  font-size: 14px;
  margin-bottom:8px;
}
.field input, .field textarea, .field select,
.question-card > input,
.question-card > textarea,
.question-card > select{
  width:100%;
  padding: 14px 12px;
  border:1px solid var(--line);
  border-radius: 14px;
  outline:none;
  font-size:16px;
  background:#fff;
}
.field textarea,
.question-card textarea{min-height: 96px; resize: vertical;}
.field input:focus, .field textarea:focus, .field select:focus,
.question-card input:focus, .question-card textarea:focus, .question-card select:focus{
  border-color: rgba(31,111,235,.65);
  box-shadow: var(--focus);
}

.question-card{
  border:1px solid var(--line);
  border-radius:16px;
  padding:14px 16px;
  background:#fbfdff;
  margin-top:14px;
}
.question-card + .question-card{ margin-top:14px; }
.question-card .inline-note{ margin-top:0; margin-bottom:8px; }
.conditional.is-hidden,
.detail-field.is-hidden{ display:none; }

.row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top: 10px;
}
.chip{
  display:flex;
  align-items:center;
  gap:10px;
  border:1px solid var(--line);
  background:#fff;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 800;
}
.chip input{
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  flex: 0 0 24px;
  accent-color: var(--brand2);
}

/* größere Checkboxen für lange Einwilligungstexte */
.consent-check .chip input,
#iteroBlock .chip input,
#emailBlock .chip input,
#stepRecall .chip input{
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  flex: 0 0 26px;
}

.actions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  flex-wrap:wrap;
  margin-top: 18px;
}
button{
  border:none;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 900;
  cursor:pointer;
  font-size:16px;
}
button.primary{
  background: linear-gradient(90deg, var(--brand), var(--brand2));
  color:#fff;
}
button.secondary{
  background:#fff;
  border:1px solid var(--line);
  color: var(--text);
}
button.danger{
  background:#fff;
  border:1px solid rgba(180,35,24,.35);
  color: var(--danger);
}

.notice{
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: #fbfdff;
  color: var(--muted);
  font-size: 14px;
  line-height:1.45;
  margin-top: 12px;
}

.sigwrap{
  border:1px solid var(--line);
  border-radius: 16px;
  overflow:hidden;
  background:#fff;
}
.sigbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 12px 14px;
  border-bottom:1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}
canvas{
  display:block;
  width:100%;
  height: 210px;
  touch-action: none;
}
.small{
  font-size: 13px;
  color: var(--muted);
}

.footer{
  margin: 18px 0 44px;
  color: var(--muted);
  font-size: 12px;
  text-align:center;
}

.toast{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  background: #0b1220;
  color:#fff;
  padding: 12px 14px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  max-width: 92vw;
  display:none;
  font-weight: 800;
}
.toast.show{display:block;}



/* Wizard (step-by-step) */
.wizard{ margin-top: 8px; }
.step{ display:none; }
.step.is-active{ display:block; animation: stepIn .22s ease-out; }
@keyframes stepIn{
  from{ opacity:0; transform: translateX(10px); }
  to{ opacity:1; transform: translateX(0); }
}
.stephead{ margin: 2px 0 14px 0; padding-bottom: 10px; border-bottom:1px dashed var(--line); }
.steplabel{ font-size: 13px; font-weight: 900; color: var(--muted); }
.wizardnav{
  position: sticky;
  bottom: 0;
  margin-top: 14px;
  padding-top: 12px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-top:1px solid var(--line);
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
}
.wizardnav__mid{ flex:1; text-align:center; min-width: 160px; }
.wizardnav button{ flex:0 0 auto; }
@media (max-width: 560px){
  .wizardnav__mid{ order:3; width:100%; text-align:left; }
}


/* Legal texts: readable scroll box */
.legal-scroll{
  margin-top:10px;
  padding:12px 14px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
  max-height:280px;
  overflow:auto;
  white-space:pre-wrap;
  line-height:1.45;
  font-size:14px;
  color:var(--text);
}
.legal-scroll strong{font-weight:800;}
.notice .hint{margin-top:10px;color:var(--muted);font-size:13px;}
/* === UI Micro-Tuning (safe, optional) === */

/* Mehr Luft zwischen Formular-Blöcken */
.form-section { margin-bottom: 22px; }
.checkbox-group { margin-bottom: 16px; }

/* Optional fields dezenter */
.optional label { color: #6b7280; font-size: 0.95em; }
.optional input::placeholder { color: #9ca3af; }

/* Rechtstexte ruhig hervorheben (override) */
.legal-scroll{
  background:#f8fafc;
  border-radius: 10px;
  padding: 14px 16px;
}

/* Detail-Felder weich ein-/ausblenden */
.detail-field { transition: all 0.2s ease; }

/* === Step transition re-trigger (safe) === */
.step.step-anim {
  animation: stepFadeIn .22s ease-out;
}
@keyframes stepFadeIn{
  from{ opacity:0; transform: translateY(8px); }
  to{ opacity:1; transform: translateY(0); }
}

button:disabled{opacity:.55;cursor:not-allowed;}

.scroll-gate-hint{
  margin-top:4px;
  color:var(--danger);
  font-weight:800;
  font-size:13px;
}

.field input.is-invalid, .field textarea.is-invalid, .field select.is-invalid,
.question-card input.is-invalid, .question-card textarea.is-invalid, .question-card select.is-invalid{border-color: var(--danger); box-shadow: 0 0 0 4px rgba(180,35,24,.10);}
.chip.is-invalid{border-color: rgba(180,35,24,.45); box-shadow: 0 0 0 4px rgba(180,35,24,.08);}
.sigwrap.is-invalid{border-color: rgba(180,35,24,.55); box-shadow: 0 0 0 4px rgba(180,35,24,.08);}
