#altrom-chat-root {
  position: fixed;
  right: clamp(1rem, 2vw, 1.5rem);
  left: auto;
  bottom: clamp(1rem, 2vh, 1.5rem);
  z-index: 990;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.altrom-chat-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  max-width: min(19.5rem, calc(100vw - 1.5rem));
  padding: 0.65rem 1rem;
  border: 2px solid #f39314;
  border-radius: 12px;
  background: #00276a;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.18;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 39, 106, 0.28);
  animation: altrom-chat-pulse 2.5s ease-in-out infinite;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.altrom-chat-btn::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 2px solid #f39314;
  border-radius: 16px;
  pointer-events: none;
  animation: altrom-chat-ring 2.5s ease-out infinite;
}

.altrom-chat-btn:hover,
.altrom-chat-btn.is-open,
.altrom-chat-btn.is-seen,
.altrom-chat-btn:hover::after,
.altrom-chat-btn.is-open::after,
.altrom-chat-btn.is-seen::after {
  animation: none;
}

.altrom-chat-btn-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.altrom-chat-btn-title {
  font-size: 0.96rem;
  font-weight: 700;
}

.altrom-chat-btn-sub {
  margin-top: 0.12rem;
  color: #f9b252;
  font-size: 0.8rem;
  font-weight: 600;
}

.altrom-chat-btn-icon {
  flex: none;
  color: #f39314;
  transition: color 0.16s ease;
}

.altrom-chat-btn:hover {
  background: #f39314;
  color: #001a49;
}

.altrom-chat-btn:hover .altrom-chat-btn-icon,
.altrom-chat-btn:hover .altrom-chat-btn-sub {
  color: #001a49;
}

.altrom-chat-btn:active {
  transform: translateY(1px);
}

@keyframes altrom-chat-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}

@keyframes altrom-chat-ring {
  0% {
    opacity: 0.65;
    transform: scale(0.98);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(1.1);
  }
}

.altrom-chat-btn:focus-visible {
  outline: 3px solid #f39314;
  outline-offset: 3px;
}

.altrom-chat-panel {
  display: none;
  width: min(385px, calc(100vw - 1.5rem));
  height: min(475px, calc(100svh - 6.5rem));
  margin-bottom: 0.65rem;
  border: 1px solid #00276a;
  border-radius: 16px;
  background: #f4f7fc;
  color: #1b2738;
  overflow: hidden;
  flex-direction: column;
  box-shadow: 0 22px 54px rgba(0, 26, 73, 0.3);
}

.altrom-chat-panel.open {
  display: flex;
}

.altrom-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: #00276a;
  color: #ffffff;
  font-size: 0.98rem;
  font-weight: 700;
}

.altrom-chat-head-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.altrom-chat-head-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f39314;
  box-shadow: 0 0 0 3px rgba(243, 147, 20, 0.25);
}

.altrom-chat-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font: inherit;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.altrom-chat-close:hover {
  background: #f39314;
  border-color: #f39314;
  color: #001a49;
}

.altrom-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem;
  background: #f4f7fc;
}

.altrom-chat-msg {
  margin: 0 0 0.6rem;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  max-width: 90%;
  line-height: 1.46;
  font-size: 0.95rem;
}

.altrom-chat-msg-text {
  margin: 0;
  white-space: pre-line;
}

.altrom-chat-msg.bot {
  background: #ffffff;
  color: #1b2738;
  border: 1px solid #dce4f0;
}

.altrom-chat-msg.user {
  margin-left: auto;
  background: #00276a;
  color: #ffffff;
  font-weight: 500;
}

.altrom-chat-inline-link {
  color: #00276a;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.altrom-chat-inline-link:hover {
  color: #db7f07;
}

.altrom-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.15rem 0 0.65rem;
}

.altrom-chat-chip {
  padding: 0.38rem 0.68rem;
  border: 1px solid #c6d4ea;
  border-radius: 999px;
  background: #ffffff;
  color: #00276a;
  font: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.altrom-chat-chip:hover {
  background: #00276a;
  border-color: #00276a;
  color: #ffffff;
}

.altrom-chat-read {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.42rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #00276a;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.altrom-chat-read span {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.altrom-chat-read-icon {
  flex: none;
}

.altrom-chat-read:hover {
  color: #db7f07;
}

.altrom-chat-note {
  margin: 0;
  padding: 0.38rem 0.9rem 0.42rem;
  background: #e6eef9;
  color: #425268;
  font-size: 0.8rem;
  line-height: 1.35;
  border-top: 1px solid #dce4f0;
}

.altrom-chat-mic-status {
  margin: 0;
  padding: 0 0.9rem 0.45rem;
  background: #e6eef9;
  color: #9a5200;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}

.altrom-chat-mic-status:empty {
  display: none;
}

.altrom-chat-form {
  display: flex;
  align-items: flex-end;
  flex: none;
  gap: 0.45rem;
  padding: 0.6rem;
  background: #e6eef9;
}

.altrom-chat-form textarea {
  flex: 1;
  min-width: 0;
  max-height: 7.5rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid #c6d4ea;
  border-radius: 10px;
  background: #ffffff;
  color: #1b2738;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
  resize: none;
  overflow-y: hidden;
}

.altrom-chat-form textarea:focus {
  outline: 2px solid #00276a;
  border-color: #00276a;
}

.altrom-chat-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-sizing: border-box;
  height: 2.6rem;
  padding: 0 1rem;
  border: 0;
  border-radius: 10px;
  background: #f39314;
  color: #001a49;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.altrom-chat-form button:hover {
  background: #db7f07;
  color: #ffffff;
}

.altrom-chat-form button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.altrom-chat-form .altrom-chat-mic {
  width: 2.6rem;
  padding: 0;
  background: #00276a;
  color: #ffffff;
}

.altrom-chat-form .altrom-chat-mic:hover {
  background: #001a49;
  color: #ffffff;
}

.altrom-chat-form .altrom-chat-mic.is-listening {
  background: #dc2626;
  color: #ffffff;
}

@media (max-width: 680px) {
  #altrom-chat-root {
    right: 12px;
    bottom: 74px;
  }

  .altrom-chat-panel {
    width: calc(100vw - 24px);
    height: min(430px, calc(100svh - 9.5rem));
  }

  .altrom-chat-btn {
    padding: 0.52rem 0.78rem;
  }

  .altrom-chat-btn-title {
    font-size: 0.88rem;
  }

  .altrom-chat-btn-sub {
    font-size: 0.73rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .altrom-chat-btn,
  .altrom-chat-btn::after {
    animation: none;
  }
}
