/* Gestaltung der Interviewanwendung (S6): ruhig, sachlich, gut lesbar.
   Nur Systemschriften, keine externen Quellen. Kontraste von Text zu Hintergrund
   mindestens 4.5:1 (WCAG AA), Knöpfe mindestens 48 px hoch. */

:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-soft: #f1f0eb;
  --ink: #1f2725;
  --ink-soft: #364240;
  --muted: #55605d;
  --line: #d3d5cf;
  --line-strong: #7f8f8b;
  --primary: #24584f;
  --primary-dark: #173f39;
  --primary-tint: #e4eeeb;
  --hint-bg: #f6f0e1;
  --hint-line: #b89a52;
  --danger: #9f3128;
  --danger-tint: #fbeeec;
  --focus: #1d5fa5;
  --radius: 14px;
  --width: 860px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 100%;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

a { color: var(--primary-dark); }
a:hover { color: var(--primary); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* --- Kopf, Inhalt, Fuß ------------------------------------------------------ */

.site-header {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  /* Ränder so, dass Kopf und Inhalt an derselben Kante beginnen. */
  padding: 0 max(1rem, calc((100% - var(--width)) / 2));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.page-shell {
  width: min(100% - 2rem, var(--width));
  flex: 1 0 auto;
  margin: 0 auto;
  padding: 2.5rem 0 3rem;
}

.site-footer {
  padding: 1.5rem 1rem 2rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.875rem;
}

.site-footer a { color: inherit; }

/* Aufklappbare Datenschutzhinweise auf der Einführung */
.datenhinweise {
  margin: 1.25rem 0 1.5rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
.datenhinweise summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.6rem 0;
}
.datenhinweise h2 { font-size: 1rem; margin-top: 1rem; }

/* --- Text --------------------------------------------------------------------- */

/* Lange Wörter wie „Organisationsuntersuchung“ nach deutscher Silbentrennung umbrechen. */
h1, h2 { line-height: 1.25; color: var(--ink); hyphens: auto; }
h1 { margin: 0 0 0.75rem; font-size: clamp(1.75rem, 1.35rem + 1.6vw, 2.25rem); font-weight: 700; }
h2 { margin: 0 0 0.6rem; font-size: 1.25rem; font-weight: 650; }
p { margin: 0 0 1rem; }

.eyebrow {
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
}

.lead { color: var(--ink-soft); font-size: 1.125rem; }
.form-hint { color: var(--muted); font-size: 0.9375rem; }
.error-text { color: var(--danger); }
.hidden { display: none !important; }

.form-error {
  /* Abstand zum Bildschirmrand, wenn die Meldung ins Bild gescrollt wird. */
  scroll-margin: 1rem;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--danger);
  border-radius: 6px;
  background: var(--danger-tint);
  color: var(--danger);
}

.notice {
  margin: 1rem 0;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: var(--surface);
}

/* --- Karten ------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.narrow-card { width: min(100%, 720px); margin: 0 auto; }
.hero-card { padding: clamp(1.25rem, 4vw, 2.75rem); }
.hero-card > :last-child { margin-bottom: 0; }

/* Einführung aus konfiguration/einstiegstext.md */
.einstiegstext h1 { font-size: clamp(1.5rem, 1.2rem + 1.3vw, 2rem); }
.einstiegstext h2 { margin-top: 2rem; }
.einstiegstext form,
.einstiegstext > .button { margin-top: 2rem; }

/* --- Knöpfe ------------------------------------------------------------------- */

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-weight: 650;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button.primary { color: #ffffff; background: var(--primary); }
.button.primary:hover:not(:disabled) { color: #ffffff; background: var(--primary-dark); }
.button.secondary { color: var(--primary-dark); background: var(--surface); border-color: var(--line-strong); }
.button.secondary:hover:not(:disabled) { background: var(--primary-tint); }
.button:disabled { opacity: 0.55; cursor: not-allowed; }
.full-width { width: 100%; }

/* --- Gespräch ----------------------------------------------------------------- */

.section-header { margin-bottom: 1.25rem; }
.section-header .lead { max-width: 42rem; margin-bottom: 0.5rem; }

.chat-card {
  display: flex;
  min-height: 40vh;
  max-height: 60vh;
  flex-direction: column;
  gap: 1.1rem;
  overflow-y: auto;
  padding: clamp(0.9rem, 3vw, 1.5rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.message { display: flex; max-width: 85%; flex-direction: column; gap: 0.25rem; }
.message.user { align-self: flex-end; }
.message.assistant { align-self: flex-start; }

.message-label { color: var(--muted); font-size: 0.875rem; font-weight: 650; }
.message.assistant .message-label { color: var(--primary-dark); }
.message.user .message-label { text-align: right; }

.message-content {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  white-space: pre-wrap;
  /* Lange Wörter oder Adressen umbrechen statt die Seite zu verbreitern. */
  overflow-wrap: anywhere;
}
.message.assistant .message-content {
  background: var(--surface-soft);
  border-left: 4px solid var(--primary);
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}
.message.user .message-content {
  background: var(--primary-tint);
  border-bottom-right-radius: 4px;
}

.message.streaming .message-content::after {
  content: "▍";
  margin-left: 1px;
  color: var(--primary);
  animation: blink 1.2s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.summary-offer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.summary-offer p { margin: 0; color: var(--ink-soft); }
.summary-offer p + p { margin-top: 0.35rem; }
.summary-offer p.form-hint { color: var(--muted); }
.summary-offer .button { flex: 0 0 auto; }
.summary-offer.hervorgehoben {
  border-color: var(--primary);
  border-left-width: 4px;
  background: var(--primary-tint);
}

.composer { margin-top: 1.25rem; }

label { display: block; margin-bottom: 0.4rem; font-size: 1rem; font-weight: 650; }

textarea {
  display: block;
  width: 100%;
  min-height: 6.5rem;
  resize: vertical;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
}
textarea:focus-visible { border-color: var(--focus); }
textarea:disabled { background: var(--surface-soft); }

/* Hinweis der Dienstvereinbarung KI direkt unter dem Eingabefeld (A02). */
.eingabehinweis {
  margin: 0.6rem 0 0;
  padding: 0.6rem 0.85rem;
  border-left: 4px solid var(--hint-line);
  border-radius: 6px;
  background: var(--hint-bg);
  color: var(--ink);
  font-size: 0.9375rem;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.85rem;
}
.composer-actions .form-hint { margin: 0; }
.composer-actions .button { flex: 0 0 auto; min-width: 8rem; }
.composer .form-error { margin-top: 0.85rem; }

/* --- Prüfseite ---------------------------------------------------------------- */

.action-card { padding: clamp(1.1rem, 3vw, 1.5rem); }
.summary-field + .summary-field { margin-top: 1.5rem; }
.summary-field .form-hint { margin: -0.2rem 0 0.4rem; }
#summary-edit .button { margin-top: 1.5rem; }

.two-column-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
.two-column-actions .action-card { display: flex; flex-direction: column; }
.two-column-actions .action-card .button { margin-top: auto; }
.approval-card { border-color: var(--primary); }

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0.5rem 0 1.25rem;
  font-weight: 500;
  cursor: pointer;
}
.checkbox-row input {
  flex: 0 0 auto;
  width: 1.4rem;
  height: 1.4rem;
  margin: 0.1rem 0 0;
  accent-color: var(--primary);
}

/* --- Schmale Bildschirme ------------------------------------------------------ */

@media (max-width: 720px) {
  .page-shell { padding: 1.25rem 0 2rem; }
  .site-header { min-height: 52px; }
  .two-column-actions { grid-template-columns: 1fr; }
  .chat-card { min-height: 45vh; max-height: 55vh; }
  .message { max-width: 94%; }
  .summary-offer { align-items: stretch; flex-direction: column; }
  .summary-offer .button,
  .composer-actions .button { width: 100%; }
  .composer-actions { align-items: stretch; flex-direction: column-reverse; }
}

@media (prefers-reduced-motion: reduce) {
  .message.streaming .message-content::after { animation: none; }
}
