/* ============================================================
   Artgenossen – Verwaltung
   Design-Tokens wie marence.at / apps.marence.at; hell und dunkel automatisch.
   ============================================================ */
:root {
  --bg: #f4f5f6;
  --surface: #ffffff;
  --sunken: #eceef0;
  --accent: #2a60b2;
  --accent-hover: #235095;
  --on-accent: #ffffff;
  --tint: #e3e9f2;
  --text: #181b20;
  --muted: #5e646e;
  --border: rgba(24, 27, 32, 0.12);
  --nav-bg: rgba(244, 245, 246, 0.85);
  --ok: #1d7a46;       --ok-bg: #e2f3e9;
  --warn: #9a5b00;     --warn-bg: #fdf0d8;
  --bad: #b3261e;      --bad-bg: #fbe4e2;
  --info: #2a60b2;     --info-bg: #e3e9f2;
  --shadow-sm: 0 1px 2px rgba(24, 27, 32, 0.05), 0 1px 3px rgba(24, 27, 32, 0.04);
  --shadow-md: 0 8px 28px -10px rgba(24, 27, 32, 0.18);
  --radius: 14px;
  --radius-sm: 10px;
  --nav-h: 60px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101114; --surface: #17191d; --sunken: #1d2024;
    --accent: #7fa2d7; --accent-hover: #9ab6df; --on-accent: #121821; --tint: #1f2937;
    --text: #eeeff1; --muted: #9ca2ab; --border: rgba(255, 255, 255, 0.11);
    --nav-bg: rgba(16, 17, 20, 0.85);
    --ok: #6fd09a; --ok-bg: #16301f; --warn: #f0be6a; --warn-bg: #36290f;
    --bad: #f2928b; --bad-bg: #3a1a18; --info: #7fa2d7; --info-bg: #1f2937;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35); --shadow-md: 0 8px 28px -10px rgba(0, 0, 0, 0.6);
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.55; font-size: 16px;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1 { font-size: 1.65rem; line-height: 1.25; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; line-height: 1.3; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Kopfzeile ─────────────────────────────────────────── */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--nav-bg); backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); }
.topbar__inner { max-width: 1180px; margin: 0 auto; padding: 0 20px; height: var(--nav-h); display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand__mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; font-weight: 800; font-size: 0.95rem; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--muted); font-weight: 500; font-size: 0.93rem; padding: 7px 14px; border-radius: 999px;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.nav a:hover { background: var(--tint); color: var(--accent); text-decoration: none; }
.nav a.is-active { background: var(--tint); color: var(--accent); }
.count { background: var(--accent); color: var(--on-accent); font-size: 0.72rem; font-weight: 700; min-width: 19px; height: 19px;
  padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; width: 34px; height: 34px; border-radius: 50%; background: var(--sunken);
  display: grid; place-items: center; font-weight: 700; font-size: 0.85rem; text-transform: uppercase; border: 1px solid var(--border); }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu__panel { position: absolute; right: 0; top: 42px; min-width: 220px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md); padding: 6px; z-index: 60; }
.usermenu__panel .who { padding: 8px 12px; font-size: 0.85rem; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; word-break: break-all; }
.usermenu__panel a, .usermenu__panel button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 9px 12px;
  border-radius: 8px; background: none; border: 0; color: var(--text); font-size: 0.93rem; }
.usermenu__panel a:hover, .usermenu__panel button:hover { background: var(--tint); text-decoration: none; }

/* ── Seite ─────────────────────────────────────────────── */
.page { max-width: 1180px; margin: 0 auto; padding: 28px 20px 80px; }
.page--narrow { max-width: 760px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { color: var(--muted); margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.9rem; margin-bottom: 10px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 12px; gap: 12px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px; }
.card + .card { margin-top: 16px; }
.card--flush { padding: 0; overflow: hidden; }
.card h2 { margin-bottom: 4px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card__head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid > .card + .card { margin-top: 0; }

.stat { display: block; color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--accent); }
.stat__n { font-size: 2rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.stat__l { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.stat--accent { background: var(--tint); border-color: transparent; }

/* ── Buttons ───────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 20px; border-radius: 999px;
  font-weight: 600; font-size: 0.93rem; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; line-height: 1.3; }
.btn:hover { background: var(--tint); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--danger { color: var(--bad); }
.btn--danger:hover { background: var(--bad-bg); }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--sm { padding: 6px 14px; font-size: 0.85rem; }
.btn--lg { padding: 13px 28px; font-size: 1rem; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 15px; height: 15px; }
.iconbtn { width: 34px; height: 34px; padding: 0; border-radius: 50%; display: inline-grid; place-items: center; background: none; border: 0; color: var(--muted); }
.iconbtn:hover { background: var(--tint); color: var(--accent); }
.iconbtn.danger:hover { background: var(--bad-bg); color: var(--bad); }
.iconbtn[disabled] { opacity: .3; pointer-events: none; }

/* ── Formulare ─────────────────────────────────────────── */
.field { display: block; }
.field + .field, .field-row + .field, .field + .field-row { margin-top: 16px; }
.field > span, .label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.field > span em { color: var(--muted); font-weight: 400; font-style: normal; }
.input, .select, .textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input[type=color] { padding: 3px; height: 42px; width: 64px; }
.help { color: var(--muted); font-size: 0.86rem; margin-top: 5px; }
.field-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.field-row .field { margin-top: 0 !important; }
.field-row--3 { grid-template-columns: repeat(3, 1fr); }
.form-sub { font-size: 1.05rem; margin: 26px 0 4px; padding-top: 20px; border-top: 1px solid var(--border); }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input[type=checkbox], .check input[type=radio] { width: 19px; height: 19px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.check--box { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.check--box:hover { border-color: var(--accent); }
.check--box:has(input:checked) { border-color: var(--accent); background: var(--tint); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.search { position: relative; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 38px; }

/* ── Chips, Badges ─────────────────────────────────────── */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 999px; font-size: 0.88rem; font-weight: 500;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip small { opacity: .7; font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; background: var(--sunken); color: var(--muted); }
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--bad { background: var(--bad-bg); color: var(--bad); }
.badge--info { background: var(--info-bg); color: var(--info); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: inline-block; flex: none; }
.dot--off { background: transparent; border: 1px solid var(--border); }

/* ── Tabellen ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
table.data th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: .04em;
  padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); }
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: color-mix(in srgb, var(--tint) 55%, transparent); }
table.data tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
table.data tr.is-new .strong { font-weight: 700; }
tr.clickable { cursor: pointer; }
td.check-cell, th.check-cell { width: 44px; padding-right: 0; }
.strong { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 0.85rem; }
.bulkbar { position: sticky; bottom: 16px; margin-top: 16px; display: none; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px;
  background: var(--text); color: var(--bg); border-radius: 999px; box-shadow: var(--shadow-md); width: fit-content; max-width: 100%; }
.bulkbar.is-open { display: flex; }
.bulkbar .select { width: auto; padding: 6px 12px; border-radius: 999px; background: var(--bg); color: var(--text); }
.bulkbar .btn { background: var(--bg); color: var(--text); border-color: transparent; padding: 6px 16px; }

/* ── Leere Zustände, Hinweise ──────────────────────────── */
.empty { text-align: center; padding: 48px 24px; }
.empty > .icon { width: 40px; height: 40px; color: var(--muted); margin: 0 auto 12px; stroke-width: 1.4; }
.empty h2 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 440px; margin: 0 auto 18px; }
.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--info-bg); color: var(--text); border: 1px solid transparent; align-items: flex-start; }
.notice .icon { color: var(--info); margin-top: 2px; }
.notice--warn { background: var(--warn-bg); } .notice--warn .icon { color: var(--warn); }
.notice--bad { background: var(--bad-bg); } .notice--bad .icon { color: var(--bad); }
.notice--ok { background: var(--ok-bg); } .notice--ok .icon { color: var(--ok); }
.notice + .notice, .notice + .card, .card + .notice { margin-top: 16px; }

.toasts { position: fixed; top: calc(var(--nav-h) + 12px); left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(520px, calc(100vw - 32px)); }
.toast { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--text); color: var(--bg); box-shadow: var(--shadow-md); display: flex; gap: 10px; align-items: center;
  animation: toast-in .25s ease; font-size: 0.93rem; }
.toast--error { background: var(--bad); color: #fff; }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; opacity: .7; font-size: 1.2rem; line-height: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-md); width: min(440px, calc(100vw - 32px)); margin: auto; }
dialog::backdrop { background: rgba(10, 12, 16, .5); backdrop-filter: blur(2px); }
dialog h2 { margin-bottom: 8px; }
dialog .form-actions { justify-content: flex-end; }

/* ── Schritte ──────────────────────────────────────────── */
.steps { display: flex; gap: 6px; align-items: center; font-size: 0.9rem; flex-wrap: wrap; }
.steps a, .steps span.step { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 999px; color: var(--muted); font-weight: 500; }
.steps a:hover { background: var(--tint); text-decoration: none; }
.steps .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 0.78rem; font-weight: 700; background: var(--sunken); }
.steps .is-current { color: var(--text); font-weight: 600; }
.steps .is-current .n { background: var(--accent); color: var(--on-accent); }
.steps .is-done .n { background: var(--ok-bg); color: var(--ok); }
.steps .sep { color: var(--border); }

/* ── Checkliste ────────────────────────────────────────── */
.checklist { list-style: none; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; }
.checklist .mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--ok-bg); color: var(--ok); margin-top: 1px; }
.checklist .mark .icon { width: 14px; height: 14px; stroke-width: 2.5; }
.checklist li.todo .mark { background: var(--warn-bg); color: var(--warn); }
.checklist li.bad .mark { background: var(--bad-bg); color: var(--bad); }
.checklist .t { font-weight: 600; }

/* ── Fortschritt, Balken ───────────────────────────────── */
.bar { height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s; }
.bar--ok > i { background: var(--ok); } .bar--warn > i { background: #d98b00; } .bar--bad > i { background: var(--bad); }
.bigstat { display: flex; align-items: baseline; gap: 8px; }
.bigstat b { font-size: 2.4rem; letter-spacing: -0.02em; line-height: 1; }
.timeline { display: flex; align-items: flex-end; gap: 14px; height: 130px; padding-top: 10px; }
.timeline .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 36px; max-width: 90px; }
.timeline .bars { display: flex; align-items: flex-end; gap: 3px; height: 100%; }
.timeline .bars i { width: 14px; border-radius: 4px 4px 0 0; background: var(--accent); min-height: 2px; }
.timeline .bars i.click { background: var(--ok); }
.timeline small { color: var(--muted); font-size: 0.75rem; }

/* ── Anmeldeliste: Karten auf dem Handy ────────────────── */
.course-group + .course-group { margin-top: 22px; }
.course-group > h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 4px 8px; }
.courseline { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.courseline:last-child { border-bottom: 0; }
.courseline.is-off { opacity: .55; }
.courseline .meta { width: 200px; flex: none; }
.courseline .actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; flex: none; min-width: 280px; }

/* ── Anmeldung (Detail) ────────────────────────────────── */
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; }
.dl dt { color: var(--muted); font-size: 0.9rem; }
.dl dd { word-break: break-word; }
.segmented { display: inline-flex; background: var(--sunken); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 6px 16px; border-radius: 999px; font-size: 0.9rem; font-weight: 500; color: var(--muted); }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }

/* ── Vorlagen-Auswahl ──────────────────────────────────── */
.tplgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.tpl { position: relative; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; display: block; }
.tpl:hover { border-color: var(--accent); }
.tpl input { position: absolute; opacity: 0; }
.tpl:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.tpl__thumb { height: 210px; overflow: hidden; background: #f4f5f6; position: relative; pointer-events: none; }
.tpl__thumb iframe { width: 285.7%; height: 285.7%; border: 0; transform: scale(.35); transform-origin: top left; }
.tpl__thumb--blank { display: grid; place-items: center; color: var(--muted); }
.tpl__body { padding: 12px 14px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tpl__body b { font-size: 0.95rem; }

/* ── Editor ────────────────────────────────────────────── */
.editor-bar { position: sticky; top: var(--nav-h); z-index: 40; background: var(--surface); border-bottom: 1px solid var(--border); }
.editor-bar__inner { max-width: 1500px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.editor-bar .title-input { font-weight: 600; border: 1px solid transparent; background: transparent; padding: 6px 10px; border-radius: 8px; width: 260px; max-width: 100%; }
.editor-bar .title-input:hover { border-color: var(--border); } .editor-bar .title-input:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.savestate { font-size: 0.85rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; min-width: 110px; }
.savestate.is-saving { color: var(--warn); } .savestate.is-error { color: var(--bad); } .savestate.is-ok .icon { color: var(--ok); }
.editor { max-width: 1500px; margin: 0 auto; padding: 20px; display: grid; grid-template-columns: minmax(380px, 520px) 1fr; gap: 20px; align-items: start; }
.editor__side { display: grid; gap: 14px; }
.editor__preview { position: sticky; top: calc(var(--nav-h) + 70px); }
.preview-frame { background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.preview-frame__bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.preview-frame iframe { width: 100%; height: calc(100vh - 220px); min-height: 480px; border: 0; display: block; margin: 0 auto; background: #f4f5f6; transition: width .2s; }
.preview-frame.is-mobile iframe { width: 390px; max-width: 100%; }
.blocks { display: grid; gap: 10px; }
.block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.block.is-focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.block__head { display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 14px; }
.block__head .kind { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.block__tools { margin-left: auto; display: flex; }
.block__body { padding: 2px 14px 14px; display: grid; gap: 10px; }
.block.is-collapsed .block__body { display: none; }
.block__summary { color: var(--muted); font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; cursor: pointer; }
.block:not(.is-collapsed) .block__summary { display: none; }
.richtext { min-height: 110px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 0 0 var(--radius-sm) var(--radius-sm); background: var(--surface); line-height: 1.6; }
.richtext:focus { outline: none; border-color: var(--accent); }
.richtext p, .richtext div { margin: 0 0 .7em; }
.richtext a { color: var(--accent); text-decoration: underline; }
.rt-toolbar { display: flex; gap: 2px; padding: 4px; border: 1px solid var(--border); border-bottom: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--surface); flex-wrap: wrap; }
.rt-toolbar button { width: 32px; height: 30px; border-radius: 6px; border: 0; background: none; font-weight: 700; display: grid; place-items: center; }
.rt-toolbar button:hover { background: var(--tint); }
.rt-toolbar .sep { width: 1px; background: var(--border); margin: 4px 4px; }
.rt-toolbar .tag { margin-left: auto; font-size: 0.78rem; color: var(--muted); align-self: center; padding: 0 8px; }
.dropimage { border: 2px dashed var(--border); border-radius: var(--radius-sm); padding: 18px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.dropimage:hover, .dropimage.is-over { border-color: var(--accent); background: var(--tint); color: var(--accent); }
.imagepreview { position: relative; }
.imagepreview img { border-radius: 8px; max-height: 200px; object-fit: contain; background: var(--sunken); width: 100%; }
.addblock { border: 2px dashed var(--border); border-radius: var(--radius-sm); padding: 14px; background: transparent; }
.addblock h3 { font-size: 0.85rem; color: var(--muted); margin-bottom: 10px; font-weight: 600; }
.addblock .chips .chip { cursor: pointer; }
.addblock .chip:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.insert-hint { font-size: 0.82rem; color: var(--muted); }
.courselist { display: grid; gap: 6px; max-height: 260px; overflow: auto; padding: 2px; }

/* ── Anmelde-Login ─────────────────────────────────────── */
.authwrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.authcard { width: min(420px, 100%); }
.authcard .brand { justify-content: center; margin-bottom: 22px; font-size: 1.15rem; }
.authcard h1 { font-size: 1.35rem; text-align: center; margin-bottom: 6px; }
.authcard .lead { text-align: center; color: var(--muted); margin-bottom: 22px; }

/* ── Öffentliche Formulare ─────────────────────────────── */
.public { --brand: #5aa650; background: transparent; }
body.public-page { background: var(--bg); }
body.public-page.is-embed { background: transparent; min-height: 0; }
.pubwrap { max-width: 680px; margin: 0 auto; padding: 28px 16px 48px; }
.is-embed .pubwrap { padding: 4px 4px 16px; max-width: none; }
.pubcard { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow-sm); }
.is-embed .pubcard { box-shadow: none; }
.pubcard h1 { font-size: 1.4rem; margin-bottom: 4px; }
.pubcard .lead { color: var(--muted); margin-bottom: 22px; }
.pubcard .input:focus, .pubcard .select:focus, .pubcard .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.pubcard .check input[type=checkbox] { accent-color: var(--brand); }
.btn--brand { background: var(--brand); border-color: var(--brand); color: #fff; padding: 13px 34px; font-size: 1rem; }
.btn--brand:hover { background: var(--brand); filter: brightness(.92); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--bad); }
.error { color: var(--bad); font-size: 0.86rem; margin-top: 5px; font-weight: 500; }
.req { color: var(--bad); }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.coursehint { margin-top: 8px; font-size: 0.9rem; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--warn); }
.coursehint.is-info { background: var(--sunken); color: var(--muted); }
.thanks { text-align: center; padding: 20px 0; }
.thanks .tick { width: 64px; height: 64px; border-radius: 50%; background: color-mix(in srgb, var(--brand) 18%, transparent); color: var(--brand); display: grid; place-items: center; margin: 0 auto 16px; }
.thanks .tick .icon { width: 32px; height: 32px; stroke-width: 2.4; }
.codebox { position: relative; background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; white-space: pre-wrap; word-break: break-all; line-height: 1.55; }

/* ── Mobil ─────────────────────────────────────────────── */
@media (max-width: 960px) {
  .editor { grid-template-columns: 1fr; }
  .editor__preview { position: static; }
  .preview-frame iframe { height: 560px; }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .page { padding: 20px 14px 80px; }
  .grid--2, .grid--3, .field-row { grid-template-columns: 1fr; }
  .topbar__inner { padding: 0 12px; gap: 8px; flex-wrap: wrap; height: auto; padding-top: 8px; padding-bottom: 4px; }
  .brand span.t { display: none; }
  .nav { order: 3; flex-basis: 100%; padding-bottom: 6px; }
  .topbar__inner .usermenu { margin-left: auto; }
  .editor__preview { order: 2; }
  h1 { font-size: 1.4rem; }
  .courseline { flex-wrap: wrap; } .courseline .meta { width: auto; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; } .dl dd { margin-bottom: 10px; }
  .pubcard { padding: 20px 16px; }
  .stack-sm > * { width: 100%; }
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { padding: 12px 16px; border-bottom: 1px solid var(--border); position: relative; }
  table.cards td { padding: 2px 0; border: 0; }
  table.cards td.check-cell { position: absolute; right: 12px; top: 12px; width: auto; }
  table.cards tr.is-new { box-shadow: inset 3px 0 0 var(--accent); }
  table.cards tr.is-new td:first-child { box-shadow: none; }
  table.cards td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; }
}
@media print { .topbar, .toasts, .bulkbar { display: none; } }
@media (max-width: 720px) { [data-sidebar-grid] { grid-template-columns: 1fr !important; } }
.field > label > span { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }

.courselist .grouphead { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin: 8px 2px 0; display: flex; justify-content: space-between; align-items: center; }
.courselist .grouphead button { background: none; border: 0; color: var(--accent); font-size: .78rem; text-transform: none; letter-spacing: 0; font-weight: 600; }
@media (max-width: 720px) { .editor-bar { position: static; } .editor-bar .title-input { width: 100%; } }

/* ── Editor: Verschieben, Einfügen, Sektionen ───────────── */
.blocks { gap: 0; }
.insert { position: relative; height: 14px; display: flex; justify-content: center; }
.insert__btn { position: absolute; top: -2px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  display: grid; place-items: center; opacity: 0; transition: opacity .15s; z-index: 2; padding: 0; }
.insert:hover .insert__btn, .insert__btn:focus-visible, .insert:has(.addmenu) .insert__btn { opacity: 1; }
.insert__btn:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
@media (hover: none) { .insert__btn { opacity: .6; } }
.insert .addmenu { position: absolute; top: 24px; left: 0; right: 0; z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px; box-shadow: var(--shadow-md); justify-content: center; }
.addmenu .chip { cursor: pointer; }
.addmenu .chip:hover, .addblock .chip:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.grip { width: 26px; height: 30px; border: 0; background: none; color: var(--muted); cursor: grab; display: grid; place-items: center; border-radius: 6px; margin-left: -8px; }
.grip:hover { background: var(--tint); color: var(--accent); }
.block__head { cursor: pointer; }
.block.is-simple .block__head { cursor: default; }
.block.is-dragging { opacity: .4; }
.block.is-dropbefore { box-shadow: 0 -4px 0 -1px var(--accent); }
.block.is-dropafter { box-shadow: 0 4px 0 -1px var(--accent); }
.block__summary { margin-left: 4px; }
.block.is-simple .block__body { display: none; }
.bgrow { display: flex; align-items: center; gap: 12px; padding-top: 8px; border-top: 1px dashed var(--border); flex-wrap: wrap; }
.segmented--sm span { padding: 3px 12px; font-size: .82rem; }
.gallery-slots { display: grid; gap: 12px; }
.gallery-slots .slot { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px 12px; background: var(--bg); }
.is-collapsed .bgrow { display: none; }
.dropimage { display: block; }
.dropimage > .icon { display: block; width: 28px; height: 28px; margin: 0 auto 8px; }

/* ── Prüfung im Editor ──────────────────────────────────── */
.lint { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.lint__head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: .93rem; }
.lint__head .mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-bg); color: var(--ok); flex: none; }
.lint.has-error .lint__head .mark { background: var(--bad-bg); color: var(--bad); }
.lint.has-warn .lint__head .mark { background: var(--warn-bg); color: var(--warn); }
.lint__head .mark .icon { width: 13px; height: 13px; stroke-width: 2.6; }
.lint__head .chev { margin-left: auto; transition: transform .15s; color: var(--muted); }
.lint.is-open .lint__head .chev { transform: rotate(180deg); }
.lint__list { display: none; list-style: none; border-top: 1px solid var(--border); }
.lint.is-open .lint__list { display: block; }
.lint__list li { display: flex; gap: 10px; padding: 9px 14px; align-items: flex-start; font-size: .88rem; border-bottom: 1px solid var(--border); }
.lint__list li:last-child { border-bottom: 0; }
.lint__list .dotl { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--info); }
.lint__list .error .dotl { background: var(--bad); } .lint__list .warn .dotl { background: #d98b00; }
.lint__list button { background: none; border: 0; color: var(--accent); font-weight: 600; font-size: .85rem; padding: 0; margin-left: 6px; }
.lint__list button:hover { text-decoration: underline; }
.preview-frame.is-dark iframe { background: #000; }

/* ── Barrierefreiheit ───────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 200; background: var(--accent); color: var(--on-accent); padding: 10px 18px; border-radius: 999px; font-weight: 600; }
.skip:focus { top: 10px; text-decoration: none; }
a.rowlink { color: inherit; text-decoration: none; }
a.rowlink:hover, a.rowlink:focus-visible { text-decoration: underline; }
tr:focus-within { background: color-mix(in srgb, var(--tint) 55%, transparent); }
.block__head .kind { background: none; border: 0; color: var(--muted); padding: 4px 6px 4px 0; cursor: pointer; font: inherit; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.block__head .kind:hover { color: var(--accent); }
.block.is-simple .block__head .kind { cursor: default; }
.lint__head { background: none; border: 0; width: 100%; text-align: left; color: inherit; font: inherit; font-weight: 600; font-size: .93rem; }
.lint__head:focus-visible { outline-offset: -2px; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible, .richtext:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pubcard .input:focus-visible, .pubcard .select:focus-visible, .pubcard .textarea:focus-visible { outline-color: var(--brand); }
.error { color: #a31f17; }
.pubcard .error a, .notice--bad a { color: inherit; text-decoration: underline; }
.notice[tabindex="-1"]:focus { outline: 2px solid var(--bad); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
@media (forced-colors: active) { .btn--primary, .chip.is-active, .segmented input:checked + span { outline: 2px solid ButtonText; } }

/* Einstellungen: Seitenleiste + Bereiche */
.settings-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 32px; align-items: start; }
.settings-main { max-width: 760px; }
.settings-main .sec { scroll-margin-top: calc(var(--nav-h) + 16px); }
.subnav { position: sticky; top: calc(var(--nav-h) + 20px); display: flex; flex-direction: column; gap: 2px; }
.subnav-group { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 0 4px 12px; }
.subnav-group:first-child { margin-top: 0; }
.subnav a { display: block; padding: 7px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .94rem; border-left: 3px solid transparent; }
.subnav a:hover { background: var(--sunken); }
.subnav a.is-active { background: var(--sunken); font-weight: 700; border-left-color: var(--accent); }
.savebar { position: sticky; bottom: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 16px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.userlist { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.userlist li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.userbox summary { list-style: none; cursor: pointer; }
.userbox summary::-webkit-details-marker { display: none; }
.userbox[open] { flex-basis: 100%; order: 5; }
@media (max-width: 860px) {
  .settings-layout { grid-template-columns: 1fr; gap: 14px; }
  .subnav { position: sticky; top: 98px; z-index: 35; flex-direction: row; overflow-x: auto; gap: 6px; padding: 8px 0; background: var(--bg); }
  .subnav-group { display: none; }
  .subnav a { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0; }
  .subnav a.is-active { border-bottom-color: var(--accent); }
  .settings-main .sec { scroll-margin-top: 170px; }
  .savebar .muted { display: none; }
  .savebar .btn { width: 100%; }
}

.brand__logo { height: 40px; width: auto; max-width: 180px; object-fit: contain; display: block; }
.authcard .brand__logo { height: 56px; max-width: 240px; margin: 0 auto; }
@media (prefers-color-scheme: dark) { .brand__logo { background: #fff; padding: 3px 8px; border-radius: 8px; } }

/* Webseite: Seitenbaum */
.pageline { display: flex; align-items: center; gap: 14px; padding: 10px 16px 10px calc(16px + var(--depth, 0) * 26px); border-bottom: 1px solid var(--border); }
.pageline:last-child { border-bottom: 0; }
.pageline:target { background: var(--tint); }
.pageline.is-off .pageline__title { color: var(--muted); }
.pageline__main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pageline__icon { color: var(--muted); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--sunken); flex: none; }
.pageline__title { color: var(--text); }
.pageline__badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pageline .actions { display: flex; gap: 2px; flex: none; }
.pageline .actions form { display: inline; }
@media (max-width: 720px) { .pageline { flex-wrap: wrap; padding-left: calc(12px + var(--depth, 0) * 14px); } .pageline__badges { order: 3; width: 100%; justify-content: flex-start; } }

/* Webseite: Editor */
.pubstate { font-size: .85rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pubstate.is-live { background: var(--ok-bg); color: var(--ok); }
.pubstate.is-pending { background: var(--warn-bg); color: var(--warn); }
.moremenu { position: relative; }
.moremenu summary { list-style: none; cursor: pointer; font-size: 1.2rem; line-height: 1; }
.moremenu summary::-webkit-details-marker { display: none; }
.moremenu__panel { position: absolute; right: 0; top: 40px; z-index: 50; min-width: 280px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md); padding: 6px; }
.moremenu__panel a, .moremenu__panel button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; color: var(--text); font: inherit; font-size: .93rem; background: none; border: 0; cursor: pointer; }
.moremenu__panel a:hover, .moremenu__panel button:hover { background: var(--tint); text-decoration: none; }
.moremenu__panel .danger { color: var(--bad); }
.moremenu__panel form { margin: 0; }
.pagemeta summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.pagemeta summary .muted { word-break: break-all; }
.preview-frame--web { position: relative; }
.preview-frame--web .preview-frame__viewport { overflow: hidden; height: calc(100vh - 220px); min-height: 480px; }
.preview-frame--web iframe { background: #fff; transform-origin: 0 0; }
.preview-frame--web.is-mobile .preview-frame__viewport { display: flex; justify-content: center; }
.preview-frame--web.is-mobile iframe { transform: none !important; width: 390px !important; height: 100% !important; }
.editor__preview { min-width: 0; }
.preview-frame--web .preview-frame__viewport { width: 100%; }

.linkbtn { border: 0; background: none; padding: 0; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; }

/* ── Bezahlt-Umschalter in der Anmeldungsliste ───────── */
.paytoggle { font: inherit; font-size: .82rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--warn); background: var(--warn-bg); color: var(--warn); }
.paytoggle.is-paid { border-color: transparent; background: var(--ok-bg); color: var(--ok); }
.paytoggle:hover { filter: brightness(.96); }

/* ── Teilnehmerliste (Bildschirm und Druck) ───────────── */
.plist-card { margin-bottom: 18px; }
table.plist tbody th { text-transform: none; letter-spacing: 0; font-size: inherit; color: var(--text); font-weight: 600; white-space: normal;
  padding: 13px 16px; border-bottom: 1px solid var(--border); background: transparent; }
table.plist tr:last-child th { border-bottom: 0; }
.plist__check { width: 3.2em; text-align: center !important; }
.plist__nr { width: 2.5em; color: var(--muted); }
.plist__box { width: 20px; height: 20px; accent-color: var(--accent); }
.plist__msg { min-width: 12em; white-space: pre-wrap; }
.plist__name a { color: inherit; }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff !important; color: #000 !important; font-size: 10.5pt; }
  .noprint, .back, .skip, dialog { display: none !important; }
  .page { padding: 0 !important; max-width: none !important; }
  .page-head { margin-bottom: 10px; }
  .page-head p { color: #000; }
  .card { box-shadow: none !important; border: 0 !important; padding: 0 !important; background: none !important; }
  .card__head { padding: 8px 0 4px; border: 0; }
  .table-wrap { overflow: visible; }
  table.plist { font-size: 10pt; }
  table.plist th, table.plist td { color: #000 !important; padding: 6px 7px !important; border: 1px solid #555 !important; background: none !important; }
  table.plist thead { display: table-header-group; }
  table.plist tr { break-inside: avoid; }
  .plist__box { appearance: none; -webkit-appearance: none; width: 14px; height: 14px; border: 1.5px solid #000; border-radius: 2px; margin: 0; }
  .plist__name a { text-decoration: none; }
  .badge { background: none !important; color: #000 !important; padding: 0 !important; font-weight: 400; }
  .plist-foot { color: #000; }
}
