/* Verwaltung */

body.admin { background: var(--paper-2); min-height: 100vh; }

.a-head {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 32px;
  height: 64px; padding: 0 max(20px, calc((100vw - 1240px) / 2));
  color: var(--ink);
  background: var(--paper-2);
  border-bottom: 1px solid var(--line-2);
}
.a-head .brand-hero { color: var(--ink); }
.a-head .brand-hero { gap: 12px; }
.a-head .brand-hero img { height: 38px; }
.a-head .brand-hero strong { font-size: 16px; letter-spacing: .12em; }
.a-head nav { display: flex; gap: 4px; margin-right: auto; }
.a-head nav a {
  display: inline-flex; align-items: center; height: 64px; padding: 0 10px;
  font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none;
  border-bottom: 3px solid transparent;
}
.a-head nav a:hover { color: var(--ink); }
.a-head nav a.on { color: var(--ink); border-bottom-color: var(--green); }
.a-user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.a-user .btn { background: transparent; }

.a-wrap { max-width: 1240px; margin: 0 auto; padding: 40px 20px 120px; }

.a-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 32px; }
.a-title h1 { font-size: clamp(30px, 4vw, 44px); font-weight: 700; letter-spacing: -.035em; }
.a-title .eyebrow { margin-bottom: 10px; display: block; }
.a-title .sub { margin-top: 10px; color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.a-title .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px; font-size: 13px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); }
.back svg { width: 14px; height: 14px; }

.card { background: var(--paper); border: 1px solid var(--line); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.card-body { padding: 20px; }
.stack { display: grid; gap: 18px; }

/* ---------- Übersicht ---------- */

.polls { background: var(--paper); border: 1px solid var(--line); }
.poll-row {
  display: grid; grid-template-columns: 140px minmax(0, 1fr) 100px 70px 110px 110px 290px;
  align-items: center; gap: 16px; padding: 18px 20px; border-top: 1px solid var(--line);
}
.poll-row:first-child { border-top: 0; }
.poll-row.head { padding-top: 12px; padding-bottom: 12px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); background: var(--paper-2); }
.poll-row .t { min-width: 0; }
.poll-row .t a { font-weight: 620; font-size: 16px; letter-spacing: -.015em; text-decoration: none; overflow-wrap: anywhere; }
.poll-row .t a:hover { color: var(--green); }
.poll-row .num { font-size: 14px; }
.poll-row .muted { color: var(--muted); font-size: 13px; }
.poll-row .acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.poll-row .lbl { display: none; }

.empty { padding: 72px 20px; text-align: center; }
.empty h2 { font-size: 24px; margin-bottom: 10px; }
.empty p { color: var(--muted); margin-bottom: 24px; }

@media (max-width: 960px) {
  .poll-row.head { display: none; }
  .poll-row { grid-template-columns: 1fr 1fr; gap: 10px 16px; }
  .poll-row .t { grid-column: 1 / -1; order: -1; }
  .poll-row .acts { grid-column: 1 / -1; justify-content: flex-start; }
  .poll-row .lbl { display: inline; color: var(--muted); font-size: 12px; margin-right: 6px; }
}

/* ---------- Editor ---------- */

.editor { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 28px; align-items: start; }
.editor aside { position: sticky; top: 88px; }
@media (max-width: 960px) { .editor { grid-template-columns: 1fr; } .editor aside { position: static; } }

.locked { padding: 14px 18px; margin-bottom: 24px; background: var(--gold-soft); border-left: 3px solid var(--gold); font-size: 14px; display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

.qlist { display: grid; gap: 16px; }
.q {
  background: var(--paper); border: 1px solid var(--line);
  display: grid; grid-template-columns: 64px minmax(0, 1fr);
  transition: box-shadow .2s, border-color .2s;
}
.q:focus-within { border-color: var(--line-2); box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .25); }
.q-no {
  padding: 18px 0 0; text-align: center; border-right: 1px solid var(--line);
  font-size: 24px; font-weight: 700; letter-spacing: -.04em; color: var(--gold); font-variant-numeric: tabular-nums;
}
.q-main { padding: 18px 20px 20px; display: grid; gap: 16px; min-width: 0; }
.q-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.q-top .select { width: auto; min-width: 210px; min-height: 38px; padding-top: 6px; padding-bottom: 6px; font-size: 14px; font-weight: 560; }
.q-tools { margin-left: auto; display: flex; gap: 2px; }
.q-text { font-size: 18px; font-weight: 600; letter-spacing: -.015em; min-height: 56px; }
.q-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }

.opt-list { display: grid; gap: 8px; }
.opt { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.opt b { display: grid; place-items: center; height: 34px; border: 1px solid var(--line-2); font-size: 13px; font-weight: 650; color: var(--ink-2); }
.opt .input { min-height: 40px; }
.opt .btn-icon { color: var(--muted); }
.opt .btn-icon:hover { color: var(--danger); background: var(--danger-soft); }

.add-q { margin-top: 20px; padding: 20px; border: 1px dashed var(--line-2); background: transparent; }
.add-q p { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.add-q .types { display: flex; flex-wrap: wrap; gap: 8px; }

.savebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 12px max(20px, calc((100vw - 1240px) / 2)) calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--paper); border-top: 1px solid var(--line);
}
.savebar .state { margin-right: auto; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.savebar .state.dirty { color: var(--gold); font-weight: 600; }
.savebar .state.dirty::before { content: ''; width: 7px; height: 7px; background: var(--gold); }

/* ---------- Steuerung ---------- */

.ctl { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
@media (max-width: 1060px) { .ctl { grid-template-columns: 1fr; } }

.now { background: var(--paper); border: 1px solid var(--line); }
.now-head { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.now-phase { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; }
.now-phase::before { content: ''; width: 8px; height: 8px; background: currentColor; }
.now-phase.open { color: var(--green); }
.now-phase.open::before { animation: blink 1.4s infinite; }
.now-phase.closed { color: var(--ink-2); }
.now-phase.lobby { color: var(--gold); }
.now-phase.end { color: var(--ink); }
.now-phase.draft { color: var(--muted); }
.now-head .vis { margin-left: auto; font-size: 12.5px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.now-head .vis svg { width: 15px; height: 15px; }
.now-body { padding: 24px 20px 28px; }
.now-no { font-size: 13px; color: var(--muted); margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.now-no strong { color: var(--ink); }
.now-q { font-size: clamp(22px, 2.6vw, 32px); font-weight: 680; letter-spacing: -.03em; line-height: 1.12; margin-bottom: 26px; overflow-wrap: anywhere; }
.now-res .res { --rs: 15px; }
.now-res .res-words { --rs: 17px; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.stats div { padding: 14px 20px 16px; }
.stats div + div { border-left: 1px solid var(--line); }
.stats span { display: block; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stats strong { display: block; margin-top: 4px; font-size: 30px; font-weight: 700; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stats strong.warn { color: var(--gold); }
.stats strong small { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; }

.controls { display: grid; gap: 10px; padding: 16px 20px 20px; border-top: 1px solid var(--line); }
.controls .row { display: flex; gap: 8px; flex-wrap: wrap; }
.controls .row .btn { flex: 1 1 auto; }
.btn.armed { background: var(--danger); border-color: var(--danger); color: #fff; }

.qnav { display: grid; }
.qnav-item {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 12px 16px 12px 20px; border-top: 1px solid var(--line);
}
.qnav-item:first-child { border-top: 0; }
.qnav-item .n { font-weight: 700; color: var(--faint); font-variant-numeric: tabular-nums; }
.qnav-item .tx { min-width: 0; }
.qnav-item .tx strong { display: block; font-size: 14px; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qnav-item .tx small { font-size: 12px; color: var(--muted); }
.qnav-item.cur { background: var(--green-soft); box-shadow: inset 3px 0 0 var(--green); }
.qnav-item.cur .n { color: var(--green); }

.joinbox { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: center; }
.joinbox .qr { background: #fff; padding: 6px; border: 1px solid var(--line); }
.joinbox .qr img { display: block; width: 100%; }
.joinbox .code { font-size: 30px; font-weight: 700; letter-spacing: .04em; font-variant-numeric: tabular-nums; line-height: 1; }
.joinbox .url { font-size: 13px; color: var(--muted); margin-top: 6px; overflow-wrap: anywhere; }

.live-sticky { display: none; }
@media (max-width: 760px) {
  .live-sticky {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--paper); border-top: 1px solid var(--line);
  }
  .live-sticky .btn { width: 100%; }
  .controls .primary-slot { display: none; }
  .stats strong { font-size: 24px; }
  .stats div { padding: 12px 14px; }
}

/* ---------- Ergebnisse ---------- */

.rq { background: var(--paper); border: 1px solid var(--line); display: grid; grid-template-columns: 80px minmax(0, 1fr); margin-bottom: 16px; break-inside: avoid; }
.rq-no { padding-top: 24px; text-align: center; border-right: 1px solid var(--line); font-size: 28px; font-weight: 700; letter-spacing: -.04em; color: var(--gold); font-variant-numeric: tabular-nums; }
.rq-main { padding: 24px 28px 28px; min-width: 0; }
.rq-main .eyebrow { margin-bottom: 8px; display: block; }
.rq-main h2 { font-size: 22px; font-weight: 660; letter-spacing: -.025em; margin-bottom: 24px; overflow-wrap: anywhere; }
.rq-main .res { --rs: 15px; max-width: 760px; }
details.answers { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 14px; }
details.answers summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); list-style: none; display: flex; align-items: center; gap: 8px; }
details.answers summary::-webkit-details-marker { display: none; }
details.answers summary::before { content: '+'; display: inline-grid; place-items: center; width: 18px; height: 18px; border: 1px solid var(--line-2); font-weight: 500; }
details.answers[open] summary::before { content: '–'; }
.atable-wrap { overflow-x: auto; margin-top: 14px; }
.atable { width: 100%; border-collapse: collapse; font-size: 14px; }
.atable th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--ink); }
.atable td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.atable td:first-child { white-space: nowrap; font-weight: 560; }

@media (max-width: 640px) {
  .rq, .q { grid-template-columns: 1fr; }
  .rq-no, .q-no { border-right: 0; border-bottom: 1px solid var(--line); text-align: left; padding: 12px 20px; font-size: 20px; }
  .rq-main { padding: 20px; }
  .a-head { gap: 14px; height: 60px; }
  .a-head .brand-hero img { height: 34px; }
  .a-head .brand-hero strong { font-size: 15px; letter-spacing: .1em; }
  .a-head nav { display: none; }
  .a-user { margin-left: auto; }
  .a-user span { display: none; }
}

/* ---------- Anmeldung ---------- */

.login {
  position: relative;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  padding: clamp(24px, 4vw, 56px) clamp(20px, 6vw, 112px);
  background: #0c100e url('/img/server.webp') center / cover no-repeat;
  color: #fff;
}
.login::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(8, 12, 10, .88) 0%, rgba(8, 12, 10, .62) 38%, rgba(8, 12, 10, .05) 72%);
}
.login > * { position: relative; }

.login-main { display: grid; gap: 36px; width: 100%; max-width: 420px; }
.login-main h1 { font-size: clamp(42px, 5.6vw, 84px); font-weight: 750; letter-spacing: -.05em; line-height: .92; }
.login-main h1 em { font-style: normal; color: #f3cf62; }
.login-main > div > p { margin-top: 18px; max-width: 32ch; color: rgba(255, 255, 255, .78); font-size: 16px; }

.login-card { background: var(--paper); color: var(--ink); padding: 28px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .55); }
.login-card form { display: grid; gap: 18px; }
.login-card h2 { font-size: 24px; font-weight: 700; letter-spacing: -.03em; }
.login-card .hint { margin-top: -12px; }
.login-card .err { padding: 10px 12px; background: var(--danger-soft); color: var(--danger); font-size: 14px; }
.login-foot { display: grid; gap: 6px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .6); }
.byline { font-size: 11px; letter-spacing: .04em; text-transform: none; color: #fff; text-decoration: none; opacity: .85; }
.byline:hover { opacity: 1; text-decoration: underline; }

@media (max-width: 760px) {
  .login { background-position: 70% center; }
  .login::before { background: linear-gradient(180deg, rgba(8, 12, 10, .8) 0%, rgba(8, 12, 10, .6) 100%); }
}

.btn-icon.armed { width: auto; padding: 0 12px; }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
