:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1f2330;
  --muted: #6b7185;
  --border: #e3e5ee;
  --primary: #4f46e5;
  --primary-soft: #eef0ff;
  --danger: #dc2626;
  --yes: #16a34a;
  --yes-soft: #dcfce7;
  --maybe: #ca8a04;
  --maybe-soft: #fef9c3;
  --no-soft: #f3f4f6;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12141c;
    --card: #1b1e29;
    --text: #e8eaf2;
    --muted: #9aa0b4;
    --border: #2c3040;
    --primary: #818cf8;
    --primary-soft: #262a45;
    --yes-soft: #163823;
    --maybe-soft: #3a3113;
    --no-soft: #23262f;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--primary); }
h1 { font-size: 1.6rem; margin: 0 0 .75rem; }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
h3 { margin: 0 0 .5rem; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  padding: .75rem 1.25rem; background: var(--card); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); font-size: 1.1rem; }
.topbar nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.topbar nav a { text-decoration: none; }

main { max-width: 900px; margin: 0 auto; padding: 1.5rem 16px 3rem; }
main.wide { max-width: 1200px; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: 1rem;
}
.card.narrow { max-width: 460px; margin: 2rem auto; }
.card.inactive, tr.inactive { opacity: .6; }
.link-card { display: block; text-decoration: none; color: inherit; transition: border-color .15s; }
.link-card:hover { border-color: var(--primary); }
.share { background: var(--primary-soft); overflow-wrap: anywhere; }

.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.head h1 { margin: 0; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > label { flex: 1 1 140px; }

.hero { text-align: center; padding: 2rem 0; }
.hero h1 { font-size: 2rem; }
.hero p { max-width: 600px; margin: 0 auto 1rem; color: var(--muted); }

.profile { text-align: center; margin-bottom: 1.5rem; }
.avatar {
  width: 64px; height: 64px; border-radius: 50%; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 1.6rem; font-weight: 700; margin: 0 auto .75rem;
}

label { display: block; margin-bottom: .9rem; font-weight: 500; }
label.check { display: flex; gap: .5rem; align-items: center; }
input, textarea, select {
  display: block; width: 100%; margin-top: .3rem; padding: .55rem .7rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit;
}
input[type=checkbox], input[type=radio] { display: inline; width: auto; margin: 0; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 1rem; padding: 1rem; }
legend { font-weight: 600; padding: 0 .4rem; }
.option-row { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.option-row input { margin: 0; max-width: 260px; }

.btn {
  display: inline-block; background: var(--primary); color: #fff; border: 0; border-radius: 8px;
  padding: .6rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--primary-soft); color: var(--primary); }
.btn.small { padding: .3rem .7rem; font-size: .9rem; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.danger { color: var(--danger); }
button.link { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
.danger { color: var(--danger) !important; }
form.inline { display: inline; }
.copy { font-size: .85rem; margin-left: .3rem; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.pre { white-space: pre-line; }
.alert { padding: .75rem 1rem; border-radius: 8px; margin: 0 0 1rem; }
.alert.error { background: #fee2e2; color: #991b1b; }
.alert.ok { background: var(--yes-soft); color: var(--text); }
.tag { display: inline-block; font-size: .75rem; padding: .1rem .5rem; border-radius: 99px; background: var(--primary-soft); color: var(--primary); }
.tag.done { background: var(--yes-soft); color: var(--yes); }
.warn { font-size: .75rem; color: var(--maybe); font-weight: 600; }

.list { padding-left: 1.1rem; margin: 0; }
.list li { margin-bottom: .4rem; overflow-wrap: anywhere; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table.avail input { display: inline-block; width: auto; margin: 0; }
.actions { white-space: nowrap; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }

/* Buchungsseite */
.booking { display: grid; grid-template-columns: 300px 1fr; gap: 1rem; align-items: start; }
.week-nav { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: .4rem; margin-bottom: 1rem; }
.day {
  border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 8px;
  padding: .5rem .2rem; cursor: pointer; font: inherit; display: flex; flex-direction: column; align-items: center;
}
.day small { color: var(--muted); font-size: .75rem; }
.day:disabled { opacity: .4; cursor: default; }
.day.active, .slot.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.day.active small { color: #fff; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.slot {
  border: 1px solid var(--primary); color: var(--primary); background: transparent; border-radius: 8px;
  padding: .5rem; font: inherit; font-weight: 600; cursor: pointer;
}
.booking-form { border-top: 1px solid var(--border); padding-top: 1rem; }
.cancel-box { margin-top: 1rem; }

/* Kalender */
.connect-buttons { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.btn.disabled { opacity: .5; cursor: default; }
details.help { margin: 1rem 0; }
details.help summary { cursor: pointer; color: var(--primary); }
details.help li { margin-bottom: .4rem; }
.calendars form.settings label { margin-bottom: .3rem; font-weight: normal; }
.calendars td { overflow-wrap: anywhere; }
.cancel-box summary { cursor: pointer; color: var(--danger); font-weight: 600; margin-bottom: .75rem; }

/* Abstimmungsmatrix */
.matrix-wrap { overflow-x: auto; }
.matrix { border-collapse: separate; border-spacing: 3px; min-width: 100%; }
.matrix th, .matrix td { padding: .45rem .5rem; text-align: center; border-radius: 6px; font-size: .9rem; }
.matrix thead th { background: var(--bg); font-weight: 600; min-width: 110px; }
.matrix tbody th, .matrix tfoot th { text-align: left; white-space: nowrap; }
.matrix thead th.best { outline: 2px solid var(--yes); }
.matrix thead th.final { background: var(--yes); color: #fff; }
.matrix td.best { color: var(--yes); }
.vote.yes { background: var(--yes-soft); color: var(--yes); }
.vote.maybe { background: var(--maybe-soft); color: var(--maybe); }
.vote.no { background: var(--no-soft); color: var(--muted); }
.edit-row input[type=text], .edit-row input:not([type]), .edit-row input[type=email] { min-width: 160px; margin: .15rem 0; }
.vote-input { white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: .15rem; margin: 0 .1rem; padding: .2rem .35rem; border-radius: 6px; font-weight: 600; cursor: pointer; }
.pill.yes { background: var(--yes-soft); color: var(--yes); }
.pill.maybe { background: var(--maybe-soft); color: var(--maybe); }
.pill.no { background: var(--no-soft); color: var(--muted); }

@media (max-width: 720px) {
  .booking { grid-template-columns: 1fr; }
  .days { grid-template-columns: repeat(4, 1fr); }
  .topbar nav { gap: .6rem; font-size: .9rem; }
}
