:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1d2430;
  --muted: #5d6675;
  --border: #d9dde3;
  --primary: #0b5cad;
  --primary-dark: #084a8c;
  --success-bg: #e7f5ec; --success: #1e6b3a;
  --warning-bg: #fff6e0; --warning: #7a5200;
  --error-bg: #fdecec;   --error: #9b1c1c;
  --info-bg: #e9f1fb;    --info: #0b4a8a;
  --radius: 8px;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}
a { color: var(--primary); }
h1 { font-size: 1.6rem; margin: 0 0 .75rem; }
h2 { font-size: 1.25rem; margin: 1.5rem 0 .75rem; }
h3 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; }
p { margin: .5rem 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.pre { white-space: pre-line; }
.mono { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* Layout */
.topbar { background: #1d2430; color: #fff; }
.topbar .inner { max-width: 1200px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.topbar .brand { font-weight: 700; color: #fff; text-decoration: none; margin-right: 1rem; }
.topbar nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.topbar nav a { color: #cfd6e0; text-decoration: none; padding: .35rem .65rem; border-radius: 6px; font-size: .95rem; }
.topbar nav a:hover, .topbar nav a.active { background: #2f3a4b; color: #fff; }
.topbar .user { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: #cfd6e0; }
.topbar .user button { background: transparent; border: 1px solid #56627a; color: #fff; padding: .25rem .6rem; border-radius: 6px; cursor: pointer; }
main.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
main.narrow { max-width: 720px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.stat .value { font-size: 1.8rem; font-weight: 700; line-height: 1.2; }
.stat .label { color: var(--muted); font-size: .9rem; }
.stat.alert .value { color: var(--error); }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.inline { display: inline; }

/* Tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tabs a { padding: .5rem .9rem; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }

/* Tabellen */
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; background: #fafbfc; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 1rem; }
td.actions-cell { white-space: nowrap; }
td.actions-cell form { display: inline; }

/* Badges */
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #eceff3; color: #3a4455; white-space: nowrap; }
.badge.free, .badge.active, .badge.confirmed, .badge.sent, .badge.resent, .badge.open { background: var(--success-bg); color: var(--success); }
.badge.booked { background: var(--info-bg); color: var(--info); }
.badge.blocked, .badge.paused, .badge.queued, .badge.invited, .badge.draft { background: var(--warning-bg); color: var(--warning); }
.badge.cancelled, .badge.failed, .badge.deactivated, .badge.expired { background: var(--error-bg); color: var(--error); }
.badge.replaced, .badge.completed, .badge.archived { background: #eceff3; color: #3a4455; }

/* Meldungen */
.flash { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid transparent; white-space: pre-line; }
.flash.success { background: var(--success-bg); color: var(--success); border-color: #bfe3cc; }
.flash.warning { background: var(--warning-bg); color: var(--warning); border-color: #f1dca3; }
.flash.error { background: var(--error-bg); color: var(--error); border-color: #f3c3c3; }
.flash.info { background: var(--info-bg); color: var(--info); border-color: #c4d9f2; }

/* Formulare */
form .field { margin-bottom: 1rem; }
label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .95rem; }
label.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: normal; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; padding: .55rem .65rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: #fff; color: var(--text);
}
textarea { min-height: 7rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc3ee; border-color: var(--primary); }
.field .error { color: var(--error); font-size: .875rem; margin-top: .25rem; }
.field .hint { color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: var(--error); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }

.btn, button.btn {
  display: inline-block; padding: .5rem 1rem; border-radius: 6px; border: 1px solid var(--primary);
  background: var(--primary); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.3;
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: #fff; color: var(--primary); }
.btn.secondary:hover { background: #eef4fb; }
.btn.danger { background: #fff; color: var(--error); border-color: #e3a3a3; }
.btn.danger:hover { background: var(--error-bg); }
.btn.small { padding: .2rem .55rem; font-size: .85rem; font-weight: 500; }
.btn.large { padding: .75rem 1.4rem; font-size: 1.05rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-button { background: none; border: none; color: var(--primary); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }

/* Teilnehmer: Terminauswahl */
.slot-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .6rem; }
.slot-option { display: flex; gap: .85rem; align-items: flex-start; padding: .9rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; cursor: pointer; font-weight: normal; margin: 0; }
.slot-option:hover { border-color: #9cc3ee; }
.slot-option input { margin-top: .3rem; width: 1.1rem; height: 1.1rem; flex-shrink: 0; }
.slot-option:has(input:checked) { border-color: var(--primary); background: #f2f7fd; box-shadow: 0 0 0 1px var(--primary); }
.slot-option .slot-title { font-weight: 700; }
.slot-option .slot-meta { color: var(--muted); font-size: .92rem; }
dl.summary { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 0; }
dl.summary dt { color: var(--muted); }
dl.summary dd { margin: 0; font-weight: 600; }
.notice-box { border-left: 4px solid var(--primary); background: var(--info-bg); padding: .75rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1rem 0; }
.notice-box.warning { border-left-color: #d9a400; background: var(--warning-bg); }
.privacy { font-size: .85rem; color: var(--muted); margin-top: 2rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.participant-header { text-align: center; padding: 1.25rem 1rem .25rem; color: var(--muted); font-size: .95rem; }
.counter { text-align: right; font-size: .8rem; color: var(--muted); }

.email-preview { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; background: #fcfcfd; white-space: pre-wrap; font-size: .9rem; max-height: 420px; overflow: auto; }
.link-box { padding: .9rem; background: #f2f7fd; border: 1px dashed var(--primary); border-radius: var(--radius); font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
.qr svg { max-width: 220px; height: auto; }
.pagination { display: flex; gap: .5rem; align-items: center; margin-top: 1rem; }
details summary { cursor: pointer; color: var(--primary); }

@media (max-width: 640px) {
  .card { padding: 1rem; }
  dl.summary { grid-template-columns: 1fr; }
  dl.summary dd { margin-bottom: .5rem; }
}
.login-card { max-width: 420px; margin: 2rem auto; }
.mt { margin-top: 1.25rem; }
a.stat { display: block; text-decoration: none; color: inherit; }
a.stat:hover { border-color: #9cc3ee; }
select.auto, .actions select { width: auto; min-width: 12rem; }
label.inline { display: inline; margin: 0; }
code { background: #eef1f5; padding: 0 .25rem; border-radius: 4px; }
.mt-small { margin-top: .4rem; }
td.actions-cell details { display: inline-block; margin-right: .4rem; }
td.actions-cell details input[type=email] { width: 16rem; }
