#kokanun-chatbot-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;

  /* Besarkan ikon di desktop */
  width: 90px;
  height: 90px;

  border-radius: 9999px;
  border: none;
  padding: 0;

  /* Buang background hijau/gradient – biar ikon PNG yang menentukan rupa */
  background: transparent;

  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;

  /* Pastikan sentiasa di atas elemen lain */
  z-index: 9999;
}

#kokanun-chatbot-bubble img {
  width: 90px;
  height: 90px;
  border-radius: 9999px;
  display: block;
}

#kokanun-chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  top: 88px;
  width: 360px;
  max-width: calc(100vw - 40px);
  max-height: calc(100dvh - 188px);
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 60;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

#kokanun-chatbot-window.kb-open {
  display: flex;
}

#kokanun-chatbot-sound-toast {
  position: fixed;
  right: 24px;
  bottom: 112px;
  max-width: min(280px, calc(100vw - 40px));
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.01em;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 100001;
}

#kokanun-chatbot-sound-toast.kb-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 640px) {
  #kokanun-chatbot-bubble {
    bottom: max(96px, calc(88px + env(safe-area-inset-bottom, 0px)));
    right: max(14px, calc(14px + env(safe-area-inset-right, 0px)));
    width: 74px;
    height: 74px;
  }

  #kokanun-chatbot-bubble img {
    width: 74px;
    height: 74px;
  }

  #kokanun-chatbot-bubble.kb-open {
    display: none;
  }

  #kokanun-chatbot-window {
    top: env(safe-area-inset-top, 0px);
    /* Ambil kira safe area (notch/status bar iOS & Android) */
    right: env(safe-area-inset-right, 0px);
    bottom: env(safe-area-inset-bottom, 0px);
    left: env(safe-area-inset-left, 0px);
    width: 100vw;
    max-width: 100vw;
    height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }

  #kokanun-chatbot-sound-toast {
    right: max(16px, calc(16px + env(safe-area-inset-right, 0px)));
    bottom: max(112px, calc(112px + env(safe-area-inset-bottom, 0px)));
  }
}

.kokanun-chatbot-header {
  background: linear-gradient(135deg, #0f766e, #0284c7);
  color: #ffffff;
  /* padding-top guna safe-area supaya header tidak tersembunyi di sebalik status bar */
  padding: 12px 16px;
  padding-top: max(12px, calc(12px + env(safe-area-inset-top, 0px)));
  display: flex;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  flex: 0 0 auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.kb-header-user {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.kb-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background-color: rgba(255, 255, 255, 0.1);
  object-fit: cover;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.16), 0 8px 18px rgba(2, 132, 199, 0.24);
  transform-origin: center center;
  will-change: transform, box-shadow;
  animation: kb-avatar-float 4.8s ease-in-out infinite, kb-avatar-glow 3.8s ease-in-out infinite;
}

#kokanun-chatbot-window.kb-presence-idle .kb-avatar {
  animation-duration: 6.2s, 5.4s;
  filter: saturate(0.96);
}

#kokanun-chatbot-window.kb-presence-online .kb-avatar {
  animation-duration: 4.8s, 3.8s;
}

#kokanun-chatbot-window.kb-presence-typing .kb-avatar {
  animation-duration: 2.8s, 2.2s;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.08), 0 14px 28px rgba(14, 165, 233, 0.26);
  filter: saturate(1.06);
}

@keyframes kb-avatar-float {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-2px) scale(1.015);
  }
}

@keyframes kb-avatar-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.14), 0 8px 18px rgba(2, 132, 199, 0.2);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.08), 0 12px 24px rgba(15, 118, 110, 0.22);
  }
}

@media (prefers-reduced-motion: reduce) {
  .kb-avatar {
    animation: none;
  }
}

.kb-user-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.kb-status-wrapper {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 0;
}

.kb-status-dot {
  width: 8px;
  height: 8px;
  background-color: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 4px #22c55e;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.kb-status-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.01em;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.kb-status-wrapper.is-idle .kb-status-dot {
  background-color: #f59e0b;
  box-shadow: 0 0 4px rgba(245, 158, 11, 0.8);
  opacity: 0.9;
}

.kb-status-wrapper.is-online .kb-status-dot {
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.35);
  animation: kb-status-online-pulse 2.4s ease-in-out infinite;
}

.kb-status-wrapper.is-typing .kb-status-dot {
  background-color: #38bdf8;
  box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.42);
  animation: kb-status-typing-pulse 1s ease-in-out infinite;
}

.kb-status-wrapper.is-idle .kb-status-text {
  color: rgba(255, 244, 214, 0.96);
}

@keyframes kb-status-online-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.12);
  }
}

@keyframes kb-status-typing-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.42);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(56, 189, 248, 0.14);
    transform: scale(1.08);
  }
}

.kb-title {
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1.05;
}

.kb-subtitle {
  font-size: 0.75rem;
  opacity: 0.9;
}

.kb-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.kb-icon-btn {
  position: relative;
}

.kb-icon-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.24);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.kb-icon-btn:hover::after,
.kb-icon-btn:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.kb-menu-btn,
.kb-clear-btn,
.kb-sound-btn,
.kb-back-btn {
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.kb-close-btn {
  border: none;
  cursor: pointer;
}

.kokanun-chatbot-messages {
  padding: 16px;
  background-color: #e5ddd5; /* WhatsApp classic background color */
  background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png'); /* Subtle doodle pattern */
  background-repeat: repeat;
  background-size: 350px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 480px;
  overflow-y: auto;
  font-size: 0.88rem;
  color: #111b21;
  position: relative;
}

.kb-menu-btn,
.kb-sound-btn,
.kb-close-btn,
.kb-back-btn {
  border-radius: 9999px;
  width: 32px;
  height: 32px;
  line-height: 1;
  padding: 0;
  border: 2px solid #ffeb3b;
  background: rgba(255, 255, 255, 0.15);
  color: #ffeb3b;
}

.kb-clear-btn {
  border-radius: 9999px;
  width: 32px;
  height: 32px;
  line-height: 1;
  padding: 0;
  border: 2px solid #ff4444;
  background: rgba(255, 255, 255, 0.15);
  color: #ff4444;
}

.kb-menu-btn:hover,
.kb-sound-btn:hover,
.kb-close-btn:hover,
.kb-back-btn:hover {
  background: rgba(255, 235, 59, 0.25);
  border-color: #fff176;
  color: #fff176;
  transform: translateY(-1px);
}

.kb-clear-btn:hover {
  background: rgba(255, 68, 68, 0.25);
  border-color: #ff7961;
  color: #ff7961;
  transform: translateY(-1px);
}

.kb-menu-btn svg,
.kb-clear-btn svg,
.kb-sound-btn svg {
  width: 16px;
  height: 16px;
}

.kb-sound-btn.is-muted {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(252, 165, 165, 0.8);
  color: #fca5a5;
}

.kb-close-btn {
  font-size: 1.05rem;
}

.kokanun-chatbot-message {
  display: flex;
  margin-bottom: 12px;
  animation: fadeInUp 0.3s ease-out forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.kokanun-chatbot-message.user {
  justify-content: flex-end;
}

.kokanun-chatbot-message.bot {
  justify-content: flex-start;
  align-items: flex-start;
}

.kokanun-chatbot-message.bot.kb-bot-appearing {
  animation: none;
}

.kokanun-chatbot-message.bot.kb-bot-appearing .kokanun-chatbot-bubble,
.kokanun-chatbot-message.bot.kb-bot-appearing .kb-feedback-row,
.kokanun-chatbot-message.bot.kb-bot-appearing .kb-book-pill-row {
  opacity: 0;
  transform: translateY(8px) scale(0.985);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.kokanun-chatbot-message.bot.kb-bot-appearing.kb-bot-visible .kokanun-chatbot-bubble,
.kokanun-chatbot-message.bot.kb-bot-appearing.kb-bot-visible .kb-feedback-row,
.kokanun-chatbot-message.bot.kb-bot-appearing.kb-bot-visible .kb-book-pill-row {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Inner column wrapper untuk bot messages — susun bubble + feedback + pill menegak */
.kb-bot-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 85%;
}

.kokanun-chatbot-bubble {
  position: relative;
  padding: 8px 12px;
  border-radius: 8px;
  line-height: 1.5;
  max-width: 85%;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.kokanun-chatbot-message.bot .kokanun-chatbot-bubble {
  background-color: #ffffff;
  color: #111b21;
  border-radius: 0 8px 8px 8px;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
}

.kokanun-chatbot-message.bot .kokanun-chatbot-bubble:after {
  content: "";
  position: absolute;
  top: 0;
  left: -8px;
  width: 0;
  height: 0;
  border-top: 0px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 10px solid #ffffff;
}

.kokanun-chatbot-message.user .kokanun-chatbot-bubble {
  padding-bottom: 12px; /* Extra space for ticks */
  padding-right: 32px; /* Ensure text doesn't overlap ticks */
  background-color: #d9fdd3; /* Light green WhatsApp user color - will use brand teal/blue instead below but following structure */
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  border-radius: 8px 0 8px 8px;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
}

.kb-ticks {
  position: absolute;
  bottom: 4px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0;
  line-height: 1;
}

.kb-tick-icon {
  display: block;
}

/* Bile dah baca (read) - kaler biru - dikendalikan oleh JS terus pada stroke attribute */
.kb-ticks.read svg path {
  stroke: #4fc3f7;
}

.kokanun-chatbot-message.user .kokanun-chatbot-bubble:after {
  content: "";
  position: absolute;
  top: 0;
  right: -8px;
  width: 0;
  height: 0;
  border-top: 0px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 10px solid #0369a1;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
}

.typing-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.01em;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: #94a3b8;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Streaming SSE cursor */
.kb-stream-cursor {
  display: inline-block;
  color: #0d9488;
  font-weight: 700;
  animation: kb-blink 0.75s step-end infinite;
  margin-left: 1px;
  line-height: 1;
}
@keyframes kb-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.kb-streaming {
  min-height: 1.4em;
}

/* Feedback 👍/👎 — letakkan di bawah bubble, bukan di sebelah */
.kb-feedback-row {
  display: flex;
  flex-direction: row;
  gap: 4px;
  margin-top: 6px;
  padding-left: 2px;
  opacity: 0;
  animation: kb-feedback-appear 0.4s ease 1.2s forwards;
  align-self: flex-start;
}
@keyframes kb-feedback-appear {
  to { opacity: 1; }
}
.kb-feedback-btn {
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  line-height: 1.5;
  color: #444;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.kb-feedback-btn:hover { background: rgba(0,0,0,0.07); transform: scale(1.1); }
.kb-feedback-btn.kb-voted { background: rgba(13,148,136,0.12); border-color: #0d9488; }
.kb-feedback-btn:disabled { opacity: 0.35; cursor: default; }

/* Pre-fill Booking Pill — di bawah butang lokasi */
.kb-book-pill-row {
  margin-top: 6px;
  padding-left: 0;
  animation: kb-feedback-appear 0.4s ease 1.4s both;
  opacity: 0;
  align-self: flex-start;
}
.kb-book-pill {
  background: linear-gradient(135deg, #0d9488, #0284c7);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  font-family: inherit;
  box-shadow: 0 2px 6px rgba(13,148,136,0.25);
}
.kb-book-pill:hover { opacity: 0.88; transform: translateY(-1px); }

/* Timestamp & Meta row */
.kb-msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 4px;
  margin-top: 2px;
  animation: kb-feedback-appear 0.3s ease 0.5s both;
  opacity: 0;
}
.kb-msg-meta-user {
  padding-left: 0;
  justify-content: flex-end;
  padding-right: 4px;
}
.kb-msg-time {
  font-size: 0.68rem;
  color: #9ca3af;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* Copy button */
.kb-copy-btn {
  background: none;
  border: none;
  padding: 1px 5px;
  font-size: 0.72rem;
  color: #9ca3af;
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  line-height: 1;
}
.kb-copy-btn:hover { color: #0d9488; background: rgba(13,148,136,0.08); }

/* WhatsApp Smart Button in feedback row */
.kb-wa-smart {
  text-decoration: none;
  font-size: 0.85rem;
  line-height: 1.4;
  opacity: 0.75;
  transition: opacity 0.15s, transform 0.1s;
}
.kb-wa-smart:hover { opacity: 1; transform: scale(1.15); }

.kokanun-chatbot-input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px;
  background-color: #f0f2f5;
  flex: 0 0 auto;
}

.kb-quick-replies {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 12px;
  background-color: rgba(248, 250, 252, 0.8);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.kb-quick-replies.kb-trigger-mode {
  align-items: flex-start;
  background: transparent;
  border-bottom: none;
  padding: 10px 12px 0;
}

.kb-menu-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(2, 132, 199, 0.18);
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.98), rgba(224, 242, 254, 0.96));
  color: #075985;
  border-radius: 9999px;
  padding: 8px 14px;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.kb-menu-trigger-btn:hover {
  background: linear-gradient(180deg, #dbeafe, #bfdbfe);
  color: #0c4a6e;
  border-color: #93c5fd;
  box-shadow: 0 8px 18px rgba(2, 132, 199, 0.16);
  transform: translateY(-1px);
}

.kb-menu-trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.kb-menu-trigger-icon svg,
.kb-quick-replies-collapse svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kb-quick-replies-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kb-quick-replies-title {
  font-size: 0.78rem;
  font-weight: 800;
  color: #075985;
  margin-bottom: 2px;
}

.kb-quick-replies-collapse {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 9999px;
  border: 1px solid rgba(220, 38, 38, 0.22);
  background: linear-gradient(180deg, #fef2f2, #fee2e2);
  color: #b91c1c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.kb-quick-replies-collapse:hover,
.kb-quick-replies-collapse:focus-visible {
  background: linear-gradient(180deg, #fee2e2, #fecaca);
  color: #991b1b;
  border-color: #f87171;
  box-shadow: 0 8px 18px rgba(220, 38, 38, 0.18);
  transform: translateY(-1px);
  outline: none;
}

.kb-quick-replies.kb-submenu-mode {
  background: linear-gradient(180deg, rgba(240, 253, 250, 0.96), rgba(236, 253, 245, 0.9));
  border-bottom-color: rgba(16, 185, 129, 0.16);
}

.kb-quick-replies.kb-submenu-mode .kb-quick-replies-title {
  color: #047857;
}

.kb-quick-replies.kb-submenu-mode .kb-quick-replies-collapse {
  border-color: rgba(220, 38, 38, 0.22);
  background: linear-gradient(180deg, #fef2f2, #fee2e2);
  color: #b91c1c;
}

.kb-quick-replies.kb-submenu-mode .kb-quick-replies-collapse:hover,
.kb-quick-replies.kb-submenu-mode .kb-quick-replies-collapse:focus-visible {
  background: linear-gradient(180deg, #fee2e2, #fecaca);
  border-color: #f87171;
  color: #991b1b;
}

.kb-qr-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
  background-color: #e2e8f0;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.kb-quick-replies:not(.kb-submenu-mode) .kb-qr-btn {
  background: linear-gradient(180deg, #e8eef8, #dde7f4);
  border-color: #c7d4e7;
}

.kb-quick-replies.kb-submenu-mode .kb-qr-btn {
  background: linear-gradient(180deg, #ecfdf5, #dff7ec);
  border-color: #b7e4cd;
}

.kb-qr-btn:hover,
.kb-qr-btn:focus-visible {
  background: linear-gradient(180deg, #dff4ee, #cceee5) !important;
  color: #0f172a !important;
  border-color: #7bc9b7 !important;
  box-shadow: 0 10px 20px rgba(15, 118, 110, 0.12);
  outline: none;
}

.kb-qr-btn:hover .kb-qr-index,
.kb-qr-btn:hover .kb-qr-label,
.kb-qr-btn:focus-visible .kb-qr-index,
.kb-qr-btn:focus-visible .kb-qr-label {
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a;
}

.kb-qr-btn:hover *,
.kb-qr-btn:focus-visible * {
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a;
}

.kb-qr-index {
  flex: 0 0 16px;
  font-weight: 800;
}

.kb-qr-label {
  flex: 1;
  line-height: 1.35;
}

.kb-qr-back {
  justify-content: center;
  background: rgba(15, 118, 110, 0.08);
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.18);
}

.kb-qr-back:hover,
.kb-qr-back:focus-visible {
  background: linear-gradient(180deg, #dff4ee, #cceee5);
  color: #0f766e;
  border-color: #7bc9b7;
  box-shadow: 0 10px 20px rgba(15, 118, 110, 0.12);
  outline: none;
}

@media (max-width: 640px) {
  .kokanun-chatbot-messages {
    max-height: none;
    padding-top: 14px;
  }

  .kb-quick-replies.kb-trigger-mode {
    position: sticky;
    bottom: 0;
    z-index: 8;
    margin-top: auto;
    padding: 8px 12px 10px;
    background: linear-gradient(180deg, rgba(240, 249, 255, 0.2), rgba(255, 255, 255, 0.96));
    border-top: 1px solid rgba(191, 219, 254, 0.5);
    box-shadow: 0 -10px 20px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .kb-menu-trigger-btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    font-size: 0.82rem;
    box-shadow: 0 8px 20px rgba(2, 132, 199, 0.12);
  }

  .kokanun-chatbot-input {
    position: sticky;
    bottom: 0;
    z-index: 9;
    padding-bottom: max(8px, calc(8px + env(safe-area-inset-bottom, 0px)));
    box-shadow: 0 -8px 18px rgba(15, 23, 42, 0.08);
  }
}

.kokanun-chatbot-input input[type="text"] {
  flex: 1;
  border-radius: 9999px;
  border: 1px solid #cbd5f5;
  padding: 8px 12px;
  font-size: 0.85rem;
  outline: none;
}

.kokanun-chatbot-input input[type="text"]:focus {
  border-color: #0f766e;
  box-shadow: 0 0 0 1px rgba(15, 118, 110, 0.3);
}

.kokanun-chatbot-input button[type="submit"] {
  background-color: #0f766e;
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  padding: 8px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}

.kokanun-chatbot-input button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Hint bubble di atas ikon chatbot */
#kokanun-chatbot-hint {
  position: fixed;
  bottom: 104px;
  right: 24px;
  max-width: 220px;
  background-color: #ffffff;
  color: #0f172a;
  padding: 8px 14px;
  border-radius: 9999px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.45);
  font-size: 0.8rem;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 55;
}

#kokanun-chatbot-hint.kb-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#kokanun-chatbot-hint::after {
  content: "";
  position: absolute;
  bottom: -8px;
  right: 20px;
  border-width: 8px 8px 0 8px;
  border-style: solid;
  border-color: #ffffff transparent transparent transparent;
}

#kokanun-chatbot-notice-modal,
#kokanun-chatbot-confirm-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.6);
  z-index: 99999;
  pointer-events: auto;
}

#kokanun-chatbot-notice-modal.kb-visible,
#kokanun-chatbot-confirm-modal.kb-visible {
  display: flex;
}

.kb-modal-card {
  width: 100%;
  max-width: 360px;
  background: #ffffff;
  color: #0f172a;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
  padding: 24px 20px;
  text-align: center;
}

.kb-modal-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
}

.kb-modal-icon.info {
  background: rgba(15, 118, 110, 0.14);
  color: #0f766e;
}

.kb-modal-icon.warn {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
}

.kb-modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.kb-modal-message {
  font-size: 0.95rem;
  line-height: 1.55;
  color: #475569;
}

.kb-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.kb-modal-btn {
  appearance: none;
  border: 0;
  border-radius: 9999px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
}

.kb-modal-btn.primary {
  margin-top: 20px;
  background: #0f766e;
  color: #ffffff;
}

.kb-modal-btn.secondary {
  background: #e2e8f0;
  color: #0f172a;
}

.kb-modal-btn.danger {
  background: #dc2626;
  color: #ffffff;
}


/* Bubble size (mobile) */
@media (max-width: 768px) {
  #kokanun-chatbot-bubble {
    width: 72px;
    height: 72px;
    right: 16px;
    bottom: 16px;
  }
  #kokanun-chatbot-bubble img {
    width: 72px;
    height: 72px;
  }
}


/* Pautan ringkas (tanpa URL panjang) – akan dipaparkan sebagai 'pill' */
.kb-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  margin: 8px 8px 0 0;
  border-radius: 9999px;
  background: rgba(15, 118, 110, 0.12);
  color: #0f766e;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(15, 118, 110, 0.25);
  vertical-align: top;
  line-height: 1.25;
}
.kb-link-pill:hover {
  background: rgba(15, 118, 110, 0.18);
}

.kb-link-pill:focus-visible {
  outline: 2px solid rgba(2, 132, 199, 0.45);
  outline-offset: 2px;
}

.kb-status-closed-line {
  color: #dc2626;
  font-weight: 800;
}

@media (max-width: 640px) {
  .kb-link-pill {
    min-height: 42px;
    padding: 9px 14px;
    margin-top: 10px;
    max-width: 100%;
  }
}
