.assistant {
  --assistant-inset: var(--pad);
  --assistant-bottom: max(var(--assistant-inset), env(safe-area-inset-bottom));
  --assistant-gap: 12px;
  --assistant-toggle-size: 58px;
  --assistant-surface-offset: calc(var(--assistant-toggle-size) + var(--assistant-gap));
  --assistant-surface-inset: max(var(--assistant-inset), env(safe-area-inset-right));
  position: fixed;
  right: var(--assistant-surface-inset);
  bottom: var(--assistant-bottom);
  z-index: 60;
  font-family: var(--sans);
  color: var(--ink);
}

.assistant[hidden],
.assistant [hidden],
.assistant__toggle[hidden] {
  display: none;
}

.assistant__toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--assistant-toggle-size);
  height: var(--assistant-toggle-size);
  border-radius: 50%;
  background: var(--gold);
  color: var(--cream);
  box-shadow: 0 6px 20px rgba(68, 51, 28, 0.22);
  transition: background 0.3s var(--ease);
}

.assistant__toggle .ico {
  width: 27px;
  height: 27px;
  stroke-width: 1.7;
}

.assistant__toggle[aria-expanded="true"] {
  background: var(--taupe);
}

.assistant__surface {
  position: absolute;
  right: 0;
  bottom: var(--assistant-surface-offset);
  width: min(380px, calc(100vw - var(--assistant-surface-inset) - max(var(--assistant-inset), env(safe-area-inset-left))));
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: var(--bg);
  box-shadow: 0 16px 48px rgba(44, 42, 37, 0.2);
  animation: assistant-in 0.38s var(--ease) both;
}

@keyframes assistant-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.assistant__intro {
  width: min(340px, calc(100vw - var(--assistant-surface-inset) - max(var(--assistant-inset), env(safe-area-inset-left))));
  padding: 17px 15px 15px;
}

.assistant__intro::after {
  content: "";
  position: absolute;
  right: calc(var(--assistant-toggle-size) / 2 - 6px);
  bottom: -6px;
  width: 12px;
  height: 12px;
  transform: rotate(45deg);
  border-right: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
  background: var(--bg);
}

.assistant__intro h2 {
  margin: 0 31px 12px 0;
  color: var(--deep);
  font-family: var(--serif);
  font-size: clamp(1.2rem, 1.1rem + 0.45vw, 1.45rem);
  font-weight: 500;
  line-height: 1.24;
}

.assistant__close.x {
  width: 38px;
  height: 38px;
  border-color: transparent;
  background: transparent;
  color: var(--ink);
}

.assistant__close.x::before,
.assistant__close.x::after {
  width: 14px;
  margin-left: -7px;
}

.assistant__intro .assistant__close {
  position: absolute;
  top: 7px;
  right: 7px;
}

.assistant__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.assistant__chips .pill {
  min-height: 38px;
  padding: 0 10px;
  border-radius: 999px;
  border-color: var(--line);
  background: var(--bg-2);
  color: var(--deep);
  font-size: 0.75rem;
  font-weight: 600;
}

.assistant__panel {
  display: flex;
  flex-direction: column;
  height: 480px;
  max-height: calc(100dvh - var(--assistant-bottom) - var(--assistant-surface-offset) - 12px);
  overflow: hidden;
}

.assistant__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 13px 12px 18px;
  border-bottom: 1px solid var(--line-2);
}

.assistant__head h2 {
  color: var(--deep);
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.3;
}

.assistant__head h2:focus {
  outline: none;
}

.assistant__head p {
  font-size: 0.72rem;
  color: var(--taupe);
}

.assistant__body {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px;
}

.assistant__body:focus-visible {
  outline-offset: -2px;
}

.assistant__entry {
  display: grid;
  justify-items: start;
  gap: 7px;
  flex: none;
  max-width: 94%;
}

.assistant__entry--user {
  align-self: flex-end;
}

.assistant__message {
  max-width: 100%;
  padding: 9px 12px;
  border-radius: var(--r-md) var(--r-md) var(--r-md) 4px;
  background: var(--bg-2);
  font-size: var(--fs-sm);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.assistant__message--user {
  border-radius: var(--r-md) var(--r-md) 4px var(--r-md);
  background: var(--taupe);
  color: var(--white);
}

.assistant__message--pending {
  color: var(--taupe);
}

.assistant__card {
  width: min(290px, 100%);
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md) var(--r-md) var(--r-md) 4px;
  color: var(--deep);
  background: var(--white);
  line-height: 1.4;
}

.assistant__card--offer {
  border-color: var(--gold);
  background: var(--cream);
}

.assistant__offer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.assistant__card-title {
  font-size: 0.75rem;
  font-weight: 750;
}

.assistant__offer-service,
.assistant__offer-until {
  font-size: 0.75rem;
  color: var(--taupe-2);
}

.assistant__offer-service {
  margin-top: 3px;
}

.assistant__discount {
  flex: none;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(176, 141, 87, 0.23);
  font-size: 0.75rem;
  font-weight: 750;
  white-space: nowrap;
}

.assistant__offer-prices {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 3px 8px;
  margin: 7px 0 4px;
  white-space: nowrap;
}

.assistant__offer-prices strong {
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1.15;
}

.assistant__offer-prices s {
  font-size: var(--fs-sm);
  color: var(--taupe-2);
}

.assistant__place {
  display: flex;
  gap: 9px;
  align-items: center;
}

.assistant__place-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--taupe-2);
}

.assistant__place-icon .ico {
  width: 18px;
  height: 18px;
  stroke-width: 1.65;
}

.assistant__address {
  margin-top: 2px;
  font-size: 0.88rem;
  font-weight: 700;
}

.assistant__location-actions {
  display: grid;
  gap: 6px;
  margin-top: 11px;
}

.assistant__location-actions .pill {
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding-inline: 11px;
  border-color: var(--line-2);
  border-radius: 12px;
  background: var(--bg-2);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: normal;
}

.assistant__location-actions .ico {
  width: 15px;
  height: 15px;
  stroke-width: 1.7;
}

.assistant__location-actions .assistant__route {
  border-color: var(--taupe);
  background: var(--taupe);
  color: var(--white);
}

.assistant__form {
  padding: 10px 14px 12px;
  border-top: 1px solid var(--line-2);
}

.assistant__error.bk__err {
  margin: 0 0 8px;
  padding: 6px 10px;
  font-size: var(--fs-sm);
}

.assistant__compose {
  position: relative;
}

.assistant__compose .qsearch__in {
  min-height: 44px;
  padding: 0 48px 0 13px;
  border-radius: var(--r-md);
  font-size: 1rem;
}

.assistant__compose .qsearch__in::placeholder {
  color: var(--taupe);
  font-size: var(--fs-sm);
}

.assistant__send {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 13px 3px 13px 3px;
  background: var(--taupe);
  color: var(--white);
  font-size: 1.2rem;
  line-height: 1;
  transition: background 0.3s var(--ease);
}

.assistant__send:disabled {
  cursor: default;
  opacity: 0.6;
}

.assistant__note {
  margin: 6px 2px 0;
  color: var(--taupe);
  font-size: 0.68rem;
  line-height: 1.4;
}

#fab {
  right: auto;
  left: max(clamp(16px, 2vw, 32px), env(safe-area-inset-left));
}

body.is-locked #fab,
body.is-locked #mbar,
body.is-locked .assistant {
  visibility: hidden;
}

@media (min-width: 1001px) {
  body:has(#cookie.is-on) #fab {
    bottom: calc(clamp(10px, 2vw, 32px) + var(--assistant-cookie-height, 100px) + 12px);
  }
}

.mbar--assistant .assistant__toggle {
  display: none;
}

@media (max-width: 1000px) {
  body {
    --assistant-mobile-action: 44px;
    --assistant-mobile-bar-height: calc(var(--assistant-mobile-action) + 10px);
    --assistant-mobile-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .mbar--assistant {
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    gap: 4px;
    grid-template-columns: minmax(0, 1fr) repeat(2, auto);
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(44, 42, 37, 0.15);
  }

  .mbar--assistant .btn {
    min-height: var(--assistant-mobile-action);
    padding-inline: 10px;
    border-radius: 13px;
    font-weight: 600;
  }

  .mbar--assistant .btn__arrow {
    display: none;
  }

  .mbar--assistant .mbar__ic,
  .mbar--assistant .assistant__toggle {
    width: var(--assistant-mobile-action);
    height: var(--assistant-mobile-action);
    box-shadow: none;
  }

  .mbar--assistant .mbar__ic--call {
    border-color: var(--line-2);
    background: var(--bg-2);
    color: var(--taupe-2);
  }

  .mbar--assistant .mbar__ic--call::after {
    content: none;
  }

  .mbar--assistant .mbar__ic--call .ico {
    animation: none;
  }

  .mbar--assistant .assistant__toggle:not([hidden]) {
    display: grid;
  }

  .mbar--assistant .assistant__toggle .ico {
    width: 23px;
    height: 23px;
  }

  .mbar--assistant :focus-visible {
    outline-offset: -4px;
    outline-color: currentColor;
  }

  .assistant--mobile-bar {
    --assistant-toggle-size: var(--assistant-mobile-action);
    --assistant-surface-offset: 0px;
    --assistant-surface-inset: calc(max(10px, env(safe-area-inset-right)) + 5px);
    --assistant-bottom: calc(var(--assistant-mobile-bottom) + var(--assistant-mobile-bar-height) + var(--assistant-gap));
    z-index: 80;
  }

  .assistant--mobile-bar > .assistant__toggle {
    display: none;
  }

  #cookie {
    bottom: calc(var(--assistant-mobile-bottom) + var(--assistant-mobile-bar-height) + 8px);
  }

  body:has(#cookie.is-on) .assistant--mobile-bar {
    --assistant-surface-offset: calc(var(--assistant-cookie-height, 100px) + 8px);
  }

  body:has(#cookie.is-on) .assistant__intro::after {
    content: none;
  }
}

@media (max-width: 600px) {
  .assistant {
    --assistant-inset: 12px;
    --assistant-gap: 11px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .assistant__toggle:hover {
    background: var(--taupe);
  }

  .assistant__chips .pill:hover,
  .assistant__close.x:hover {
    border-color: var(--line);
    background: var(--card-2);
    color: var(--deep);
  }

  .assistant__send:hover:enabled {
    background: var(--taupe-2);
  }

  .assistant__location-actions .pill:hover {
    border-color: var(--line);
    background: var(--card-2);
    color: var(--deep);
  }

  .assistant__location-actions .assistant__route:hover {
    border-color: var(--taupe-2);
    background: var(--taupe-2);
    color: var(--white);
  }
}
