:root {
    --bg: #f4f6f9;
    --card: #ffffff;
    --ink: #2b2f33;
    --muted: #6b7785;
    --primary: #3aa335;
    --primary-dark: #2c7d28;
    --border: #dde3ea;
    --ok-bg: #e7f5ec; --ok-ink: #1c6b3a;
    --err-bg: #fdecec; --err-ink: #b94242;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
}

a { color: var(--primary); }

.topbar {
    background: var(--primary);
    color: #fff;
    padding: 0 1.25rem;
    min-height: 56px;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: 0 1px 6px rgba(0,0,0,.14);
    position: relative;
    z-index: 20;
}
.topbar a { color: #fff; text-decoration: none; }
.topbar .brand { font-weight: 700; font-size: 1.1rem; letter-spacing: .01em; white-space: nowrap; }

.topbar nav { display: flex; gap: .2rem; flex: 1; }
.topbar nav a {
    color: rgba(255,255,255,.86);
    padding: .42rem .8rem;
    border-radius: 8px;
    font-size: .92rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.topbar nav a:hover { background: rgba(255,255,255,.16); color: #fff; }
.topbar nav a.active { background: rgba(255,255,255,.24); color: #fff; }

/* Benutzer-Menü (Dropdown) */
.topbar .user { position: relative; }
.topbar .user-btn {
    display: flex; align-items: center; gap: .55rem;
    background: rgba(255,255,255,.12);
    border: none; color: #fff; cursor: pointer;
    padding: .35rem .65rem .35rem .4rem; border-radius: 999px;
    font: inherit; font-size: .9rem; font-weight: 500;
}
.topbar .user-btn:hover { background: rgba(255,255,255,.22); }
.topbar .avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(255,255,255,.25);
    display: flex; align-items: center; justify-content: center;
    font-size: .78rem; font-weight: 700;
}
.topbar .caret { font-size: .7rem; opacity: .85; }
.topbar .user-menu {
    position: absolute; right: 0; top: calc(100% + .45rem);
    background: var(--card); color: var(--ink);
    border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,.16);
    min-width: 190px; padding: .35rem; display: none;
}
.topbar .user-menu.open { display: block; }
.topbar .user-menu .uname { padding: .5rem .7rem .3rem; font-weight: 600; font-size: .9rem; }
.topbar .user-menu .urole { padding: 0 .7rem .5rem; color: var(--muted); font-size: .78rem; }
.topbar .user-menu a {
    display: block; padding: .55rem .7rem; border-radius: 7px;
    color: var(--ink); font-size: .9rem;
}
.topbar .user-menu a:hover { background: var(--bg); }
.topbar .user-menu .sep { height: 1px; background: var(--border); margin: .3rem 0; }

@media (max-width: 640px) {
    .topbar { gap: .6rem; padding: 0 .75rem; flex-wrap: wrap; min-height: 52px; }
    .topbar nav { gap: .1rem; }
    .topbar nav a { padding: .38rem .55rem; font-size: .85rem; }
    .topbar .user-btn span:not(.avatar):not(.caret) { display: none; }
}

.container { max-width: 60rem; margin: 2rem auto; padding: 0 1.25rem; }
.narrow { max-width: 28rem; }

.site-footer {
    text-align: center;
    padding: 1.6rem 1rem 2rem;
    color: var(--muted);
    font-size: .85rem;
}

.form-logo { text-align: center; margin: .2rem 0 1.6rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--border); }
.form-logo img { width: 100%; max-width: 440px; height: auto; }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

h1 { margin-top: 0; color: var(--primary-dark); font-size: 1.5rem; }
h2 { font-size: 1.2rem; }

label { display: block; font-weight: 600; margin: .9rem 0 .3rem; font-size: .92rem; }

input[type=text], input[type=email], input[type=password],
input[type=number], input[type=tel], input[type=date],
textarea, select {
    width: 100%;
    padding: .6rem .7rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    font: inherit;
    background: #fff;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(58,163,53,.15);
}

.btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: .65rem 1.1rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--primary-dark); }
.btn-block { width: 100%; }

.muted { color: var(--muted); font-size: .9rem; }

.alert { padding: .7rem .9rem; border-radius: 7px; margin: .6rem 0; font-size: .92rem; }
.alert-ok   { background: var(--ok-bg);  color: var(--ok-ink); }
.alert-err  { background: var(--err-bg); color: var(--err-ink); }
.alert-info { background: #eaf1fb; color: #2b5797; }
.alert ul { margin: .2rem 0 0; padding-left: 1.1rem; }

/* 12-Spalten-Raster für Formularfelder */
.field-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1rem 1.1rem;
}
.field-grid > .field { grid-column: span 12; }
.field-grid > .field-col-12 { grid-column: span 12; }
.field-grid > .field-col-9  { grid-column: span 9; }
.field-grid > .field-col-8  { grid-column: span 8; }
.field-grid > .field-col-6  { grid-column: span 6; }
.field-grid > .field-col-4  { grid-column: span 4; }
.field-grid > .field-col-3  { grid-column: span 3; }
@media (max-width: 640px) {
    .field-grid > * { grid-column: span 12 !important; }
}

/* Pflichtfeld-Markierung */
.req { color: #b94242; }

/* Hilfetext eines Feldes: direkt unter dem Label, über dem Eingabefeld */
.field-help { margin: -.15rem 0 .45rem; color: var(--muted); font-size: .85rem; line-height: 1.35; }

/* === Embed (iframe auf externen Landingpages): transparent & ohne Box === */
body.embed { background: transparent; margin: 0; }
.embed #fezz-embed-root { padding: 0; }
.embed .card { background: transparent; border: 0; box-shadow: none; padding: 0; }
.embed .embed-title { margin-top: 0; }
.embed .embed-thanks { padding: .5rem 0; }

/* Gepflegtes Standard-(Light-)Design fürs Embed – gilt auch ohne Theme */
.embed .field-grid { gap: 1.1rem 1.1rem; }
.embed label { font-weight: 600; font-size: .9rem; }
.embed input,
.embed textarea,
.embed select {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: .8rem .95rem;
    transition: border-color .15s, box-shadow .15s;
}
.embed input:focus,
.embed textarea:focus,
.embed select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, .05);
}
.embed .btn {
    border-radius: 11px;
    padding: .9rem 1.7rem;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .10);
}
.embed .btn:hover { filter: brightness(1.04); }

/* Professionelles Dark-Theme fürs Embed (data-fezz-theme="dark") */
.embed.theme-dark { color: #e9edf3; }
.embed.theme-dark .field-grid { gap: 1.15rem 1.1rem; }
.embed.theme-dark label { color: #e9edf3; font-weight: 600; font-size: .9rem; letter-spacing: .01em; }
.embed.theme-dark .req { color: #ff7a7a; }
.embed.theme-dark input,
.embed.theme-dark textarea,
.embed.theme-dark select {
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .16);
    color: #fff;
    border-radius: 11px;
    padding: .8rem .95rem;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.embed.theme-dark input::placeholder,
.embed.theme-dark textarea::placeholder { color: rgba(255, 255, 255, .42); }
.embed.theme-dark input:hover,
.embed.theme-dark textarea:hover,
.embed.theme-dark select:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .28); }
.embed.theme-dark input:focus,
.embed.theme-dark textarea:focus,
.embed.theme-dark select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, .09);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .14);
}
.embed.theme-dark select option { color: #111; }
.embed.theme-dark .field-help,
.embed.theme-dark .embed-desc { color: rgba(255, 255, 255, .6); }
.embed.theme-dark .choice { color: #e9edf3; }
.embed.theme-dark .btn {
    border-radius: 11px;
    padding: .9rem 1.7rem;
    font-weight: 700;
    letter-spacing: .01em;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .35);
}
.embed.theme-dark .btn:hover { filter: brightness(1.07); }
.embed.theme-dark .alert-err {
    background: rgba(255, 90, 90, .14);
    color: #ffb9b9;
    border: 1px solid rgba(255, 90, 90, .32);
}
.embed.theme-dark .embed-thanks { color: #e9edf3; font-size: 1.05rem; }
.embed.theme-dark .dz-file { color: #e9edf3; }
.embed.theme-dark .dz-chip { background: rgba(255, 255, 255, .12); }
.embed.theme-dark .dz-text { color: rgba(255, 255, 255, .7); }

/* Datei-Upload: Drag-and-drop-Zone */
.dropzone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: 9px;
    background: #fafbfc;
    padding: 1.1rem 1rem;
    text-align: center;
    transition: border-color .15s, background .15s;
}
.dropzone.dz-over { border-color: var(--primary); background: rgba(58,163,53,.06); }
.dropzone .dz-input {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0; cursor: pointer;
}
.dropzone .dz-text { color: var(--muted); font-size: .92rem; pointer-events: none; }
.dropzone .dz-link { color: var(--primary); font-weight: 600; text-decoration: underline; }
/* Liste der gewählten Dateien: über dem Input (klickbare ×-Buttons) */
.dropzone .dz-file { position: relative; z-index: 2; margin-top: .5rem; font-size: .85rem; color: var(--ink); pointer-events: none; }
.dropzone .dz-file:empty { margin-top: 0; }
.dz-chip {
    display: inline-flex; align-items: center; gap: .25rem;
    background: rgba(0, 0, 0, .06); border-radius: 6px;
    padding: .12rem .2rem .12rem .45rem; margin: .15rem .25rem 0 0;
    font-weight: 500; pointer-events: auto;
}
.dz-x {
    border: 0; background: none; cursor: pointer; color: var(--muted);
    font-size: 1rem; line-height: 1; padding: 0 .2rem;
}
.dz-x:hover { color: #b94242; }
.dz-current { margin-top: .4rem; font-size: .85rem; }

/* Radio-/Checkbox-Gruppen */
.choice-group { display: flex; flex-direction: column; gap: .35rem; margin-top: .2rem; }
.choice { display: flex; align-items: center; gap: .5rem; font-weight: normal; margin: 0; }
.choice input { width: auto; }

/* Layout-Vorschau im Editor */
.preview-field {
    background: #eef2f7;
    border: 1px dashed #b3c0cf;
    border-radius: 7px;
    padding: .55rem .7rem;
    font-size: .85rem;
}
.preview-field .pf-label { font-weight: 600; }
.preview-field .pf-meta { color: var(--muted); font-size: .78rem; }
.preview-field.preview-spacer {
    background: repeating-linear-gradient(45deg, #f4f6f9, #f4f6f9 8px, #eaeef3 8px, #eaeef3 16px);
    border-style: dotted;
    display: flex;
    align-items: center;
    justify-content: center;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); }

/* Kompakte Tabelle, die in die Box passt (kein horizontaler Scroll) */
.compact-table { font-size: .82rem; }
.compact-table th, .compact-table td { padding: .4rem .4rem; }
.compact-table td { overflow-wrap: anywhere; }
.compact-table .btn { padding: .25rem .5rem; font-size: .8rem; }
th { font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }

/* === Danke-Seite: Übertragungs-Animation === */
.transmit { padding: .25rem 0 0; }
.transmit-head { font-weight: 600; font-size: 1.05rem; margin-bottom: 1.1rem; color: var(--ink); }
.progress-list { list-style: none; margin: 0 auto; padding: 0; max-width: 320px; text-align: left; }
.progress-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .55rem .15rem; opacity: .4; transition: opacity .3s;
}
.progress-item.active, .progress-item.done { opacity: 1; }
.p-icon { position: relative; width: 22px; height: 22px; flex: 0 0 auto; }
.p-icon .spinner {
    position: absolute; inset: 0;
    border: 2px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; opacity: 0; animation: spin .7s linear infinite;
}
.progress-item.active .spinner { opacity: 1; }
.progress-item.done .spinner { opacity: 0; }
.p-icon .check {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary); color: #fff; border-radius: 50%;
    font-size: 13px; font-weight: 700;
    transform: scale(0); transition: transform .25s cubic-bezier(.2,1.4,.4,1);
}
.progress-item.done .check { transform: scale(1); }
.p-label { font-size: .95rem; }
.transmit-final {
    display: flex; align-items: center; justify-content: center; gap: .7rem;
    margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--border);
    font-weight: 700; font-size: 1.02rem; color: var(--primary-dark);
}
.final-check {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; background: var(--primary); color: #fff;
    border-radius: 50%; font-size: 17px;
    transform: scale(0); animation: pop .45s .05s forwards cubic-bezier(.2,1.5,.4,1);
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop  { to { transform: scale(1); } }

.thanks-final[hidden] { display: none; }
.thanks-final { animation: fadeIn .45s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
