:root {
  --rkm-ai-navy: #071f3b;
  --rkm-ai-navy-2: #0b3e64;
  --rkm-ai-maroon: #7a1730;
  --rkm-ai-gold: #d9ad55;
  --rkm-ai-green: #16894b;
  --rkm-ai-text: #17324d;
  --rkm-ai-muted: #718195;
  --rkm-ai-line: rgba(7, 31, 59, .11);
  --rkm-ai-bg: #f5f8fb;
}

.rkm-ai-overlay[hidden],
.rkm-ai-panel[hidden],
.rkm-ai-typing[hidden] {
  display: none !important;
}

/* Hide only the three fixed service tabs while the AI panel is open. */
.rkm-ai-suppressed-fixed {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateX(120%) !important;
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s !important;
}

.rkm-ai-overlay {
  position: fixed;
  inset: 0;
  z-index: 10008;
  background: rgba(3, 15, 28, .34);
  opacity: 0;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition: opacity .2s ease;
}

.rkm-ai-overlay.is-open {
  opacity: 1;
}

.rkm-ai-panel {
  position: fixed;
  right: 18px;
  bottom: 76px;
  z-index: 10010;
  display: flex;
  flex-direction: column;
  width: min(392px, calc(100vw - 30px));
  max-height: min(720px, calc(100vh - 94px));
  overflow: hidden;
  color: var(--rkm-ai-text);
  border: 1px solid rgba(217, 173, 85, .42);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(3, 18, 35, .28), 0 4px 18px rgba(3, 18, 35, .12);
  font-family: "Segoe UI", Arial, sans-serif;
  opacity: 0;
  transform: translateY(18px) scale(.97);
  transform-origin: right bottom;
  transition: opacity .2s ease, transform .2s ease;
}

.rkm-ai-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.rkm-ai-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
  padding: 16px 15px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 0%, rgba(217, 173, 85, .22), transparent 30%),
    linear-gradient(135deg, #06182e, #0a3157 64%, #113e64);
}

.rkm-ai-header::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--rkm-ai-gold), transparent);
}

.rkm-ai-brand {
  position: relative;
  flex: 0 0 auto;
}

.rkm-ai-brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(239, 215, 154, .34);
  border-radius: 14px;
  color: #f5dda3;
  background: rgba(255, 255, 255, .08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
  font-size: 1.08rem;
}

.rkm-ai-online-dot {
  position: absolute;
  right: -2px;
  bottom: -1px;
  width: 12px;
  height: 12px;
  border: 2px solid #0a3157;
  border-radius: 50%;
  background: #4ee08c;
}

.rkm-ai-heading {
  min-width: 0;
  flex: 1 1 auto;
}

.rkm-ai-heading p,
.rkm-ai-heading h2 {
  margin: 0;
}

.rkm-ai-heading .rkm-ai-kicker {
  margin-bottom: 2px;
  color: #efd79a;
  font-size: .57rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.rkm-ai-heading h2 {
  color: #fff;
  font-size: .98rem;
  line-height: 1.25;
  font-weight: 850;
}

.rkm-ai-heading h2 span {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 5px;
  border: 1px solid rgba(239, 215, 154, .28);
  border-radius: 999px;
  color: #efd79a;
  vertical-align: 2px;
  font-size: .48rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.rkm-ai-heading > p:last-child {
  margin-top: 3px;
  color: rgba(255, 255, 255, .72);
  font-size: .62rem;
}

.rkm-ai-heading > p:last-child i {
  margin-right: 3px;
  color: #7ce4a7;
}

.rkm-ai-icon-btn,
.rkm-ai-reset {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 10px;
  color: #fff;
  background: rgba(255, 255, 255, .07);
  cursor: pointer;
}

.rkm-ai-icon-btn:hover {
  background: rgba(255, 255, 255, .14);
}

.rkm-ai-safety {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 0 0 auto;
  padding: 9px 13px;
  color: #6b5530;
  border-bottom: 1px solid rgba(217, 173, 85, .22);
  background: #fff9ea;
  font-size: .64rem;
  line-height: 1.42;
}

.rkm-ai-safety i {
  margin-top: 2px;
  color: #bd8730;
}

.rkm-ai-messages {
  min-height: 205px;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 15px 13px 8px;
  background:
    radial-gradient(circle at 0 0, rgba(13, 66, 105, .055), transparent 32%),
    linear-gradient(#f7f9fb, #f4f7fa);
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.rkm-ai-message {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  margin-bottom: 11px;
}

.rkm-ai-message.user {
  justify-content: flex-end;
}

.rkm-ai-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(145deg, var(--rkm-ai-navy-2), var(--rkm-ai-navy));
  font-size: .66rem;
  box-shadow: 0 5px 12px rgba(7, 31, 59, .16);
}

.rkm-ai-bubble {
  max-width: 82%;
  padding: 9px 11px 7px;
  border: 1px solid var(--rkm-ai-line);
  border-radius: 14px 14px 14px 4px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(7, 31, 59, .065);
}

.rkm-ai-message.user .rkm-ai-bubble {
  color: #fff;
  border-color: transparent;
  border-radius: 14px 14px 4px 14px;
  background: linear-gradient(145deg, #0d4269, #092d4d);
  box-shadow: 0 8px 20px rgba(7, 31, 59, .16);
}

.rkm-ai-message.emergency .rkm-ai-bubble {
  color: #7b2030;
  border-color: rgba(154, 36, 56, .22);
  background: #fff2f4;
}

.rkm-ai-bubble p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: .73rem;
  line-height: 1.55;
}

.rkm-ai-bubble time {
  display: block;
  margin-top: 4px;
  color: #98a3ae;
  text-align: right;
  font-size: .51rem;
}

.rkm-ai-sources {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(7, 31, 59, .08);
}

.rkm-ai-sources-title {
  color: #718195;
  font-size: .52rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.rkm-ai-source-link {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 6px 7px;
  color: #0b5d3c;
  border: 1px solid rgba(22, 137, 75, .15);
  border-radius: 9px;
  background: #f1fbf5;
  text-decoration: none;
  font-size: .6rem;
  font-weight: 750;
}

.rkm-ai-source-link span {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rkm-ai-source-link > i:first-child {
  color: #16894b;
}

.rkm-ai-source-link > i:last-child {
  color: #7790a5;
  font-size: .52rem;
}

.rkm-ai-source-link:hover,
.rkm-ai-source-link:focus-visible {
  color: #fff;
  border-color: #16894b;
  background: #16894b;
}

.rkm-ai-source-link:hover i,
.rkm-ai-source-link:focus-visible i {
  color: #fff;
}

.rkm-ai-feedback {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  padding-top: 6px;
  color: #7b8998;
  border-top: 1px dashed rgba(7, 31, 59, .1);
  font-size: .53rem;
}

.rkm-ai-feedback > span {
  margin-right: auto;
}

.rkm-ai-feedback button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  color: #60758a;
  border: 1px solid rgba(7, 31, 59, .12);
  border-radius: 8px;
  background: #f7fafc;
  cursor: pointer;
  font-size: .58rem;
}

.rkm-ai-feedback button:hover,
.rkm-ai-feedback button:focus-visible {
  color: #fff;
  border-color: #0d4269;
  background: #0d4269;
}

.rkm-ai-feedback.is-saved {
  color: #147444;
  font-weight: 750;
}

.rkm-ai-message.user .rkm-ai-bubble time {
  color: rgba(255, 255, 255, .6);
}

.rkm-ai-quick {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 12px 9px;
  border-top: 1px solid rgba(7, 31, 59, .06);
  background: #fff;
  scrollbar-width: none;
}

.rkm-ai-quick::-webkit-scrollbar {
  display: none;
}

.rkm-ai-quick button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid rgba(13, 66, 105, .16);
  border-radius: 999px;
  color: #244866;
  background: #f7fafc;
  cursor: pointer;
  font: inherit;
  font-size: .61rem;
  font-weight: 750;
  white-space: nowrap;
}

.rkm-ai-quick button:hover,
.rkm-ai-quick button:focus-visible {
  color: #fff;
  border-color: #0d4269;
  background: #0d4269;
}

.rkm-ai-typing {
  position: absolute;
  left: 50px;
  bottom: 131px;
  z-index: 2;
  gap: 4px;
  padding: 8px 11px;
  border: 1px solid var(--rkm-ai-line);
  border-radius: 12px 12px 12px 4px;
  background: #fff;
  box-shadow: 0 7px 18px rgba(7, 31, 59, .1);
}

.rkm-ai-typing:not([hidden]) {
  display: flex;
}

.rkm-ai-typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7790a5;
  animation: rkmAiBounce 1s infinite ease-in-out;
}

.rkm-ai-typing span:nth-child(2) { animation-delay: .12s; }
.rkm-ai-typing span:nth-child(3) { animation-delay: .24s; }

@keyframes rkmAiBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .55; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.rkm-ai-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  padding: 10px 11px;
  border-top: 1px solid var(--rkm-ai-line);
  background: #fff;
}

.rkm-ai-form textarea {
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  min-height: 40px;
  max-height: 112px;
  resize: none;
  padding: 10px 12px;
  border: 1px solid rgba(7, 31, 59, .14);
  border-radius: 13px;
  outline: none;
  color: var(--rkm-ai-text);
  background: #f8fafc;
  font: inherit;
  font-size: .72rem;
  line-height: 1.4;
}

.rkm-ai-form textarea:focus {
  border-color: rgba(13, 66, 105, .55);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(13, 66, 105, .08);
}

.rkm-ai-form #rkmAiSend,
.rkm-ai-form .rkm-ai-voice {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, var(--rkm-ai-maroon), #9c2946);
  box-shadow: 0 8px 17px rgba(122, 23, 48, .22);
  cursor: pointer;
}

.rkm-ai-form .rkm-ai-voice {
  color: #31536f;
  border: 1px solid rgba(7, 31, 59, .12);
  background: #f2f6f9;
  box-shadow: none;
}

.rkm-ai-form .rkm-ai-voice:hover,
.rkm-ai-form .rkm-ai-voice:focus-visible {
  color: #fff;
  border-color: #0d4269;
  background: #0d4269;
}

.rkm-ai-form .rkm-ai-voice.is-listening {
  color: #fff;
  border-color: #a52242;
  background: #a52242;
  box-shadow: 0 0 0 4px rgba(165, 34, 66, .12);
  animation: rkmAiVoicePulse 1.2s ease-in-out infinite;
}

.rkm-ai-form .rkm-ai-voice[hidden] {
  display: none !important;
}

.rkm-ai-form button:disabled {
  cursor: wait;
  opacity: .55;
}

@keyframes rkmAiVoicePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.rkm-ai-footer {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 0 11px 8px;
  background: #fff;
}

.rkm-ai-human {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 1 1 auto;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(22, 137, 75, .22);
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(145deg, #17934f, #11783f);
  cursor: pointer;
  font: inherit;
  font-size: .65rem;
  font-weight: 800;
}

.rkm-ai-reset {
  width: 34px;
  height: 34px;
  color: #6e7f91;
  border-color: rgba(7, 31, 59, .12);
  background: #f4f7fa;
}

.rkm-ai-privacy {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 12px 9px;
  color: #8a96a2;
  text-align: center;
  background: #fff;
  font-size: .53rem;
}

.rkm-ai-panel .sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.rkm-ai-panel button:focus-visible,
.rkm-ai-panel textarea:focus-visible {
  outline: 2px solid rgba(217, 173, 85, .82);
  outline-offset: 2px;
}

@media (min-width: 768px) {
  .rkm-ai-overlay {
    display: none !important;
  }
}

@media (max-width: 767.98px) {
  .rkm-ai-panel {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(88vh, 760px);
    max-height: min(88dvh, 760px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
    transform-origin: center bottom;
  }

  .rkm-ai-messages {
    min-height: 180px;
  }

  body.rkm-ai-lock {
    overflow: hidden;
    touch-action: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rkm-ai-panel,
  .rkm-ai-overlay,
  .rkm-ai-suppressed-fixed,
  .rkm-ai-typing span,
  .rkm-ai-form .rkm-ai-voice.is-listening {
    transition: none !important;
    animation: none !important;
  }
}
