:root {
  --night: #0e1a2e;
  --night-2: #16284a;
  --ice: #e8f1fa;
  --ice-2: #cfe0f1;
  --ink: #17223a;
  --muted: #5d6b84;
  --line: #d6e1ee;
  --card: #ffffff;
  --red: #c8102e;
  --red-dark: #9c0b23;
  --gold: #e7b75f;
  --green: #1f8a5b;
  --amber: #c27a0e;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 var(--font);
  color: var(--ink);
  background: var(--ice);
}
a { color: var(--red); }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
h1, h2 { line-height: 1.2; }
h1 { font-size: 1.75rem; margin: .2em 0 .5em; }
h2 { font-size: 1.2rem; margin: 0 0 .8rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
h2 small { font-weight: 500; color: var(--muted); font-size: .95rem; }

/* ---------- Öffentlicher Bereich ---------- */
body.public {
  background:
    radial-gradient(1200px 500px at 50% -120px, var(--night-2), transparent 70%),
    linear-gradient(180deg, var(--night) 0, var(--night) 260px, var(--ice) 260px);
  background-repeat: no-repeat;
}
.snow {
  position: absolute; inset: 0 0 auto 0; height: 300px; pointer-events: none; overflow: hidden;
  background-image:
    radial-gradient(2px 2px at 10% 20%, #fff8, transparent),
    radial-gradient(1.5px 1.5px at 30% 60%, #fff6, transparent),
    radial-gradient(2px 2px at 55% 30%, #fff7, transparent),
    radial-gradient(1px 1px at 70% 75%, #fff8, transparent),
    radial-gradient(2.5px 2.5px at 85% 15%, #fff5, transparent),
    radial-gradient(1.5px 1.5px at 92% 55%, #fff7, transparent);
  background-size: 320px 300px;
  animation: snow 18s linear infinite;
}
@keyframes snow { to { background-position: 40px 300px; } }
@media (prefers-reduced-motion: reduce) { .snow { animation: none; } }

.hero { color: #fff; padding: 36px 0 28px; position: relative; }
.brand {
  display: inline-flex; align-items: center; gap: 12px;
  color: inherit; text-decoration: none; font-weight: 800; letter-spacing: -.01em;
  font-size: clamp(1.4rem, 4vw, 2.1rem);
}
.hero .sub { margin: .4rem 0 0; color: var(--ice-2); font-size: 1.05rem; }
.stone {
  width: 1.3em; height: 1.1em; flex: none; position: relative;
  background: radial-gradient(ellipse at 50% 70%, var(--red) 0 58%, transparent 60%);
}
.stone::before {
  content: ""; position: absolute; left: 30%; top: 0; width: 40%; height: 45%;
  border-radius: 4px; background: var(--ice);
}

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: 0 1px 2px #0e1a2e14, 0 8px 24px #0e1a2e12;
  padding: 22px; margin: 0 0 18px;
}
.card.center { text-align: center; max-width: 620px; margin: 10px auto 24px; }
.info {
  background: #fff8ec; border: 1px solid #f1dcb3; border-radius: var(--radius);
  padding: 4px 18px; margin: 0 0 18px; position: relative;
}
.step {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--night); color: #fff; font-size: .9rem; font-weight: 700;
}
.big-icon { font-size: 3rem; line-height: 1; }

/* Tage */
.days {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.day {
  flex: none; width: 70px; scroll-snap-align: start;
  display: grid; justify-items: center; gap: 0; padding: 8px 4px;
  border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink);
  background: #fff; transition: border-color .15s, transform .15s;
}
.day:hover { border-color: var(--night); transform: translateY(-1px); }
.day .wd { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.day .dn { font-size: 1.45rem; font-weight: 800; line-height: 1.15; }
.day .mo { font-size: .78rem; color: var(--muted); }
.day .av { margin-top: 4px; font-size: .72rem; font-weight: 600; color: var(--green); }
.day.few .av { color: var(--amber); }
.day.full { background: #f4f6f9; }
.day.full .av { color: var(--muted); }
.day.active { background: var(--night); border-color: var(--night); color: #fff; }
.day.active .wd, .day.active .mo { color: var(--ice-2); }
.day.active .av { color: var(--gold); }

/* Slots */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.slot {
  position: relative; display: grid; gap: 2px; padding: 12px 14px; cursor: pointer;
  border: 2px solid var(--line); border-radius: 12px; background: #fff; user-select: none;
  transition: border-color .15s, background .15s;
}
.slot input { position: absolute; opacity: 0; pointer-events: none; }
.slot .time { font-weight: 700; font-variant-numeric: tabular-nums; }
.slot .state { font-size: .8rem; color: var(--green); }
.slot:hover { border-color: var(--night-2); }
.slot.sel, .slot:has(input:checked) { border-color: var(--red); background: #fdf0f2; }
.slot.sel .state, .slot:has(input:checked) .state { color: var(--red); }
.slot:has(input:focus-visible) { outline: 3px solid #c8102e55; outline-offset: 2px; }
.slot.full, .slot.past { cursor: not-allowed; background: #f4f6f9; }
.slot.full .time, .slot.past .time { color: #9aa6b8; text-decoration: line-through; }
.slot.full .state, .slot.past .state { color: var(--muted); }
.slot:has(input:disabled) { cursor: not-allowed; }
.picked { min-height: 1.5em; margin: 12px 0 0; font-weight: 600; }

/* Formular */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.grid .wide { grid-column: 1 / -1; }
label { display: grid; gap: 5px; font-size: .9rem; font-weight: 600; }
input, select, textarea {
  font: inherit; font-weight: 400; color: var(--ink); width: 100%;
  padding: 10px 12px; border: 1px solid #b9c7d8; border-radius: 10px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 3px solid #16284a33; border-color: var(--night-2); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 16px 0; }
.check input { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.hp { position: absolute !important; left: -9999px; }
@media (max-width: 600px) { .grid { grid-template-columns: 1fr; } }

.btn {
  display: inline-block; font: inherit; font-weight: 700; border: 0; cursor: pointer; text-decoration: none;
  background: var(--red); color: #fff; padding: 12px 22px; border-radius: 999px;
  box-shadow: 0 4px 12px #c8102e40; transition: background .15s, transform .1s;
}
.btn:hover { background: var(--red-dark); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--night); box-shadow: inset 0 0 0 2px var(--night); }
.btn.ghost:hover { background: var(--night); color: #fff; }
.btn.danger { background: #8a1020; }
.btn.small { padding: 7px 14px; font-size: .875rem; }
.btn.grey { background: #e3e9f1; color: var(--ink); box-shadow: none; }
.btn.grey:hover { background: #d3dce7; }

.termine { list-style: none; padding: 0; margin: 14px 0; }
.termine li {
  display: inline-block; margin: 3px; padding: 6px 12px; border-radius: 999px;
  background: var(--ice); font-weight: 600; font-variant-numeric: tabular-nums;
}
.facts { display: grid; grid-template-columns: auto auto; justify-content: center; gap: 4px 14px; text-align: left; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

.notice { border-radius: 10px; padding: 12px 16px; margin: 0 0 16px; background: #e8f6ee; border: 1px solid #b5e0c8; }
.notice.err { background: #fdecee; border-color: #f2b8c0; color: #7d0d1d; }
.notice.warn { background: #fff5e3; border-color: #f0d49b; color: #6b4605; }
.notice ul { margin: 0; padding-left: 1.2em; }

.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  color: var(--muted); font-size: .875rem; padding-top: 12px; padding-bottom: 40px;
}
.foot .links a { margin-left: 14px; color: var(--muted); }

/* ---------- Backoffice ---------- */
body.admin { background: #f2f5f9; }
.topbar { background: var(--night); color: #fff; margin-bottom: 22px; }
.topbar .wrap { max-width: 1200px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; padding-bottom: 12px; }
.topbar .brand { font-size: 1.2rem; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px; }
.topbar nav a { color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 8px; font-weight: 600; font-size: .95rem; }
.topbar nav a:hover { background: #ffffff1a; }
.topbar nav a.muted { color: var(--ice-2); font-weight: 400; }
body.admin main.wrap, body.admin .foot { max-width: 1200px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
.toolbar label { font-weight: 600; font-size: .8rem; }
.toolbar input, .toolbar select { padding: 7px 10px; min-width: 150px; width: auto; }
.toolbar .check input { min-width: 0; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: 12px; padding: 10px 16px; box-shadow: 0 1px 2px #0e1a2e14; }
.stat b { display: block; font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .8rem; }

.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: 0 1px 2px #0e1a2e14; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: 9px 12px; border-bottom: 1px solid #e7edf4; text-align: left; vertical-align: top; }
th { background: #f7f9fc; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
tr:hover td { background: #fafcff; }
td.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.st-cancelled td, tr.st-expired td { color: #98a3b3; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.badge.pending { background: #fff1d6; color: #8a5a00; }
.badge.confirmed { background: #dcf3e6; color: #13623f; }
.badge.cancelled { background: #eceff3; color: #6b7686; }
.badge.expired { background: #eceff3; color: #6b7686; }

.plan th:first-child, .plan td:first-child { width: 120px; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }
.plan td.cell a.book { display: block; text-decoration: none; color: inherit; border-radius: 8px; padding: 6px 10px; }
.plan td.cell.confirmed a.book { background: #dcf3e6; }
.plan td.cell.pending a.book { background: #fff1d6; }
.plan td.cell.empty a.book { color: #9aa6b8; border: 1px dashed #c9d4e2; }
.plan td.cell.empty a.book:hover { color: var(--night); border-color: var(--night); }
.plan .who { font-weight: 700; }

.admin .card { max-width: none; position: relative; }
.days-table td { vertical-align: middle; }
.days-table input[type=time] { width: 130px; padding: 6px 8px; }
.days-table input[type=checkbox] { width: 20px; height: 20px; }
.days-table input[name$="[note]"] { min-width: 160px; padding: 6px 8px; }
.days-table td:last-child { white-space: nowrap; }
.actions label { display: flex; align-items: center; gap: 8px; }
.actions input[type=date] { width: auto; padding: 7px 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }
.actions .spacer { flex: 1; }
.login { max-width: 380px; margin: 40px auto; }
.login form { display: grid; gap: 14px; }
.mail-log { font-size: .85rem; }
.mail-log .fail { color: var(--red); }
