/* Meeting-Umfrage – Styles */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --accent: #4f46e5;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e5e7eb;
  --soft: #f1f5f9;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; font-size: 16px; }
h1, h2 { margin: 0 0 .25em; line-height: 1.2; letter-spacing: -.02em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
a { color: var(--accent); text-decoration: none; }
.muted { color: var(--muted); }
.stack > * + * { margin-top: 16px; }

/* ---------- Layout */
.container { max-width: 1080px; margin: 0 auto; padding: 32px 20px 64px; }
.container.narrow { max-width: 640px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.page-title { margin-bottom: 24px; }
.back { display: inline-block; margin-bottom: 16px; color: var(--muted); font-size: .95rem; }
.back:hover { color: var(--text); }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: rgba(255,255,255,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar nav { display: flex; gap: 8px; align-items: center; }
.topbar form { margin: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent);
  color: #fff; font-weight: 800; font-size: 1rem; }
.logo-lg { width: 52px; height: 52px; border-radius: 14px; font-size: 1.6rem; margin-bottom: 12px; }

/* ---------- Buttons & Inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 10px;
  padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, transform .05s;
  color: var(--text); background: transparent; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--surface); border-color: var(--line); }
.btn-ghost:hover { background: var(--soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: .9rem; }
.btn-lg { padding: 15px 20px; font-size: 1.05rem; border-radius: 12px; }
.btn-block { width: 100%; }
.danger-text { color: var(--danger); }
.icon-btn { border: 0; background: none; font-size: 1.4rem; color: var(--muted); cursor: pointer; width: 40px; border-radius: 8px; }
.icon-btn:hover { background: var(--soft); color: var(--text); }

.field { display: block; }
.field > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
input[type=text], input[type=password], .copy input, .code-input {
  width: 100%; font: inherit; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text); outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.options-edit { display: grid; gap: 8px; margin-bottom: 8px; }
.option-row { display: flex; gap: 6px; }
.alert { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; padding: 10px 14px; border-radius: 10px; margin: 12px 0; }

/* ---------- Pills */
.pill { display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.pill-open { background: #dcfce7; color: #166534; }
.pill-closed { background: #f1f5f9; color: #475569; }
.pill-draft { background: #fef3c7; color: #92400e; }

/* ---------- Liste */
.list { display: grid; gap: 10px; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; color: var(--text);
  transition: border-color .15s, transform .15s; }
.list-item:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); transform: translateY(-1px); }
.list-q { font-weight: 600; }
.list-meta { font-size: .88rem; }
.empty { text-align: center; padding: 56px 24px; }
.empty .btn { margin-top: 12px; }

/* ---------- Detail */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.detail-head h1 { margin-top: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.qr-card { text-align: center; }
.qr-card .qr { width: 220px; margin: 16px auto 8px; }
.qr svg { display: block; width: 100%; height: auto; border-radius: 8px; }
.code-big { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 800; letter-spacing: .15em; font-size: 1.6rem; }
.linkbox { text-align: left; margin-top: 18px; }
.linkbox > span { font-size: .85rem; font-weight: 600; color: var(--muted); }
.copy { display: flex; gap: 6px; margin-top: 4px; }
.copy input { font-size: .85rem; padding: 7px 10px; background: var(--soft); }
.more { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; padding: 16px; }
.more form { margin: 0; }

/* ---------- Ergebnisbalken */
.results { display: grid; gap: 16px; }
.bar-label { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; margin-bottom: 6px; }
.bar-val { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { height: 14px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: color-mix(in srgb, var(--accent) 55%, #fff); border-radius: 999px;
  transition: width .8s cubic-bezier(.2,.8,.2,1); }
.bar-row.lead .bar-fill { background: var(--accent); }

/* ---------- Login */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; text-align: center; padding: 36px 28px; }
.auth-card form { text-align: left; margin-top: 20px; }

/* ---------- Abstimmseite (Handy) */
.vote-page { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, #fff) 0%, var(--bg) 320px); }
.vote-wrap { max-width: 520px; margin: 0 auto; padding: 24px 16px calc(32px + env(safe-area-inset-bottom)); min-height: 100vh; display: flex; flex-direction: column; }
.vote-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 20px; }
.vote-card { padding: 28px 22px; }
.vote-card h1 { font-size: 1.45rem; }
.choices { display: grid; gap: 10px; margin: 22px 0; }
.choice { position: relative; display: block; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-box { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 2px solid var(--line); border-radius: 14px;
  font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s; user-select: none; }
.choice-mark { flex: none; width: 22px; height: 22px; border: 2px solid #cbd5e1; border-radius: 50%; display: grid; place-items: center; transition: all .15s; }
.choice input[type=checkbox] + .choice-box .choice-mark { border-radius: 6px; }
.choice input:checked + .choice-box { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, #fff); }
.choice input:checked + .choice-box .choice-mark { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 4px #fff; }
.choice input[type=checkbox]:checked + .choice-box .choice-mark { box-shadow: none; }
.choice input[type=checkbox]:checked + .choice-box .choice-mark::after { content: "✓"; color: #fff; font-size: .8rem; font-weight: 800; }
.choice input:focus-visible + .choice-box { outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.code-input { text-align: center; font-size: 1.8rem; letter-spacing: .3em; text-transform: uppercase; font-weight: 800; padding: 14px; }
.state { text-align: center; padding: 48px 24px; }
.state-icon { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem;
  background: var(--soft); color: var(--muted); }
.state-icon.ok { background: #dcfce7; color: var(--ok); font-size: 2rem; font-weight: 800; animation: pop .4s cubic-bezier(.2,1.6,.4,1); }
.spinner { width: 44px; height: 44px; margin: 0 auto 18px; border: 4px solid var(--soft); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
.vote-foot { text-align: center; font-size: .8rem; margin-top: auto; padding-top: 24px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* ---------- Live-Ansicht (Beamer / PowerPoint) */
.live-page { margin: 0; height: 100vh; overflow: hidden; background: #fff; }
.live { height: 100vh; display: grid; grid-template-columns: 1fr minmax(180px, 26vw); grid-template-rows: 1fr auto;
  gap: 0 4vw; padding: 5vh 5vw 3vh; }
.no-qr .live { grid-template-columns: 1fr; }
.live-main { display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.live-q { font-size: clamp(22px, 4.2vw, 64px); line-height: 1.15; margin-bottom: 5vh; letter-spacing: -.025em; }
.results-live { gap: 2.6vh; }
.results-live .bar-label { font-size: clamp(14px, 2vw, 32px); margin-bottom: .8vh; }
.results-live .bar { height: clamp(12px, 3.6vh, 44px); border-radius: 12px; }
.results-live .bar-fill { border-radius: 12px; }
.results-live .bar-val { color: var(--text); font-weight: 800; }
.results.is-hidden .bar-val { visibility: hidden; }
.live-hint { margin-top: 4vh; color: var(--muted); font-size: clamp(13px, 1.5vw, 24px); }
.live-side { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 2vh; }
.live-side .qr { width: 100%; max-width: 40vh; }
.live-join { display: grid; gap: .4vh; font-size: clamp(12px, 1.3vw, 22px); }
.live-join strong { word-break: break-all; }
.live-join .code-big { font-size: clamp(20px, 3vw, 52px); color: var(--accent); }
.live-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; font-size: clamp(12px, 1.2vw, 20px); color: var(--muted); padding-top: 2vh; }
.live-count { margin-left: auto; }
.live-count strong { color: var(--text); font-size: 1.3em; font-variant-numeric: tabular-nums; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; }
.live-dot.open { background: var(--ok); box-shadow: 0 0 0 0 rgba(22,163,74,.5); animation: pulse 1.8s infinite; }
.live-dot.draft { background: #f59e0b; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }

.live-page.dark { background: #0b1020; color: #f1f5f9; --text: #f1f5f9; --muted: #94a3b8; --soft: #1e2539; }
.live-page.dark .qr svg { border: 8px solid #fff; }

/* ---------- Responsive */
@media (max-width: 820px) {
  .grid-2 { grid-template-columns: 1fr; }
  .topbar .brand { font-size: .95rem; }
}
@media (max-aspect-ratio: 1/1) {
  .live { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .live-side { order: -1; flex-direction: row; }
  .live-side .qr { max-width: 22vh; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
