/* AP-15 / AS-04 - Buchungsbaustein fuer Kundenwebsites.
 *
 * Alles ist unter .hkb gekapselt. Schrift kommt von der Website (inherit), die ruhige Papierflaeche
 * bleibt auch auf dunklen Vorlagen lesbar. Einzige Markenfarbe ist --hkb-accent (Website-Akzent oder
 * eigene Farbe aus dem Konfigurator); die Schrift darauf waehlt das Script nach Kontrast.
 * Keine Webfonts, keine externen Ressourcen.
 */
.hkb {
  --hkb-accent: #1d1a16;
  --hkb-on-accent: #ffffff;
  --hkb-line: color-mix(in srgb, currentColor 22%, transparent);
  --hkb-line-strong: color-mix(in srgb, currentColor 45%, transparent);
  --hkb-soft: color-mix(in srgb, currentColor 6%, transparent);
  --hkb-muted: color-mix(in srgb, currentColor 68%, transparent);
  --hkb-radius: 24px;
  --hkb-radius-sm: 10px;
  --hkb-ok: #2f7a4a;
  --hkb-warn: #a35c00;
  --hkb-error: #b3261e;
  display: block;
  /* Volle Breite des umgebenden Website-Containers - die Vorlage bestimmt die Inhaltsbreite wie
     bei jedem anderen Abschnitt, der Baustein engt sie nicht zusaetzlich ein. */
  width: 100%;
  max-width: none;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  line-height: 1.5;
}
/* Container nur um die Karte: das Dialog-Overlay bleibt am Browserfenster ausgerichtet. */
.hkb .hkb__layout { container-type: inline-size; }
.hkb *, .hkb *::before, .hkb *::after { box-sizing: border-box; }
.hkb :where(h3, h4, p, ul, ol, li, fieldset, legend, dl, dd) { margin: 0; padding: 0; }
.hkb :where(ul, ol) { list-style: none; }
.hkb :where(button, input, select, textarea) {
  font: inherit;
  color: inherit;
  margin: 0;
  letter-spacing: normal;
  text-transform: none;
  box-shadow: none;
}
.hkb button {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  width: auto;
  min-width: 0;
  height: auto;
  cursor: pointer;
  line-height: 1.3;
}
.hkb button:disabled { cursor: not-allowed; }
.hkb :focus-visible { outline: 3px solid var(--hkb-accent); outline-offset: 2px; }
.hkb .hkb__sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.hkb .hkb__card {
  display: grid;
  gap: 0;
  border: 1px solid var(--hkb-line);
  border-radius: var(--hkb-radius);
  overflow: hidden;
  background: #fcfbfa;
  color: #202833;
  box-shadow: 0 12px 40px rgba(24, 34, 52, 0.06);
}
@container (min-width: 820px) {
  .hkb .hkb__card { grid-template-columns: minmax(260px, 0.85fr) 2fr; }
}
.hkb .hkb__aside, .hkb .hkb__main { min-width: 0; padding: 28px; display: grid; gap: 24px; align-content: start; }
.hkb .hkb__main { background: transparent; }
.hkb .hkb__aside { background: var(--hkb-accent); color: var(--hkb-on-accent); }
.hkb .hkb__aside :is(.hkb__eyebrow, .hkb__hint, .hkb__service-meta) { color: inherit; }
.hkb .hkb__aside :focus-visible { outline-color: var(--hkb-on-accent); }
.hkb .hkb__aside .hkb__h { font-size: 1.75rem; margin-top: 10px; }
.hkb .hkb__aside .hkb__field { font-size: 0.8125rem; gap: 8px; }
.hkb .hkb__aside .hkb__hint { font-size: 0.8125rem; }

.hkb .hkb__card > .hkb__main:only-child { grid-column: 1 / -1; }
.hkb .hkb__eyebrow { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--hkb-muted); }
.hkb .hkb__h { font-size: 1.25rem; font-weight: 700; line-height: 1.25; margin-top: 4px; }
.hkb .hkb__hint { font-size: 0.875rem; color: var(--hkb-muted); }
.hkb .hkb__banner {
  padding: 10px 14px; border-radius: var(--hkb-radius-sm); font-size: 0.875rem;
  border: 1px dashed var(--hkb-line-strong); background: var(--hkb-soft);
}

/* --- Leistungen --- */
.hkb .hkb__select {
  display: block; width: 100%; min-width: 0; max-width: 100%; min-height: 48px; padding: 10px 12px;
  background: #fcfbfa; color: #202833; border: 1px solid transparent; border-radius: var(--hkb-radius-sm);
  text-overflow: ellipsis; font-size: 0.875rem; cursor: pointer; color-scheme: light;
}
.hkb .hkb__select:disabled { cursor: default; opacity: 0.85; }
.hkb .hkb__services { display: grid; gap: 0; }
.hkb .hkb__service {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0;
  padding: 12px 0; border-bottom: 1px solid var(--hkb-line);
}
.hkb .hkb__service:first-child { padding-top: 0; }
.hkb .hkb__service:last-child { border-bottom: 0; padding-bottom: 0; }
.hkb .hkb__service > div { min-width: 0; overflow-wrap: anywhere; }
.hkb .hkb__remove { flex: none; width: 44px; min-height: 44px; border: 1px solid var(--hkb-line); border-radius: 50%; font-size: 1.25rem; }
.hkb .hkb__remove:hover { background: var(--hkb-soft); border-color: currentColor; }
.hkb .hkb__service-title { display: block; font-weight: 600; }
.hkb .hkb__service-meta { display: block; font-size: 0.85rem; color: var(--hkb-muted); }
.hkb .hkb__totals { display: grid; gap: 6px; padding-top: 14px; border-top: 1px solid var(--hkb-line); }
.hkb .hkb__total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.hkb .hkb__total strong { font-size: 1.35rem; font-weight: 600; }

/* --- Wochen und Tage --- */
.hkb .hkb__range { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hkb .hkb__range-label { font-weight: 600; }
.hkb .hkb__ghost {
  min-height: 40px; padding: 8px 14px; border: 1px solid var(--hkb-line-strong); border-radius: 999px; font-size: 0.9rem;
}
.hkb .hkb__ghost:hover:not(:disabled) { background: var(--hkb-soft); }
.hkb .hkb__ghost:disabled { opacity: 0.4; }
.hkb .hkb__week { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; }
.hkb .hkb__arrow {
  width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--hkb-line-strong);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.hkb .hkb__arrow:hover:not(:disabled) { background: var(--hkb-soft); }
.hkb .hkb__arrow:disabled { opacity: 0.3; }
.hkb .hkb__days { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }
.hkb .hkb__day {
  min-height: 58px; padding: 8px 4px; border-radius: var(--hkb-radius-sm); border: 1px solid var(--hkb-line);
  display: grid; justify-items: center; gap: 2px;
}
.hkb .hkb__day small { font-size: 0.75rem; color: var(--hkb-muted); }
.hkb .hkb__day strong { font-size: 1.05rem; font-weight: 700; }
.hkb .hkb__day:hover:not(:disabled) { border-color: var(--hkb-line-strong); }
.hkb .hkb__day[aria-pressed="true"] { background: var(--hkb-accent); border-color: var(--hkb-accent); color: var(--hkb-on-accent); }
.hkb .hkb__day[aria-pressed="true"] small { color: inherit; opacity: 0.85; }
.hkb .hkb__day:disabled { background: var(--hkb-soft); border-color: transparent; opacity: 0.55; text-decoration: line-through; }
/* Ein geschlossener Tag kann gewaehlt sein (Woche ohne offenen Tag) - dann nie Akzentschrift auf grauem Grund. */
.hkb .hkb__day[aria-pressed="true"]:disabled { color: inherit; border-color: var(--hkb-line-strong); }

/* --- Zeiten: Kacheln --- */
.hkb .hkb__tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.hkb .hkb__tile {
  min-height: 44px; padding: 10px 6px; border-radius: var(--hkb-radius-sm); border: 1px solid var(--hkb-line);
  text-align: center; background: #ffffff; font-variant-numeric: tabular-nums;
}
.hkb .hkb__tile:hover:not(:disabled) { border-color: var(--hkb-accent); box-shadow: inset 0 0 0 1px var(--hkb-accent); }
.hkb .hkb__tile[aria-pressed="true"] { background: var(--hkb-accent); border-color: var(--hkb-accent); color: var(--hkb-on-accent); font-weight: 600; }
.hkb .hkb__tile:disabled { background: var(--hkb-soft); border-color: transparent; color: var(--hkb-muted); opacity: 0.6; }

/* --- Zeiten: Liste --- */
.hkb .hkb__list { display: grid; gap: 6px; }
.hkb .hkb__row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px;
  padding: 10px 14px; border: 1px solid var(--hkb-line); border-radius: var(--hkb-radius-sm); font-variant-numeric: tabular-nums;
}
.hkb .hkb__row:hover { border-color: var(--hkb-line-strong); }
.hkb .hkb__row[aria-pressed="true"] { border-color: var(--hkb-accent); box-shadow: inset 0 0 0 1px var(--hkb-accent); font-weight: 600; }
.hkb .hkb__radio { width: 18px; height: 18px; border-radius: 999px; border: 1.5px solid var(--hkb-line-strong); flex: none; }
.hkb .hkb__row[aria-pressed="true"] .hkb__radio { border: 5px solid var(--hkb-accent); }

/* --- Zeiten: Tageszeitachse --- */
.hkb .hkb__axis { position: relative; display: grid; grid-template-columns: 52px 1fr; }
.hkb .hkb__axis-times { position: relative; }
.hkb .hkb__axis-time { position: absolute; left: 0; transform: translateY(-50%); font-size: 0.75rem; color: var(--hkb-muted); font-variant-numeric: tabular-nums; }
.hkb .hkb__axis-track { position: relative; border-left: 1px solid var(--hkb-line); }
.hkb .hkb__axis-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--hkb-line); }
.hkb .hkb__axis-line--half { border-top-style: dashed; opacity: 0.6; }
.hkb .hkb__axis-off {
  position: absolute; left: 6px; right: 0; border-radius: 8px; background: var(--hkb-soft);
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--hkb-line) 6px 7px);
  font-size: 0.75rem; color: var(--hkb-muted); padding: 2px 8px; overflow: hidden;
}
.hkb .hkb__axis-slot {
  position: absolute; left: 6px; right: 0; border-radius: 8px; padding: 0 10px; text-align: left;
  display: flex; align-items: center; font-size: 0.85rem; font-variant-numeric: tabular-nums;
}
.hkb .hkb__axis-slot--covered { color: transparent; }
.hkb .hkb__axis-slot:hover { background: color-mix(in srgb, var(--hkb-accent) 14%, transparent); }
.hkb .hkb__axis-pick {
  position: absolute; left: 6px; right: 0; border-radius: 10px; background: var(--hkb-accent); color: var(--hkb-on-accent);
  padding: 6px 12px; display: grid; align-content: start; gap: 2px; pointer-events: none; z-index: 1;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--hkb-accent) 30%, transparent);
}
.hkb .hkb__axis-pick strong { font-weight: 700; }
.hkb .hkb__axis-pick small { font-size: 0.8rem; opacity: 0.9; }

.hkb .hkb__legend { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 0.8rem; color: var(--hkb-muted); }
.hkb .hkb__empty { padding: 16px; border-radius: var(--hkb-radius-sm); border: 1px dashed var(--hkb-line-strong); font-size: 0.9rem; }

/* --- Formular --- */
.hkb .hkb__fields { display: grid; gap: 12px; }
@container (min-width: 560px) { .hkb .hkb__fields { grid-template-columns: 1fr 1fr; } .hkb .hkb__field--wide { grid-column: 1 / -1; } }
.hkb .hkb__field { display: grid; gap: 6px; align-content: start; font-size: 0.9rem; }
.hkb .hkb__field input {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--hkb-line-strong); border-radius: var(--hkb-radius-sm);
  background: transparent;
}
.hkb .hkb__field input[aria-invalid="true"] { border-color: var(--hkb-error); }
.hkb .hkb__error { color: var(--hkb-error); font-size: 0.85rem; }
.hkb .hkb__honey { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.hkb .hkb__submit-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hkb .hkb__primary {
  min-height: 48px; padding: 12px 22px; border-radius: 999px; background: var(--hkb-accent); color: var(--hkb-on-accent); font-weight: 600;
}
.hkb .hkb__primary:hover:not(:disabled) { filter: brightness(1.06); }
.hkb .hkb__primary:disabled { opacity: 0.45; }
.hkb .hkb__note { padding: 12px 14px; border-radius: var(--hkb-radius-sm); border: 1px solid var(--hkb-line); font-size: 0.9rem; }
.hkb .hkb__note--error { border-color: var(--hkb-error); }
.hkb .hkb__note--ok { border-left: 4px solid var(--hkb-ok); }
.hkb .hkb__note--warn { border-left: 4px solid var(--hkb-warn); }

/* --- Reservierung / Countdown --- */
.hkb .hkb__status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; border: 1px solid currentColor; }
.hkb .hkb__status--pending { color: var(--hkb-warn); }
.hkb .hkb__status--ok { color: var(--hkb-ok); }
.hkb .hkb__countdown { font-size: 2.25rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.hkb .hkb__panel { display: grid; gap: 14px; }
.hkb .hkb__actions { display: flex; gap: 10px; flex-wrap: wrap; }

.hkb .hkb__overlay {
  position: fixed; inset: 0; z-index: 2147483000; background: rgba(15, 15, 15, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.hkb .hkb__dialog {
  width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; border-radius: 18px; padding: 24px;
  background: #ffffff; color: #1d1a16; display: grid; gap: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}
.hkb .hkb__dialog .hkb__ghost { border-color: rgba(29, 26, 22, 0.35); }
@media (prefers-reduced-motion: no-preference) {
  .hkb .hkb__dialog { animation: hkb-in 160ms ease-out; }
  @keyframes hkb-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

/* Die Wochentage bleiben in einer Zeile; Pfeile sitzen immer auf derselben Achse. */
@container (max-width: 559px) {
  .hkb .hkb__card { border-radius: 18px; }
  .hkb .hkb__aside, .hkb .hkb__main { padding: 20px 16px; gap: 20px; }
  .hkb .hkb__aside .hkb__h { font-size: 1.5rem; margin-top: 4px; }
  .hkb .hkb__week { grid-template-columns: 28px minmax(0, 1fr) 28px; gap: 4px; }
  .hkb .hkb__arrow { width: 28px; height: 44px; border-radius: 8px; }
  .hkb .hkb__days { gap: 3px; }
  .hkb .hkb__day { min-height: 56px; padding: 8px 1px; border-radius: 8px; }
  .hkb .hkb__day small { font-size: 0.6875rem; }
  .hkb .hkb__day strong { font-size: 0.9375rem; }
  .hkb .hkb__tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hkb .hkb__range-label { font-size: 0.875rem; }
  .hkb .hkb__primary { width: 100%; }
}

/* --- Personen (mehrere Kalender) --- */
.hkb .hkb__label { font-size: 0.875rem; font-weight: 600; }
.hkb .hkb__people { display: flex; flex-wrap: wrap; gap: 8px; }
.hkb .hkb__person {
  min-height: 44px; padding: 8px 16px; border: 1px solid var(--hkb-line-strong); border-radius: 999px;
  background: #ffffff; font-size: 0.9rem; text-align: center;
}
.hkb .hkb__person:hover { border-color: var(--hkb-accent); box-shadow: inset 0 0 0 1px var(--hkb-accent); }
.hkb .hkb__person[aria-pressed="true"] { background: var(--hkb-accent); border-color: var(--hkb-accent); color: var(--hkb-on-accent); font-weight: 600; }
.hkb .hkb__empty .hkb__people { margin-top: 12px; }
.hkb .hkb__suggest {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  padding: 12px 16px; border-left: 3px solid var(--hkb-accent); border-radius: var(--hkb-radius-sm);
  background: color-mix(in srgb, var(--hkb-accent) 8%, #ffffff);
}
.hkb .hkb__suggest p { font-size: 0.9rem; }
@container (max-width: 559px) {
  .hkb .hkb__person { padding-inline: 12px; flex: 1 1 auto; }
}
