:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #d8dce1;
  --text: #1f2430;
  --muted: #6b7280;
  --accent: #1f6f50;
  --accent-dark: #164f39;
  --danger-bg: #fdecec;
  --danger-border: #e0a1a1;
  --danger-text: #8a1f1f;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}

header {
  background: var(--accent-dark);
  color: #fff;
  padding: 20px 24px;
}

header h1 { margin: 0 0 4px; font-size: 1.4rem; }
header p { margin: 0; color: #cfe4d9; font-size: 0.9rem; }

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px 60px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 1000px) {
  main { grid-template-columns: 1.4fr 1fr; align-items: start; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.hinweisbox {
  background: #fff8e1;
  border: 1px solid #e8d38f;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  grid-column: 1 / -1;
}

.hinweisbox strong { display: block; margin-bottom: 4px; }

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 16px;
  padding: 12px 16px 16px;
}

legend {
  padding: 0 6px;
  font-weight: 600;
  color: var(--accent-dark);
}

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 0.85rem; margin-bottom: 4px; color: var(--text); }
.field input, .field select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.9rem;
  background: #fff;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.field-note { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
.field-group-label { font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; }
.field-group-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.field-group-grid label { font-size: 0.8rem; }

.field-row { display: flex; gap: 10px; }
.field-row > div { flex: 1; }
.field-narrow { max-width: 110px; }

.kind-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}
.kind-row label { display: block; font-size: 0.8rem; margin-bottom: 4px; }
.kind-row input { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; }

.btn-secondary {
  background: #eef2f0;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.8rem;
}
.btn-secondary:hover { background: #e2e8e4; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 0.95rem;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-dark); }

#validation-errors {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 0.85rem;
}
#validation-errors ul { margin: 4px 0 0; padding-left: 20px; }

.sticky-panel { position: sticky; top: 16px; }

#export-preview {
  background: #0f1720;
  color: #d7e4dd;
  padding: 12px;
  border-radius: 6px;
  max-height: 480px;
  overflow: auto;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.75rem;
  white-space: pre;
}

.export-actions { display: flex; gap: 10px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.export-actions label { font-size: 0.85rem; display: flex; align-items: center; gap: 6px; }

.form-actions { text-align: right; margin-top: 8px; }
.btn-primary[href] { display: inline-block; text-decoration: none; text-align: center; }

.single-column main, main.single-column { grid-template-columns: 1fr; max-width: 820px; }

.chooser { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.chooser-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.chooser-card h2 { margin-top: 0; color: var(--accent-dark); }
.chooser-card p { color: var(--muted); font-size: 0.9rem; }

.dok-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 0.85rem;
}
.dok-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
.dok-add-row select { padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; }

.status-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 0.88rem; }
.status-table th, .status-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.status-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.status-offen { background: #fdecec; color: #8a1f1f; }
.status-ergaenzt { background: #fff3d6; color: #8a5a00; }
.status-importiert { background: #e2f3e8; color: var(--accent-dark); }
.status-uebergeben { background: #e6effa; color: #1f4f8a; }

/* Einladungen (status.html) */
.panel + .panel { margin-top: 16px; }
.panel-title { font-size: 1.05rem; margin: 18px 0 6px; color: var(--accent-dark); }
.panel-title:first-child { margin-top: 0; }
.einladung-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 12px; margin-top: 10px; }
.einladung-grid .field input { width: 100%; box-sizing: border-box; }
.einladung-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; gap: 14px; flex-wrap: wrap; }
.senden-option { font-size: 0.85rem; display: flex; align-items: center; gap: 6px; }
.senden-option[hidden] { display: none; }
.versand-info { margin: 4px 0 2px; color: var(--accent-dark); }
.versand-fehler { color: #8a1f1f; }
.link-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.link-row input { flex: 1; min-width: 240px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font-family: monospace; font-size: 0.82rem; }
.hinweis-fehler { background: #fdecec; border-color: #c0392b; color: #8a1f1f; }
.status-table td.aktionen { white-space: nowrap; }
.einladung-offen { background: #e6effa; color: #1f4f8a; }
.einladung-verwendet { background: #e2f3e8; color: var(--accent-dark); }
.einladung-abgelaufen, .einladung-widerrufen { background: #eee; color: #666; }

/* Zweiter Faktor */
.zweitfaktor p { font-size: 0.9rem; }
.code-eingabe { width: 9rem; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 1.1rem; letter-spacing: 0.25em; font-family: monospace; }
