/* Member area. Brand colors match the public site (style.css). */
:root {
    /* Club colors: verein.php?css (linked after this file) overrides these four. */
    --primary: #1f3f8f;
    --secondary: #c2185b;
    --on-primary: #ffffff; /* text on --primary */
    --on-secondary: #ffffff;
    --primary-soft: color-mix(in srgb, var(--primary) 9%, white);
    --secondary-soft: color-mix(in srgb, var(--secondary) 10%, white);
    --red: #c62828;
    --red-soft: #fdeaea;
    --slate: #6b7280;
    --green: #2e7d32;
    --slate-soft: #eceef2;
    --amber: #8a5a00;
    --amber-soft: #fff4dc;
    --ink: #1b1d29;
    --muted: #5d6275;
    --line: #dde0ea;
    --bg: #f4f5f9;
    --card: #ffffff;
    --radius: 10px;
    color-scheme: light;
}

* { box-sizing: border-box; }

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

[hidden] { display: none !important; }

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

h1, h2, h3 { margin: 0; line-height: 1.2; }

input, textarea, select, button { font: inherit; color: inherit; }

input:not([type=checkbox]):not([type=radio]), textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}
textarea { resize: vertical; min-height: 2.6em; overflow: hidden; }
input:focus, textarea:focus, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
    border-color: var(--primary);
}
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); flex-shrink: 0; }

/* ---------------------------------------------------------------- top bar */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 16px;
    background: var(--primary);
    color: var(--on-primary);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--on-primary); text-decoration: none; font-weight: 600; }
.brand img { height: 40px; }
.topbar-link { color: var(--on-primary); font-size: 0.95em; }
.topbar-nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
/* Help link and feedback button (added by setupTopbar) */
.topbar-pill { background: none; cursor: pointer; padding: 3px 10px; border: 1px solid color-mix(in srgb, var(--on-primary) 50%, transparent); border-radius: 999px; text-decoration: none; }
.topbar-pill:hover { background: color-mix(in srgb, var(--on-primary) 15%, transparent); }
.topbar-user {
    padding: 3px 10px;
    border: 1px solid color-mix(in srgb, var(--on-primary) 50%, transparent);
    border-radius: 999px;
    text-decoration: none;
    max-width: 14em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topbar-user:hover { background: color-mix(in srgb, var(--on-primary) 12%, transparent); }

/* ---------------------------------------------------------------- buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { border-color: var(--primary); }
.btn-primary { background: var(--secondary); border-color: var(--secondary); color: var(--on-secondary); font-weight: 600; }
.btn-primary:hover { background: color-mix(in srgb, var(--secondary) 88%, black); border-color: color-mix(in srgb, var(--secondary) 88%, black); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }
.btn-small { padding: 4px 10px; font-size: 0.9em; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--primary); }
.btn-quiet:hover { background: var(--primary-soft); border-color: transparent; }
.btn-danger-quiet { border-color: transparent; background: transparent; color: var(--red); }
.btn-danger-quiet:hover { background: var(--red-soft); border-color: transparent; }
.btn-block { width: 100%; margin-top: 16px; }
.btn.is-disabled { opacity: 0.45; cursor: not-allowed; }

.icon-btn {
    border: none;
    background: none;
    font-size: 1.4em;
    line-height: 1;
    padding: 2px 6px;
    color: var(--muted);
    cursor: pointer;
    border-radius: 4px;
}
.icon-btn:hover { color: var(--red); background: var(--red-soft); }

/* ---------------------------------------------------------------- general */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
}

.hint { margin: 6px 0 0; font-size: 0.88em; color: var(--muted); }
.loading { text-align: center; color: var(--muted); padding: 48px 16px; }
.is-error { color: var(--red); }

.page { max-width: 1000px; margin: 0 auto; padding: 24px 16px 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { color: var(--primary); font-size: 1.8em; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- tabs */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs a {
    padding: 10px 16px;
    text-decoration: none;
    color: var(--muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    font-weight: 500;
}
.tabs a[aria-selected=true] { color: var(--primary); border-bottom-color: var(--secondary); }

/* ---------------------------------------------------------------- event list */

.event-list { display: grid; gap: 12px; }
.event-card { display: flex; gap: 16px; align-items: flex-start; padding: 0; }
.event-main { flex: 1; min-width: 0; padding: 16px 0 16px 20px; color: inherit; text-decoration: none; }
.event-main:hover h2 { color: var(--secondary); }
.event-card h2 { font-size: 1.25em; color: var(--primary); margin: 2px 0 4px; }
.event-date { font-size: 0.9em; color: var(--secondary); font-weight: 600; }
.event-meta { color: var(--muted); font-size: 0.95em; }
.event-next { margin-top: 8px; font-size: 0.92em; }
.event-next.is-overdue { color: var(--red); font-weight: 600; }
.event-next.is-clash { color: var(--amber); font-weight: 600; }

/* collision warning on the event page */
.clash-box { margin-top: 10px; padding: 10px 12px; border-radius: 6px; background: var(--amber-soft); border-left: 4px solid #e0a100; color: var(--amber); font-size: 0.92em; }
.clash-box ul { margin: 4px 0 0; padding-left: 18px; }
.clash-box small { display: block; color: var(--muted); }
.tl-clash { font-size: 0.82em; color: var(--amber); font-weight: 600; margin-top: 2px; }

/* dialog */
.dialog { width: min(520px, calc(100vw - 32px)); border: none; border-radius: var(--radius); padding: 24px; box-shadow: 0 10px 40px color-mix(in srgb, var(--primary) 25%, transparent); }
.dialog::backdrop { background: color-mix(in srgb, var(--primary) 35%, transparent); }
.dialog h2 { color: var(--primary); font-size: 1.25em; margin-bottom: 4px; }
.dialog .hint { margin-bottom: 16px; }
.dialog-error:empty { display: none; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 8px; }
.dialog-actions .spacer { flex: 1; }
.dialog-wide { width: min(680px, calc(100vw - 32px)); }

/* login page and account */
.auth-page { max-width: 420px; margin: 0 auto; padding: 40px 16px 64px; }
.auth-card h1 { color: var(--primary); font-size: 1.5em; margin-bottom: 16px; }
.auth-card .hint { margin: -8px 0 16px; }
.auth-alt { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; }
.auth-alt p { margin: 0; color: var(--muted); font-size: 0.92em; }
.auth-alt .btn-block { margin-top: 8px; }
.form-msg { margin: 0 0 12px; font-size: 0.92em; }
.form-msg:empty { display: none; }
.form-msg.is-ok, .ok-box { color: var(--green); }
.ok-box { margin: 0; padding: 10px 12px; border-radius: 6px; background: #e8f5e9; border-left: 4px solid var(--green); }
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-items: start; }
.account h2 { color: var(--primary); font-size: 1.15em; margin-bottom: 12px; }
.account .hint { margin-bottom: 12px; }
.admin { margin-top: 16px; }
.invite-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 12px; }
.invite-form > label:not(.check-line) { display: flex; flex-direction: column; gap: 2px; font-size: 0.9em; color: var(--muted); flex: 1 1 200px; }
.invite-form .check-line { padding-bottom: 8px; }
.user-list { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--line); }
.user-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.user-row.is-off .user-main { opacity: 0.6; }
.user-main { min-width: 0; overflow-wrap: anywhere; }
.user-meta { font-size: 0.88em; color: var(--muted); }
.user-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.78em; font-weight: 600; background: var(--primary-soft); color: var(--primary); vertical-align: 1px; }
.badge-wait { background: var(--amber-soft); color: var(--amber); }
.badge-off { background: var(--red-soft); color: var(--red); }
.badge-cancelled { background: var(--red-soft); color: var(--red); }
.badge-public { background: var(--secondary-soft); color: var(--ink); }
.event-badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 6px; }
.event-card.is-cancelled h2, .name-card.is-cancelled .name-input { text-decoration: line-through; text-decoration-color: var(--red); }
.chip.is-event.is-cancelled { text-decoration: line-through; opacity: 0.6; }
#user-form .check-line { margin-bottom: 10px; }

/* merge conflicts */
.merge-list { display: grid; gap: 12px; max-height: 60vh; overflow-y: auto; margin-bottom: 8px; }
.merge-item { margin: 0; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.merge-item legend { font-weight: 700; color: var(--primary); padding: 0 4px; }
.merge-option { display: flex; align-items: flex-start; gap: 10px; padding: 6px 4px; cursor: pointer; border-radius: 6px; }
.merge-option:hover { background: var(--bg); }
.merge-option input { width: 16px; height: 16px; flex-shrink: 0; margin-top: 3px; accent-color: var(--secondary); }
.merge-value { display: block; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 8em; overflow-y: auto; color: var(--muted); font-size: 0.92em; margin-top: 2px; }

/* calendar subscription */
.check-line { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-family: ui-monospace, monospace; font-size: 0.85em; background: var(--bg); }
.invite-link { margin-top: 8px; }
.warn-box { margin: 10px 0 0; padding: 8px 12px; border-radius: 6px; background: var(--amber-soft); border-left: 4px solid #e0a100; color: var(--amber); font-size: 0.9em; }
.abo-h { font-size: 1em; color: var(--primary); margin: 20px 0 6px; }
.abo-steps { margin: 0; padding-left: 20px; }
.abo-reset { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 12px; }
.abo-reset summary { cursor: pointer; color: var(--muted); }

/* iCal import */
.import-tools { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 8px 0; }
.import-past { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 0.9em; color: var(--muted); }
.import-list { list-style: none; margin: 0 0 12px; padding: 0; max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; }
.import-list li + li { border-top: 1px solid var(--line); }
.import-list label { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; }
.import-text { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.import-list label:hover { background: var(--bg); }
.import-when { flex: 0 0 255px; color: var(--muted); font-size: 0.88em; }
.import-title { flex: 1; min-width: 0; }
.import-result:empty { display: none; }
.import-result { color: var(--green); font-weight: 600; }
.import-sources-title { font-size: 0.95em; color: var(--primary); margin: 16px 0 6px; }
.import-sources { list-style: none; margin: 0; padding: 0; }
.import-sources li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.event-actions { display: flex; flex-direction: column; gap: 6px; padding: 16px 16px 16px 0; }

.progress { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 0.85em; color: var(--muted); }
.progress-bar { width: 120px; height: 6px; background: var(--primary-soft); border-radius: 3px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--primary); }

.empty { text-align: center; color: var(--muted); padding: 32px; }
.past { margin-top: 28px; }
.past summary { cursor: pointer; color: var(--muted); font-weight: 500; margin-bottom: 12px; }
.past .event-card { opacity: 0.75; }

/* ---------------------------------------------------------------- calendar */

.calendar-card { padding: 16px; }
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cal-head h2 { flex: 1; text-align: center; color: var(--primary); font-size: 1.3em; }
.cal-head #cal-today { order: -1; }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.82em; color: var(--muted); margin-bottom: 10px; justify-content: center; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chip-swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--primary); }
.chip-swatch.is-event { background: var(--secondary); }
.chip-swatch.is-overdue { background: var(--red); }
.chip-swatch.is-other { background: var(--slate); }

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.cal-dow { background: var(--bg); text-align: center; font-size: 0.8em; font-weight: 600; color: var(--muted); padding: 6px 0; }
.cal-day { background: #fff; min-height: 96px; padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.is-blank { background: var(--bg); }
.cal-day[data-date] { cursor: copy; }
.cal-day[data-date]:hover { background: #fafbfe; }
.cal-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-toolbar .hint { margin: 0; }
.cal-num { font-size: 0.85em; color: var(--muted); align-self: flex-end; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.is-today .cal-num { background: var(--secondary); color: var(--on-secondary); font-weight: 700; }

.chip {
    display: block;
    font-size: 0.75em;
    line-height: 1.3;
    padding: 2px 5px;
    border-radius: 3px;
    background: var(--primary-soft);
    border-left: 3px solid var(--primary);
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chip:hover { filter: brightness(0.95); }
.chip.is-event { background: var(--secondary); border-color: var(--secondary); color: var(--on-secondary); font-weight: 600; }
.chip.is-done { background: #f0f1f4; border-color: #b8bccb; color: var(--muted); text-decoration: line-through; }
.chip.is-overdue { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.chip.is-other { background: var(--slate-soft); border-color: var(--slate); color: #374151; }
button.chip { width: 100%; text-align: left; border-top: none; border-right: none; border-bottom: none; cursor: pointer; font: inherit; font-size: 0.75em; }
.chip-more { font-size: 0.72em; color: var(--muted); padding-left: 4px; }

.agenda-title { margin: 28px 0 10px; color: var(--primary); font-size: 1.1em; }
.agenda { list-style: none; padding: 0; margin: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.agenda li + li { border-top: 1px solid var(--line); }
.agenda-item { width: 100%; border: none; background: none; text-align: left; font: inherit; cursor: pointer; display: flex; align-items: flex-start; gap: 12px; padding: 10px 16px; color: inherit; text-decoration: none; }
.agenda-item:hover { background: var(--bg); }
.agenda-date { width: 150px; flex-shrink: 0; color: var(--muted); font-size: 0.92em; }
.agenda-date.is-today { color: var(--secondary); font-weight: 600; }
.chip-dot { width: 12px; height: 12px; padding: 0; margin-top: 5px; flex-shrink: 0; border: none; border-radius: 3px; background: var(--primary); }
.chip-dot.is-event { background: var(--secondary); }
.chip-dot.is-overdue { background: var(--red); }
.chip-dot.is-done { background: #b8bccb; }
.chip-dot.is-other { background: var(--slate); }
.agenda-text { flex: 1; min-width: 0; }
.agenda-text small { display: block; color: var(--muted); }
.agenda-empty { padding: 16px; color: var(--muted); text-align: center; }

/* ---------------------------------------------------------------- event page */

.edit-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px 96px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 24px;
    align-items: start;
}
.checklist { display: grid; gap: 16px; }
#sections { display: grid; gap: 16px; }

.eyebrow { display: block; font-size: 0.85em; font-weight: 600; color: var(--secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.name-input { font-size: 1.5em !important; font-weight: 700; color: var(--primary); border: none !important; padding: 4px 0 !important; border-bottom: 2px solid var(--line) !important; border-radius: 0 !important; }
.about { margin: 16px 0 0; }
.name-input:focus { outline: none; border-bottom-color: var(--secondary) !important; }

.section { margin: 0; min-width: 0; }
.section legend {
    float: left;
    width: 100%;
    padding: 0;
    margin-bottom: 12px;
    font-size: 1.15em;
    font-weight: 700;
    color: var(--primary);
}
.section legend + * { clear: both; }
.question { margin-bottom: 14px; }
.question > label, .question .label { display: block; font-weight: 500; margin-bottom: 4px; }
.inline-fields { display: flex; gap: 12px; flex-wrap: wrap; }
.inline-fields label { display: flex; flex-direction: column; gap: 2px; font-size: 0.9em; color: var(--muted); flex: 1 1 160px; }
.inline-fields small { font-size: 0.85em; }

.milestones { border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 4px; }
.milestones-head { font-size: 0.85em; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.milestone-list { list-style: none; padding: 0; margin: 0 0 6px; display: grid; gap: 6px; }
.milestone {
    display: grid;
    grid-template-columns: auto 150px minmax(0, 2fr) minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.3s;
}
.milestone input:not([type=checkbox]) { padding: 6px 8px; }
.milestone.is-done [data-mfield=title] { text-decoration: line-through; color: var(--muted); }
.milestone.is-highlight { background: var(--secondary-soft); }

/* People fields (people.js): picked names as chips, typing field behind them */
.people {
    display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
    min-width: 0; padding: 4px 6px; cursor: text;
    border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.people:focus-within { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.people-chips { display: contents; list-style: none; }
.people-chip {
    display: inline-flex; align-items: center; gap: 2px; max-width: 100%;
    padding: 2px 4px 2px 10px; border-radius: 999px;
    background: color-mix(in srgb, var(--primary) 14%, white); color: var(--ink); font-size: 0.92em; line-height: 1.4;
    overflow-wrap: anywhere;
}
.people-chip button {
    border: 0; background: none; cursor: pointer; padding: 0 5px; border-radius: 999px;
    color: var(--muted); font-size: 1.05em; line-height: 1.2;
}
.people-chip button:hover { color: var(--ink); background: color-mix(in srgb, var(--primary) 18%, transparent); }
/* :not() only to outrank the general input rule */
.people input.people-input:not([type=checkbox]) { flex: 1; min-width: 7em; width: auto; border: 0; padding: 4px; background: transparent; }
.people input.people-input:focus { outline: none; }
.milestone .people { padding: 2px 4px; }
.milestone .people input.people-input:not([type=checkbox]) { min-width: 3em; padding: 3px 4px; }

/* timeline */
.timeline-panel { position: sticky; top: 16px; max-height: calc(100vh - 100px); overflow-y: auto; border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.panel-head h2 { color: var(--primary); font-size: 1.2em; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 16px; }
.tl-dot {
    position: absolute;
    left: -22px;
    top: 2px;
    width: 16px;
    height: 16px;
    margin: 0;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--primary);
}
.tl-check { cursor: pointer; border-radius: 4px; }
.tl-event .tl-dot { background: var(--secondary); border-color: var(--secondary); width: 18px; height: 18px; left: -23px; box-shadow: 0 0 0 4px var(--secondary-soft); }
.tl-date { font-size: 0.82em; color: var(--muted); }
.tl-title { display: block; font-weight: 600; color: var(--ink); text-decoration: none; }
a.tl-title:hover { color: var(--primary); text-decoration: underline; }
.tl-event .tl-title { color: var(--secondary); font-size: 1.1em; }
.tl-meta { font-size: 0.85em; color: var(--muted); }
.tl-item.is-done .tl-title { text-decoration: line-through; color: var(--muted); }
.tl-item.is-overdue .tl-date { color: var(--red); font-weight: 600; }
.tl-item.is-overdue .tl-dot { border-color: var(--red); }
.tl-gap { font-size: 0.75em; color: var(--muted); padding: 0 0 12px; font-style: italic; }
.tl-today { position: relative; margin: 0 0 14px -22px; }
.tl-today::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px dashed var(--secondary); }
.tl-today span { position: relative; background: #fff; color: var(--secondary); font-size: 0.78em; font-weight: 700; padding: 0 6px; margin-left: 24px; }
.timeline-empty { color: var(--muted); font-size: 0.9em; padding-bottom: 8px; }

/* save bar */
.savebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -2px 10px color-mix(in srgb, var(--primary) 6%, transparent);
    z-index: 10;
}
.save-status { flex: 1; font-size: 0.9em; color: var(--muted); }
.save-status.is-dirty { color: var(--secondary); font-weight: 600; }
.save-status.is-error { color: var(--red); font-weight: 600; }

/* ---------------------------------------------------------------- checklist editor */

.section.is-hidden { border-style: dashed; }
.hidden-note { margin: -6px 0 12px; }
.hidden-tag { font-weight: 400; color: var(--muted); }

.checklist-editor { padding-bottom: 96px; }
.ed-intro { max-width: 70ch; margin: -8px 0 16px; }
.ed-list { display: grid; gap: 16px; margin-bottom: 16px; }
.ed-section.is-hidden { border-style: dashed; background: transparent; }
.ed-section.is-hidden .ed-title { color: var(--muted); }
.ed-head { display: flex; align-items: center; gap: 8px; }
.ed-title { flex: 1; min-width: 0; font-size: 1.15em; font-weight: 700; color: var(--primary); }
.ed-tools { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.ed-move { font-size: 1em; }
.ed-sub { margin: 18px 0 6px; font-size: 0.85em; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.ed-sub small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.ed-questions, .ed-suggestions { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 8px; }
.ed-q { padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.ed-q.is-hidden { border-style: dashed; }
.ed-q.is-hidden input, .ed-q.is-hidden select { color: var(--muted); }
.ed-q .hint { margin: 6px 0 0; }
.ed-q-main { display: flex; align-items: center; gap: 8px; }
.ed-q-main [data-qf=label] { flex: 1; min-width: 0; }
.ed-q-main select { width: auto; }
.ed-more { margin-top: 6px; font-size: 0.9em; }
.ed-more summary { cursor: pointer; color: var(--muted); }
.ed-more-body { padding: 8px 0 0 4px; }
.ed-more .check-line { margin: 2px 0 6px; }
.ed-short { display: flex; flex-direction: column; gap: 2px; color: var(--muted); max-width: 320px; }
.ed-g { display: grid; grid-template-columns: minmax(0, 1fr) 76px auto auto auto; gap: 4px 8px; align-items: center; }
.ed-g select { width: auto; }
.ed-g-example { grid-column: 1 / -1; margin: 0 0 6px; font-size: 0.85em; }
.ed-who { display: flex; flex-direction: column; gap: 4px; margin-top: 18px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 0.9em; color: var(--muted); }
.ed-who select { width: 100%; min-width: 0; max-width: 520px; }

/* ---------------------------------------------------------------- club settings */

.club-form { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 8px 32px; }
.club-colors { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 8px; }
.color-field { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.color-field input[type=color] { width: 52px; height: 40px; padding: 3px; cursor: pointer; flex-shrink: 0; }
.color-field small { display: block; color: var(--muted); font-size: 0.85em; }
.club-logo .label { display: block; font-weight: 500; margin-bottom: 4px; }
.logo-preview { display: flex; align-items: center; justify-content: center; height: 72px; padding: 0 12px; border-radius: 8px; background: var(--primary); color: var(--on-primary); font-size: 0.9em; }
.logo-preview img { max-height: 40px; max-width: 100%; }
.logo-preview img:not([hidden]) + span { display: none; }
.logo-actions { display: flex; gap: 6px; margin: 8px 0 4px; }
.club-logo .hint { margin: 0; }
.club-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.club-actions .form-msg { flex: 1; margin: 0; }
@media (max-width: 760px) { .club-form { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- first setup */

.setup-page { max-width: 560px; }
.setup-h { font-size: 1.05em; color: var(--primary); margin: 20px 0 10px; }
.setup-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.setup-checks li { display: flex; gap: 10px; align-items: flex-start; }
.setup-checks small { display: block; color: var(--muted); }
.setup-icon { width: 22px; height: 22px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; font-weight: 700; font-size: 0.85em; color: #fff; }
.is-ok .setup-icon { background: var(--green); }
.is-warn .setup-icon { background: #e0a100; }
.is-bad .setup-icon { background: var(--red); }
.setup-stop { margin-top: 12px; }
.welcome, .data-open { margin-bottom: 16px; }
.welcome ol { margin: 8px 0 0; padding-left: 20px; }
.app-version { text-align: center; margin-top: 24px; }

/* ---------------------------------------------------------------- small screens */

@media (max-width: 900px) {
    .edit-layout { grid-template-columns: minmax(0, 1fr); }
    .timeline-panel { position: static; max-height: none; order: -1; }
}

/* ---------------------------------------------------------------- feedback (feedback.js, rueckmeldungen.html, konto.html) */
.fb-kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 16px; }
.fb-kind-option { cursor: pointer; }
.fb-kind-option input { position: absolute; opacity: 0; pointer-events: none; }
.fb-kind-option > span {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px;
    border: 1px solid var(--line); border-radius: 8px; font-weight: 600; text-align: center;
}
.fb-icon { font-size: 1.5em; line-height: 1.2; }
.fb-kind-option:hover > span { background: var(--primary-soft); }
.fb-kind-option input:checked + span { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.fb-kind-option input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; }
.fb-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-kind.fb-problem { background: var(--amber-soft); color: var(--amber); }
.fb-kind.fb-lob { background: color-mix(in srgb, var(--green) 12%, white); color: var(--green); }
.fb-status.fb-neu { background: var(--secondary-soft); color: var(--secondary); }
.fb-status.fb-erledigt { background: var(--slate-soft); color: var(--slate); }
.fb-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fb-from { color: var(--muted); font-size: 0.9em; margin-left: 4px; }
.fb-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0; }
.fb-intro { margin: -8px 0 12px; }
.fb-list { display: grid; gap: 12px; }
.fb-item.is-done { opacity: 0.75; }
.fb-details { margin: 0 0 12px; font-size: 0.85em; }
.fb-reply { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }
.fb-reply small { font-weight: 400; color: var(--muted); }
.fb-replied { margin: 4px 0 0; font-size: 0.85em; }
.fb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.fb-actions label { display: flex; align-items: center; gap: 6px; }
.fb-actions select { width: auto; }
.fb-actions .form-msg { margin: 0; }
.fb-actions .spacer { flex: 1; }
#my-feedback h3 { margin: 20px 0 4px; font-size: 1em; color: var(--muted); }
.fb-mine { list-style: none; margin: 0; padding: 0; }
.fb-mine-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.fb-mine-item:last-child { border-bottom: 0; }
.fb-reply-box { padding: 8px 12px; border-left: 3px solid var(--primary); background: var(--primary-soft); border-radius: 0 6px 6px 0; }
.fb-reply-box .fb-text { margin: 4px 0 0; }
.fb-mail { margin-top: 14px; }
#fb-mail-info:empty { display: none; }

/* ---------------------------------------------------------------- help (hilfe.html, "?" links, "Neu hier?" hint) */
.help { max-width: 820px; }
.help-intro { font-size: 1.05em; margin: 0 0 16px; }
.help-toc { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.help-toc a {
    padding: 4px 12px; border-radius: 999px; text-decoration: none; font-size: 0.92em;
    background: var(--primary-soft); color: var(--primary); border: 1px solid transparent;
}
.help-toc a:hover { border-color: var(--primary); }
.help-section { margin-bottom: 16px; scroll-margin-top: 12px; }
.help-section h2 { color: var(--primary); font-size: 1.3em; margin-bottom: 10px; }
.help-section p, .help-section li { line-height: 1.55; }
.help-section ul { padding-left: 1.2em; }
.help-section li + li { margin-top: 6px; }
.help-steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 14px; }
.help-steps li { counter-increment: step; position: relative; padding-left: 46px; min-height: 34px; }
.help-steps li::before {
    content: counter(step); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%;
    display: grid; place-items: center; font-weight: 700; background: var(--secondary); color: var(--on-secondary);
}
.help-steps h3 { font-size: 1.05em; margin: 4px 0 2px; }
.help-steps p { margin: 0; }
.help-foot { text-align: center; margin-top: 24px; }
.help-q {
    display: inline-grid; place-items: center; width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%;
    border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-weight: 700; font-size: 0.85em;
}
.help-q:hover { border-color: var(--primary); color: var(--primary); }
.panel-head h2 { flex: 1; }
.intro-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; color: var(--ink); }
.intro-box a { font-weight: 600; }
.intro-box > span { flex: 1 1 360px; }

@media (max-width: 640px) {
    .brand span { display: none; }
    .card { padding: 16px; }
    .topbar-pill-text { display: none; }
    .fb-actions .spacer { display: none; }
    .milestone { grid-template-columns: auto minmax(0, 1fr) auto; }
    .milestone [data-mfield=title] { grid-column: 2 / 3; }
    .milestone .people { grid-column: 2 / 3; }
    .milestone [data-mfield=date] { grid-column: 2 / 3; }
    .milestone .icon-btn { grid-row: 1; grid-column: 3; }
    .milestone input[type=checkbox] { grid-row: 1; grid-column: 1; }
    .milestone { border: 1px solid var(--line); padding: 8px; }
    .ed-q-main { flex-wrap: wrap; }
    .ed-q-main [data-qf=label] { flex-basis: 100%; }
    .ed-q-main .ed-tools { margin-left: auto; }
    .ed-g { grid-template-columns: 64px minmax(0, 1fr) auto auto; }
    .ed-g [data-gf=title] { grid-column: 1 / -1; }

    .event-card { flex-direction: column; gap: 0; }
    .event-main { padding: 16px 16px 8px; }
    .event-actions { flex-direction: row; padding: 0 16px 16px; }

    /* Calendar: show dots in the grid, details in the list below. */
    .cal-day { min-height: 52px; flex-direction: row; flex-wrap: wrap; align-content: flex-start; gap: 2px; }
    .cal-num { width: 100%; height: 20px; justify-content: center; place-items: center; border-radius: 10px; font-size: 0.78em; }
    .cal-day .chip { width: 8px; height: 8px; padding: 0; border: none; border-radius: 50%; font-size: 0; }
    .cal-day .chip.is-event { background: var(--secondary); }
    .cal-day .chip:not(.is-event):not(.is-overdue):not(.is-done) { background: var(--primary); }
    .cal-day .chip.is-overdue { background: var(--red); }
    .cal-day .chip.is-done { background: #b8bccb; }
    .cal-day .chip.is-other { background: var(--slate); }
    .cal-toolbar .hint { display: none; }
    .dialog { padding: 20px 16px; }
    .dialog-actions .btn { flex: 1 1 auto; white-space: normal; text-align: center; }
    .dialog-actions .spacer { display: none; }
    .import-text { flex-direction: column; gap: 0; }
    .import-when { flex-basis: auto; }
    .chip-more { font-size: 0.65em; padding: 0; }
    .agenda-item { flex-wrap: wrap; gap: 4px 10px; }
    .agenda-date { width: 100%; }
}

/* ---------------------------------------------------------------- print */

@media print {
    body { background: #fff; }
    .topbar, .savebar, .btn, .icon-btn, .tabs { display: none !important; }
    .edit-layout { display: block; padding: 0; }
    .timeline-panel { position: static; max-height: none; break-before: page; }
    .card { border: none; padding: 8px 0; break-inside: avoid; }
}

/* Public calendar: switch on the event page, cancellation, public page (termine.php) */
.public-card { padding-top: 14px; padding-bottom: 14px; }
.public-card.is-on { border-color: var(--secondary); }
.public-head { display: flex; align-items: center; gap: 10px; }
.switch-row { display: flex; align-items: center; gap: 10px; cursor: pointer; flex: 1; }
.switch-row input { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--secondary); }
.switch-row small { display: block; color: var(--muted); font-weight: normal; }
#public-details { margin-top: 10px; }
#public-details .question { margin: 14px 0 0; }
.cancel-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding: 12px 16px;
    border: 1px solid var(--red); border-radius: 12px; background: var(--red-soft); color: var(--ink); }
.cancel-banner > div { flex: 1 1 320px; }
.cancel-banner strong { color: var(--red); margin-right: 4px; }

.pub-page { max-width: 760px; }
.pub-event { margin-bottom: 14px; }
.pub-event h2 { color: var(--primary); margin: 4px 0 6px; font-size: 1.3em; }
.pub-event .badge { vertical-align: 3px; }
.pub-event.is-cancelled h2 { text-decoration: line-through; text-decoration-color: var(--red); }
.pub-event.is-cancelled .badge { text-decoration: none; }
.pub-place { margin: 0 0 6px; font-weight: 600; }
.pub-text { margin: 0 0 10px; white-space: normal; }
.pub-abo { margin-top: 28px; }
.pub-abo h2 { margin-top: 0; }
.pub-abo-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.pub-abo-url { display: block; font-size: 0.9em; color: var(--muted); }
.pub-abo-url input { width: 100%; margin-top: 4px; font-family: inherit; }

/* ---------------------------------------------------------- usage (konto.html, admins) */
.usage-intro { margin: 0 0 14px; }
.usage-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.usage-tile { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.usage-tile strong { display: block; font-size: 1.5em; color: var(--primary); line-height: 1.2; }
.usage-tile span { display: block; font-size: 0.88em; color: var(--ink); }
.usage-tile small { display: block; margin-top: 4px; font-size: 0.78em; color: var(--muted); overflow-wrap: anywhere; }
.usage-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 32px; }
@media (max-width: 640px) { .usage-charts { grid-template-columns: minmax(0, 1fr); } }
.usage-chart { margin: 0; min-width: 0; }
.usage-chart figcaption { font-size: 0.85em; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.usage-bars { display: flex; align-items: flex-end; gap: 2px; height: 72px; padding-top: 16px; border-bottom: 1px solid var(--line); }
.usage-bar { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.usage-bar span { position: relative; display: block; width: 100%; background: var(--primary); border-radius: 4px 4px 0 0; }
.usage-bar:hover span { background: var(--secondary); }
.usage-bar.is-none { background: repeating-linear-gradient(135deg, transparent 0 4px, var(--slate-soft) 4px 6px); }
.usage-bar em { position: absolute; bottom: calc(100% + 2px); right: 0; font-style: normal; font-size: 0.75em; font-weight: 600; color: var(--ink); }
.usage-axis { display: flex; justify-content: space-between; font-size: 0.72em; color: var(--muted); margin-top: 3px; }
