/* Admin-Awareness — self-contained styles. Keine externen Fonts/Assets. */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --ink: #1c2733;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #1f3a5f;
  --accent-ink: #ffffff;
  --accent-2: #2f6fb0;
  --green: #157347;
  --green-bg: #e6f4ec;
  --amber: #a45c00;
  --amber-bg: #fdf0dd;
  --red: #b02a37;
  --red-bg: #fbe7e9;
  --blue-bg: #e6eefb;
  --grey-bg: #eef1f5;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 16px rgba(16, 24, 40, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow);
}
.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.2px;
}
.brand-mark { font-size: 1.2rem; }
.topnav { display: flex; align-items: center; gap: 18px; }
.topnav a {
  color: #d6e2f2;
  text-decoration: none;
  font-size: 0.92rem;
}
.topnav a:hover { color: #fff; }
.inline-form { display: inline; margin: 0; }
.linkbtn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--accent-2);
  font: inherit;
  font-size: 0.92rem;
  text-decoration: none;
}
.topnav .linkbtn { color: #d6e2f2; }
.topnav .linkbtn:hover { color: #fff; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn.danger { color: var(--red); }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.container {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px 48px;
  flex: 1 0 auto;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 20px;
}
.card.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.card.center { text-align: center; }

h1 { font-size: 1.5rem; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 18px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.center { text-align: center; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-head h1 { margin-bottom: 2px; }
.page-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.94rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover { background: #f8fafc; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { background: #17324f; }
.btn-primary:disabled, .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: transparent; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.center-row { justify-content: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; font-weight: 600; }
label > span { color: var(--ink); }
input[type=text], input[type=password], input[type=email], input[type=number], textarea, select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.98rem;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
textarea { resize: vertical; line-height: 1.45; }
select { cursor: pointer; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; border-color: var(--accent-2); }
input[readonly] { background: #f1f5f9; color: var(--muted); }

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.92rem;
  border: 1px solid transparent;
}
.alert-error { background: var(--red-bg); color: var(--red); border-color: #f2c2c7; }
.alert-ok { background: var(--green-bg); color: var(--green); border-color: #bfe3cd; }
.alert-warn { background: var(--amber-bg); color: var(--amber); border-color: #f0d8ab; }
.alert code { background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 4px; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-grey { background: var(--grey-bg); color: #475569; }
.badge-blue { background: var(--blue-bg); color: #1d4ed8; }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-green { background: var(--green-bg); color: var(--green); }
.ok-text { color: var(--green); font-weight: 600; }
.fail-text { color: var(--red); font-weight: 600; }

/* ── Table ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 720px; }
table.data th, table.data td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data thead th { background: #f8fafc; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #f8fafc; }
.col-actions { white-space: nowrap; }
.row-actions { display: flex; gap: 12px; align-items: center; }

/* ── Copybox ────────────────────────────────────────────────────────────── */
.copybox { display: flex; gap: 8px; margin-bottom: 8px; }
.copybox input { flex: 1; font-size: 0.85rem; }

/* ── Stepper ────────────────────────────────────────────────────────────── */
.stepper {
  list-style: none;
  display: flex;
  gap: 8px;
  padding: 0;
  margin: 0 0 20px;
  font-size: 0.86rem;
  flex-wrap: wrap;
}
.stepper li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.stepper .dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--grey-bg);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
}
.stepper li.active { border-color: var(--accent-2); color: var(--accent); font-weight: 600; }
.stepper li.active .dot { background: var(--accent); color: #fff; }
.stepper li.done { color: var(--green); }
.stepper li.done .dot { background: var(--green); color: #fff; }

/* ── Learning slides ────────────────────────────────────────────────────── */
.slides { position: relative; }
.slide { display: none; animation: fade 0.2s ease; }
.slide.current { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.slide-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.slide-count { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.tag { font-size: 0.75rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.tag-do { background: var(--green-bg); color: var(--green); }
.tag-dont { background: var(--red-bg); color: var(--red); }
.tag-scenario { background: var(--blue-bg); color: #1d4ed8; }
.slide-lead { font-size: 1.05rem; font-weight: 500; margin: 8px 0 12px; }
.slide-list { padding-left: 4px; list-style: none; margin: 0 0 18px; }
.slide-list li { position: relative; padding: 8px 8px 8px 30px; border-bottom: 1px solid var(--border); }
.slide-list li:last-child { border-bottom: none; }
.slide-list li::before { content: "•"; position: absolute; left: 8px; top: 8px; color: var(--accent-2); font-weight: 700; }
.list-do li::before { content: "✓"; color: var(--green); }
.list-dont li::before { content: "✕"; color: var(--red); }
.confirm {
  display: flex; align-items: flex-start; gap: 10px;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; font-weight: 500; cursor: pointer;
  flex-direction: row;
}
.confirm input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.slide-nav { display: flex; align-items: center; gap: 14px; margin-top: 22px; }
.slide-nav .slide-progress { color: var(--muted); font-size: 0.88rem; margin-left: auto; margin-right: auto; }

/* ── Quiz ───────────────────────────────────────────────────────────────── */
.quiz { display: flex; flex-direction: column; gap: 16px; }
.question { border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin: 0; }
.question legend { font-weight: 600; padding: 0 6px; display: flex; gap: 8px; align-items: baseline; }
.qnum {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 0.8rem; font-weight: 700; flex: none;
}
.option {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  font-weight: 400; flex-direction: row;
}
.option:hover { background: #f8fafc; }
.option input { margin-top: 3px; width: 17px; height: 17px; flex: none; }
.option span { font-size: 0.96rem; }
.quiz-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 4px; }

/* ── Declaration + signature ────────────────────────────────────────────── */
.pass-banner {
  display: inline-block; background: var(--green-bg); color: var(--green);
  font-weight: 700; padding: 6px 14px; border-radius: 999px; margin-bottom: 12px;
  font-size: 0.9rem;
}
.declaration {
  background: #f8fafc; border: 1px solid var(--border); border-radius: 10px;
  padding: 20px 22px; margin-bottom: 22px;
}
.declaration h2 { font-size: 1.1rem; }
.declaration ol { padding-left: 22px; }
.declaration li { margin-bottom: 10px; }
.sigfield-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-weight: 600; font-size: 0.9rem; }
.sig-canvas-wrap { position: relative; }
.sig-canvas {
  width: 100%; height: 200px; display: block;
  background: #fff; border: 2px dashed #cbd5e1; border-radius: 10px;
  touch-action: none; cursor: crosshair;
}
.sig-placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #94a3b8; pointer-events: none; font-size: 0.95rem;
}
.sig-error { color: var(--red); font-size: 0.9rem; font-weight: 600; margin: 0; }

/* ── Misc participant ───────────────────────────────────────────────────── */
.big-icon { font-size: 3rem; line-height: 1; margin-bottom: 8px; }
.big-icon.success { color: var(--green); }
.score-big { font-size: 3rem; font-weight: 800; margin: 6px 0; }

/* ── Test-Ergebnis mit Auflösung ────────────────────────────────────────── */
.result-head { display: flex; align-items: center; gap: 18px; margin-bottom: 8px; }
.result-head .big-icon { margin-bottom: 0; }
.result-head h1 { margin-bottom: 2px; }
.score-inline { font-size: 1.15rem; font-weight: 700; margin: 2px 0; }
.review { margin: 20px 0; }
.review h2 { font-size: 1.05rem; margin-bottom: 2px; }
.review-item { border: 1px solid var(--border); border-left: 3px solid var(--red); border-radius: 8px; padding: 12px 14px; margin-top: 12px; background: #fff; }
.review-q { font-weight: 600; margin-bottom: 8px; display: flex; gap: 8px; align-items: baseline; }
.review-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--grey-bg); color: #475569; font-size: 0.78rem; font-weight: 700; flex: none; }
.review-ans { display: flex; gap: 10px; align-items: baseline; padding: 3px 0; font-size: 0.95rem; }
.review-label { flex: none; width: 108px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; padding-top: 2px; }
.review-wrong { color: var(--red); }
.review-right { color: var(--green); }

/* ── Fragenkatalog-Editor ───────────────────────────────────────────────── */
.callout {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--blue-bg); border: 1px solid #cfe0f7; border-radius: 8px;
  padding: 12px 14px; margin-bottom: 20px; font-size: 0.88rem; color: #1e3a5f;
}
.callout-icon { flex: none; }
.catalog-meta { display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 22px; }
.catalog-meta label { flex: none; }
#cat-threshold { width: 130px; }
#cat-version { width: 150px; }
.catalog-meta-info { margin-left: auto; align-self: center; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.danger-btn { color: var(--red); border-color: #f2c2c7; }
.danger-btn:hover { background: var(--red-bg); }
.err-list { margin: 6px 0 0; padding-left: 20px; }
.err-list li { margin-bottom: 2px; }

.question-block {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 18px; margin-bottom: 16px; background: #fafbfc;
}
.qb-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.qb-num {
  font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--accent); background: var(--blue-bg); padding: 3px 10px; border-radius: 999px;
}
.qb-field { margin-bottom: 12px; }
.qb-optlabel { font-size: 0.85rem; font-weight: 600; margin: 4px 0 8px; }
.options { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.option-row {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px; border-radius: 8px; border: 1px solid transparent;
}
.option-row:has(.opt-correct:checked) { background: var(--green-bg); border-color: #bfe3cd; }
.opt-correct-label { flex: none; display: flex; align-items: center; margin: 0; cursor: pointer; }
.opt-correct { width: 18px; height: 18px; cursor: pointer; }
.opt-text { flex: 1; }
.opt-remove { flex: none; font-size: 1rem; line-height: 1; }
.editor-actions { display: flex; gap: 12px; justify-content: space-between; align-items: center; margin-top: 18px; flex-wrap: wrap; }

/* Lernkarten-Editor: Stichpunkte */
.items { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.item-row { display: flex; align-items: flex-start; gap: 8px; }
.item-bullet { flex: none; color: var(--accent-2); font-weight: 700; padding-top: 10px; }
.clause-num { flex: none; color: var(--accent); font-weight: 700; padding-top: 10px; min-width: 22px; text-align: right; }
.item-text, .clause-text { flex: 1; }
.item-row .opt-remove, .item-row .linkbtn.danger { padding-top: 8px; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.sitefooter { flex-shrink: 0; border-top: 1px solid var(--border); background: var(--surface); }
.sitefooter-inner {
  max-width: 960px; margin: 0 auto; padding: 16px 20px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 0.82rem; color: var(--muted);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 620px) {
  .grid-2 { grid-template-columns: 1fr; }
  .topbar-inner { padding: 0 14px; }
  .container { padding: 20px 14px 40px; }
  .card { padding: 20px; }
  .topnav { gap: 12px; }
}
