/* ballotage.online – Design: ruhig, würdevoll, ohne Fremd-Ressourcen */
:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-alt: #f2eee5;
  --fg: #1c2230;
  --muted: #5b6272;
  --primary: #1d2a44;
  --primary-fg: #ffffff;
  --accent: #9c6f1c;
  --accent-soft: #f3e7cb;
  --border: #ddd6c6;
  --error: #8b2c2c;
  --error-bg: #f8ecec;
  --ok: #2c5a3d;
  --ok-bg: #eaf3ec;
  --shadow: 0 1px 2px rgba(28, 34, 48, .06), 0 8px 24px rgba(28, 34, 48, .06);
  --radius: 12px;
  color-scheme: light;
  --on-signal: #ffffff;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
/* Dunkel: automatisch nach Systemeinstellung, außer der Nutzer hat "Hell" gewählt;
   oder erzwungen über data-theme="dark" (Schalter im Footer, Cookie "theme"). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #11151d; --surface: #181e2a; --surface-alt: #1d2433; --fg: #e9e6df; --muted: #a2a8b6;
    --primary: #d9b872; --primary-fg: #11151d; --accent: #d9b872; --accent-soft: #2b2a24;
    --border: #2d3548; --error: #f0a0a0; --error-bg: #2e1c1f; --ok: #8fd0a6; --ok-bg: #18271f;
    --on-signal: #11151d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #11151d; --surface: #181e2a; --surface-alt: #1d2433; --fg: #e9e6df; --muted: #a2a8b6;
    --primary: #d9b872; --primary-fg: #11151d; --accent: #d9b872; --accent-soft: #2b2a24;
    --border: #2d3548; --error: #f0a0a0; --error-bg: #2e1c1f; --ok: #8fd0a6; --ok-bg: #18271f;
    --on-signal: #11151d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
/* Scrollbar immer anzeigen, damit das Layout beim Seitenwechsel nicht springt */
html { -webkit-text-size-adjust: 100%; overflow-y: scroll; }
body {
  margin: 0; font-family: var(--sans); font-size: 17px; line-height: 1.6;
  color: var(--fg); background: var(--bg);
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; color: var(--fg); margin: 0 0 .6em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-top: 1.6em; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--surface-alt); padding: .1em .35em; border-radius: 4px; word-break: break-all; }
pre { background: var(--surface-alt); padding: 1rem; border-radius: 8px; overflow-x: auto; border: 1px solid var(--border); }
pre code { background: none; padding: 0; word-break: normal; }
ul, ol { padding-left: 1.3em; margin: 0 0 1em; }
li { margin-bottom: .35em; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.wrap.narrow { max-width: 720px; padding-top: 40px; padding-bottom: 72px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--primary); color: var(--primary-fg); padding: .6rem 1rem; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }

/* Kopfzeile */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; gap: 24px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 600; font-size: 1.2rem; color: var(--fg); text-decoration: none; }
.logo { width: 30px; height: 30px; }
.logo .dark { fill: var(--primary); }
.logo .light { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.main-nav { display: flex; gap: 4px 18px; flex-wrap: wrap; flex: 1; }
.main-nav a { color: var(--muted); text-decoration: none; padding: 6px 2px; font-size: .95rem; }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--fg); text-decoration: underline; }
.header-actions { display: flex; align-items: center; gap: 18px; }
.header-actions a, .header-actions button.linkbtn {
  font: inherit; font-size: .95rem; font-weight: 400; line-height: 1.6; padding: 6px 2px; margin: 0;
  color: var(--muted); text-decoration: none;
}
.header-actions a:hover, .header-actions button.linkbtn:hover { color: var(--fg); text-decoration: underline; filter: none; }
.header-actions a.btn { color: var(--primary-fg); padding: .65rem 1.2rem; font-weight: 600; }
.header-actions a.btn:hover { text-decoration: none; filter: brightness(1.12); color: var(--primary-fg); }
.header-actions form.inline { display: flex; align-items: center; }
form.inline { display: inline; margin: 0; }

/* Buttons */
button, .btn {
  display: inline-block; font: inherit; font-weight: 600; font-size: .98rem; cursor: pointer;
  padding: .65rem 1.2rem; border-radius: 8px; border: 1px solid var(--primary);
  background: var(--primary); color: var(--primary-fg); text-decoration: none; line-height: 1.3;
}
button:hover, .btn:hover { filter: brightness(1.12); }
button.secondary, .btn.secondary { background: transparent; color: var(--primary); }
button.danger { background: var(--error); border-color: var(--error); color: var(--on-signal); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn.large { padding: .85rem 1.6rem; font-size: 1.05rem; }
.btn.light { background: var(--primary-fg); color: var(--primary); border-color: var(--primary-fg); }
.btn.ghost-light { background: transparent; color: var(--primary-fg); border-color: var(--primary-fg); }
button.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font-weight: 500; font-size: inherit; }
.stack > * + * { margin-top: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.4rem; }

/* Formulare */
label { display: block; font-weight: 600; margin: 1.2rem 0 .3rem; }
label.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; }
label.check input { margin-top: .35rem; flex: none; }
.hint { font-size: .9rem; color: var(--muted); margin-top: .25rem; }
input[type=text], input[type=email], input[type=datetime-local], textarea, select {
  width: 100%; padding: .65rem .75rem; font: inherit; color: var(--fg);
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
}
textarea { min-height: 120px; resize: vertical; }
.card-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.email-list { list-style: none; padding: 0; margin: .8rem 0; }
.email-list li { display: flex; gap: .5rem; align-items: center; margin-bottom: .4rem; }
.email-list input { flex: 1; }
.email-list button.remove { background: transparent; color: var(--error); border-color: var(--error); padding: .3rem .65rem; }
.email-list input.invalid { border-color: var(--error); background: var(--error-bg); }
details { margin-top: 1.5rem; border: 1px solid var(--border); border-radius: 8px; padding: .8rem 1rem; background: var(--surface); }
summary { cursor: pointer; font-weight: 600; }

.notice { padding: 1rem 1.2rem; border-radius: 8px; margin: 1rem 0; border: 1px solid; }
.notice.ok { background: var(--ok-bg); border-color: var(--ok); }
.notice.error { background: var(--error-bg); border-color: var(--error); }
.notice p:last-child { margin-bottom: 0; }
.badge { font-size: .75rem; background: var(--ok); color: var(--on-signal); padding: .1rem .5rem; border-radius: 999px; font-family: var(--sans); vertical-align: middle; }
.status { display: inline-block; font-size: .8rem; padding: .05rem .6rem; border-radius: 999px; background: var(--surface-alt); border: 1px solid var(--border); }
.status.scheduled { background: var(--accent-soft); border-color: var(--accent); }
.status.open { background: var(--ok-bg); border-color: var(--ok); }
.status.aborted { background: var(--error-bg); border-color: var(--error); }

table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .97rem; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.app-nav { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 1.5rem; font-size: .95rem; color: var(--muted); }

/* Hero & Sektionen (öffentlich) */
.hero { padding: 72px 0 64px; background:
  radial-gradient(900px 400px at 85% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .8rem; font-weight: 700; color: var(--accent); margin-bottom: 1rem; }
.hero h1 { max-width: 20ch; }
.hero .lead { font-size: 1.2rem; color: var(--muted); max-width: 62ch; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 2rem 0 0; }
.chips li { margin: 0; padding: .35rem .9rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: .92rem; }
.chips li::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.section { padding: 64px 0; }
.section.alt { background: var(--surface-alt); }
.section h2 { margin-top: 0; }
.section .lead { color: var(--muted); max-width: 64ch; }
.grid { display: grid; gap: 20px; margin-top: 2rem; }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card h3 { margin-bottom: .4rem; }
.card p:last-child { margin-bottom: 0; }
ol.steps { list-style: none; padding: 0; counter-reset: step; display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 2rem; }
ol.steps li { counter-increment: step; position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 24px 24px 24px; margin: 0; box-shadow: var(--shadow); }
ol.steps li::before { content: counter(step); display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: var(--primary-fg); font-weight: 700; margin-bottom: .8rem; }
ol.steps h3 { margin-bottom: .3rem; }
ol.steps p { margin: 0; color: var(--muted); }
.split { display: grid; gap: 40px; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 860px) { .split { grid-template-columns: 1.1fr 1fr; } }
.checklist { list-style: none; padding: 0; }
.checklist li { padding-left: 1.8rem; position: relative; }
.checklist li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.diagram { width: 100%; height: auto; }
.diagram .box { fill: var(--surface); stroke: var(--border); stroke-width: 2; }
.diagram .box-title { font: 700 20px var(--serif); fill: var(--fg); }
.diagram .field { font: 16px var(--sans); fill: var(--muted); }
.diagram .gap { stroke: var(--error); stroke-width: 3; stroke-dasharray: 6 6; fill: none; }
.diagram .cross { stroke: var(--error); stroke-width: 4; stroke-linecap: round; }
.diagram .gap-label { font: 600 15px var(--sans); fill: var(--error); text-anchor: middle; }
.cta-band { background: var(--primary); color: var(--primary-fg); text-align: center; padding: 64px 0; }
.cta-band h2 { color: var(--primary-fg); margin-top: 0; }
.cta-band p { max-width: 52ch; margin-left: auto; margin-right: auto; opacity: .9; }
.cta-band .actions { justify-content: center; }

/* Textseiten */
.prose { max-width: 720px; }
.prose h2 { margin-top: 2em; }
.page-head { margin-bottom: 2rem; }
.page-head .lead { font-size: 1.15rem; color: var(--muted); }
.faq-group h2 { margin-bottom: .6rem; }
.faq-group details { margin-top: .6rem; }
.faq-group details[open] { box-shadow: var(--shadow); }
.faq-group summary { padding: .2rem 0; }
.faq-group details > div { margin-top: .6rem; color: var(--fg); }
address { font-style: normal; margin-bottom: 1rem; }

/* Fußzeile */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 40px 0 48px; font-size: .93rem; color: var(--muted); }
.footer-grid { display: grid; gap: 28px; grid-template-columns: 1.6fr 1fr 1fr 1fr; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }
.site-footer h2 { font: 700 .8rem var(--sans); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 .7rem; color: var(--fg); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--fg); }
.footer-note { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); font-size: .85rem; }
.lang-switch a[aria-current="true"] { color: var(--fg); font-weight: 700; text-decoration: none; }

.error-page { text-align: center; padding: 80px 0; }
@media print { .site-header, .site-footer { display: none; } }
.wrap.narrow.wide { max-width: 1080px; }
fieldset.choices { border: 0; padding: 0; margin: 0; }
fieldset.choices legend { font-weight: 600; padding: 0; margin-bottom: .4rem; }
fieldset.choices label.check { padding: .7rem .9rem; border: 1px solid var(--border); border-radius: 8px; margin: .5rem 0; background: var(--bg); }

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.site-menu { display: flex; align-items: center; gap: 24px; flex: 1; flex-wrap: wrap; }
.nav-toggle {
  display: none; margin-left: auto; width: 44px; height: 44px; padding: 0;
  background: transparent; border: 1px solid var(--border); border-radius: 8px; color: var(--fg); cursor: pointer;
}
.nav-toggle:hover { filter: none; background: var(--surface-alt); }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after {
  display: block; width: 20px; height: 2px; background: currentColor; border-radius: 1px;
  margin: 0 auto; position: relative; transition: transform .2s, background-color .2s;
}
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.menu-open .nav-toggle-bars { background: transparent; }
.menu-open .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.menu-open .nav-toggle-bars::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 720px) {
  .header-inner { gap: 8px 16px; }
  .site-menu { gap: 8px 16px; }
  .main-nav { flex-basis: 100%; gap: 2px 14px; }
  .header-actions { margin-left: auto; }
  /* Mit JavaScript: Navigation hinter dem Burger-Button */
  .has-toggle .nav-toggle { display: block; }
  .has-toggle .site-menu { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 0; padding: 4px 0 12px; }
  .has-toggle.menu-open .site-menu { display: flex; }
  .has-toggle .main-nav, .has-toggle .header-actions { flex-direction: column; align-items: stretch; gap: 0; margin: 0; }
  .has-toggle .main-nav a, .has-toggle .header-actions a, .has-toggle .header-actions button.linkbtn {
    padding: 12px 2px; font-size: 1rem; border-bottom: 1px solid var(--border); text-align: left;
  }
  .has-toggle .header-actions form.inline { display: block; }
  .has-toggle .header-actions button.linkbtn { width: 100%; }
  .has-toggle .header-actions a.btn { margin-top: 12px; text-align: center; border-bottom: 0; padding: .75rem 1.2rem; }
  .hero { padding: 48px 0; }
  .section { padding: 48px 0; }
}
button.small { padding: .3rem .8rem; font-size: .85rem; margin-top: .5rem; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1.2rem; }
dl.facts dt { color: var(--muted); } dl.facts dd { margin: 0; }
.notice.testmode { background: var(--accent-soft); border-color: var(--accent); }
.badge.testmode { background: var(--accent); }
.btn.small-btn { padding: .4rem .9rem; font-size: .9rem; }

/* Admin-Portal */
.subnav { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 1.5rem; padding-bottom: .6rem; border-bottom: 1px solid var(--border); }
.subnav a { color: var(--muted); text-decoration: none; padding: 4px 2px; }
.subnav a[aria-current="page"], .subnav a:hover { color: var(--fg); text-decoration: underline; }
.kpis { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 1.5rem 0; }
.kpi { font: 600 2.2rem var(--serif); line-height: 1; margin-bottom: .3rem; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 1rem 0; }
.filters input, .filters select { width: auto; flex: 1 1 220px; }
.filters button { margin: 0; }
.stack.card { margin-bottom: 1.2rem; }
.org-line { flex-direction: column; align-items: flex-start; gap: .35rem; justify-content: flex-start; }

.theme-switch { margin-top: 1rem; font-size: .85rem; }
.theme-switch a { color: var(--muted); }
.theme-switch a[aria-current="true"] { color: var(--fg); font-weight: 700; text-decoration: none; }
