:root {
  --utility-offset: 14px;
  --utility-bottom: calc(var(--utility-offset) + env(safe-area-inset-bottom, 0px));
}

.contact-widget {
  position: fixed;
  z-index: 32;
  inset: auto max(14px, env(safe-area-inset-right)) var(--utility-bottom) auto;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  box-shadow: 0 4px 15px #0002;
}
:root body .contact-widget :is(button, a) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  color: var(--fg);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
:root body .contact-widget button[hidden] { display: none; }
:root body .contact-widget :is(button, a):is(:hover, :focus-visible) {
  background: var(--section-tint);
  color: var(--accent);
}
.contact-widget svg,
.contact-chat-head svg {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
:root body .contact-widget .contact-widget-chat {
  background: linear-gradient(var(--button-active-top), var(--button-active-bottom));
  color: var(--button-active-ink);
}
:root body .contact-widget .contact-widget-chat:is(:hover,:focus-visible) {
  background: var(--button-active-bottom);
  color: var(--button-active-ink);
}

:root body .contact-chat {
  position: fixed;
  inset: auto max(14px, env(safe-area-inset-right)) calc(var(--utility-bottom) + 60px) auto;
  width: min(412px, calc(100% - 28px));
  max-width: none;
  max-height: calc(100dvh - var(--utility-bottom) - 72px);
  margin: 0;
  padding: clamp(15px, 4vw, 22px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--fg);
  box-shadow: 0 16px 52px #0005;
  opacity: 1;
  animation: none;
}
.contact-chat::backdrop { background: #0006; }
.contact-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.contact-chat-head h2 { margin: 0; font-size: 22px; line-height: 1.15; }
:root body :is(.contact-chat,.mobile-settings) .contact-chat-close {
  flex: none;
  width: 44px;
  min-height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.contact-chat > p { margin: 8px 0 17px; font-size: 14px; line-height: 1.5; }
.contact-chat-form { display: grid; gap: 12px; }
.contact-chat-form label { display: grid; gap: 4px; min-width: 0; font-size: 13px; font-weight: 600; }
.contact-chat-identity { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.contact-chat-form :is(input:not([type="hidden"]), textarea) {
  width: 100%;
  min-height: 44px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--fg);
  background: var(--section-tint);
  font: inherit;
  font-size: 16px;
  font-weight: 400;
}
.contact-chat-form textarea { resize: vertical; }
.contact-chat-form .btn { min-height: 44px; justify-self: start; }
.contact-chat-status { margin: 0; font-size: 14px; }
.contact-chat-status:empty { display: none; }
@media (max-width: 760px), (max-width: 1100px) and (pointer: coarse) {
  :root { --utility-offset: 88px; }
  :root body .contact-chat {
    inset-block-end: var(--utility-bottom);
    max-height: calc(100dvh - var(--utility-bottom) - 14px);
  }
}
@media (max-width: 440px) {
  .contact-widget-whatsapp span { display: none; }
}
@media print {
  .contact-widget, .contact-chat, .mobile-settings, .mobile-settings-open { display: none !important; }
}


.theme-choice,
:root body .mobile-settings-open[hidden] { display: none; }

:root body .mobile-settings-open {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border-radius: 7px;
}
.mobile-settings-open svg { width: 21px; height: 21px; }

:root body .mobile-settings {
  position: fixed;
  inset: 0;
  width: min(366px, calc(100% - 28px));
  min-width: 0;
  max-width: none;
  height: fit-content;
  max-height: calc(100dvh - 28px);
  margin: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--fg);
  opacity: 1;
  animation: none;
  overflow: auto;
  box-shadow: 0 16px 52px #0005;
}
.mobile-settings::backdrop { background: #0007; }
.mobile-settings .contact-chat-head { margin-bottom: 14px; }
.mobile-settings-theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  border-top: 1px solid var(--line);
}
:root body .mobile-settings .theme-toggle {
  display: inline-flex;
  width: auto;
  min-width: 85px;
  min-height: 44px;
  justify-content: center;
  padding-inline: 11px;
  gap: 7px;
}
.mobile-settings .theme-choice { display: inline; }
.mobile-settings-audio { border-top: 1px solid var(--line); padding-top: 14px; }
.mobile-settings-audio h3 { margin: 0 0 8px; font-size: 15px; font-weight: 620; }

@media (max-width: 760px), (max-width: 1100px) and (pointer: coarse) {
  body > .contact-widget, .header-tools > .theme-toggle { display: none; }
  .site-header .header-tools .contact-widget {
    position: static;
    gap: 3px;
    flex: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  :root body .site-header .contact-widget :is(button, a) { border-radius: 7px; padding-inline: 8px; }
}
@media (max-width: 350px) {
  .site-header .contact-widget-chat span { display: none; }
}
