@font-face {
  font-family: 'Libre Franklin';
  src: url('/fonts/LibreFranklin-Variable.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #FFFFFF;
  --paper: #F3F4F7;
  --ink: #14161A;
  --muted: #5A606A;
  --line: #E1E4E9;
  --line-strong: #C9CED6;
  --accent: #2348D9;
  --accent-ink: #1A37AD;
  --accent-soft: #EAEFFD;
  --warn: #B0491C;
  --warn-soft: #FCEFE8;
  --ok: #1E7B3A;
  --ok-soft: #E6F4EA;
  --radius: 14px;
  --ring: 0 0 0 1px var(--line);
  --lift: 0 1px 2px rgba(20, 22, 26, .04), 0 6px 20px rgba(20, 22, 26, .05);
  --gutter: max(20px, env(safe-area-inset-left, 0px));
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Libre Franklin', 'Helvetica Neue', Arial, sans-serif; font-size: 16px; line-height: 1.5; }
body.page-survey, body.page-home, body.page-done { background: var(--paper); }
.wrap { max-width: 720px; margin: 0 auto; padding-left: var(--gutter); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
a { color: var(--ink); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* ---------- Header and page heads ---------- */
header.top { background: var(--bg); border-bottom: 1px solid var(--line); }
header.top .wrap { padding-top: 16px; padding-bottom: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand b { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.mark { height: 23px; width: auto; fill: var(--ink); }
.mark .act { fill: var(--accent); }

main.wrap { padding-top: 40px; padding-bottom: 72px; }
h1 { margin: 0; font-size: clamp(30px, 6vw, 42px); font-weight: 800; line-height: 1.08; letter-spacing: -0.02em; text-wrap: balance; }
.intro { margin-top: 14px; color: var(--muted); font-size: 17px; }
.intro p { margin: 0 0 10px; }
.eyebrow { margin: 0 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.meta li { padding: 5px 12px; border-radius: 999px; background: var(--bg); box-shadow: var(--ring); font-size: 14px; font-weight: 600; color: var(--muted); }

.back { margin: 0 0 20px; font-size: 15px; }
.back a { color: var(--accent); font-weight: 650; text-decoration: none; }
.back a:hover { text-decoration: underline; }

/* ---------- Progress, sticks to the top while scrolling ---------- */
.progress { position: sticky; top: 0; z-index: 10; margin: 22px calc(-1 * var(--gutter)) 0; padding: 10px var(--gutter); background: rgba(243, 244, 247, .92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.progress-inner { display: flex; align-items: center; gap: 12px; }
.progress progress { flex: 1; height: 8px; border: 0; border-radius: 4px; background: #DCE0E7; appearance: none; overflow: hidden; }
.progress progress::-webkit-progress-bar { background: #DCE0E7; border-radius: 4px; }
.progress progress::-webkit-progress-value { background: var(--accent); border-radius: 4px; transition: width .3s ease; }
.progress progress::-moz-progress-bar { background: var(--accent); border-radius: 4px; }
.progress-text { flex: none; font-size: 13.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Question cards ---------- */
.survey { counter-reset: q; display: grid; gap: 14px; margin-top: 14px; }
.q { counter-increment: q; min-width: 0; margin: 0; padding: 22px 22px 24px; border: 0; border-radius: var(--radius); background: var(--bg); box-shadow: var(--ring), var(--lift); }
/* Float keeps the legend inside the card instead of cutting through its edge */
.q legend { float: left; width: 100%; display: flex; align-items: flex-start; gap: 12px; margin: 0 0 14px; padding: 0; font-size: 18px; font-weight: 700; line-height: 1.35; }
.q legend::before { content: counter(q); flex: none; display: grid; place-items: center; width: 28px; height: 28px; margin-top: -1px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 800; }
.q-text { flex: 1; }
.optional { display: inline-block; margin-left: 6px; padding: 1px 9px; vertical-align: 2px; border-radius: 999px; background: var(--paper); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.q .desc, .q .err, .q .options, .q .field { clear: both; }
.desc { margin: -8px 0 0; padding: 0 0 0 40px; font-size: 14.5px; color: var(--muted); }
.err { margin: 6px 0 0; padding: 0 0 0 40px; font-size: 14.5px; font-weight: 650; color: var(--warn); }
.desc + .desc { margin-top: 2px; }
.q.has-error { box-shadow: 0 0 0 2px var(--warn), var(--lift); }

/* Follow-up field ("Sonstiges"), sits right under its question */
.q.q-sub { counter-increment: none; margin-top: -6px; padding-top: 18px; border-left: 4px solid var(--accent); }
.q-sub legend { margin-bottom: 4px; font-size: 16px; font-weight: 650; }
.q-sub legend::before { content: none; }
.q-sub .desc, .q-sub .err { padding-left: 0; }
.q-sub .field { margin-top: 10px; }

/* ---------- Answer tiles with drawn radio and check marks ---------- */
.options { display: grid; gap: 8px; margin-top: 14px; }
.option { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 10px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-strong); cursor: pointer; transition: box-shadow .15s, background-color .15s; }
.option:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.option:has(input:checked) { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); font-weight: 600; }
.option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.option input { flex: none; display: grid; place-content: center; width: 20px; height: 20px; margin: 0; border: 2px solid #8F96A3; border-radius: 50%; background: var(--bg); appearance: none; -webkit-appearance: none; transition: border-color .15s, background-color .15s, box-shadow .15s; }
.option input:focus-visible { outline: none; }
.option input[type="checkbox"] { border-radius: 6px; }
.option input:checked { border-color: var(--accent); background: var(--accent); }
.option input[type="radio"]:checked { box-shadow: inset 0 0 0 3px var(--bg); }
.option input[type="checkbox"]:checked::after { content: ''; width: 10px; height: 5px; border: solid #FFFFFF; border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }

.field { display: block; width: 100%; margin-top: 14px; padding: 12px 14px; border: 0; border-radius: 10px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--ink); font: inherit; transition: box-shadow .15s; }
.field::placeholder { color: #9AA0AA; }
.field:hover { box-shadow: inset 0 0 0 1px #9AA0AA; }
.field:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 4px var(--accent-soft); }
textarea.field { resize: vertical; min-height: 100px; }
.field.narrow { max-width: 160px; }

/* ---------- Sending ---------- */
.submit-card { padding: 22px; border-radius: var(--radius); background: var(--bg); box-shadow: var(--ring), var(--lift); }
.submit-title { margin: 0 0 6px; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.consent { margin: 0 0 16px; font-size: 14.5px; color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 24px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent); color: #FFFFFF; font: inherit; font-weight: 650; cursor: pointer; transition: background-color .15s; }
.btn:hover { background: var(--accent-ink); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn-lg { width: 100%; min-height: 54px; font-size: 17px; }

.errors { margin-top: 22px; padding: 14px 16px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.errors p { margin: 0; }

/* Trap for bots: moved out of view, not display:none, which some bots skip */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Start page ---------- */
.choose { display: grid; gap: 12px; margin: 28px 0 0; padding: 0; list-style: none; }
.choose-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 16px; padding: 20px 22px; border-radius: var(--radius); background: var(--bg); box-shadow: var(--ring), var(--lift); text-decoration: none; transition: box-shadow .15s; }
.choose-card:hover { box-shadow: 0 0 0 2px var(--accent), var(--lift); }
.choose-card .eyebrow { grid-column: 1; margin: 0 0 2px; font-size: 12px; }
.choose-title { grid-column: 1; font-size: 19px; font-weight: 750; line-height: 1.3; }
.choose-card .muted { grid-column: 1; font-size: 14.5px; }
.arrow { grid-column: 2; grid-row: 1 / span 3; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 18px; font-weight: 800; transition: background-color .15s, color .15s; }
.choose-card:hover .arrow { background: var(--accent); color: #FFFFFF; }

/* ---------- Thank-you page ---------- */
.done { max-width: 540px; margin: 12px auto 0; padding: 44px 28px; border-radius: 18px; background: var(--bg); box-shadow: var(--ring), var(--lift); text-align: center; }
.done-icon { display: grid; place-items: center; width: 68px; height: 68px; margin: 0 auto 22px; border-radius: 50%; background: var(--ok-soft); }
.done-icon svg { width: 34px; height: 34px; fill: none; stroke: var(--ok); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.done h1 { font-size: clamp(26px, 5vw, 34px); }
.done p { margin: 14px 0 0; font-size: 17px; }
.done p.muted { font-size: 15px; }

/* ---------- Privacy and imprint ---------- */
.prose { margin-top: 18px; }
.prose h2 { margin: 28px 0 6px; font-size: 19px; font-weight: 800; }
.prose p { margin: 0 0 10px; color: #3D434A; }
.prose .notice { margin: 4px 0 8px; padding: 14px 16px; border-radius: 12px; background: var(--accent-soft); color: var(--ink); font-weight: 600; }

@media (max-width: 520px) {
  main.wrap { padding-top: 28px; }
  .q { padding: 18px 16px 20px; }
  .desc, .err { padding-left: 0; }
  .submit-card { padding: 18px 16px; }
}
@media (min-width: 640px) {
  .btn-lg { width: auto; padding: 0 34px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Admin ---------- */
.wrap.wide { max-width: 960px; }
.admin-bar { display: flex; justify-content: space-between; align-items: center; margin: -22px 0 28px; font-size: 15px; }
.admin-bar form { margin: 0; }
.link-btn { padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn.danger, .danger-zone h2 { color: var(--warn); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14.5px; text-decoration: none; }
.btn.ghost { background: var(--bg); color: var(--accent); }
.btn.danger { border-color: var(--warn); background: var(--warn); }

.login { display: grid; gap: 10px; max-width: 360px; margin-top: 26px; }
.login label { font-weight: 700; }
.login .field { margin-top: 0; }
.login .btn { justify-self: start; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 26px 0 0; padding: 0; list-style: none; }
.card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.card-main { display: grid; gap: 4px; padding: 18px 18px 16px; text-decoration: none; }
.card-main:hover { background: var(--paper); }
.card-title { font-weight: 700; }
.card-count { font-size: 44px; font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--accent); }
.card-main .muted { font-size: 14.5px; }
.card-link { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: auto; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--paper); font-size: 14px; }
.card-link code { flex-basis: 100%; overflow-wrap: anywhere; font-size: 13px; color: var(--muted); }

.back { margin: 0 0 10px; font-size: 15px; }
.survey-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.survey-head h1 { flex-basis: 100%; }
.survey-head p { margin: 0; }
.exports { display: flex; gap: 8px; margin-left: auto !important; }
.notice { margin-top: 18px; padding: 12px 16px; border-radius: 8px; background: var(--accent-soft); font-weight: 600; }
.tabs { display: flex; gap: 22px; margin: 26px 0 8px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 0; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 650; text-decoration: none; }
.tabs a[aria-current="page"] { border-color: var(--accent); color: var(--ink); }
.empty { margin-top: 26px; padding: 26px; border: 1px dashed #CDD1D8; border-radius: 12px; color: var(--muted); text-align: center; }

.aq { padding: 24px 0; border-bottom: 1px solid var(--line); }
.aq-head { display: grid; gap: 2px; margin-bottom: 12px; }
.aq-head h3 { margin: 0; font-size: 17px; line-height: 1.3; }
.aq-head .muted { font-size: 14px; }
.bars { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.bar-label { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.bar-n { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-n b { color: var(--ink); }
.bars progress { display: block; width: 100%; height: 10px; margin-top: 5px; border: 0; border-radius: 5px; background: var(--paper); appearance: none; overflow: hidden; }
.bars progress::-webkit-progress-bar { background: var(--paper); border-radius: 5px; }
.bars progress::-webkit-progress-value { background: var(--accent); border-radius: 5px; }
.bars progress::-moz-progress-bar { background: var(--accent); border-radius: 5px; }
.stats { display: flex; flex-wrap: wrap; gap: 8px 26px; margin: 0; color: var(--muted); }
.stats b { color: var(--ink); font-size: 20px; }
.answers { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); font-size: 15px; }
.answers li { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.answers span { white-space: pre-wrap; overflow-wrap: anywhere; }
.answers small { flex: none; color: var(--muted); }

.responses { display: grid; gap: 14px; margin: 18px 0 0; padding: 0; list-style: none; }
.resp { padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; }
.resp-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.resp-head form { margin: 0 0 0 auto; }
.resp dl { margin: 0; }
.resp dt { margin-top: 10px; font-size: 14px; color: var(--muted); }
.resp dd { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.danger-zone { margin-top: 40px; padding: 18px; border: 1px solid #F0CDBD; border-radius: 12px; }
.danger-zone h2 { margin: 0 0 4px; font-size: 17px; }
.danger-zone p { margin: 0 0 12px; font-size: 14.5px; }
.danger-zone .row { display: flex; flex-wrap: wrap; gap: 10px; }
.danger-zone .field { margin-top: 0; }

footer { border-top: 1px solid var(--line); background: var(--paper); font-size: 13.5px; color: var(--muted); }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; padding-top: 20px; padding-bottom: 24px; }
footer a { color: var(--muted); }
.foot-links { display: flex; gap: 18px; }
body.page-survey footer, body.page-home footer, body.page-done footer { background: var(--bg); }

/* ---------- Step-by-step mode (set by app.js; without JS all questions show at once) ---------- */
.stepper .step-off { display: none !important; }
.stepper .q:focus { outline: none; }
.stepper .q legend::before { content: attr(data-num); }
.stepper .q { padding: 26px 24px 28px; }
.stepper .q legend { font-size: 20px; }
.stepper .q-sub legend { font-size: 16px; }
body.past-intro .hero { display: none; }
.step-in { animation: step-in .28s ease both; }
@keyframes step-in { from { opacity: 0; transform: translateY(10px); } }
.step-nav { display: flex; justify-content: space-between; gap: 10px; }
.step-nav .btn { min-height: 50px; padding: 0 22px; }
.step-nav [data-next] { min-width: 140px; }
.btn.ghost { border-color: var(--line-strong); background: var(--bg); color: var(--ink); }
.btn.ghost:hover { border-color: var(--ink); background: var(--bg); }
@media (max-width: 520px) {
  .stepper .q { padding: 22px 18px 24px; }
  .stepper .q legend { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  .step-in { animation: none; }
}

/* ---------- Admin: key figures, trends, filter ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 26px 0 0; padding: 0; list-style: none; }
.kpis li { display: grid; gap: 2px; padding: 16px 18px; border-radius: 12px; background: var(--paper); }
.kpi-n { font-size: 32px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpis .muted { font-size: 14px; }
.card-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.spark { width: 140px; height: 36px; flex: none; }
.spark rect { fill: #DCE2F5; }
.spark rect.has { fill: var(--accent); }

.filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 22px; padding: 12px 14px; border-radius: 12px; background: var(--paper); }
.filter label { font-weight: 700; font-size: 15px; }
.filter .field { flex: 1 1 260px; width: auto; min-width: 0; max-width: 100%; margin: 0; padding: 9px 12px; }
.filter-note { margin: 12px 0 0; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; font-size: 15px; }
.filter-note a { margin-left: 8px; color: var(--accent); }
.lead-answer { margin: -4px 0 12px; font-size: 15px; color: var(--muted); }
.lead-answer b { color: var(--ink); }
.bars progress::-webkit-progress-value { background: #9DB0EE; }
.bars progress::-moz-progress-bar { background: #9DB0EE; }
.bars li.top progress::-webkit-progress-value { background: var(--accent); }
.bars li.top progress::-moz-progress-bar { background: var(--accent); }
.bars li.top .bar-label > span:first-child { font-weight: 650; }
.aq-head .link-btn { justify-self: start; margin-top: 2px; font-size: 14px; color: var(--accent); }
.exports { flex-wrap: wrap; }
@media (max-width: 640px) {
  .kpis { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .kpis li { padding: 12px; }
  .kpi-n { font-size: 26px; }
  .exports { margin-left: 0 !important; }
}

/* ---------- Print / PDF of an analysis ---------- */
@media print {
  @page { margin: 16mm 14mm; }
  body, body.page-admin { background: #FFFFFF; font-size: 12pt; }
  header.top, footer, .no-print, .step-nav { display: none !important; }
  main.wrap { max-width: none; padding: 0; }
  h1 { font-size: 22pt; }
  .aq, .resp, .kpis li, .card { break-inside: avoid; }
  .aq { padding: 14px 0; }
  .bars progress, .spark rect { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .filter-note { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: var(--ink); text-decoration: none; }
}

/* ---------- Admin: link builder for channels ---------- */
.link-builder { display: grid; gap: 6px; margin-top: 22px; padding: 14px 16px; border-radius: 12px; background: var(--paper); }
.link-builder label { font-weight: 700; font-size: 15px; }
.link-builder .field { max-width: 360px; margin: 0; padding: 9px 12px; }
.link-builder .muted { margin: 0; font-size: 14px; }
