/* ==========================================================================
   overlay.css – Schubfach, Befehlspalette, Popover, Hover-Karte, Tooltip, Toast,
   Bestätigungsdialog, Blatt (mobil), Abdunkelung

   Schubfach   <aside class="a-drawer" role="dialog" aria-modal="false" aria-labelledby="…">
                 __head (__titles __eyebrow __title __sub __tools) · __body (__section, __section-title)
                 __foot · offen: .is-open · .a-drawer--wide · .a-drawer--inline (im Fluss, Stilblatt)
               Desktop ≥ 1024: nicht-modal, die Liste bleibt sichtbar; darunter modal mit .a-scrim.
   Palette     <dialog class="a-palette-dialog"><div class="a-palette">
                 __field (__input role="combobox") · __body (role="listbox") · __group · __label
                 __item[role="option"][aria-selected] (__icon __text __title __meta __hint) · __empty · __foot
   Popover     .a-pop (+ __title __body __foot; --arrow-top/--arrow-bottom; --inline)
   Hover-Karte .a-hovercard (Belegung: Gast, Nächte, Betrag, Zahlung)
   Tooltip     .a-tip (+ --top --bottom --right; .a-tipwrap zeigt ihn bei Hover/Fokus)
   Toast       .a-toasts > .a-toast (+ --ok --attn --info) · __icon __msg __action __close __timer
               „Toast mit Stich“: gestrichelte Naht innen. Rückgängig statt Rückfrage.
   Dialog      <dialog class="dialog a-dialog"> (+ .a-dialog--danger) · __actions
   Blatt       .a-sheet (+ __grip __head __title __body; .is-open) – mobil „Mehr“ & Auswahl
   ========================================================================== */

.a-scrim {
  position: fixed;
  inset: 0;
  z-index: calc(var(--a-z-drawer) - 1);
  background: var(--a-scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--d-3) var(--ease-out);
}
.a-scrim.is-visible { opacity: 1; pointer-events: auto; }

/* ---- Schubfach -------------------------------------------------------------------------- */
.a-drawer {
  --a-dr-pad: 1.5rem;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: var(--a-z-drawer);
  display: flex;
  flex-direction: column;
  width: var(--a-drawer-w);
  max-width: 100vw;
  background: var(--a-raised);
  color: var(--fg);
  box-shadow: var(--a-shadow-drawer);
  transform: translateX(calc(100% + 32px));
  visibility: hidden;
  transition: transform 380ms var(--ease-out), visibility 0s linear 380ms;
}
.a-drawer.is-open, .a-drawer[open] {
  transform: none;
  visibility: visible;
  transition: transform 380ms var(--ease-out), visibility 0s;
}
.a-drawer--wide { --a-drawer-w: min(48rem, 100vw); }
.a-drawer--inline {   /* im Fluss (Stilblatt, Vorschau) */
  position: relative;
  inset: auto;
  z-index: auto;
  width: 100%;
  max-width: var(--a-drawer-w);
  transform: none;
  visibility: visible;
  border-radius: var(--a-r-lg);
  box-shadow: var(--a-shadow-pop);
  overflow: hidden;
}
.a-drawer__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem var(--a-dr-pad) 1rem;
  background: var(--a-raised);
  border-bottom: 1px solid var(--a-line);
}
.a-drawer__titles { display: grid; gap: .3rem; min-width: 0; flex: 1 1 0; }
.a-drawer__title {
  --wght: 380;
  font-family: var(--font-display);
  font-weight: var(--wght);
  font-variation-settings: "SOFT" 30, "WONK" 0;
  font-size: var(--a-fs-2xl);
  line-height: 1.1;
  letter-spacing: -.01em;
}
.a-drawer__sub { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; font-size: var(--a-fs-sm); color: var(--fg-2); }
.a-drawer__tools { display: flex; flex: none; gap: 2px; margin: -.3rem -.6rem 0 0; }
.a-drawer__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: .25rem var(--a-dr-pad) 1.5rem;
  scrollbar-width: thin;
}
.a-drawer__section { padding-block: 1.25rem; }
.a-drawer__section + .a-drawer__section { border-top: 1px solid var(--a-line); }
.a-drawer__section-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.a-drawer__section-title {
  font-size: var(--a-fs-2xs);
  font-weight: 600;
  font-stretch: 85%;
  font-variation-settings: "wdth" 85;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.a-drawer__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  padding: .85rem var(--a-dr-pad) calc(.85rem + var(--safe-bottom));
  background: var(--a-raised);
  border-top: 1px solid var(--a-line-2);
}
.a-drawer__foot > .a-spacer { flex: 1 1 auto; }
@media (max-width: 767.98px) {
  .a-drawer { --a-dr-pad: 1rem; }
  .a-drawer:not(.a-drawer--inline) { width: 100vw; }
  .a-drawer__foot .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .a-drawer, .a-drawer.is-open { transition: none; }
}

/* ---- Befehlspalette ------------------------------------------------------------------------ */
.a-palette-dialog {
  width: min(40rem, calc(100vw - 2rem));
  max-width: none;
  max-height: none;
  margin: 12vh auto auto;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}
.a-palette-dialog::backdrop { background: var(--a-scrim); animation: a-fade var(--d-2) var(--ease-out); }
.a-palette-dialog[open] .a-palette { animation: a-pop-in var(--d-2) var(--ease-out); }
.a-palette {
  display: flex;
  flex-direction: column;
  max-height: min(34rem, 76vh);
  border-radius: var(--a-r-pop);
  background: var(--a-raised);
  color: var(--fg);
  box-shadow: var(--a-shadow-pop);
  overflow: hidden;
}
.a-palette__field {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 0 1rem;
  min-height: 3.5rem;
  border-bottom: 1px solid var(--a-line-2);
}
.a-palette__field > .a-ico { width: 1.25rem; height: 1.25rem; color: var(--fg-2); }
.a-palette__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 3.5rem;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-size: var(--a-fs-lg);
  outline: none;
}
.a-palette__input::placeholder { color: var(--fg-2); opacity: .85; }
.a-palette__scope { flex: none; }
.a-palette__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: .4rem; overscroll-behavior: contain; }
.a-palette__group + .a-palette__group { margin-top: .35rem; }
.a-palette__label {
  padding: .55rem .65rem .3rem;
  font-size: var(--a-fs-2xs);
  font-weight: 600;
  font-stretch: 85%;
  font-variation-settings: "wdth" 85;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.a-palette__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 2.75rem;
  padding: .35rem .65rem;
  border-radius: 8px;
  color: var(--fg);
  cursor: pointer;
}
.a-palette__item:hover { background: var(--a-hover); }
.a-palette__item[aria-selected="true"] { background: var(--a-selected); }
.a-palette__item[aria-selected="true"]::before {   /* am Faden */
  content: "";
  position: absolute;
  left: 0;
  top: .5rem;
  bottom: .5rem;
  width: var(--a-thread-w);
  border-radius: 1px;
  background: var(--a-thread);
}
.a-palette__icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: var(--a-surface-2);
  color: var(--fg-2);
}
.a-palette__icon .a-ico { width: 1.0625rem; height: 1.0625rem; }
.a-palette__item[aria-selected="true"] .a-palette__icon { background: var(--a-surface); color: var(--accent); box-shadow: var(--a-shadow-0); }
.a-palette__text { display: grid; min-width: 0; flex: 1 1 auto; line-height: 1.3; }
.a-palette__title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-palette__title mark { background: none; color: inherit; font-weight: 700; text-decoration: underline; text-decoration-color: var(--faden); text-decoration-thickness: 1.5px; text-underline-offset: .18em; }
.a-palette__meta { font-size: var(--a-fs-sm); color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-palette__hint { flex: none; display: inline-flex; gap: .2rem; color: var(--fg-2); font-size: var(--a-fs-xs); }
.a-palette__item:not([aria-selected="true"]) .a-palette__hint--enter { visibility: hidden; }
.a-palette__empty { padding: 2rem 1rem; text-align: center; color: var(--fg-2); font-size: var(--a-fs-base); }
.a-palette__empty strong { color: var(--fg); }
.a-palette__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem 1.1rem;
  padding: .6rem 1rem;
  border-top: 1px solid var(--a-line);
  background: var(--a-surface-2);
  font-size: var(--a-fs-xs);
  color: var(--fg-2);
}
.a-palette__foot > span { display: inline-flex; align-items: center; gap: .3rem; }
.a-palette__foot > :last-child { margin-left: auto; }
@media (max-width: 767.98px) {
  .a-palette-dialog { width: 100vw; margin: 0; height: 100dvh; }
  .a-palette-dialog .a-palette { max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .a-palette__foot { display: none; }
  .a-palette__item { min-height: 3rem; }
}

/* ---- Popover ----------------------------------------------------------------------------- */
.a-pop {
  --a-pop-arrow-x: 1.25rem;
  position: absolute;
  z-index: var(--z-popover);
  width: max-content;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: .85rem 1rem;
  border-radius: 10px;
  background: var(--a-raised);
  color: var(--fg);
  font-size: var(--a-fs-sm);
  line-height: 1.5;
  box-shadow: var(--a-shadow-pop);
}
.a-pop--inline { position: relative; }
.a-pop__title { font-weight: 600; font-size: var(--a-fs-base); margin-bottom: .25rem; color: var(--fg); }
.a-pop__body { color: var(--fg-2); }
.a-pop__foot { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .75rem; }
.a-pop--arrow-top::before, .a-pop--arrow-bottom::before {
  content: "";
  position: absolute;
  left: var(--a-pop-arrow-x);
  width: 10px;
  height: 10px;
  background: var(--a-raised);
  box-shadow: -1px -1px 0 0 var(--a-line-2);
  transform: rotate(45deg);
}
.a-pop--arrow-top::before { top: -5px; }
.a-pop--arrow-bottom::before { bottom: -5px; box-shadow: 1px 1px 0 0 var(--a-line-2); }

/* Hover-Karte (Belegung) */
.a-hovercard { width: 17.5rem; padding: .9rem 1rem .85rem; }
.a-hovercard__head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: .65rem; }
.a-hovercard__name { font-weight: 600; font-size: var(--a-fs-md); color: var(--fg); line-height: 1.25; }
.a-hovercard__sub { font-size: var(--a-fs-sm); color: var(--fg-2); }
.a-hovercard .a-dl { grid-template-columns: auto minmax(0, 1fr); gap: .3rem 1rem; font-size: var(--a-fs-sm); }
.a-hovercard .a-dl > dd { text-align: right; }
.a-hovercard__foot { margin-top: .7rem; padding-top: .55rem; border-top: 1px dashed var(--a-line-3); font-size: var(--a-fs-xs); color: var(--fg-2); }

/* ---- Tooltip (invers) ----------------------------------------------------------------------- */
.a-tip {
  position: absolute;
  z-index: var(--a-z-tooltip);
  width: max-content;
  max-width: 16rem;
  padding: .35rem .6rem;
  border-radius: 6px;
  background: var(--a-inverse-bg);
  color: var(--a-inverse-fg);
  font-size: var(--a-fs-xs);
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  box-shadow: 0 4px 12px -2px rgb(35 31 28 / .25);
  pointer-events: none;
}
.a-tip::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  background: inherit;
  transform: rotate(45deg);
}
.a-tip { bottom: calc(100% + 8px); left: 50%; translate: -50% 0; }
.a-tip::after { bottom: -4px; left: calc(50% - 4px); }
.a-tip--bottom { bottom: auto; top: calc(100% + 8px); }
.a-tip--bottom::after { bottom: auto; top: -4px; }
.a-tip--right { bottom: auto; left: calc(100% + 8px); top: 50%; translate: 0 -50%; }
.a-tip--right::after { bottom: auto; left: -4px; top: calc(50% - 4px); }
.a-tip--static { position: relative; bottom: auto; left: auto; top: auto; translate: none; display: inline-block; }
.a-tip kbd, .a-tip .a-kbd { background: transparent; color: inherit; border-color: var(--a-inverse-line); }
.a-tipwrap { position: relative; display: inline-flex; }
.a-tipwrap > .a-tip { opacity: 0; visibility: hidden; transition: opacity var(--d-1) var(--ease-out) 0s, visibility 0s linear var(--d-1); }
.a-tipwrap:hover > .a-tip, .a-tipwrap:focus-within > .a-tip {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--d-1) var(--ease-out) 350ms, visibility 0s linear 350ms;
}

/* ---- Toast ----------------------------------------------------------------------------------- */
.a-toasts {
  position: fixed;
  left: 50%;
  bottom: calc(var(--a-pad-5) + var(--safe-bottom));
  z-index: var(--a-z-toast);
  display: grid;
  justify-items: center;
  gap: .5rem;
  width: max-content;
  max-width: calc(100vw - 2rem);
  translate: -50% 0;
  pointer-events: none;
}
@media (max-width: 767.98px) { .a-toasts { bottom: calc(var(--a-bottomnav-h) + var(--safe-bottom) + .75rem); } }
.a-toast {
  --a-toast-icon: var(--a-inverse-accent);
  position: relative;
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 3.25rem;
  max-width: min(34rem, calc(100vw - 2rem));
  padding: .55rem .55rem .55rem 1rem;
  border-radius: 12px;
  background: var(--a-inverse-bg);
  color: var(--a-inverse-fg);
  font-size: var(--a-fs-base);
  line-height: 1.4;
  box-shadow: var(--a-shadow-pop);
  pointer-events: auto;
  animation: a-toast-in var(--d-3) var(--ease-out);
  overflow: hidden;
}
.a-toast::after {   /* der Stich */
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed color-mix(in srgb, var(--a-inverse-fg) 22%, transparent);
  border-radius: 9px;
  pointer-events: none;
}
.a-toast.is-leaving { animation: a-toast-out var(--d-2) var(--ease-in) forwards; }
.a-toast--ok { --a-toast-icon: #8FC0B8; }
.a-toast--attn { --a-toast-icon: #E9907F; }
.a-toast--info { --a-toast-icon: var(--a-inverse-accent); }
[data-theme="abend"] .a-toast--ok { --a-toast-icon: #2E6A5A; }
[data-theme="abend"] .a-toast--attn { --a-toast-icon: var(--c-krapp); }
.a-toast__icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--a-toast-icon) 18%, transparent);
  color: var(--a-toast-icon);
}
.a-toast__icon .a-ico { width: 1rem; height: 1rem; }
.a-toast__msg { flex: 1 1 auto; min-width: 0; }
.a-toast__msg strong { font-weight: 600; }
.a-toast__msg span { color: var(--a-inverse-fg-2); }
.a-toast__action {
  flex: none;
  min-height: 2.25rem;
  padding: 0 .85rem;
  border-radius: var(--r-pill);
  color: var(--a-inverse-accent);
  font-size: var(--a-fs-sm);
  font-weight: 650;
  letter-spacing: .01em;
  white-space: nowrap;
}
.a-toast__action:hover, .a-toast__action.is-hover { background: color-mix(in srgb, var(--a-inverse-fg) 10%, transparent); }
.a-toast__action:focus-visible { outline: 2px solid var(--a-inverse-accent); outline-offset: 1px; }
.a-toast__close { flex: none; }
.a-toast__close:focus-visible { outline-color: var(--a-inverse-accent); }
/* Handy: Text bekommt die volle Breite, „Rückgängig“ und × rücken in eine zweite Zeile rechts –
   sonst steht ein langer Hinweis als schmale Spalte mit sieben Zeilen da */
@media (max-width: 479.98px) {
  .a-toast:has(.a-toast__action) { flex-wrap: wrap; row-gap: .1rem; padding-block: .7rem .45rem; }
  .a-toast:has(.a-toast__action) .a-toast__icon { align-self: flex-start; }
  .a-toast:has(.a-toast__action) .a-toast__msg { flex-basis: calc(100% - 2.5rem); }
  .a-toast:has(.a-toast__action) .a-toast__action { margin-left: auto; }
}
/* Restzeit als Faden, der kürzer wird */
.a-toast__timer {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 2px;
  border-radius: 1px;
  background: var(--a-toast-icon);
  transform-origin: left;
  animation: a-timer var(--t, 6s) linear forwards;
}
.a-toast:hover .a-toast__timer, .a-toast:focus-within .a-toast__timer { animation-play-state: paused; }
@keyframes a-timer { to { transform: scaleX(0); } }
@keyframes a-toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes a-toast-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes a-fade { from { opacity: 0; } }
@keyframes a-pop-in { from { opacity: 0; transform: translateY(-6px) scale(.985); } }
@media (prefers-reduced-motion: reduce) {
  .a-toast__timer { animation: none; transform: scaleX(.6); }
}
.a-toast--static { animation: none; }
.a-toast--static .a-toast__timer { animation: none; transform: scaleX(.62); }

/* ---- Bestätigungsdialog (nur bei Unumkehrbarem) -------------------------------------------- */
.dialog.a-dialog { --dlg-max: 30rem; }
.a-dialog .dialog__panel { padding: 1.5rem 1.5rem 1.25rem; border-radius: var(--a-r-pop); background-color: var(--a-raised); }
.a-dialog .dialog__title { font-size: var(--a-fs-2xl); margin-top: .25rem; }
.a-dialog .dialog__body { font-size: var(--a-fs-base); line-height: var(--a-lh-text); }
.a-dialog .dialog__actions { justify-content: flex-end; margin-top: 1.5rem; gap: .5rem; }
.a-dialog .dialog__close { position: absolute; top: .6rem; right: .6rem; }
.a-dialog--danger .dialog__panel { box-shadow: var(--shadow-deep), inset 0 3px 0 var(--a-attn-fill); }
/* im Fluss (Stilblatt) */
.a-dialog--inline { display: block; position: relative; width: 100%; max-width: 30rem; margin: 0; }
.a-dialog--inline .dialog__panel { animation: none; box-shadow: var(--a-shadow-pop); }
/* Kontor-Dialoge erscheinen zügig: nach spätestens 180 ms ganz deckend (auch wenn die Seite
   dahinter gerade rechnet – keine halb durchsichtigen Dialoge über Text) */
.dialog.a-dialog:not(.a-dialog--inline) .dialog__panel { animation-duration: 180ms; }
.dialog.a-dialog::backdrop { animation-duration: 160ms; }
@media (prefers-reduced-motion: reduce) {
  .dialog.a-dialog .dialog__panel, .dialog.a-dialog::backdrop { animation: none; }
}

/* ---- Blatt (mobil „Mehr“, Auswahl) ------------------------------------------------------------ */
.a-sheet {
  position: fixed;
  inset: auto 0 0 0;
  z-index: var(--a-z-drawer);
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  background: var(--a-raised);
  color: var(--fg);
  box-shadow: 0 -12px 40px -12px rgb(35 31 28 / .3);
  transform: translateY(105%);
  visibility: hidden;
  transition: transform 420ms var(--ease-out), visibility 0s linear 420ms;
}
.a-sheet.is-open { transform: none; visibility: visible; transition: transform 420ms var(--ease-out), visibility 0s; }
.a-sheet--inline { position: relative; inset: auto; transform: none; visibility: visible; box-shadow: var(--a-shadow-pop); }
.a-sheet__grip { align-self: center; width: 40px; height: 4px; margin: 10px 0 2px; border-radius: 2px; background: var(--a-line-3); }
.a-sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem 1rem .75rem; }
.a-sheet__title { font-family: var(--font-display); font-size: var(--a-fs-xl); font-weight: 400; }
.a-sheet__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 1rem calc(1.25rem + var(--safe-bottom)); overscroll-behavior: contain; }
/* „Mehr“: Bereiche als Kacheln */
.a-sheet__nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; list-style: none; margin: 0; padding: 0; }
.a-sheet__nav a {
  position: relative;
  display: grid;
  justify-items: center;
  gap: .4rem;
  padding: .9rem .25rem .8rem;
  border-radius: 10px;
  background: var(--a-surface);
  box-shadow: var(--a-shadow-0);
  color: var(--fg);
  font-size: var(--a-fs-xs);
  font-weight: 500;
  text-align: center;
  text-decoration: none;
}
.a-sheet__nav a .a-ico { width: 1.375rem; height: 1.375rem; color: var(--fg-2); }
.a-sheet__nav a .a-badge { position: absolute; top: .4rem; right: .4rem; }
@media (prefers-reduced-motion: reduce) { .a-sheet, .a-sheet.is-open { transition: none; } }
