:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --brand: #0d9488;
    --brand-strong: #0f766e;
    --brand-weak: #ccfbf1;
    --ok-bg: #ecfdf5; --ok-border: #a7f3d0; --ok-text: #065f46;
    --err-bg: #fef2f2; --err-border: #fecaca; --err-text: #991b1b;
    --radius: 14px; --radius-sm: 9px;
    --shadow: 0 1px 3px rgba(0,0,0,.05), 0 10px 30px rgba(0,0,0,.06);
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a; --surface: #1e293b; --text: #e2e8f0; --muted: #94a3b8;
        --border: #334155; --brand: #2dd4bf; --brand-strong: #5eead4; --brand-weak: #134e4a;
        --ok-bg: #022c22; --ok-border: #065f46; --ok-text: #a7f3d0;
        --err-bg: #450a0a; --err-border: #7f1d1d; --err-text: #fecaca;
        --shadow: 0 1px 3px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
    }
}

* { box-sizing: border-box; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .bar { max-width: 860px; margin: 0 auto; padding: .95rem 1.25rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.2rem; letter-spacing: -.02em; color: var(--text); }
.brand .dot { width: .72rem; height: .72rem; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-weak); }
.brand small { font-weight: 500; font-size: .78rem; color: var(--muted); }

/* Layout */
.page { max-width: 860px; margin: 1.6rem auto; padding: 0 1.25rem; }
.page.wide { max-width: 1120px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.6rem 1.7rem; }
h1 { font-size: 1.45rem; margin: 0 0 1rem; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; margin: 1.5rem 0 .6rem; }
.muted { color: var(--muted); font-size: .88rem; }

/* Formulare */
label { display: block; margin: .9rem 0 .3rem; font-size: .82rem; font-weight: 600; }
input, select, textarea {
    width: 100%; padding: .62rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font: inherit; background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weak); }

.btn {
    display: inline-flex; align-items: center; gap: .4rem; margin-top: 1.3rem;
    padding: .65rem 1.2rem; border: 0; border-radius: var(--radius-sm);
    background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
    transition: background .15s, transform .03s;
}
.btn:hover { background: var(--brand-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }

/* Slots (Auswahl) */
.slot { display: flex; align-items: center; gap: .65rem; padding: .7rem .85rem; border: 1px solid var(--border); border-radius: var(--radius-sm); margin: .45rem 0; cursor: pointer; transition: border-color .15s, background .15s; }
.slot:hover { border-color: var(--brand); background: var(--brand-weak); }
.slot input { width: auto; margin: 0; accent-color: var(--brand); }
.slot .when { font-weight: 600; }

/* Meldungen */
.flash { background: var(--ok-bg); border: 1px solid var(--ok-border); color: var(--ok-text); padding: .75rem .95rem; border-radius: var(--radius-sm); margin-bottom: 1rem; }
.error { background: var(--err-bg); border: 1px solid var(--err-border); color: var(--err-text); padding: .75rem .95rem; border-radius: var(--radius-sm); margin-bottom: 1rem; }
.link-box { background: var(--bg); border: 1px solid var(--border); padding: .65rem .8rem; border-radius: var(--radius-sm); word-break: break-all; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; }

/* Badge / Status */
.badge { display: inline-block; padding: .18rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--brand-weak); color: var(--brand-strong); }

/* Tabelle */
table { width: 100%; border-collapse: collapse; font-size: .9rem; margin-top: .5rem; }
th { text-align: left; padding: .55rem .6rem; border-bottom: 2px solid var(--border); color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; }
td { padding: .62rem .6rem; border-bottom: 1px solid var(--border); }
tbody tr:hover td { background: var(--brand-weak); }

/* Kalender-Legende (Toggle als Pills) */
.legend { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.legend label { display: inline-flex; align-items: center; gap: .45rem; margin: 0; padding: .35rem .75rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); cursor: pointer; font-size: .85rem; font-weight: 500; }
.legend .dot { width: .8rem; height: .8rem; border-radius: 50%; display: inline-block; }
.legend input { width: auto; margin: 0; accent-color: var(--brand); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: none; align-items: center; justify-content: center; padding: 1rem; z-index: 50; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem 1.6rem; min-width: 300px; max-width: 92vw; }
.modal h2 { margin-top: 0; }
.modal dl { display: grid; grid-template-columns: auto 1fr; gap: .4rem .9rem; margin: 0; font-size: .9rem; }
.modal dt { color: var(--muted); }
.modal dd { margin: 0; }

/* FullCalendar an das Theme angleichen */
.fc {
    --fc-border-color: var(--border);
    --fc-today-bg-color: var(--brand-weak);
    --fc-button-bg-color: var(--brand);
    --fc-button-border-color: var(--brand);
    --fc-button-hover-bg-color: var(--brand-strong);
    --fc-button-hover-border-color: var(--brand-strong);
    --fc-button-active-bg-color: var(--brand-strong);
    --fc-button-active-border-color: var(--brand-strong);
    --fc-page-bg-color: var(--surface);
    font-size: .9rem;
}
.fc .fc-toolbar-title { font-size: 1.1rem; letter-spacing: -.01em; }
.fc .fc-button { text-transform: none; font-weight: 600; }
