:root {
  --drk-red: #e3000b;
  --drk-red-dark: #b8000f;
  --drk-red-tint: #fdecec;
  --ink: #1d1d1f;
  --ink-soft: #6e6e73;
  --bg: #f5f5f7;
  --card: #ffffff;
  --line: #e5e5ea;
  --green: #2fa84f;
  --amber: #e2a500;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand .mark {
  width: 26px;
  height: 26px;
  background: var(--drk-red);
  border-radius: 8px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
}

.brand .title-block { display: flex; flex-direction: column; line-height: 1.15; }
.brand .title-block .main { font-size: 16px; }
.brand .title-block .sub { font-size: 12px; color: var(--ink-soft); font-weight: 500; }

main.container {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.center-screen {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px;
  border: 1px solid rgba(0,0,0,0.03);
}

.card + .card { margin-top: 18px; }

h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 6px; }
h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 4px; }
p.lead { color: var(--ink-soft); font-size: 15px; line-height: 1.5; margin: 0 0 20px; }

.login-card { width: 100%; max-width: 400px; text-align: center; }
.login-card .mark-lg {
  width: 56px; height: 56px; margin: 0 auto 18px; background: var(--drk-red);
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 22px; letter-spacing: -0.02em;
}

label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin: 0 0 6px; text-align: left; }

input[type="password"], input[type="text"], select, textarea {
  width: 100%;
  font-size: 16px;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fafafa;
  color: var(--ink);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--drk-red);
  box-shadow: 0 0 0 4px var(--drk-red-tint);
  background: #fff;
}
textarea { resize: vertical; min-height: 76px; }

.field { margin-bottom: 16px; text-align: left; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 980px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .06s ease, background .15s, opacity .15s;
  font-family: inherit;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--drk-red); color: #fff; }
.btn-primary:hover { background: var(--drk-red-dark); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-secondary { background: #efeff2; color: var(--ink); }
.btn-secondary:hover { background: #e4e4e8; }
.btn-ghost { background: transparent; color: var(--drk-red); padding: 8px 10px; width: auto; }

.error-msg {
  background: var(--drk-red-tint);
  color: var(--drk-red-dark);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  margin-top: 12px;
  display: none;
}
.error-msg.show { display: block; }

.hint { font-size: 12.5px; color: var(--ink-soft); margin-top: 14px; line-height: 1.5; }

/* Likert segmented control */
.likert-question { margin-bottom: 26px; }
.likert-question .qtext { font-size: 16px; font-weight: 500; margin-bottom: 12px; line-height: 1.4; }
.likert-scale { display: flex; gap: 8px; }
.likert-opt {
  flex: 1;
  text-align: center;
  padding: 12px 4px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: #fafafa;
  cursor: pointer;
  font-weight: 700;
  font-size: 16px;
  color: var(--ink-soft);
  transition: all .12s ease;
  user-select: none;
}
.likert-opt:hover { border-color: #c7c7cc; }
.likert-opt.selected {
  background: var(--drk-red);
  border-color: var(--drk-red);
  color: #fff;
  transform: scale(1.03);
}
.likert-labels { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-soft); margin-top: 6px; }

.category-block { margin-bottom: 8px; }
.category-header {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0 18px;
}
.category-header .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--drk-red); flex: none; }
.category-header h2 { margin: 0; }

.progress-wrap { position: sticky; top: 61px; z-index: 15; background: rgba(245,245,247,0.9); backdrop-filter: blur(10px); padding: 10px 20px; border-bottom: 1px solid var(--line);}
.progress-bar-outer { max-width: 760px; margin: 0 auto; height: 6px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress-bar-inner { height: 100%; background: var(--drk-red); width: 0%; transition: width .25s ease; border-radius: 4px; }
.progress-text { max-width: 760px; margin: 6px auto 0; font-size: 12px; color: var(--ink-soft); text-align: right; }

.divider { height: 1px; background: var(--line); margin: 26px 0; border: none; }

/* Admin dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-tile { background: var(--card); border-radius: var(--radius-md); padding: 18px; box-shadow: var(--shadow); }
.stat-tile .label { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.stat-tile .value { font-size: 30px; font-weight: 700; margin-top: 4px; letter-spacing: -0.02em; }
.stat-tile .value.score-good { color: var(--green); }
.stat-tile .value.score-mid { color: var(--amber); }
.stat-tile .value.score-bad { color: var(--drk-red); }
.stat-tile .sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }

.bar-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.bar-row .bar-label { width: 220px; flex: none; font-size: 13.5px; font-weight: 500; }
.bar-row .bar-track { flex: 1; height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; border-radius: 6px; background: var(--drk-red); }
.bar-row .bar-value { width: 42px; flex: none; text-align: right; font-size: 13.5px; font-weight: 700; }

.wide-container { max-width: 1040px; }

table.simple { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.simple th, table.simple td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); }
table.simple th { color: var(--ink-soft); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.02em; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 980px; font-size: 12px; font-weight: 600; }
.pill.active { background: #e6f6ea; color: var(--green); }
.pill.closed { background: #eeeef0; color: var(--ink-soft); }

.tabbar { display: flex; gap: 6px; margin-bottom: 20px; background: #eeeef0; padding: 4px; border-radius: 980px; width: fit-content; }
.tabbar button {
  border: none; background: transparent; padding: 9px 18px; border-radius: 980px;
  font-size: 14px; font-weight: 600; color: var(--ink-soft); cursor: pointer; font-family: inherit;
}
.tabbar button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }

.open-answer-block { margin-bottom: 22px; }
.open-answer-block h3 { font-size: 14.5px; margin: 0 0 10px; }
.open-answer-item {
  background: #fafafa; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 14px; margin-bottom: 8px; line-height: 1.5;
}

.segmented { display: flex; gap: 4px; background: #eeeef0; padding: 4px; border-radius: 980px; width: fit-content; margin-bottom: 10px; }
.seg-btn {
  border: none; background: transparent; padding: 7px 16px; border-radius: 980px;
  font-size: 13px; font-weight: 600; color: var(--ink-soft); cursor: pointer; font-family: inherit;
}
.seg-btn.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }

.response-card {
  border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px 18px;
  margin-bottom: 14px; background: #fbfbfc;
}
.response-card-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.response-num { font-weight: 700; font-size: 14.5px; }
.response-meta { font-size: 12.5px; color: var(--ink-soft); }
.response-qa { margin-bottom: 10px; }
.response-qa:last-child { margin-bottom: 0; }
.response-q { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; margin-bottom: 3px; }
.response-a { font-size: 14px; line-height: 1.5; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }

.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { margin-bottom: 0; min-width: 160px; }

.success-screen { text-align: center; }
.success-screen .checkmark {
  width: 64px; height: 64px; border-radius: 50%; background: var(--green);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 18px;
}

.warn-box {
  background: #fff8e6; border: 1px solid #f3d99b; color: #8a6100;
  border-radius: var(--radius-sm); padding: 14px 16px; font-size: 13.5px; line-height: 1.5;
}

.small-note { font-size: 12px; color: var(--ink-soft); }

.func-select-wrap { margin-bottom: 4px; }

/* Fragenauswahl-Baukasten (Runden verwalten) */
.catalog-block { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px; margin-bottom: 14px; background: #fbfbfc; }
.catalog-header { padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.qselect-category { margin-bottom: 14px; }
.qselect-category:last-child { margin-bottom: 0; }
.qselect-questions { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; padding-left: 26px; }
.qselect-item {
  display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; line-height: 1.45;
  cursor: pointer; user-select: none;
}
.qselect-item input[type="checkbox"] { margin-top: 3px; flex: none; width: 16px; height: 16px; accent-color: var(--drk-red); cursor: pointer; }
.catalog-toggle-label, .category-toggle-label { font-size: 14.5px; }

.live-banner {
  display: flex; align-items: center; gap: 10px; background: #fff0f0; border: 1px solid #ffc9c9;
  color: var(--drk-red-dark); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px;
  margin-bottom: 16px;
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--drk-red); flex: none;
  animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (max-width: 560px) {
  .bar-row .bar-label { width: 130px; font-size: 12.5px; }
  main.container { padding: 20px 14px 60px; }
  .card { padding: 20px; }
}
