/* ===== HERMES PIA UI ===== */
/* Designsprache lt. UI-Styleguide v1.0: „Navy trägt, Grün handelt“. */
:root {
  --color-bg:        #f8f9fb;  /* Grund */
  --color-surface:   #ffffff;  /* Karte */
  --color-brand:     #16213e;  /* Navy – Banner, Sidebar, Titel */
  --color-accent:    #0f3460;  /* Tiefblau – Rollen-Badges, Akzente */
  --color-primary:   #439458;  /* Aktionsgrün – Buttons, Links, aktiv */
  --color-text:      #1f2733;  /* Text dunkel */
  --color-muted:     #6b7684;  /* Text grau */
  --color-border:    #e5e7eb;  /* Linie */
  --color-done:      #10b981;  /* Erfolg-Grün – Häkchen, Abschluss */
  --color-required:  #e0912f;  /* Pflicht-Amber – nur das Sternchen */
  --color-followup:  #f59e0b;
  --color-focus-ring: rgba(67, 148, 88, .18);  /* weicher Fokusring in Grün */
  --radius:          8px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
               sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 15px;
  line-height: 1.6;
}

/* ---- Umgebungs-Banner ---- */
.env-banner {
  padding: 6px 28px;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: .02em;
}
.env-banner--dev {
  background: #16a34a;
  color: #ffffff;
}
.env-banner--test {
  background: #f59e0b;
  color: #1a1a2e;
}
.env-banner--int {
  background: #3b82f6;
  color: #ffffff;
}

/* ---- Versions-Badge (immer sichtbar, dezent unten rechts) ---- */
.app-version-badge {
  position: fixed;
  bottom: 8px;
  right: 10px;
  z-index: 50;
  padding: 3px 9px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #6b7280;
  background: rgba(255, 255, 255, .85);
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  user-select: text;
}

/* ---- Formular-Fehlermeldung ---- */
.form-error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 14px;
}

/* ---- Marken-Leiste (Logo) ---- */
.brand-bar {
  background: #ffffff;
  padding: 10px 28px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 16px;
}
.user-menu {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
}
.user-link {
  color: var(--color-accent);
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.user-link:hover { color: var(--color-primary); text-decoration: none; }
.user-email { color: var(--color-muted); }
.user-org {
  color: var(--color-accent);
  font-weight: 600;
  padding: 2px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}
.user-org:empty { display: none; }
.user-logout { color: var(--color-primary); }
.brand-logo {
  display: block;
  height: 40px;
  width: auto;
}

/* ---- Header ---- */
header {
  background: var(--color-brand);
  color: #fff;
  padding: 12px 28px;
  font-size: 15px;
  letter-spacing: .01em;
}
header strong { color: #e2e8f0; }

/* ---- Buttons ---- */
.btn-primary {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 22px;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .88; }

.btn-primary.btn-large { padding: 12px 28px; font-size: 16px; }

.btn-secondary {
  display: inline-block;
  background: var(--color-surface);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  padding: 10px 22px;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.btn-secondary:hover { background: color-mix(in srgb, var(--color-primary) 8%, #fff); }

.btn-link {
  color: var(--color-primary);
  text-decoration: none;
  font-size: 14px;
}
.btn-link:hover { text-decoration: underline; }

/* ---- Nächster Schritt ----
   Genau EIN Vorschlag, hervorgehoben; alles Weitere tritt zurück. Die Karte
   trägt keinen eigenen Farbton: sie wirkt durch Ruhe und Position, nicht
   durch Signalfarbe. Ein Aufruf, der schreit, wird übersehen wie zehn. */
.naechster-schritt {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 32px;
  max-width: 620px;
}
.ns-gruss { margin: 0 0 4px; color: var(--color-muted); font-size: 14px; }
.ns-titel { margin: 0 0 6px; font-size: 19px; line-height: 1.35; }
.ns-wo { margin: 0 0 10px; color: var(--color-muted); font-size: 13px; }
.ns-warum { margin: 0 0 16px; font-size: 14px; line-height: 1.55; max-width: 60ch; }
.ns-los { display: inline-block; }
.ns-weitere { margin-top: 18px; font-size: 14px; }
.ns-weitere summary { cursor: pointer; color: var(--color-muted); }
.ns-liste { margin: 10px 0 0; padding-left: 18px; line-height: 1.9; }
.ns-ruhig { margin: 14px 0 0; font-size: 13px; }

/* ---- Index ---- */
main { padding: 32px 28px; max-width: 900px; }
main.wide { max-width: 100%; padding: 0; }
/* Seiten, die vor allem Tabellen zeigen: 900px zwingt Spalten in den Umbruch,
   waehrend rechts die halbe Flaeche leer bleibt. Nicht 100% - Fliesstext
   bleibt sonst unlesbar breit; die einzelnen Textbloecke haben ohnehin ihr
   eigenes Mass. */
main.breit { max-width: 1240px; }

.index-hero { margin-bottom: 40px; }
.index-hero h1 { margin: 0 0 8px; font-size: 22px; }
h1 small { color: var(--color-muted); font-weight: normal; font-size: .75em; }
.hero-desc { color: var(--color-muted); margin: 0 0 24px; max-width: 620px; }

.start-form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px 28px;
  max-width: 560px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-row-wide {
  grid-column: 1 / -1;
}

.form-row-action {
  grid-column: 1 / -1;
  margin-top: 4px;
}

.start-form-card label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.start-form-card input[type="text"] {
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color .15s;
}

.start-form-card input[type="text"]:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.start-form-card input[type="text"]::placeholder {
  color: var(--color-muted);
  font-size: 13px;
}

.required { color: var(--color-required); margin-left: 1px; }

.sessions-section h2 { font-size: 17px; margin-bottom: 12px; }
.sessions-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.sessions-table th {
  text-align: left;
  font-size: 12px;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
}
.sessions-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}
.sessions-table tr:last-child td { border-bottom: none; }

/* ---- Interview Layout ---- */
.interview-layout {
  display: flex;
  gap: 0;
  min-height: calc(100vh - 48px);
  width: 100%;
}

/* ---- Progress Panel (links) ---- */
.progress-panel {
  width: 240px;
  min-width: 200px;
  background: var(--color-brand);
  color: #e2e8f0;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-shrink: 0;
}

.project-meta { padding-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,.12); }
.project-name { font-weight: bold; font-size: 14px; color: #fff; word-break: break-word; }
.project-type { margin-top: 6px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-type    { background: #0f3460; color: #93c5fd; }
.badge-pending { background: rgba(255,255,255,.1); color: #9ca3af; }

.section-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  overflow-y: auto;
}
.section-item {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 5px 6px;
  border-radius: 5px;
  font-size: 12px;
  color: rgba(255,255,255,.5);
  transition: background .1s;
}
.section-item.section-done    { color: var(--color-done); }
.section-item.section-current { color: #fff; background: rgba(255,255,255,.1); font-weight: bold; }
.section-item.section-followup_pending { color: var(--color-followup); }

.section-status-icon { width: 14px; text-align: center; flex-shrink: 0; }
.section-number      { flex-shrink: 0; font-size: 11px; opacity: .7; }
.section-title-short { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.progress-bar-wrap {
  height: 4px;
  background: rgba(255,255,255,.15);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--color-done);
  transition: width .4s;
}
.progress-label { font-size: 11px; color: rgba(255,255,255,.45); text-align: right; }

/* ---- Interview Main (Mitte) ---- */
.interview-main {
  flex: 0 0 500px;
  padding: 32px 36px;
  max-width: 500px;
  background: var(--color-bg);
  border-right: 1px solid var(--color-border);
}

/* ---- Edit-Button in Fortschrittsliste ---- */
.section-item { position: relative; }
.btn-edit-section {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(255,255,255,.35);
  cursor: pointer;
  font-size: 12px;
  padding: 1px 4px;
  border-radius: 3px;
  text-decoration: none;
  transition: color .15s, background .15s;
}
.btn-edit-section:hover { color: #fff; background: rgba(255,255,255,.12); }

/* ---- Preview-Panel (rechts) ---- */
.preview-panel {
  flex: 1;
  min-width: 300px;
  max-width: 420px;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  position: sticky;
  top: 0;
  z-index: 1;
}

.preview-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-muted);
}

.preview-version {
  font-size: 11px;
  background: var(--color-accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
}

.preview-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.preview-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  color: var(--color-muted);
  font-size: 13px;
  text-align: center;
  gap: 6px;
}

.preview-section {
  background: var(--color-bg);
  border-radius: var(--radius);
  padding: 12px 14px;
  border-left: 3px solid var(--color-accent);
}

.preview-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-accent);
  margin-bottom: 7px;
  display: flex;
  gap: 6px;
  align-items: baseline;
}

.preview-num {
  background: var(--color-accent);
  color: #fff;
  border-radius: 3px;
  padding: 0 5px;
  font-size: 10px;
}

.preview-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-text);
  margin: 0;
  white-space: pre-wrap;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.preview-table th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-muted);
  padding: 4px 8px;
  border-bottom: 1px solid var(--color-border);
}

.preview-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  vertical-align: top;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.section-num-badge {
  background: var(--color-accent);
  color: #fff;
  border-radius: 5px;
  padding: 2px 9px;
  font-size: 13px;
  font-weight: bold;
  flex-shrink: 0;
}
.section-header h2 { margin: 0; font-size: 20px; line-height: 1.35; }
/* Herkunftsvermerk: der Fachbegriff bleibt sichtbar, tritt aber zurück.
   Der negative Abstand holt ihn an die Frage heran, ohne den Abstand der
   Kopfzeile zu ändern – die gilt auch dort, wo es keine Leitfrage gibt. */
.section-herkunft {
  margin: -14px 0 20px 46px;      /* auf Höhe des Titels, an der Nummer vorbei */
  color: var(--color-muted);
  font-size: 13px;
}

.question-list { margin-bottom: 16px; }
.question-item {
  background: var(--color-surface);
  border-left: 3px solid var(--color-primary);
  padding: 10px 14px;
  margin: 0 0 8px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 15px;
}

.completeness-hint {
  font-size: 13px;
  color: var(--color-muted);
  margin-bottom: 18px;
  cursor: pointer;
}
.completeness-hint summary { padding: 4px 0; }
.completeness-hint ul { margin: 6px 0 0 18px; }

/* ---- Answer area ---- */
.answer-area {
  position: relative;
  margin-bottom: 18px;
}
#answer-text, textarea[name="raw_text"] {
  width: 100%;
  padding: 14px;
  padding-right: 130px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
  line-height: 1.5;
  background: var(--color-surface);
  resize: vertical;
  transition: border-color .15s;
}
#answer-text:focus, textarea[name="raw_text"]:focus {
  outline: none;
  border-color: var(--color-primary);
}

.btn-voice {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.btn-voice:hover    { background: #0a2540; }
.btn-voice.recording { background: var(--color-primary); animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .7; }
}

.voice-status { font-size: 12px; color: var(--color-muted); margin-top: 4px; min-height: 18px; }

/* Mikrofonwahl (Server-STT): nur das gewählte Mikrofon wird aufgenommen. */
.voice-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mic-select {
  font-size: 12px;
  color: var(--color-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 3px 6px;
  max-width: 280px;
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ---- Followup ---- */
.followup-card {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid var(--color-followup);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 22px;
}
.followup-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-followup);
  font-weight: bold;
  margin-bottom: 8px;
}
.followup-question { margin: 0 0 8px; font-size: 16px; font-weight: 500; }
.followup-suggestion { margin: 0; font-size: 13px; color: var(--color-muted); }

/* ---- Complete ---- */
.complete-banner {
  text-align: center;
  padding: 60px 20px;
}
.complete-icon {
  width: 64px;
  height: 64px;
  background: var(--color-done);
  color: #fff;
  border-radius: 50%;
  font-size: 32px;
  line-height: 64px;
  margin: 0 auto 20px;
}
.complete-banner h2 { margin: 0 0 12px; }
.complete-banner p  { color: var(--color-muted); margin-bottom: 28px; }

/* ---- Version-Bump-Seite ---- */
.version-bump-page { max-width: 680px; padding: 32px 28px; }
.vb-header h1 { margin: 0 0 4px; font-size: 20px; }
.vb-subtitle { color: var(--color-muted); margin: 0 0 32px; }
.vb-form { display: flex; flex-direction: column; gap: 28px; }
.vb-section h2 { font-size: 15px; margin: 0 0 10px; }
.vb-hint { color: var(--color-muted); font-size: 13px; margin: 0 0 10px; }

.vb-bump-options { display: flex; flex-direction: column; gap: 8px; }
.vb-bump-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.vb-bump-option:hover { border-color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 7%, #fff); }
.vb-bump-option input[type="radio"]:checked + .vb-bump-label { color: var(--color-primary); }

.vb-changed-list {
  margin: 0 0 12px 20px;
  padding: 0;
  font-size: 14px;
  color: var(--color-text);
}
.vb-changed-list li { margin-bottom: 3px; }

.vb-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.vb-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  background: var(--color-surface);
}
.vb-textarea:focus { outline: none; border-color: var(--color-primary); }

.vb-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.vb-log-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-muted);
  padding: 6px 10px;
  border-bottom: 1px solid var(--color-border);
}
.vb-log-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
}

.vb-actions { display: flex; gap: 12px; align-items: center; }

/* ---- Aktionen in der Sessions-Liste (Weiter / Löschen) ---- */
.session-actions { display: flex; gap: 14px; align-items: center; }
.inline-form { display: inline; margin: 0; }
.btn-danger { color: #c0392b; }
.admin-hint { font-size: 12px; margin-top: 4px; }
.btn-delete {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  color: var(--color-primary);
}
.btn-delete:hover { text-decoration: underline; }

/* ---- Abschnitt bearbeiten ---- */
.edit-page { max-width: 720px; padding: 32px 28px; margin: 0 auto; }
.edit-hint {
  color: var(--color-muted);
  font-size: 14px;
  margin: 10px 0 18px;
  line-height: 1.5;
}

/* ---- Responsive ---- */
/* Tablet: alles vertikal stapeln, Vorschau bleibt sichtbar (statt versteckt) */
@media (max-width: 980px) {
  .interview-layout { flex-direction: column; min-height: 0; }
  .progress-panel {
    width: 100%;
    min-width: 0;
    padding: 16px 18px;
  }
  .section-list { max-height: 200px; }
  .interview-main {
    flex: 1 1 auto;
    max-width: 100%;
    border-right: none;
    padding: 26px 22px;
  }
  .preview-panel {
    flex: 1 1 auto;
    max-width: 100%;
    min-width: 0;
    border-top: 2px solid var(--color-border);
    max-height: 60vh;
  }
  .preview-section { overflow-x: auto; }
}

/* Smartphone: einspaltiges Startformular, kompakter Header */
@media (max-width: 600px) {
  main { padding: 20px 16px; }
  main.wide { padding: 0; }
  header { padding: 12px 16px; font-size: 14px; }
  .brand-bar { padding: 8px 16px; }
  .brand-logo { height: 30px; }
  .env-banner { padding: 6px 16px; font-size: 12px; }

  .start-form-card {
    grid-template-columns: 1fr;
    max-width: 100%;
    padding: 20px 18px;
  }

  .interview-main { padding: 18px 14px; }
  .preview-panel { max-height: none; }
  .preview-table { font-size: 11px; }

  .sessions-table { font-size: 13px; }
  .sessions-table th, .sessions-table td { padding: 9px 10px; }
  .session-actions { gap: 10px; flex-wrap: wrap; }

  .edit-page { padding: 20px 16px; }

  /* Versions-Badge auf sehr kleinen Screens ausblenden – stört sonst */
  .app-version-badge { display: none; }
}

/* ===================== Anmeldung & Verwaltung ===================== */
.login-page { max-width: 460px; margin: 0 auto; padding: 40px 24px; }
.login-page h1 { margin-bottom: 4px; }
.login-sub { color: var(--color-muted); margin: 0 0 22px; }
.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-page { max-width: 880px; margin: 0 auto; padding: 32px 28px; }
.admin-page h1 { margin-bottom: 6px; }
.admin-page h2 { font-size: 16px; margin: 0 0 10px; }

.admin-inline-form {
  display: flex;
  gap: 10px;
  margin: 16px 0 26px;
}
.admin-inline-form input[type="text"] { flex: 1; }

.admin-grid-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.admin-grid-form input[type="text"],
.admin-grid-form input[type="email"],
.admin-grid-form input[type="password"] { flex: 1 1 180px; }

.admin-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.admin-card-head { display: flex; align-items: center; justify-content: space-between; }
.admin-sub { font-size: 13px; color: var(--color-muted); margin: 6px 0 14px; }
.admin-warn { color: var(--color-primary); }
.admin-empty { color: var(--color-muted); margin-top: 18px; }

input[type="text"], input[type="email"], input[type="password"], input[type="date"] {
  padding: 9px 11px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.chk {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--color-text);
  white-space: nowrap;
}
.rights-form { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.users-table td { vertical-align: middle; }
.muted { color: var(--color-muted); font-size: 13px; }

@media (max-width: 600px) {
  .admin-page, .login-page { padding: 20px 16px; }
  .user-menu { gap: 10px; font-size: 12px; }
  .admin-grid-form { flex-direction: column; align-items: stretch; }
}

/* ---- Passwort/Reset & Erfolgsmeldung ---- */
.form-success {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 14px;
}
.reset-form { display: flex; align-items: center; gap: 8px; }
.reset-form input[type="password"] { width: 150px; font-size: 13px; padding: 6px 9px; }
.action-cell { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.admin-add-admin { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--color-border); }
.users-table th:last-child { width: 240px; }

@media (max-width: 600px) {
  .reset-form { flex-wrap: wrap; }
  .reset-form input[type="password"] { width: 100%; }
}

/* ---- Projekte: Startseite + Projektansicht ------------------------- */
.start-form-title { margin: 0 0 4px; font-size: 1.15rem; color: var(--color-text); }
.start-form-hint  { margin: 0 0 18px; color: var(--color-muted); font-size: .9rem; }
.projekt-link { color: var(--color-accent); font-weight: 600; text-decoration: none; }
.projekt-link:hover { text-decoration: underline; }

.breadcrumb-back {
  display: inline-block; margin-bottom: 16px;
  color: var(--color-muted); text-decoration: none; font-size: .9rem;
}
.breadcrumb-back:hover { color: var(--color-accent); text-decoration: underline; }

.projekt-head { margin-bottom: 28px; }
.projekt-head h1 { margin: 0 0 12px; }
.projekt-meta-grid {
  display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px;
  margin: 0; font-size: .92rem;
}
.projekt-meta-grid dt { color: var(--color-muted); }
.projekt-meta-grid dd { margin: 0; color: var(--color-text); }

.phase-title {
  margin: 0 0 16px; padding-bottom: 8px;
  border-bottom: 2px solid var(--color-accent); color: var(--color-accent);
}

.meilenstein-bar {
  list-style: none; margin: 0 0 24px; padding: 0;
  display: flex; flex-wrap: wrap; gap: 10px;
}
.meilenstein {
  flex: 1 1 180px; padding: 10px 14px;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); border-left: 4px solid var(--color-border);
}
.meilenstein-start { border-left-color: var(--color-primary); }
/* Ein erreichter Meilenstein wird BENANNT, nicht nur eingefaerbt: Farbe
   allein traegt keine Aussage und wird uebersehen. Der Rand bleibt als
   zweites, schwaecheres Signal - er ersetzt den Satz nicht. */
.meilenstein-erreicht {
  border-left-color: var(--color-done);
  border-left-width: 6px;
  background: color-mix(in srgb, var(--color-done) 5%, #fff);
}
.meilenstein-status {
  display: block; margin-top: 4px; font-size: .85rem;
  font-weight: 600; color: var(--color-done);
}
.meilenstein-status-offen { color: var(--color-muted); font-weight: normal; }
.meilenstein-name  { display: block; font-weight: 600; color: var(--color-text); }
.meilenstein-datum { display: block; font-size: .85rem; color: var(--color-accent); margin-top: 2px; }
.meilenstein-rolle { display: block; font-size: .8rem; color: var(--color-muted); margin-top: 2px; }

.modul-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px;
}
.modul-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 16px 18px;
}
.modul-title {
  margin: 0 0 12px; padding-bottom: 8px; font-size: 1rem;
  border-bottom: 1px solid var(--color-border); color: var(--color-text);
}
.modul-empty { font-size: .88rem; margin: 0; }

.ergebnis-list { list-style: none; margin: 0; padding: 0; }
.ergebnis-item { padding: 10px 0; border-bottom: 1px solid var(--color-border); }
.ergebnis-item:last-child { border-bottom: none; }
.ergebnis-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ergebnis-titel { flex: 1 1 auto; }
.ergebnis-titel { font-weight: 600; color: var(--color-text); }
.ergebnis-aufgabe { font-size: .82rem; margin-top: 2px; }
.ergebnis-actions { margin-top: 6px; }
.badge-rolle { background: #0f3460; color: #93c5fd; white-space: nowrap; }

/* ---- Freigabe-Upload + Präsentationsvorlage ------------------------- */
.ergebnis-freigabe {
  margin-top: 10px; padding-top: 8px;
  border-top: 1px dashed var(--color-border);
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
}
.freigabe-info { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .88rem; }
.badge-freigabe { background: #f59e0b; color: #1a1a2e; }
.upload-label { cursor: pointer; }
.upload-label input[type="file"] { display: none; }
.vorlage-block {
  margin-top: 28px; padding: 16px 18px;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.vorlage-title { margin: 0 0 8px; font-size: 1rem; color: var(--color-text); }
.vorlage-status { margin: 0 0 10px; font-size: .88rem; }
.vorlage-actions { display: flex; flex-wrap: wrap; gap: 18px; }
.upload-status { margin-top: 10px; min-height: 18px; font-size: .88rem; }

/* Erkennungs-Vorschau der Wortvorlage */
.vorlage-erkennung {
  border-left: 3px solid var(--color-accent);
  padding-left: 12px; margin: 6px 0 12px;
}

/* Drag-&-Drop-Zone für die Wortvorlage */
.dropzone {
  display: flex; align-items: center; justify-content: center;
  min-height: 70px; padding: 14px 18px; margin-top: 4px;
  border: 2px dashed var(--color-border); border-radius: var(--radius);
  color: var(--color-muted); text-align: center; cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
}
.dropzone:hover { border-color: var(--color-accent); color: var(--color-text); }
.dropzone--over {
  border-color: var(--color-accent); border-style: solid;
  background: color-mix(in srgb, var(--color-accent) 8%, transparent);
  color: var(--color-text);
}
.dropzone-text { pointer-events: none; font-size: .9rem; }

/* Kapitel-Zuordnungs-Editor */
.zuordnung { margin-top: 14px; }
.zuordnung-status { margin: 0 0 10px; font-size: .88rem; }
.zuordnung-scroll { overflow-x: auto; }
.zuordnung-tabelle { width: 100%; border-collapse: collapse; font-size: .88rem; }
.zuordnung-tabelle th, .zuordnung-tabelle td {
  text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.zuordnung-tabelle th { color: var(--color-muted); font-weight: 600; }
.zt-kapitel { min-width: 220px; }
.zt-ziel { width: 100%; max-width: 320px; }
.zt-bemerkung-wrap { display: flex; align-items: center; gap: 6px; }
.zt-bemerkung { flex: 1; min-width: 120px; }
.diktat-btn {
  flex: none; border: 1px solid var(--color-border); background: var(--color-surface);
  border-radius: 6px; padding: 4px 8px; cursor: pointer; line-height: 1;
  font-size: 14px; transition: border-color .12s, background .12s;
}
.diktat-btn:hover:not(:disabled) { border-color: var(--color-primary); }
.diktat-btn:disabled { opacity: .4; cursor: not-allowed; }
.diktat-btn.recording {
  border-color: var(--color-primary); background: var(--color-primary); color: #fff;
  animation: pulse 1s infinite;
}
.diktat-status { margin-top: 8px; min-height: 16px; font-size: .82rem; }
.zuordnung form > button { margin-top: 12px; }

/* Erscheinungsbild (Org-Branding) im PMO-Bereich */
.branding-zeile {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin: 0 0 12px;
}
.branding-label { font-weight: 600; min-width: 56px; }
.branding-logo-vorschau {
  max-height: 32px; width: auto;
  border: 1px solid var(--color-border); border-radius: 4px;
  background: #fff; padding: 2px 6px;
}
.branding-zeile .chk { display: inline-flex; align-items: center; gap: 6px; }
.branding-zeile input[type="color"] {
  width: 44px; height: 26px; padding: 0; border: 1px solid var(--color-border);
  border-radius: 4px; background: none; cursor: pointer;
}

/* ===== Warnbanner ===== */
/* Für Zustände, in denen HERMES PIA weiterarbeitet, aber schlechtere Ergebnisse
   liefert – etwa ohne Pseudonymisierungsdienst. Bewusst NICHT wegklickbar:
   still degradieren und dabei still bleiben war die eigentliche Gefahr. */
.warnbanner {
  background: #fff7ed;
  border: 1px solid var(--color-required);
  border-left: 4px solid var(--color-required);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  margin-bottom: 1rem;
  color: var(--color-text);
  line-height: 1.5;
}
.warnbanner strong { display: block; margin-bottom: .2rem; }
.warnbanner code {
  font-family: var(--font-mono);
  font-size: .9em;
  background: rgba(0, 0, 0, .05);
  padding: .05rem .3rem;
  border-radius: 4px;
}

/* ===== Qualitätsprüfung (Invarianten) ===== */
/* Waehrend der Erstellung nur ein Hinweis – zusammengeklappt, damit er nicht
   drängt. Verbindlich wird die Pruefung erst vor der Ausgabe. */
.qualitaet-hinweis {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-followup);
  border-radius: var(--radius);
  padding: .6rem .9rem;
  margin-bottom: 1rem;
}
.qualitaet-hinweis summary { cursor: pointer; font-weight: 600; }
.qualitaet-hinweis ul { margin: .6rem 0 0; padding-left: 1.2rem; }
.qualitaet-hinweis li { margin: .25rem 0; line-height: 1.45; }
.qualitaet-hinweis code,
.befundliste code {
  font-family: var(--font-mono); font-size: .85em;
  color: var(--color-muted);
}
.befundliste { width: 100%; border-collapse: collapse; margin: .5rem 0 1.5rem; }
.befundliste th, .befundliste td {
  border-bottom: 1px solid var(--color-border);
  padding: .45rem .6rem; text-align: left; vertical-align: top;
}
.befundliste th { background: var(--color-bg); font-weight: 600; }

/* ===== Fachliche Prüfung (Auftraggeber-Sicht, Stufe 4) ===== */
/* Bewusst anders als die Invarianten-Anzeige: der Nutzer muss Regelbefund und
   fachliches Urteil unterscheiden können (Briefing 5.1). */
.empfehlung {
  border: 1px solid var(--color-border);
  border-left: 5px solid var(--color-accent);
  border-radius: var(--radius);
  padding: 1rem 1.2rem; margin: 1rem 0 1.5rem;
  background: var(--color-surface);
}
.empfehlung-label {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--color-muted);
}
.empfehlung-wert { font-size: 1.35rem; font-weight: 700; margin: .2rem 0 .5rem; }
.empfehlung-freigebbar        { border-left-color: var(--color-done); }
.empfehlung-mit-vorbehalt     { border-left-color: var(--color-required); }
.empfehlung-nicht-freigebbar  { border-left-color: #c0392b; }
.widerspruch-form { display: flex; gap: .3rem; align-items: center; }
.widerspruch-form input[type=text] { font-size: .85rem; padding: .2rem .4rem; }
tr.widersprochen td { opacity: .55; text-decoration: line-through; }
tr.widersprochen td:last-child { opacity: 1; text-decoration: none; }

/* ===== Kapitelweiser Prüflauf ===== */
.lauf {
  border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: 1rem 1.2rem; margin: 1rem 0; background: var(--color-surface);
}
.lauf-kopf { display: flex; justify-content: space-between; align-items: baseline;
             margin-bottom: .6rem; }
.lauf-schritte { list-style: none; margin: .8rem 0 0; padding: 0; }
.lauf-schritte li { padding: .15rem 0; color: var(--color-muted); }
.lauf-schritte li.aktiv { color: var(--color-text); font-weight: 600; }
.lauf-schritte li.erledigt { color: var(--color-done); }
.lauf-schritte li.erledigt .lauf-punkt::before { content: "\2713"; }
.lauf-schritte li.erledigt .lauf-punkt { font-size: 0; }
.lauf-schritte li.erledigt .lauf-punkt::before { font-size: 1rem; }
.lauf-schritte li.gescheitert { color: #c0392b; }
.lauf-punkt { display: inline-block; width: 1.2rem; }

/* Fachliche Pruefung: gezaehlte Werte und priorisierte Befunde.
   Die Zahlen kommen aus dem Code (protokoll.zaehlung), nicht aus dem
   Modelltext - eine erzaehlte Zahl war schon falsch. */
.zaehlung { margin: .4rem 0 .2rem; font-size: .95rem; letter-spacing: .01em; }
.gewicht-muss { color: #b02020; margin-top: 1.4rem; }
.gewicht-vorbehalt { color: #9a6b00; margin-top: 1.4rem; }
.hinweis-block { margin-top: 1.4rem; }
.hinweis-block > summary { cursor: pointer; font-weight: 600; padding: .35rem 0; }

/* ---- Projektinitialisierungsfreigabe ----
   Die Bewertung ist die einzige Farbe auf der Seite: sie soll beim
   Ueberfliegen zeigen, wo etwas offen ist. Alles andere bleibt ruhig. */
.freigabe-herkunft { margin-left: 0; }
.freigabe-kapitel { margin: 32px 0; }
.freigabe-kapitel h2 { font-size: 17px; margin: 0 0 12px; }
.freigabe-tabelle { width: 100%; border-collapse: collapse; font-size: 14px; }
.freigabe-tabelle th {
  text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--color-border);
  color: var(--color-muted); font-weight: 600; font-size: 13px;
}
.freigabe-tabelle td {
  padding: 10px; border-bottom: 1px solid var(--color-border);
  vertical-align: top; line-height: 1.5;
}
.freigabe-nr { font-family: var(--font-mono); white-space: nowrap; color: var(--color-muted); }
.freigabe-erlaeuterung { color: var(--color-muted); }
/* Die Begruendung ist das Wertvollste an der Zeile - sie darf nicht in einem
   Zwei-Zeilen-Fenster verschwinden. Das Feld waechst mit dem Inhalt (siehe
   freigabe.html); diese Mindesthoehe gilt, bevor das Skript greift. */
.freigabe-erlaeuterung .vb-textarea {
  min-height: 5.4em; line-height: 1.45; resize: vertical; overflow: hidden;
  width: 100%;
}
/* Feste Spaltenanteile für die Prüfpunkte. Ohne sie verteilt der Browser nach
   Textlänge: das Kriterium bekam die halbe Tabelle, die Erläuterung wurde zur
   Schlucht, und jede Zeile wuchs auf zehn Umbrüche. Die Frage darf breit sein,
   die Antwort muss es. */
.pruefpunkte { table-layout: fixed; width: 100%; }
.pruefpunkte th:nth-child(1), .pruefpunkte td:nth-child(1) { width: 6%; }
.pruefpunkte th:nth-child(2), .pruefpunkte td:nth-child(2) { width: 38%; }
.pruefpunkte th:nth-child(3), .pruefpunkte td:nth-child(3) { width: 18%; }
.pruefpunkte th:nth-child(4), .pruefpunkte td:nth-child(4) { width: 38%; }
.pruefpunkte .mic-select { width: 100%; max-width: 190px; }
.freigabe-herkunftsvermerk {
  display: block; margin-top: 4px; font-size: 12px; color: var(--color-muted);
  font-style: italic;
}
/* Linker Balken je Bewertung - Farbe UND Position, damit die Unterscheidung
   nicht allein am Farbsehen haengt. */
.freigabe-tabelle tr[class^="bewertung-"] td:first-child { border-left: 3px solid transparent; }
.bewertung-erfuellt td:first-child { border-left-color: var(--color-done) !important; }
.bewertung-teilweise-erfuellt td:first-child { border-left-color: var(--color-required) !important; }
.bewertung-nicht-erfuellt td:first-child { border-left-color: #c0392b !important; }
.bewertung-zu-bestaetigen td:first-child { border-left-color: var(--color-accent) !important; }
.bewertung-offen td:first-child { border-left-color: var(--color-border) !important; }

.freigabe-aktionen { display: flex; align-items: center; gap: 18px; margin: 24px 0; }
.freigabe-tor {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary); border-radius: var(--radius);
  padding: 20px 24px; margin: 32px 0; max-width: 620px;
}
.freigabe-tor h2 { margin: 0 0 10px; font-size: 17px; }
.freigabe-tor p { font-size: 14px; line-height: 1.55; margin: 0 0 14px; }
.freigabe-erledigt { color: var(--color-done); font-weight: 600; }
.freigabe-datum { width: 170px; display: block; margin: 6px 0 14px; }
.freigabe-fehler {
  background: #fdf1ef; border-left: 3px solid #c0392b; padding: 12px 16px;
  border-radius: var(--radius); font-size: 14px; line-height: 1.55; max-width: 620px;
}
.freigabe-hinweis {
  background: #eefaf1; border-left: 3px solid var(--color-done); padding: 12px 16px;
  border-radius: var(--radius); font-size: 14px; line-height: 1.55; max-width: 620px;
}

/* ---- Kopfdaten ---- */
.kopfdaten-raster {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px 24px; max-width: 820px; margin-bottom: 18px;
}
.kopfdaten-raster input[type="text"] {
  padding: 9px 12px; border: 1px solid var(--color-border);
  border-radius: var(--radius); font-size: 14px;
  background: var(--color-bg); color: var(--color-text);
}
.kopfdaten-raster input[readonly] { color: var(--color-muted); }
.kopfdaten-hinweis { font-size: 13px; line-height: 1.55; max-width: 62ch; margin: 0 0 16px; }
/* Der Abgleich traegt den Amber-Ton der offenen Pflicht: er verlangt eine
   Entscheidung, meldet aber keinen Fehler. */
.kopfdaten-abgleich { border-left-color: var(--color-required); }
