/* CME Abstimmung – Design angelehnt an cmeducation.de (Fira Sans, Akzent #eb4260) */

@font-face { font-family: 'Fira Sans'; font-style: normal; font-weight: 300; font-display: swap; src: url(/static/fonts/fira-sans-latin-300-normal.woff2) format('woff2'); }
@font-face { font-family: 'Fira Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url(/static/fonts/fira-sans-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Fira Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url(/static/fonts/fira-sans-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Fira Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url(/static/fonts/fira-sans-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Fira Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url(/static/fonts/fira-sans-latin-700-normal.woff2) format('woff2'); }

:root {
  --accent: #eb4260;
  --accent-dark: #c9304d;
  --accent-soft: #fdecef;
  --ink: #3b3b3b;
  --ink-2: #505050;
  --muted: #81898d;
  --line: #dedede;
  --line-soft: #ececec;
  --bg: #f4f4f4;
  --surface: #ffffff;
  --ok: #1f8a4c;
  --ok-soft: #e7f5ec;
  --err: #b42318;
  --err-soft: #fdecea;
  --radius: 4px;
  --radius-lg: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 16px rgba(0, 0, 0, .04);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Fira Sans', Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { color: var(--ink); line-height: 1.25; margin: 0 0 .5em; }
h1 { font-weight: 600; }
h2, h3 { font-weight: 500; }
a { color: var(--accent); }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: 1px solid transparent; border-radius: var(--radius);
  padding: 10px 20px; font: inherit; font-weight: 500; font-size: 1rem;
  cursor: pointer; text-decoration: none; line-height: 1.2;
  background: var(--accent); color: #fff;
  transition: background-color .15s, opacity .15s, transform .05s;
}
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(235, 66, 96, .35); outline-offset: 2px; }
.btn[disabled] { opacity: .4; cursor: not-allowed; transform: none; background: var(--accent); }
.btn--ghost { background: #fff; color: var(--ink-2); border-color: #b4b4b4; }
.btn--ghost:hover, .btn--ghost[disabled] { background: #fff; }
.btn--ghost:hover:not([disabled]) { background: #f7f7f7; }
.btn--danger { background: #fff; color: var(--err); border-color: #e6b4ae; }
.btn--danger:hover { background: var(--err-soft); }
.btn--sm { padding: 6px 12px; font-size: .875rem; }
.btn--block { width: 100%; }
.btn--lg { padding: 16px 24px; font-size: 1.15rem; letter-spacing: .04em; border-radius: 6px; }

/* ---------- Kopfzeile ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 3px solid var(--accent);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar__inner {
  max-width: 1100px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.topbar__logo { display: block; height: 30px; }
.topbar__logo img { height: 100%; width: auto; display: block; }
.topbar__tag { margin-left: auto; font-size: .8rem; color: var(--muted); }

/* =====================================================================
   Teilnehmerseite (mobil zuerst)
   ===================================================================== */
.vote { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.vote .topbar__inner { max-width: 680px; }
.vote__main { flex: 1; width: 100%; max-width: 680px; margin: 0 auto; padding: 20px 16px 24px; }
.vote__foot { text-align: center; font-size: .75rem; color: var(--muted); padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
.vote__foot p { margin: 0 0 6px; }

/* Cookie-Hinweis (nur Information, keine Einwilligung) – im Seitenfluss unter der Kopfzeile, verdeckt nichts */
.cookie-notice {
  width: calc(100% - 32px); max-width: 648px; margin: 12px auto 0; padding: 10px 12px;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  font-size: .8rem; line-height: 1.4; color: var(--ink-2);
}
.cookie-notice__text { margin: 0; flex: 1; }
.cookie-notice__text a { color: var(--accent); white-space: nowrap; }
.cookie-notice__btn { flex: 0 0 auto; }
.cookie-notice:not([hidden]) ~ .vote__main { padding-top: 12px; }

/* Impressum / Datenschutz */
.legal { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 20px; font-size: .8rem; }
.legal a { color: var(--muted); text-decoration: none; padding: 6px 2px; }
.legal a:hover { color: var(--accent); text-decoration: underline; }
.admin-foot { width: 100%; padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }

.screen { animation: fadeIn .25s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 24px 20px;
}
.kicker {
  display: inline-block; color: var(--accent); font-weight: 600; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: .6em;
}
.welcome h1 { font-size: 1.6rem; }
.welcome__text { font-size: 1.05rem; margin: 1em 0 1.75em; }
.welcome__text p:last-child { margin-bottom: 0; }
.welcome__meta { font-size: .875rem; color: var(--muted); margin: 1em 0 0; text-align: center; }

.progress { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; font-size: .85rem; color: var(--muted); }
.progress__bar { flex: 1; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress__fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .35s ease; }
.progress__count { font-variant-numeric: tabular-nums; white-space: nowrap; }

.question__text { font-size: 1.25rem; font-weight: 500; color: var(--ink); margin: 0 0 1em; }
.question__hint { font-size: .875rem; color: var(--muted); margin: -.5em 0 1em; }
.question__note { font-size: .8rem; color: var(--muted); margin-top: 1.25em; }

.options { display: grid; gap: 10px; margin: 0; padding: 0; border: 0; }
.option {
  position: relative; display: flex; align-items: flex-start; gap: 14px;
  width: 100%; text-align: left; font: inherit; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px;
  padding: 14px 14px; min-height: 56px; cursor: pointer;
  transition: border-color .12s, background-color .12s, box-shadow .12s;
  -webkit-tap-highlight-color: transparent;
}
.option:hover { border-color: #b4b4b4; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option__letter {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 600; font-size: .95rem;
  border: 1.5px solid #b4b4b4; color: var(--ink-2); background: #fff;
  transition: all .12s;
}
.option--multi .option__letter { border-radius: 6px; }
.option__text { padding-top: 4px; line-height: 1.4; }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.option:has(input:checked) .option__letter { background: var(--accent); border-color: var(--accent); color: #fff; }
.option:has(input:focus-visible) { outline: 3px solid rgba(235, 66, 96, .35); outline-offset: 2px; }

/* läuft beim Scrollen unten mit, endet aber über der Fußzeile (Impressum/Datenschutz) */
.actionbar {
  position: sticky; bottom: 0; z-index: 10;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
}
.actionbar__inner { max-width: 680px; margin: 0 auto; }

.final { text-align: center; padding-top: 36px; padding-bottom: 36px; }
.final__icon {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 20px;
  background: var(--accent-soft); color: var(--accent); display: grid; place-items: center;
}
.final__icon svg { width: 36px; height: 36px; }
.final h1 { font-size: 1.5rem; }
.final__text { font-size: 1.05rem; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); z-index: 20;
  max-width: 560px; margin: 0 auto; padding: 12px 16px; border-radius: 8px;
  background: var(--ink); color: #fff; font-size: .95rem; box-shadow: var(--shadow);
  animation: fadeIn .2s ease-out;
}

.message { max-width: 560px; margin: 48px auto; padding: 0 16px; }

@media (min-width: 720px) {
  .vote__main { padding-top: 40px; }
  .card { padding: 36px 40px; }
  .welcome h1 { font-size: 2rem; }
  .question__text { font-size: 1.4rem; }
}

/* =====================================================================
   Admin-Backend
   ===================================================================== */
.admin .topbar__nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-left: auto; }
.admin .topbar__nav a {
  color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: var(--radius); font-size: .95rem;
}
.admin .topbar__nav a:hover, .admin .topbar__nav a.is-active { color: var(--accent); background: var(--accent-soft); }
.admin .topbar__nav form { margin: 0; }
.admin .topbar__nav button.link { background: none; border: 0; font: inherit; color: var(--muted); cursor: pointer; padding: 6px 10px; }
.admin .topbar__badge { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 600; }

/* Fußzeile auch auf kurzen Seiten am unteren Rand halten */
body.admin { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.wrap { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 24px 16px 32px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 20px; }
.page-head h1 { font-size: 1.6rem; margin: 0; }
.page-head__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 4px; width: 100%; }
.crumbs a { color: var(--muted); }

.panel { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.panel h2 { font-size: 1.15rem; margin-bottom: 12px; }
.panel__head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel__head h2 { margin: 0; }
.panel__head .spacer { flex: 1; }

.grid-2 { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 2fr 1fr; } }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; }
.flash--ok { background: var(--ok-soft); color: #14532d; }
.flash--error { background: var(--err-soft); color: var(--err); }

.pill { display: inline-block; font-size: .75rem; font-weight: 500; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); background: #fff; white-space: nowrap; }
.pill--on { color: var(--ok); border-color: #b7dfc5; background: var(--ok-soft); }
.pill--off { color: var(--muted); background: #f4f4f4; }

.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.list th { text-align: left; font-weight: 500; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line); padding: 8px 10px; white-space: nowrap; }
table.list td { border-bottom: 1px solid var(--line-soft); padding: 12px 10px; vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.list a.title { color: var(--ink); font-weight: 500; text-decoration: none; }
table.list a.title:hover { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }

.qlist { list-style: none; margin: 0; padding: 0; }
.qitem { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.qitem:last-child { border-bottom: 0; }
.qitem__num { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: .9rem; }
.qitem__body { flex: 1; min-width: 0; }
.qitem__label { font-size: .8rem; color: var(--accent); font-weight: 500; }
.qitem__text { color: var(--ink); font-weight: 500; }
.qitem__opts { margin: 6px 0 0; padding: 0; list-style: none; font-size: .875rem; color: var(--ink-2); }
.qitem__opts li { padding: 1px 0; }
.qitem__opts b { display: inline-block; width: 1.4em; color: var(--muted); font-weight: 500; }
.qitem__actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.qitem__actions form { margin: 0; }
.correct-tag { color: var(--ok); font-weight: 500; font-size: .8rem; margin-left: 6px; white-space: nowrap; }

.form-row { margin-bottom: 16px; }
.form-row label, .label { display: block; font-weight: 500; color: var(--ink); margin-bottom: 4px; }
.form-row .help { font-size: .85rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=password], input[type=date], textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #c8c8c8; border-radius: var(--radius); padding: 9px 11px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(235, 66, 96, .15); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.inline-fields { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .inline-fields { grid-template-columns: 1fr 1fr; } }
.prefix-input { display: flex; align-items: stretch; }
.prefix-input span { background: #f4f4f4; border: 1px solid #c8c8c8; border-right: 0; border-radius: var(--radius) 0 0 var(--radius); padding: 9px 10px; color: var(--muted); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.prefix-input input { border-radius: 0 var(--radius) var(--radius) 0; min-width: 0; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }

.opt-editor { display: grid; gap: 8px; }
.opt-row { display: grid; grid-template-columns: 32px 1fr auto auto; gap: 8px; align-items: center; }
.opt-row__letter { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid #b4b4b4; display: grid; place-items: center; font-weight: 600; color: var(--ink-2); }
.opt-row .check { font-size: .85rem; white-space: nowrap; }
.icon-btn { background: none; border: 1px solid transparent; border-radius: var(--radius); width: 34px; height: 34px; cursor: pointer; color: var(--muted); font-size: 1.1rem; }
.icon-btn:hover { color: var(--err); border-color: var(--line); }
@media (max-width: 520px) {
  .opt-row { grid-template-columns: 32px 1fr auto; }
  .opt-row .check { grid-column: 2; }
}

.linkbox { display: flex; gap: 8px; }
.linkbox input { flex: 1; min-width: 0; font-size: .9rem; }
.qr-preview { display: block; width: 100%; max-width: 240px; margin: 12px auto; border: 1px solid var(--line); border-radius: 8px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 16px; }
.stat__label { font-size: .8rem; color: var(--muted); }
.stat__value { font-size: 1.8rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.2; }

.stat__value--text { font-size: 1.1rem; padding-top: 8px; word-break: break-word; }
table.list tr.is-selected td { background: var(--accent-soft); }
table.list td.utm { max-width: 14rem; overflow-wrap: anywhere; }

/* Tracking-Links */
.tlist { list-style: none; margin: 0 0 12px; padding: 0; }
.titem { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.titem:first-child { padding-top: 0; }
.titem__head { display: flex; align-items: center; gap: 8px; justify-content: space-between; color: var(--ink); }
.titem .btn-row form { margin: 0; }

.filter { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter .form-row { margin: 0; }
.filter input[type=date] { width: auto; }

/* Ergebnisbalken – eine Serie, Wert direkt beschriftet */
.bars { display: grid; gap: 10px; margin-top: 8px; }
.bar { display: grid; grid-template-columns: 28px 1fr; gap: 4px 10px; align-items: center; }
.bar__letter { font-weight: 600; color: var(--ink-2); text-align: center; }
.bar__text { font-size: .9rem; color: var(--ink); }
.bar__track { grid-column: 2; display: flex; align-items: center; gap: 10px; }
.bar__rail { flex: 1; height: 14px; background: #f0f0f0; border-radius: 0 4px 4px 0; position: relative; }
.bar__fill { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; transition: width .4s ease; }
.bar__value { font-size: .85rem; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 92px; text-align: right; }

.login { max-width: 400px; margin: 64px auto; padding: 0 16px; }
.danger-zone { border: 1px solid #f0c8c3; }
.danger-zone h2 { color: var(--err); }

/* Präsentationsansicht für das Video */
.present { margin: 0; min-height: 100vh; display: grid; place-items: center; background: #fff; text-align: center; padding: 24px; }
.present__title { font-size: clamp(1.4rem, 3vw, 2.6rem); color: var(--ink); margin-bottom: .2em; }
.present__kicker { color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; }
.present img.qr { width: min(60vh, 80vw); height: auto; margin: 24px auto; display: block; }
.present__url { font-size: clamp(1rem, 1.6vw, 1.4rem); color: var(--ink-2); word-break: break-all; }
.present__logo { height: 36px; margin-top: 24px; }
.present__back { position: fixed; top: 12px; left: 12px; font-size: .85rem; }
