/* =========================================================
   MK-Vereinssoftware · Umfrageportal · Stylesheet v2
   Keine externen Schriften (DSGVO), Systemschrift des Geräts.
   Die Grundfarbe lässt sich über --primary anpassen (Vereinsfarbe setzt
   zusätzlich --button-bg/--button-ink). Standard: Pastell-Orange (seit v2.7).
   ========================================================= */

:root {
    --primary: #B84A0C;          /* kräftiges Orange: Links, Symbole, Auswahl (lesbar auf Weiß) */
    --primary-strong: #93390A;
    --primary-tint: #FFE0C7;     /* Pfirsich */
    --primary-ring: rgba(255, 146, 72, 0.45);

    /* Knöpfe: helles Orange mit dunkler Schrift (Vereinsfarbe: Farbe mit weißer Schrift) */
    --button-bg: #FF9248;
    --button-bg-hover: #F77F2E;
    --button-ink: #2B1B24;

    --ink: #2B1B24;              /* Pflaumenbraun statt Schwarz */
    --muted: #5A4352;
    --paper: #FFF1E6;            /* Apricot */
    --surface: #FFFFFF;
    --surface-soft: #FFF8F2;
    --line: #F0CDB3;
    --line-strong: #E2B796;

    --danger: #B3261E;
    --danger-strong: #8C1D17;
    --danger-tint: #FCEBEA;
    --success: #1F7A4D;
    --success-tint: #E3F3EA;
    --warn-tint: #FFF6DB;
    --warn-line: #F0D98A;

    --radius-sheet: 16px;
    --radius-row: 12px;
    --radius-field: 9px;

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;

    /* Alt-Namen, falls irgendwo noch verwendet */
    --primary-color: var(--primary);
    --primary-hover: var(--primary-strong);
    --border-color: var(--line);
    --text-color: var(--ink);
    --heading-color: var(--ink);
    --background-color: var(--paper);
    --card-background: var(--surface);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    padding: 32px 16px 24px;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
}

/* ---------- Grundgerüst ---------- */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 36px 40px 40px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sheet);
    box-shadow: 0 1px 2px rgba(43, 27, 36, 0.04), 0 8px 28px rgba(43, 27, 36, 0.05);
}
.container.container-wide { max-width: 1040px; }

@media (max-width: 600px) {
    body { padding: 0 0 16px; background: var(--surface); }
    .container {
        padding: 24px 16px 28px;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
}

h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem); font-weight: 750; letter-spacing: -0.02em; }
h2 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 1.1rem; font-weight: 650; }
h4 { font-size: 1rem; font-weight: 650; }
p  { margin: 0 0 1em; }

a { color: var(--primary); font-weight: 600; text-decoration: none; }
a:hover { color: var(--primary-strong); text-decoration: underline; text-underline-offset: 3px; }

hr { border: 0; height: 1px; background: var(--line); margin: 32px 0; }

:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; }

.muted, .hint { color: var(--muted); font-size: 0.9rem; }
.back-link { display: inline-block; margin-bottom: 20px; font-size: 0.95rem; }

/* ---------- Formularelemente ---------- */
.form-group { margin-bottom: 22px; }

label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.95rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-field);
    transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 110px; }
input::placeholder, textarea::placeholder { color: #9C8790; }

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-ring);
}

input[type="file"] {
    display: block;
    width: 100%;
    padding: 10px;
    font: inherit;
    font-size: 0.9rem;
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius-field);
    background: var(--surface-soft);
}

input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 18px; height: 18px; }

/* Checkbox-Zeilen in den Admin-Formularen (label > input) */
label > input[type="checkbox"] { vertical-align: -3px; margin: 0 8px 0 0; }

/* ---------- Buttons ---------- */
button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 11px 20px;
    font: inherit;
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.2;
    color: var(--button-ink);
    background: var(--button-bg);
    border: 1.5px solid var(--button-bg);
    border-radius: var(--radius-field);
    cursor: pointer;
    text-decoration: none;
    transition: background-color .15s, border-color .15s, transform .05s;
}
button:hover, .button:hover { background: var(--button-bg-hover); border-color: var(--button-bg-hover); color: var(--button-ink); text-decoration: none; }
button:active, .button:active { transform: translateY(1px); }
button:disabled, button[aria-busy="true"] { opacity: .7; cursor: progress; }

.button-secondary, .button.button-secondary, button.button-secondary {
    color: var(--ink);
    background: var(--surface);
    border-color: var(--line-strong);
}
.button-secondary:hover, .button.button-secondary:hover, button.button-secondary:hover {
    color: var(--ink);
    background: var(--surface-soft);
    border-color: var(--muted);
}

.button-danger, button.button-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.button-danger:hover, button.button-danger:hover { background: var(--danger-strong); border-color: var(--danger-strong); color: #fff; }

.button-block, button.button-block { display: flex; width: 100%; }

.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Ladekreis im Absende-Button */
.spinner {
    width: 18px; height: 18px;
    border: 2.5px solid rgba(43,27,36,.22);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Kopfbereich einer Umfrage ---------- */
.survey-header {
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 28px;
}
.survey-header-text { width: 100%; }
.survey-header h1 { margin-bottom: 10px; }
.survey-header p { margin: 0; color: var(--muted); font-size: 1.02rem; }
.survey-logo {
    display: block;
    max-width: 160px;
    max-height: 72px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Ergebnis-/Admin-Köpfe: Logo rechts */
.survey-header.header-row {
    flex-direction: row;
    justify-content: space-between;
}
.survey-header.header-row .survey-logo { max-height: 64px; max-width: 120px; }

.meta-line { color: var(--muted); font-size: 0.95rem; margin: 0; }

/* ---------- Teilnehmer-Formular ---------- */
.question {
    margin: 0;
    padding: 24px 0;
    border: 0;
    border-top: 1px solid var(--line);
    min-width: 0;
}
.question:first-child,
form > input[type="hidden"] + .question,
form > input[type="hidden"] + .question-group { border-top: 0; padding-top: 4px; }

/* Infotext + zugehörige Frage als eine Einheit */
.question-group {
    padding-top: 24px;
    border-top: 1px solid var(--line);
}
.question-group > .info-block { margin: 0 0 16px; }
.question-group > .question { border-top: 0; padding-top: 0; }

.question-title,
.question legend,
.question h3 {
    display: block;
    float: left;            /* holt die Legende aus der Fieldset-Linie */
    width: 100%;
    margin: 0 0 12px;
    padding: 0;
    font-size: 1.08rem;
    font-weight: 650;
    line-height: 1.4;
    color: var(--ink);
}
.question .question-hint { clear: both; margin: -6px 0 12px; color: var(--muted); font-size: 0.92rem; line-height: 1.45; }
.question .question-hint + .question-hint { margin-top: -8px; }
.question .form-input-wrapper, .question .field-error { clear: both; }

.required-star { color: var(--danger); font-weight: 700; margin-left: 3px; }

/* Antwortzeilen (Radio/Checkbox) */
.option { position: relative; margin-bottom: 8px; }
.option:last-child { margin-bottom: 0; }

/* Eingabe nur optisch verstecken – Tastatur & Screenreader funktionieren weiter */
.option input[type="radio"],
.option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px; height: 1px;
    margin: 0;
    pointer-events: none;
}

.option label {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 52px;
    margin: 0;
    padding: 12px 16px;
    font-weight: 500;
    font-size: 1rem;
    line-height: 1.35;
    background: var(--surface);
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-row);
    cursor: pointer;
    transition: border-color .15s, background-color .15s, box-shadow .15s;
    -webkit-tap-highlight-color: transparent;
}
.option label::before {
    content: "";
    flex: 0 0 22px;
    width: 22px; height: 22px;
    border: 2px solid var(--line-strong);
    background: var(--surface) center / 14px no-repeat;
    transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.option input[type="radio"] + label::before { border-radius: 50%; }
.option input[type="checkbox"] + label::before { border-radius: 6px; }

.option label:hover { border-color: var(--primary); }
.option label:hover::before { border-color: var(--primary); }

.option input:focus-visible + label { box-shadow: 0 0 0 4px var(--primary-ring); border-color: var(--primary); }

.option input:checked + label {
    background: var(--primary-tint);
    border-color: var(--primary);
    font-weight: 600;
}
.option input[type="radio"]:checked + label::before {
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: inset 0 0 0 4px var(--surface);
}
.option input[type="checkbox"]:checked + label::before {
    border-color: var(--primary);
    background-color: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Fehlerzustand einer Frage */
.field-error {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 10px 0 0;
    color: var(--danger);
    font-size: 0.92rem;
    font-weight: 600;
}
.field-error[hidden] { display: none; }

.validation-error .question-title,
.validation-error legend,
.validation-error h3 { color: var(--danger); }
.validation-error input[type="text"],
.validation-error textarea,
.validation-error .option label { border-color: var(--danger); }
.validation-error .option label::before { border-color: var(--danger); }
.validation-error input[type="text"]:focus,
.validation-error textarea:focus { box-shadow: 0 0 0 4px rgba(179, 38, 30, 0.18); }
.validation-error { animation: shake .4s; }

@keyframes shake {
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* Infotext innerhalb der Umfrage */
.info-block {
    margin: 0 0 24px;
    padding: 16px 18px;
    background: var(--surface-soft);
    border-left: 4px solid var(--primary);
    border-radius: 0 var(--radius-field) var(--radius-field) 0;
    line-height: 1.6;
    color: var(--ink);
}
.info-block + .question,
.info-block + .question-group { border-top: 0; padding-top: 0; }

.form-actions {
    margin-top: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}
.form-actions .hint { margin: 12px 0 0; text-align: center; }

/* ---------- Meldungen ---------- */
.success-message, .error-message, .notice {
    margin: 0 0 20px;
    padding: 14px 16px;
    border-radius: var(--radius-field);
    font-weight: 600;
    font-size: 0.95rem;
}
.success-message { background: var(--success-tint); color: var(--success); border: 1px solid #B7DEC8; }
.error-message   { background: var(--danger-tint);  color: var(--danger);  border: 1px solid #F3C3C0; }
.notice          { background: var(--warn-tint);    color: #6B4E00;         border: 1px solid var(--warn-line); font-weight: 500; }
.notice strong   { font-weight: 700; }

/* ---------- Zentrierte Statusseiten (Danke, geschlossen, Login) ---------- */
.status-page { text-align: center; padding-top: 48px; padding-bottom: 48px; }
.status-page .survey-logo { margin: 0 auto 24px; }
.status-icon {
    display: inline-grid;
    place-items: center;
    width: 64px; height: 64px;
    margin-bottom: 20px;
    border-radius: 50%;
    background: var(--primary-tint);
    color: var(--primary);
}
.status-icon.is-muted { background: var(--surface-soft); color: var(--muted); }
.status-page p { color: var(--muted); max-width: 46ch; margin-left: auto; margin-right: auto; }

.login-wrapper { width: 100%; max-width: 420px; margin: 6vh auto 0; }
.login-wrapper .container { padding: 32px; }
.login-wrapper h1 { font-size: 1.5rem; }

/* ---------- Footer ---------- */
.site-footer {
    max-width: 680px;
    margin: 28px auto 0;
    padding: 0 16px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--muted);
}
.site-footer p { margin: 2px 0; }
.site-footer a { color: var(--muted); font-weight: 600; }
.site-footer a:hover { color: var(--primary); }

/* =========================================================
   ADMIN
   ========================================================= */

.admin-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    margin-bottom: 24px;
}
.admin-topbar h1 { margin: 0; }

/* Übersichtstabelle */
.survey-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.survey-table th, .survey-table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.survey-table th {
    font-size: 0.85rem;
    font-weight: 650;
    color: var(--muted);
    background: transparent;
    border-bottom: 1.5px solid var(--line-strong);
}
.survey-table tbody tr:hover { background: var(--surface-soft); }
.survey-table td[data-label="Titel"] { font-weight: 600; }
.survey-table td[data-label="Teilnahmen"],
.survey-table th:nth-child(4) { text-align: center; font-variant-numeric: tabular-nums; }

@media (max-width: 800px) {
    .survey-table thead { display: none; }
    .survey-table, .survey-table tbody, .survey-table tr, .survey-table td { display: block; width: 100%; }
    .survey-table tr {
        margin-bottom: 14px;
        padding: 6px 14px;
        border: 1px solid var(--line);
        border-radius: var(--radius-row);
    }
    .survey-table tbody tr:hover { background: transparent; }
    .survey-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 10px 0;
        text-align: right;
    }
    .survey-table td[data-label="Teilnahmen"] { text-align: right; }
    .survey-table tr td:last-child { border-bottom: 0; }
    .survey-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--muted);
        text-align: left;
        font-size: 0.85rem;
    }
    .survey-table td[data-label="Aktionen"] { flex-direction: column; align-items: stretch; }
    .survey-table td[data-label="Aktionen"]::before { display: none; }
    .survey-table .action-icons { justify-content: flex-start; flex-wrap: wrap; }
}

/* Status-Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 650;
    white-space: nowrap;
}
.status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-open   { background: var(--success-tint); color: var(--success); }
.status-closed { background: #F6ECE4; color: var(--muted); }

/* Aktions-Icons */
.action-icons { display: flex; align-items: center; gap: 6px; }
.action-icons form { display: contents; }

.action-icons a,
.action-icons button {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 36px; height: 36px;
    min-height: 0;
    padding: 0;
    font-size: 14px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
    cursor: pointer;
    transition: border-color .15s, color .15s, background-color .15s;
}
.action-icons a:hover,
.action-icons button:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-tint);
    text-decoration: none;
}
.action-icons .delete-link { color: var(--danger); }
.action-icons .delete-link:hover { color: var(--danger-strong); border-color: var(--danger); background: var(--danger-tint); }
.action-icons .is-copied { color: #fff !important; background: var(--success) !important; border-color: var(--success) !important; }

/* Tooltips (nur bei Geräten mit Maus) */
@media (hover: hover) {
    .action-icons [data-tooltip]::after {
        content: attr(data-tooltip);
        position: absolute;
        bottom: calc(100% + 8px);
        left: 50%;
        transform: translate(-50%, 4px);
        padding: 5px 9px;
        font-size: 12px;
        font-weight: 600;
        white-space: nowrap;
        color: #fff;
        background: var(--ink);
        border-radius: 6px;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity .15s, transform .15s, visibility .15s;
        z-index: 5;
    }
    .action-icons [data-tooltip]:hover::after,
    .action-icons [data-tooltip]:focus-visible::after {
        opacity: 1; visibility: visible; transform: translate(-50%, 0);
    }
}

.copy-link-btn { font-size: 14px; }
.delete-link { color: var(--danger); }
.delete-link:hover { color: var(--danger-strong); }

/* Fragen-Editor */
.admin-question-block {
    position: relative;
    margin-bottom: 14px;
    padding: 18px 18px 6px 48px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-row);
}
.admin-question-block h4 { margin: 0 0 14px; padding-right: 100px; color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.admin-question-block .form-group { margin-bottom: 16px; }

.drag-handle {
    position: absolute;
    left: 16px; top: 18px;
    color: #A8939C;
    font-size: 1.1rem;
    cursor: grab;
    touch-action: none;
}
.drag-handle:active { cursor: grabbing; }

.delete-btn {
    position: absolute;
    top: 12px; right: 12px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--danger);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
}
.delete-btn:hover { background: var(--danger-tint); border-color: var(--danger); }

.sortable-ghost { opacity: .45; background: var(--primary-tint); border: 2px dashed var(--primary); }
.sortable-dragging { box-shadow: 0 12px 24px rgba(43,27,36,.12); }

/* Logo-Vorschau im Editor */
.logo-preview {
    display: block;
    max-width: 120px; max-height: 80px;
    margin: 12px 0 8px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

/* ---------- Ergebnisse ---------- */
.result-question {
    padding: 20px 0;
    border-top: 1px solid var(--line);
}
.result-question:first-child { border-top: 0; padding-top: 4px; }
.result-question h3 { margin-bottom: 14px; }
.result-question .result-meta { margin: -8px 0 14px; color: var(--muted); font-size: 0.88rem; }

.text-answers { list-style: none; margin: 0; padding: 0; }
.text-answers li {
    margin-bottom: 6px;
    padding: 10px 14px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-field);
}

.option-result { margin-bottom: 14px; }
.option-result-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
    font-size: 0.95rem;
}
.option-result-head span { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress-bar {
    height: 12px;
    overflow: hidden;
    background: #F5E6DA;
    border-radius: 999px;
}
.progress {
    height: 100%;
    min-width: 4px;
    background: var(--primary);
    border-radius: 999px;
    transition: width .5s ease;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1.5px solid var(--line);
}
.tab-link {
    min-height: 0;
    padding: 12px 16px;
    margin-bottom: -1.5px;
    font-size: 0.98rem;
    font-weight: 650;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
}
.tab-link:hover { color: var(--ink); background: transparent; border-color: transparent; border-bottom-color: var(--line-strong); }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }

/* Auto-Reload-Schalter */
.auto-reload-toggle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--muted);
}
.auto-reload-toggle label { display: inline-flex; align-items: center; margin: 0; font-weight: 500; cursor: pointer; }
.auto-reload-toggle input { margin-right: 8px; }

/* Einzelergebnis-Tabelle */
.table-wrapper {
    overflow: auto;
    max-height: 70vh;
    border: 1px solid var(--line);
    border-radius: var(--radius-row);
}
.results-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; white-space: nowrap; }
.results-table th, .results-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
}
.results-table th:last-child, .results-table td:last-child { border-right: 0; }
.results-table tbody tr:last-child td { border-bottom: 0; }
.results-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    font-weight: 650;
    background: var(--surface-soft);
}
.results-table tbody tr:nth-of-type(even) { background: #FFFBF7; }

.results-table td.editable-text,
.results-table td.editable-select { cursor: text; transition: background-color .15s, box-shadow .15s; }
.results-table td.editable-select { cursor: pointer; }
.results-table td.editable-text:hover,
.results-table td.editable-select:hover { background: var(--primary-tint); }
.results-table td.editable-text:focus { outline: none; background: #fff; box-shadow: inset 0 0 0 2px var(--primary); }
.results-table td.is-saving { box-shadow: inset 0 0 0 2px #E0A800; }
.results-table td.is-saved  { box-shadow: inset 0 0 0 2px var(--success); }
.results-table td.is-error  { box-shadow: inset 0 0 0 2px var(--danger); }

.results-table .actions-cell { text-align: center; }
.results-table .actions-cell a { color: var(--danger); }

.results-table td .inline-select { padding: 6px 8px; font-size: inherit; }

/* Teilen-Dialog */
dialog.share-dialog {
    width: min(520px, calc(100vw - 32px));
    padding: 24px;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius-sheet);
    box-shadow: 0 20px 50px rgba(43,27,36,.2);
}
dialog.share-dialog::backdrop { background: rgba(43,27,36,.35); }
dialog.share-dialog h3 { margin-bottom: 8px; }
dialog.share-dialog input { margin: 8px 0 16px; font-size: 0.9rem; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Editor: Hinweistext / Infotext verbinden */
.button-small, button.button-small { min-height: 36px; padding: 7px 14px; font-size: 0.9rem; }
.merge-container .hint { margin: 6px 0 0; }
.admin-question-block.just-merged { animation: merged 1.6s ease-out; }
@keyframes merged {
    0%, 40% { box-shadow: 0 0 0 3px var(--primary); background: var(--primary-tint); }
    100%    { box-shadow: 0 0 0 0 transparent; }
}
.hint-container textarea { min-height: 64px; }

/* ---------- Unterlagen / Dokumente ---------- */
.doc-list { margin: 0 0 28px; }
.doc-list-title { font-size: 1rem; font-weight: 650; margin: 0 0 10px; color: var(--ink); }
.doc-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.doc-list a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--ink);
    font-weight: 500;
    background: var(--surface-soft);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-row);
    transition: border-color .15s, background-color .15s;
}
.doc-list a:hover { text-decoration: none; border-color: var(--primary); background: var(--primary-tint); color: var(--ink); }
.doc-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.doc-name { font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.doc-meta { font-size: 0.85rem; color: var(--muted); }
.doc-action { flex: none; font-size: 0.9rem; font-weight: 650; color: var(--primary); }

.doc-icon {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 42px; height: 48px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #fff;
    background: #7A6672;
    border-radius: 6px 14px 6px 6px;
}
.doc-icon.doc-pdf { background: #B3261E; }
.doc-icon.doc-doc, .doc-icon.doc-docx, .doc-icon.doc-odt { background: #2B5797; }
.doc-icon.doc-xls, .doc-icon.doc-xlsx, .doc-icon.doc-ods { background: #1F7A4D; }
.doc-icon.doc-jpg, .doc-icon.doc-png { background: #7A5C1E; }

@media (max-width: 420px) {
    .doc-action { display: none; }
}

.status-docs { max-width: 460px; margin: 28px auto 0; text-align: left; }

/* Editor: Dokumentverwaltung */
.doc-admin-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.doc-admin-list li {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 6px 14px;
    padding: 10px 12px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-row);
}
.doc-admin-list input[type="text"] { padding: 8px 10px; }
.doc-admin-list .doc-meta { grid-column: 2; margin-top: -2px; }
.doc-admin-list .doc-meta a { font-weight: 600; }
.doc-admin-list .doc-remove { grid-column: 3; grid-row: 1 / span 2; margin: 0; font-weight: 500; font-size: 0.88rem; color: var(--danger); white-space: nowrap; cursor: pointer; }
.doc-admin-list li:has(.doc-remove input:checked) { opacity: .55; background: var(--danger-tint); }

/* ---------- Neue Feldtypen ---------- */
input.input-short { max-width: 240px; }
select.survey-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 44px;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%235A4352' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 14px center / 16px no-repeat;
    cursor: pointer;
    min-height: 50px;
}
.validation-error select { border-color: var(--danger); }

/* "Sonstiges" mit Freitext */
.sonstiges-field { display: none; margin-top: 8px; }
.sonstiges-field.is-visible { display: block; }
.option-other .sonstiges-field { margin: 8px 0 0; }

/* Datenschutzhinweis unter dem Absende-Button */
.privacy-note { margin: 14px 0 0; text-align: center; font-size: 0.85rem; color: var(--muted); }
.privacy-note a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
details.privacy-note { text-align: left; }
details.privacy-note summary { cursor: pointer; text-align: center; font-weight: 600; list-style-position: inside; }
details.privacy-note > div { margin-top: 10px; padding: 12px 14px; background: var(--surface-soft); border-radius: var(--radius-field); line-height: 1.5; }

/* Auswertung: Zahlen */
.number-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 10px; }
.number-stats > div { padding: 14px 16px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius-row); }
.number-stats-value { display: block; font-size: 1.6rem; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.number-stats-label { font-size: 0.85rem; color: var(--muted); }
.other-answers { margin: 8px 0 0 12px; }
.other-answers li { padding: 6px 10px; font-size: 0.9rem; }

/* ---------- QR-Code & Aushang ---------- */
.qr-options label { display: inline-flex; align-items: center; margin: 0; font-weight: 500; }
.qr-options input { margin-right: 8px; }
.qr-link-line { margin: 14px 0 0; font-size: 0.9rem; color: var(--muted); overflow-wrap: anywhere; }

.aushang-wrap { max-width: 1040px; margin: 24px auto 0; display: flex; justify-content: center; }
.aushang {
    width: min(100%, 560px);
    aspect-ratio: 210 / 297;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 7% 8%;
    background: #fff;
    color: var(--ink);
    text-align: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(43, 27, 36, 0.10);
}
.aushang-logo { max-height: 15%; max-width: 50%; object-fit: contain; margin-bottom: 4%; }
.aushang-titel { font-size: clamp(1.4rem, 4.6vw, 2.2rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 3%; }
.aushang-text { font-size: clamp(0.85rem, 2vw, 1rem); color: var(--muted); line-height: 1.45; margin: 0 0 4%; max-width: 40ch; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; }
.aushang-qr { width: 58%; aspect-ratio: 1; margin: 3% 0 4%; padding: 3%; background: #fff; border: 3px solid var(--primary); border-radius: 12px; }
.aushang-qr svg { display: block; width: 100%; height: 100%; }
.aushang-cta { font-size: clamp(0.95rem, 2.4vw, 1.2rem); font-weight: 700; margin: 0 0 1.5%; color: var(--primary); }
.aushang-url { font-size: clamp(0.7rem, 1.6vw, 0.85rem); color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.aushang [contenteditable]:hover { outline: 1px dashed var(--line-strong); outline-offset: 4px; }
.aushang [contenteditable]:focus { outline: 2px solid var(--primary-ring); outline-offset: 4px; }
.aushang [hidden] { display: none !important; }

@media print {
    @page { size: A4 portrait; margin: 0; }
    body.qr-page { padding: 0; background: #fff; }
    body.qr-page .qr-controls, body.qr-page .site-footer { display: none !important; }
    .aushang-wrap { margin: 0; max-width: none; }
    .aushang {
        width: 210mm; height: 297mm; aspect-ratio: auto;
        padding: 22mm 20mm;
        border: 0; border-radius: 0; box-shadow: none;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .aushang-titel { font-size: 30pt; }
    .aushang-text { font-size: 13pt; -webkit-line-clamp: 8; }
    .aushang-qr { width: 110mm; }
    .aushang-cta { font-size: 16pt; }
    .aushang-url { font-size: 10pt; }
    .aushang [contenteditable] { outline: none !important; }
}

/* ---------- Benutzerverwaltung ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px 16px;
    margin: -8px 0 28px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}
.admin-nav-links, .admin-nav-user { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.admin-nav a {
    padding: 7px 12px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.95rem;
}
.admin-nav a:hover { color: var(--ink); background: var(--surface-soft); text-decoration: none; }
.admin-nav a.is-active { color: var(--primary); background: var(--primary-tint); }

.role-tag {
    display: inline-block;
    padding: 1px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-tint);
    border-radius: 999px;
    vertical-align: 1px;
}
.status-invited { background: #E7EEF8; color: #2B5797; }
.status-expired { background: var(--warn-tint); color: #6B4E00; }

details.panel {
    margin-bottom: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-row);
    background: var(--surface-soft);
}
details.panel > summary {
    padding: 14px 18px;
    font-weight: 650;
    cursor: pointer;
    color: var(--primary);
}
details.panel[open] > summary { border-bottom: 1px solid var(--line); }
details.panel > form { padding: 18px; }

.narrow-form { max-width: 560px; }
.checkbox-list { border: 0; padding: 0; margin: 0 0 22px; }
.checkbox-list legend { font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; padding: 0; }
.checkbox-list label { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-weight: 500; }
.checkbox-list label input { margin: 0; }

.member-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.member-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-field);
}
.member-list li .muted { margin-left: 6px; font-size: 0.88rem; }
.member-list form { margin: 0; }

.add-member, .filter-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 20px; }
.add-member select, .add-member input[type="text"] { flex: 1 1 260px; width: auto; }
.filter-form { margin: 0; }
.filter-form select { width: auto; min-height: 46px; padding-top: 10px; padding-bottom: 10px; }

.survey-meta { display: block; margin-top: 4px; font-size: 0.82rem; font-weight: 500; color: var(--muted); }
.group-tag {
    display: inline-block;
    margin-right: 4px;
    padding: 1px 8px;
    font-size: 0.75rem;
    font-weight: 650;
    color: #2B5797;
    background: #E7EEF8;
    border-radius: 6px;
}
.group-tag.is-private { color: var(--muted); background: #F6ECE4; }
.group-tag.is-legacy { color: #6B4E00; background: var(--warn-tint); }

.profile-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 24px; }
.profile-facts dt { color: var(--muted); font-size: 0.92rem; }
.profile-facts dd { margin: 0; font-weight: 600; }

.login-links { margin: 18px 0 0; text-align: center; font-size: 0.92rem; }

@media (max-width: 600px) {
    .admin-nav { margin-top: 0; }
    .member-list li { flex-direction: column; align-items: flex-start; }
}

/* ---------- Plätze, Anmeldeschluss, Warteliste ---------- */
.capacity-box {
    margin: 0 0 24px;
    padding: 14px 16px;
    background: var(--primary-tint);
    border: 1px solid #F0CDB3;
    border-radius: var(--radius-row);
}
.capacity-box p { margin: 0; }
.capacity-box p + p, .capacity-box .capacity-bar + p { margin-top: 8px; }
.capacity-box.is-full { background: var(--warn-tint); border-color: var(--warn-line); }
.capacity-bar { height: 8px; margin-top: 10px; background: rgba(255, 146, 72, 0.22); border-radius: 999px; overflow: hidden; }
.capacity-bar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.capacity-deadline { font-size: 0.92rem; color: var(--ink); }

.status-icon.is-waiting { background: var(--warn-tint); color: #8A6500; }
.confirm-note { margin-top: 14px; font-size: 0.95rem; }

.personal-link { max-width: 520px; margin: 24px auto 0; padding: 16px; text-align: left; background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius-row); }
.personal-link p { max-width: none; margin: 0 0 10px; color: var(--ink); }
.personal-link-row { display: flex; gap: 8px; }
.personal-link-row input { flex: 1; min-width: 0; font-size: 0.85rem; }

.registration-status { display: flex; flex-direction: column; gap: 2px; margin: 0 0 22px; padding: 14px 16px; border-radius: var(--radius-row); border: 1px solid; }
.registration-status.is-confirmed { background: var(--success-tint); border-color: #B7DEC8; color: var(--success); }
.registration-status.is-waiting { background: var(--warn-tint); border-color: var(--warn-line); color: #6B4E00; }
.registration-status span { color: var(--ink); font-size: 0.92rem; }

.cancel-box { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.cancel-box h2 { font-size: 1.05rem; margin-bottom: 4px; }

.answer-list { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 10px 18px; margin: 0 0 22px; }
.answer-list dt { color: var(--muted); font-size: 0.92rem; }
.answer-list dd { margin: 0; font-weight: 600; }
@media (max-width: 520px) { .answer-list { grid-template-columns: 1fr; gap: 2px; } .answer-list dd { margin-bottom: 10px; } }

/* Admin */
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 600px) { .form-row-2 { grid-template-columns: 1fr; } }
.capacity-admin { margin: 0 0 16px; padding: 10px 14px; background: var(--surface-soft); border-radius: var(--radius-field); }
.warn-hint { color: #8A6500; }
.capacity-mini { display: block; margin-top: 2px; font-size: 0.78rem; line-height: 1.35; color: var(--muted); }
.cap-full { font-weight: 700; color: #8A6500; }
.results-table tr.is-waitlisted td { background: #FFFBEF; }
.results-table .actions-cell { white-space: nowrap; }
.inline-action { display: inline-block; margin: 0 4px 0 0; }
.icon-button { min-height: 0; width: 30px; height: 30px; padding: 0; font-size: 13px; color: var(--primary); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }
.icon-button:hover { color: var(--button-ink); }

/* ---------- Vereinsprofil (Gruppen) ---------- */
.inline-check { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; cursor: pointer; }
.profil-logo { display: flex; align-items: center; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.profil-logo .logo-preview { max-height: 64px; width: auto; }
.farbe-zeile { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.farbe-zeile input[type="color"] { width: 56px; height: 40px; padding: 3px; border: 1.5px solid var(--line); border-radius: var(--radius-field); background: var(--surface); cursor: pointer; }
.farbe-zeile input[type="color"].ist-standard { opacity: .45; }
.farbe-vorschau { display: flex; align-items: center; gap: 14px; margin-top: 12px; padding: 14px; border: 1px dashed var(--line); border-radius: var(--radius-row); flex-wrap: wrap; }
.farbe-vorschau .button { pointer-events: none; }
.farbe-vorschau .vorschau-link { color: var(--primary); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.farbe-vorschau .vorschau-auswahl { padding: 8px 12px; border: 1.5px solid var(--primary); background: var(--primary-tint); border-radius: var(--radius-field); font-size: .9rem; }
.profil-erbe { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.profil-erbe img { max-height: 36px; width: auto; border-radius: 6px; }

/* ---------- Termin & Kalender ---------- */
.survey-termin { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 0; font-weight: 600; color: var(--ink); }
.survey-termin svg { flex: none; margin-top: 3px; color: var(--primary); }
.calendar-box { margin: 22px auto 0; max-width: 460px; padding: 18px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-row); }
.calendar-when { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 14px; line-height: 1.45; max-width: none; color: var(--ink); }
.calendar-when svg { flex: none; margin-top: 2px; color: var(--primary); }
.calendar-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.calendar-actions .button { flex: 1 1 160px; justify-content: center; text-align: center; }
.calendar-box .hint { margin: 10px 0 0; }

