.maychi-chat-root {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  letter-spacing: 0;
}

.maychi-chat-root [hidden] {
  display: none !important;
}

.maychi-chat-root button,
.maychi-chat-root input,
.maychi-chat-root textarea {
  font: inherit;
  letter-spacing: 0;
}

.maychi-chat-root button {
  box-shadow: none;
}

.maychi-chat-root .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.maychi-chat-launcher {
  position: absolute;
  right: 26px;
  bottom: 26px;
  display: grid;
  width: 64px;
  height: 64px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  color: #ffffff;
  background: var(--brand, #ea501a);
  box-shadow: 0 18px 40px rgba(123, 42, 15, 0.28);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 160ms ease;
}

.maychi-chat-launcher:hover {
  transform: scale(1.055);
  box-shadow: 0 22px 48px rgba(123, 42, 15, 0.34);
}

.maychi-chat-launcher:focus-visible,
.maychi-chat-icon-button:focus-visible,
.maychi-chat-root a:focus-visible,
.maychi-chat-root button:focus-visible,
.maychi-chat-root input:focus-visible,
.maychi-chat-root textarea:focus-visible {
  outline: 3px solid rgba(234, 80, 26, 0.3);
  outline-offset: 3px;
}

.maychi-chat-launcher-icon,
.maychi-chat-launcher-icon svg {
  display: block;
  width: 30px;
  height: 30px;
}

.maychi-chat-launcher-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.maychi-chat-unread {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #d92525;
}

.maychi-chat-root.is-open .maychi-chat-launcher {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.88);
}

.maychi-chat-panel {
  position: absolute;
  right: 24px;
  bottom: 24px;
  display: flex;
  width: min(410px, calc(100vw - 48px));
  height: min(650px, calc(100dvh - 140px));
  min-height: 520px;
  max-height: calc(100dvh - 100px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 24px;
  color: #171717;
  background: #ffffff;
  box-shadow: 0 30px 80px rgba(17, 17, 17, 0.2);
  pointer-events: auto;
  transform-origin: right bottom;
  animation: maychi-chat-open 220ms ease both;
}

.maychi-chat-header {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px 14px 18px;
  color: #ffffff;
  background: #151515;
}

.maychi-chat-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.maychi-chat-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--brand, #ea501a);
  font-size: 20px;
  font-weight: 900;
}

.maychi-chat-identity-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.maychi-chat-identity-copy strong {
  font-size: 16px;
  font-weight: 900;
  line-height: 1.1;
}

.maychi-chat-identity-copy small {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 700;
}

.maychi-chat-identity-copy small i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #47c97a;
  box-shadow: 0 0 0 4px rgba(71, 201, 122, 0.12);
}

.maychi-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.maychi-chat-icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.82);
  background: transparent;
  cursor: pointer;
}

.maychi-chat-icon-button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.maychi-chat-icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.maychi-chat-content {
  min-height: 0;
  flex: 1;
  background: #ffffff;
}

.maychi-chat-loading {
  display: grid;
  height: 100%;
  min-height: 300px;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 28px;
  color: #5f6368;
  text-align: center;
}

.maychi-chat-loading p {
  margin: 0;
  font-size: 14px;
}

.maychi-chat-spinner,
.maychi-chat-button-spinner {
  display: inline-block;
  border-radius: 50%;
  animation: maychi-chat-spin 700ms linear infinite;
}

.maychi-chat-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(234, 80, 26, 0.16);
  border-top-color: var(--brand, #ea501a);
}

.maychi-chat-button-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
}

.maychi-chat-gate {
  height: 100%;
  overflow-y: auto;
  padding: 28px;
  scrollbar-width: thin;
  scrollbar-color: rgba(17, 17, 17, 0.2) transparent;
}

.maychi-chat-gate-heading {
  margin-bottom: 26px;
}

.maychi-chat-step {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border-radius: 6px;
  color: var(--brand-dark, #bb3d12);
  background: rgba(234, 80, 26, 0.1);
  font-size: 11px;
  font-weight: 900;
}

.maychi-chat-gate-heading h2 {
  margin: 16px 0 10px;
  color: #111111;
  font-size: 25px;
  font-weight: 900;
  line-height: 1.2;
}

.maychi-chat-gate-heading p,
.maychi-chat-privacy {
  color: #5f6368;
  font-size: 13px;
  line-height: 1.65;
}

.maychi-chat-gate-heading p {
  margin: 0;
}

.maychi-chat-form {
  display: grid;
  gap: 10px;
}

.maychi-chat-form > label {
  color: #272727;
  font-size: 13px;
  font-weight: 850;
}

.maychi-chat-phone-field {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  overflow: hidden;
  border: 1px solid #d9dce1;
  border-radius: 10px;
  background: #ffffff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.maychi-chat-phone-field:focus-within {
  border-color: var(--brand, #ea501a);
  box-shadow: 0 0 0 3px rgba(234, 80, 26, 0.1);
}

.maychi-chat-phone-field > span {
  display: grid;
  min-height: 48px;
  place-items: center;
  border-right: 1px solid #e5e7eb;
  color: #242424;
  background: #f5f6f8;
  font-size: 14px;
  font-weight: 900;
}

.maychi-chat-phone-field input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 0;
  color: #171717;
  background: #ffffff;
  outline: 0;
  font-size: 16px;
}

.maychi-chat-phone-field input {
  padding: 0 14px;
}

.maychi-chat-primary {
  display: inline-flex;
  min-height: 48px;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 6px;
  padding: 11px 18px;
  border-radius: 10px;
  color: #ffffff;
  background: var(--brand, #ea501a);
  box-shadow: none;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.maychi-chat-primary:hover:not(:disabled) {
  background: var(--brand-dark, #bb3d12);
  box-shadow: none;
  transform: translateY(-1px);
}

.maychi-chat-primary:disabled,
.maychi-chat-root button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.maychi-chat-error,
.maychi-chat-composer-error {
  margin: 0;
  color: #b42318;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.5;
}

.maychi-chat-privacy {
  margin: 24px 0 0;
  padding-top: 18px;
  border-top: 1px solid #eceef1;
  font-size: 12px;
}

.maychi-chat-privacy a {
  color: var(--brand-dark, #bb3d12);
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.maychi-chat-conversation {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  background: #f6f7f9;
}

.maychi-chat-messages {
  min-height: 140px;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 18px 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(17, 17, 17, 0.2) transparent;
}

.maychi-chat-message {
  display: flex;
  max-width: 88%;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.maychi-chat-message.is-assistant {
  margin-right: auto;
  justify-content: flex-start;
}

.maychi-chat-message.is-user {
  margin-left: auto;
  justify-content: flex-end;
}

.maychi-chat-bubble {
  max-width: 100%;
  padding: 11px 13px;
  border: 1px solid rgba(17, 17, 17, 0.07);
  border-radius: 12px;
  color: #2e3136;
  background: #ffffff;
  box-shadow: 0 5px 14px rgba(17, 17, 17, 0.035);
  font-size: 13px;
  line-height: 1.58;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.maychi-chat-message.is-user .maychi-chat-bubble {
  border-color: rgba(234, 80, 26, 0.16);
  color: #762c12;
  background: #fff0e8;
}

.maychi-chat-bubble a {
  color: var(--brand-dark, #bb3d12);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.maychi-chat-message.is-failed .maychi-chat-bubble {
  border-color: rgba(180, 35, 24, 0.24);
}

.maychi-chat-retry {
  padding: 4px 8px;
  border: 1px solid rgba(180, 35, 24, 0.24);
  border-radius: 6px;
  color: #b42318;
  background: #ffffff;
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}

.maychi-chat-message.is-typing .maychi-chat-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 54px;
  min-height: 38px;
}

.maychi-chat-message.is-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8b8f96;
  animation: maychi-chat-typing 1s ease-in-out infinite;
}

.maychi-chat-message.is-typing i:nth-child(2) {
  animation-delay: 120ms;
}

.maychi-chat-message.is-typing i:nth-child(3) {
  animation-delay: 240ms;
}

.maychi-chat-specialist {
  flex: 0 0 auto;
  margin: 0 18px 10px;
  border: 1px solid #e1e3e7;
  border-radius: 10px;
  background: #ffffff;
}

.maychi-chat-specialist summary {
  padding: 10px 12px;
  color: #272727;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.maychi-chat-specialist-panel {
  padding: 0 12px 12px;
  border-top: 1px solid #eceef1;
}

.maychi-chat-specialist-panel p {
  margin: 10px 0;
  color: #686d73;
  font-size: 11px;
  line-height: 1.5;
}

.maychi-chat-specialist-panel > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.maychi-chat-specialist-panel a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 6px 7px;
  border-radius: 6px;
  color: #ffffff;
  background: #252525;
  font-size: 10px;
  font-weight: 850;
  text-align: center;
}

.maychi-chat-specialist-panel a:first-child {
  background: #176b42;
}

.maychi-chat-specialist-panel a:last-child {
  background: var(--brand, #ea501a);
}

.maychi-chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: end;
  gap: 8px;
  flex: 0 0 auto;
  padding: 12px 14px 14px;
  border-top: 1px solid #e2e4e8;
  background: #ffffff;
}

.maychi-chat-composer textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  max-height: 112px;
  resize: none;
  padding: 10px 12px;
  overflow-y: auto;
  border: 1px solid #d9dce1;
  border-radius: 9px;
  color: #1f1f1f;
  background: #ffffff;
  font-size: 13px;
  line-height: 1.45;
}

.maychi-chat-composer textarea:focus {
  border-color: var(--brand, #ea501a);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(234, 80, 26, 0.1);
}

.maychi-chat-root .maychi-chat-composer button[type="submit"] {
  display: grid;
  min-width: 42px;
  min-height: 42px;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border-radius: 9px;
  color: #ffffff;
  background: var(--brand, #ea501a);
  box-shadow: none;
  cursor: pointer;
}

.maychi-chat-root .maychi-chat-composer button[type="submit"]:hover:not(:disabled) {
  background: var(--brand-dark, #bb3d12);
  box-shadow: none;
}

.maychi-chat-root .maychi-chat-composer button[type="submit"] svg {
  display: block;
  max-width: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.maychi-chat-composer-error {
  flex: 0 0 auto;
  margin: -8px 14px 10px;
  padding: 0 2px;
}

body.maychi-chat-ready .back-to-top {
  bottom: 102px;
}

body.maychi-chat-widget-open .back-to-top {
  opacity: 0 !important;
  pointer-events: none !important;
}

@keyframes maychi-chat-open {
  from { opacity: 0; transform: translateY(14px) scale(0.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes maychi-chat-spin {
  to { transform: rotate(360deg); }
}

@keyframes maychi-chat-typing {
  0%, 70%, 100% { opacity: 0.35; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-3px); }
}

@media (max-width: 700px) {
  .maychi-chat-launcher {
    right: 16px;
    bottom: 16px;
    width: 58px;
    height: 58px;
  }

  .maychi-chat-panel {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    height: min(82dvh, 720px);
    min-height: min(520px, calc(100dvh - 24px));
    max-height: calc(100dvh - 24px);
    border-radius: 22px;
  }

  .maychi-chat-header {
    min-height: 70px;
    padding: 12px 12px 12px 14px;
  }

  .maychi-chat-mark {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .maychi-chat-gate {
    padding: 24px 20px;
  }

  .maychi-chat-gate-heading h2 {
    font-size: 23px;
  }

  .maychi-chat-messages {
    padding: 16px 14px 12px;
  }

  .maychi-chat-specialist {
    margin-right: 14px;
    margin-left: 14px;
  }

  .maychi-chat-composer {
    padding: 10px 12px max(12px, env(safe-area-inset-bottom));
  }

  body.maychi-chat-widget-open {
    overflow: hidden;
  }

  body.maychi-chat-ready .back-to-top {
    right: 20px;
    bottom: 86px;
  }
}

@media (max-width: 390px) {
  .maychi-chat-panel {
    right: 10px;
    bottom: 10px;
    left: 10px;
    height: min(83dvh, 700px);
    max-height: calc(100dvh - 20px);
    border-radius: 20px;
  }

  .maychi-chat-specialist-panel > div {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .maychi-chat-panel,
  .maychi-chat-launcher,
  .maychi-chat-spinner,
  .maychi-chat-button-spinner,
  .maychi-chat-message.is-typing i {
    animation: none;
    transition: none;
  }
}
