:root {
  --chat-ink: var(--color-primary, #190945);
  --chat-blue: var(--color-secondary, #0b57e3);
  --chat-paper: #ffffff;
  --chat-soft: #f5f7fb;
  --chat-text: #303746;
  --chat-line: #e7eaf1;
  --chat-shadow: 0 24px 65px rgba(25, 9, 69, 0.2);
}

#chat-circle {
  position: fixed;
  right: 34px;
  bottom: 30px;
  z-index: 999;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 4px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: var(--bg-gradient, linear-gradient(90deg, #0b57e3, #190945));
  box-shadow: 0 14px 32px rgba(25, 9, 69, 0.3);
  color: var(--chat-paper);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

#chat-circle:hover,
#chat-circle:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(25, 9, 69, 0.36);
  outline: none;
}

.chat-circle-icon {
  font-size: 22px;
  line-height: 1;
}

.chat-circle-status {
  position: absolute;
  top: 3px;
  right: 2px;
  width: 13px;
  height: 13px;
  border: 3px solid var(--chat-paper);
  border-radius: 50%;
  background: #57b33e;
}

.chat-widget-label {
  position: fixed;
  right: 112px;
  bottom: 48px;
  z-index: 998;
  padding: 10px 15px;
  border: 1px solid var(--chat-line);
  border-radius: 4px;
  background: var(--chat-paper);
  color: var(--chat-ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 25px rgba(25, 9, 69, 0.12);
}

.chat-widget-label::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -6px;
  width: 10px;
  height: 10px;
  border-top: 1px solid var(--chat-line);
  border-right: 1px solid var(--chat-line);
  background: var(--chat-paper);
  transform: translateY(-50%) rotate(45deg);
}

.chat-box {
  position: fixed;
  right: 30px;
  bottom: 30px;
  z-index: 1000;
  display: none;
  width: 390px;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  border: 1px solid rgba(25, 9, 69, 0.08);
  border-radius: 10px;
  background: var(--chat-paper);
  box-shadow: var(--chat-shadow);
}

.chat-box-header {
  min-height: 78px;
  padding: 15px 18px;
  color: var(--chat-paper);
  background: var(--bg-gradient, linear-gradient(90deg, #0b57e3, #190945));
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-agent {
  display: flex;
  align-items: center;
  gap: 11px;
}

.chat-agent-avatar {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.chat-agent-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chat-agent-copy b {
  font-size: 14px;
  line-height: 1.2;
}

.chat-agent-copy small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
}

.chat-online-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: #72d65a;
}

.chat-box-toggle {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: transparent;
  color: var(--chat-paper);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  transition: background 0.2s ease;
}

.chat-box-toggle:hover,
.chat-box-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

.chat-box-body {
  position: relative;
  overflow: hidden;
  background: var(--chat-soft);
}

.chat-logs {
  height: 460px;
  margin: 0;
  padding: 20px 16px 14px;
  overflow-y: auto;
  color: var(--chat-text) !important;
  background: radial-gradient(circle at 0 0, rgba(11, 87, 227, 0.06), transparent 34%), var(--chat-soft);
}

.chat-logs::-webkit-scrollbar {
  width: 5px;
}

.chat-logs::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: #cbd2e0;
}

.chat-logs p {
  margin-bottom: 8px;
  color: var(--chat-text) !important;
  line-height: 1.55;
}

.chat-msg,
.chat-msg-bot {
  clear: both;
  display: flow-root;
}

.cm-msg-text,
.cm-msg-bot {
  max-width: 86%;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--chat-line);
  border-radius: 4px 14px 14px 14px;
  background: var(--chat-paper);
  box-shadow: 0 5px 14px rgba(25, 9, 69, 0.05);
  float: left;
  font-size: 13px;
  word-wrap: break-word;
}

.chat-msg.self > .cm-msg-text {
  margin-right: 0;
  margin-left: 14%;
  border: 0;
  border-radius: 14px 4px 14px 14px;
  background: var(--bg-gradient, linear-gradient(90deg, #0b57e3, #190945));
  color: var(--chat-paper);
  float: right;
}

.cm-msg-bot ul {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.message-help {
  display: grid;
  gap: 7px;
  margin: 12px 0 14px;
  padding: 0;
  list-style: none;
}

.message-help li {
  list-style: none !important;

}

.message-help li a {
  display: block;
  padding: 9px 11px;
  border: 1px solid #dfe5f0;
  border-radius: 4px;
  background: var(--chat-paper);
  color: var(--chat-text) !important;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    text-align: left;
}

.message-help li a:hover,
.message-help li a:focus-visible {
  border-color: var(--chat-blue);
  color: var(--chat-blue);
  transform: translateX(2px);
  outline: none;
}

.chat-input {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--chat-line);
  background: var(--chat-paper);
}

.chat-input > form {
  position: relative;
  margin: 0;
}

#chat-input {
  width: 100%;
  height: 46px;
  padding: 10px 52px 10px 14px;
  border: 1px solid #dfe5f0;
  border-radius: 4px;
  outline: none;
  background: var(--chat-soft);
  font-size: 13px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

#chat-input:focus {
  border-color: var(--chat-blue);
  background: var(--chat-paper);
}

#chat-input::placeholder {
  color: #9299a8;
}

.chat-submit {
  position: absolute !important;
  right: 5px;
  bottom: 4px;
  width: 38px !important;
  height: 38px !important;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--chat-blue);
  color: var(--chat-paper);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.chat-submit:hover,
.chat-submit:focus-visible {
  background: var(--chat-ink);
  transform: translateY(-1px);
  outline: none;
}

@media only screen and (max-width: 500px) {
  #chat-circle {
    right: 18px;
    bottom: 18px;
  }

  .chat-widget-label {
    right: 88px;
    bottom: 35px;
    padding: 8px 11px;
    font-size: 11px;
  }

  .chat-box {
    right: 12px;
    bottom: 12px;
    max-width: calc(100vw - 24px);
  }

  .chat-logs {
    height: min(60vh, 460px);
  }
}
