/* Q4 Booking — öffentliche Buchungsseite + Zugangs-PWA.
   Neutral (schwarz/grau, kein Blau), viel Freiraum. Angelehnt an das q4m-Designsystem
   (erp-system/templates/base.html.twig), aber bewusst standalone: die Seite muss ohne
   Hub-Assets und ohne Build laufen. Dark-Mode über prefers-color-scheme. */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f6f7;
  --bg-sunk: #fafafa;
  --fg: #1c1c1e;
  --fg-muted: #6b6b70;
  --fg-faint: #9a9aa0;
  --line: #e4e4e7;
  --line-strong: #d0d0d5;
  --accent: #1c1c1e;
  --accent-fg: #ffffff;
  --ok-bg: #edf6ef; --ok-fg: #1e6b3a;
  --warn-bg: #fdf4e6; --warn-fg: #8a5a00;
  --err-bg: #fbecec; --err-fg: #9a1e1e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131315; --bg-soft: #1b1b1f; --bg-sunk: #1f1f24;
    --fg: #f2f2f5; --fg-muted: #a0a0a8; --fg-faint: #6e6e77;
    --line: #2c2c33; --line-strong: #3a3a43;
    --accent: #f2f2f5; --accent-fg: #131315;
    --ok-bg: #14301f; --ok-fg: #7fd6a0;
    --warn-bg: #322512; --warn-fg: #e8b45c;
    --err-bg: #341a1a; --err-fg: #ef8b8b;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg-soft);
  color: var(--fg);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, Inter, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

.wrap { max-width: 940px; margin: 0 auto; padding: 32px 20px 64px; }
.wrap--narrow { max-width: 560px; }

header.site { padding: 8px 0 28px; }
header.site h1 { margin: 0 0 6px; font-size: 26px; font-weight: 650; letter-spacing: -.02em; }
header.site p { margin: 0; color: var(--fg-muted); }

.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 4px; font-size: 18px; font-weight: 620; letter-spacing: -.01em; }
.card h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--fg-muted); }

.muted { color: var(--fg-muted); }
.faint { color: var(--fg-faint); font-size: 13px; }
.right { text-align: right; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { min-width: 0; }
.grow { flex: 1; }
.stack > * + * { margin-top: 14px; }

/* Ressourcen-Liste */
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.res-card { cursor: pointer; transition: border-color .12s, transform .12s; text-decoration: none; display: block; }
.res-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.res-card .thumb {
  aspect-ratio: 16/10; background: var(--bg-sunk) center/cover no-repeat;
  border-radius: 8px; margin: -4px -4px 12px; border: 1px solid var(--line);
}
.res-card .thumb--empty { display: grid; place-items: center; color: var(--fg-faint); font-size: 28px; }

/* Ausstattung */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.tag {
  font-size: 12px; padding: 3px 9px; border-radius: 999px;
  background: var(--bg-sunk); border: 1px solid var(--line); color: var(--fg-muted);
}

/* Galerie — Raster richtet sich nach der Bildanzahl. Ohne das stünde bei nur einem Foto
   (der Normalfall) die halbe Breite leer, weil die 3-Spalten-Aufteilung ins Nichts läuft. */
.gallery { display: grid; gap: 8px; margin-bottom: 16px; }
.gallery img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }

.gallery--1 { grid-template-columns: 1fr; }
.gallery--1 img { aspect-ratio: 16/10; height: auto; }

.gallery--2 { grid-template-columns: 1fr 1fr; }
.gallery--2 img { aspect-ratio: 4/3; height: auto; }

.gallery--3 { grid-template-columns: 2fr 1fr 1fr; }
.gallery--3 img:first-child { grid-row: span 2; aspect-ratio: 4/3; }

/* Slots */
.daybar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.slot {
  padding: 9px 4px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
  cursor: pointer; user-select: none; transition: background .1s, border-color .1s;
}
.slot:hover:not(.slot--off) { border-color: var(--line-strong); }
.slot--off { color: var(--fg-faint); background: var(--bg-sunk); cursor: not-allowed; text-decoration: line-through; }
.slot--sel { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.slot--edge { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }

/* Zeitachsen-Picker (anny-Stil): Tagesspalte links, Datum/Ableser rechts */
/* Rechte Spalte 360px: Zustand „Termin" braucht nur ~300, aber Checkout/Login (echtes Formular)
   wirken bei 300 minus Karten-Padding zu eng — 360 lässt ~320px Inhalt (§7.2). */
.picker { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; margin-top: 14px; }
/* DOM-Reihenfolge ist jetzt Seite→Achse (Datum VOR Zeit, s. index.html). Auf Desktop per
   order zurückdrehen: Achse in Spalte 1 (1fr, breit), Kalender-Seite in Spalte 2 (300px). */
.picker__main { min-width: 0; order: 1; }
.picker__side { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 12px; order: 2; }
.picker__side .daybar { margin: 0; }

.sel-readout { font-size: 13px; color: var(--fg-muted); }
.sel-readout .ro { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sel-readout .ro:last-of-type { border-bottom: 0; }
.sel-readout .ro span { color: var(--fg-muted); }
.sel-readout .ro b { color: var(--fg); font-variant-numeric: tabular-nums; font-weight: 620; }
.sel-readout .ro-warn { color: var(--err-fg); margin-top: 8px; }

/* Mini-Kalender (rechte Karte, ersetzt <input type=date>) — kompakt, rahmenlose Fläche.
   Zellen: Vollkreis-Highlight (radius 999px) statt sichtbarer Rahmen (Dichte-Tabelle §5). */
.cal { background: var(--bg-sunk); border-radius: var(--radius); padding: 10px 12px; }
.cal__head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.cal__month { flex: 1; font-size: 14px; font-weight: 600; color: var(--fg); }
.cal__arrow, .cal__toggle {
  width: 24px; height: 24px; padding: 0; border: 0; background: transparent; color: var(--fg-muted);
  cursor: pointer; font-size: 16px; line-height: 1; border-radius: 6px; display: grid; place-items: center;
}
.cal__arrow:hover, .cal__toggle:hover { background: var(--bg-soft); color: var(--fg); }
.cal__wd { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal__wd span { text-align: center; font-size: 12px; color: var(--fg-faint); padding: 2px 0; }
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.cal__day {
  aspect-ratio: 1; width: 100%; max-width: 40px; margin: 0 auto; border: 0; background: transparent;
  color: var(--fg); font: inherit; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
  border-radius: 999px; cursor: pointer; display: grid; place-items: center;
}
.cal__day:hover:not(:disabled):not(.cal__day--sel) { background: var(--bg-soft); }
.cal__day--today { box-shadow: inset 0 0 0 1px var(--line-strong); }
.cal__day--sel { background: var(--accent); color: var(--accent-fg); }
.cal__day--out { color: var(--fg-faint); font-weight: 400; }
.cal__day--off, .cal__day:disabled {
  color: var(--fg-faint); text-decoration: line-through; opacity: .5; cursor: not-allowed; font-weight: 400;
}

/* Von/Bis-Ableser + Inline-Reset (✕) — spart die eigene Reset-Button-Zeile (§3.2). */
.sel-block { display: flex; align-items: flex-start; gap: 8px; }
.sel-block .sel-readout { flex: 1; min-width: 0; }
.btn--icon {
  flex: none; width: 32px; height: 32px; padding: 0; border-radius: 8px; border: 1px solid var(--line-strong);
  background: transparent; color: var(--fg-muted); cursor: pointer; font-size: 14px; line-height: 1;
  display: grid; place-items: center;
}
.btn--icon:hover { color: var(--fg); border-color: var(--fg-muted); }

/* Panel-Zustände der rechten Spalte: Termin / Checkout / Login teilen sich denselben Platz,
   genau einer ist sichtbar (hidden-Attribut, s. setPanel() in index.html). */
[hidden] { display: none !important; }
.co-back {
  display: inline-flex; align-items: center; margin: -4px 0 8px -4px; padding: 4px 8px;
  border: 0; background: transparent; color: var(--fg-muted); font: inherit; font-size: 13px;
  cursor: pointer; border-radius: 6px;
}
.co-back:hover { color: var(--fg); background: var(--bg-soft); }

/* Checkout-Login-Leiste */
.loginbar { margin: 0 0 14px; padding: 10px 12px; background: var(--bg-sunk); border-radius: var(--radius); font-size: 13px; }
.loginbar:empty { display: none; }
.loginbar a { color: var(--fg); font-weight: 600; text-decoration: underline; }
.loginbar__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.loginbar--in { border: 1px solid var(--ok-fg); background: var(--ok-bg); color: var(--ok-fg); }
.loginbar--in a { color: inherit; }
.lg-line { display: flex; gap: 6px; }
.lg-line input { flex: 1; min-width: 0; }

/* kompakte Feld-/Button-Variante für die rechte Karte + Login (§3.4/§5): kleineres Label,
   rahmenlose Fläche statt 1px-Linie. Globale .field/.btn bleiben unverändert. */
label.field--sm > span { font-size: 12px; color: var(--fg-faint); margin-bottom: 3px; }
.field--sm input { padding: 7px 9px; border: 0; background: var(--bg); border-radius: 8px; }
.btn--sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
input.is-err { outline: 2px solid var(--err-fg); outline-offset: -1px; }
input.is-locked { background: var(--bg-sunk); color: var(--fg-muted); cursor: default; }

.tl { display: grid; grid-template-columns: 46px 1fr; }
.tl__axis { position: relative; }
.tl__hr { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--fg-faint); font-variant-numeric: tabular-nums; }
.tl__track {
  position: relative; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); overflow: hidden; cursor: crosshair; user-select: none; touch-action: pan-y;
}
.tl__line { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line); pointer-events: none; }
.tl__closed {
  position: absolute; left: 0; right: 0; pointer-events: none;
  background: repeating-linear-gradient(135deg, var(--bg-sunk) 0, var(--bg-sunk) 6px, var(--line) 6px, var(--line) 7px);
}
.tl__busy {
  position: absolute; left: 6px; right: 6px; pointer-events: none; overflow: hidden;
  background: var(--bg-sunk); border: 1px solid var(--line-strong); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.tl__busy span { font-size: 11px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: .05em; }
.tl__now { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--err-fg); pointer-events: none; z-index: 3; }
.tl__now::before { content: ''; position: absolute; left: 0; top: -4px; width: 7px; height: 7px; border-radius: 50%; background: var(--err-fg); }
.tl__sel {
  position: absolute; left: 6px; right: 6px; pointer-events: none; z-index: 4; overflow: hidden;
  background: var(--accent); color: var(--accent-fg); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; padding: 0 8px; box-shadow: var(--shadow);
}
.tl__sel span { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl__sel--pending { background: transparent; color: var(--fg); border: 2px dashed var(--line-strong); box-shadow: none; }

@media (max-width: 640px) {
  .picker { grid-template-columns: 1fr; }
  /* Kernregel: Datum/Kalender IMMER vor der Zeitachse. Seite zuerst, Achse danach. */
  .picker__side { position: static; order: 1; }
  .picker__main { order: 2; }
}

/* Formular */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--fg-muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; font: inherit; color: var(--fg);
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: 8px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--fg); outline-offset: -1px; }
textarea { min-height: 80px; resize: vertical; }
input[type=checkbox] { width: auto; }

.btn {
  display: inline-block; padding: 11px 20px; font: inherit; font-weight: 600;
  background: var(--accent); color: var(--accent-fg); border: 1px solid var(--accent);
  border-radius: 8px; cursor: pointer; text-decoration: none; text-align: center;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--fg); border-color: var(--line-strong); }
.btn--wide { width: 100%; }
.btn--lg { padding: 16px 24px; font-size: 17px; border-radius: 12px; }

.addon { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.addon:last-child { border-bottom: 0; }
.addon input[type=checkbox] { width: 18px; height: 18px; flex: none; }
.addon .qty { width: 62px; flex: none; }

table.sum { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.sum td { padding: 5px 0; }
table.sum tr.total td { border-top: 1px solid var(--line); padding-top: 10px; font-weight: 650; font-size: 17px; }

.note { padding: 11px 14px; border-radius: 8px; font-size: 14px; }
.note--ok { background: var(--ok-bg); color: var(--ok-fg); }
.note--warn { background: var(--warn-bg); color: var(--warn-fg); }
.note--err { background: var(--err-bg); color: var(--err-fg); }

.steps { display: flex; gap: 6px; margin-bottom: 20px; font-size: 12px; color: var(--fg-faint); }
.steps b { color: var(--fg); font-weight: 600; }

/* Zugangs-PWA */
.door {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px;
  background: var(--bg);
}
.door__name { font-weight: 600; }
.door__hint { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }
.door__btn {
  flex: none; width: 92px; height: 92px; border-radius: 50%; font-size: 13px; font-weight: 650;
  border: 2px solid var(--accent); background: var(--accent); color: var(--accent-fg);
  cursor: pointer; display: grid; place-items: center; line-height: 1.25;
  transition: transform .08s;
}
.door__btn:active:not(:disabled) { transform: scale(.94); }
.door__btn:disabled { background: transparent; color: var(--fg-faint); border-color: var(--line); cursor: not-allowed; }
.door__btn.is-ok { background: var(--ok-fg); border-color: var(--ok-fg); color: #fff; }
.door__btn.is-err { background: var(--err-fg); border-color: var(--err-fg); color: #fff; }

.hero-time { font-size: 15px; font-variant-numeric: tabular-nums; }
.hero-time b { font-size: 22px; font-weight: 650; display: block; letter-spacing: -.02em; }

.skel { background: var(--bg-sunk); border-radius: 6px; height: 14px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

@media (max-width: 560px) {
  .wrap { padding: 20px 14px 48px; }
  .gallery--3 { grid-template-columns: 1fr 1fr; }
  .gallery--3 img:first-child { grid-row: span 1; grid-column: span 2; aspect-ratio: 16/10; }
  .door__btn { width: 78px; height: 78px; }
}
