.rtp-ai {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  font-family: var(--font-body, "Figtree", system-ui, sans-serif);
  color: var(--ink, #10304e);
}
.rtp-ai *,
.rtp-ai *::before,
.rtp-ai *::after {
  box-sizing: border-box;
}
.rtp-ai button,
.rtp-ai textarea,
.rtp-ai select {
  font: inherit;
}
.rtp-ai-launch {
  min-height: 54px;
  border: 2px solid var(--ink, #10304e);
  border-radius: 999px;
  background: var(--ocean, #0a6bcb);
  color: #fff;
  box-shadow:
    0 7px 0 var(--ocean-deep, #07509a),
    0 16px 36px rgba(16, 48, 78, 0.18);
  padding: 8px 15px 8px 9px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.rtp-ai-launch:hover {
  transform: translateY(-1px);
  box-shadow:
    0 8px 0 var(--ocean-deep, #07509a),
    0 18px 40px rgba(16, 48, 78, 0.2);
}
.rtp-ai-launch:active {
  transform: translateY(4px);
  box-shadow:
    0 3px 0 var(--ocean-deep, #07509a),
    0 10px 24px rgba(16, 48, 78, 0.16);
}
.rtp-ai-spark,
.rtp-ai-brandmark {
  display: grid;
  place-items: center;
  flex: none;
  border: 2px solid var(--ink, #10304e);
  border-radius: 50%;
  background: var(--sun, #ffc933);
  color: var(--ink, #10304e);
  font-family: var(--font-display, "Baloo 2", system-ui, sans-serif);
  font-weight: 800;
}
.rtp-ai-spark {
  width: 34px;
  height: 34px;
  font-size: 18px;
}
.rtp-ai-launch-copy {
  display: grid;
  text-align: left;
  line-height: 1.05;
}
.rtp-ai-launch-copy b {
  font-weight: 850;
  font-size: 14px;
}
.rtp-ai-launch-copy small {
  margin-top: 3px;
  font-size: 10px;
  opacity: 0.78;
}
.rtp-ai-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(430px, calc(100vw - 28px));
  height: min(690px, calc(100vh - 105px));
  background: #fff;
  border: 2px solid var(--ink, #10304e);
  border-radius: var(--radius-panel, 24px);
  box-shadow:
    0 12px 0 rgba(16, 48, 78, 0.12),
    0 28px 70px rgba(16, 48, 78, 0.22);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto auto;
}
.rtp-ai-panel[hidden] {
  display: none;
}
.rtp-ai-head {
  min-height: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  background: linear-gradient(135deg, var(--ocean, #0a6bcb), var(--ocean-deep, #07509a));
  color: #fff;
  border-bottom: 2px solid var(--ink, #10304e);
}
.rtp-ai-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.rtp-ai-brandmark {
  width: 38px;
  height: 38px;
  font-size: 18px;
}
.rtp-ai-head strong {
  display: block;
  font: 800 18px/1.05 var(--font-display, "Baloo 2", system-ui, sans-serif);
  color: #fff;
}
.rtp-ai-head small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.2;
  opacity: 0.84;
}
.rtp-ai-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: none;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.rtp-ai-close:hover {
  background: var(--sun, #ffc933);
  border-color: var(--ink, #10304e);
  color: var(--ink, #10304e);
}
.rtp-ai-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  background: var(--sky-50, #f0f8ff);
  border-bottom: 1px solid var(--sky-line, #c4ddf0);
}
.rtp-ai-state label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-2, #46607a);
}
.rtp-ai-state select {
  min-width: 0;
  max-width: 235px;
  border: 2px solid var(--sky-line, #c4ddf0);
  border-radius: 12px;
  background: #fff;
  color: var(--ink, #10304e);
  padding: 7px 30px 7px 9px;
  font-size: 12px;
  font-weight: 700;
  outline: none;
}
.rtp-ai-state select:focus {
  border-color: var(--ocean, #0a6bcb);
  box-shadow: 0 0 0 3px var(--ocean-sub, #e6f2ff);
}
.rtp-ai-independent {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-2, #46607a);
  white-space: nowrap;
}
.rtp-ai-independent i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sea, #14bdb0);
  box-shadow: 0 0 0 3px var(--sea-50, #e3f8f5);
}
.rtp-ai-chat {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 201, 51, 0.16), transparent 24%),
    var(--sky-50, #f0f8ff);
  scrollbar-width: thin;
  scrollbar-color: var(--sky-line, #c4ddf0) transparent;
}
.rtp-ai-msg {
  max-width: 92%;
  border-radius: 18px;
  padding: 11px 12px;
  box-shadow: 0 3px 0 rgba(16, 48, 78, 0.08);
}
.rtp-ai-msg--assistant {
  align-self: flex-start;
  background: #fff;
  border: 2px solid var(--sky-line, #c4ddf0);
  border-bottom-left-radius: 7px;
}
.rtp-ai-msg--user {
  align-self: flex-end;
  background: var(--sun-50, #fff4cc);
  border: 2px solid var(--sun-line, #f6d873);
  border-bottom-right-radius: 7px;
}
.rtp-ai-answer {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink, #10304e);
}
.rtp-ai-answer p {
  margin: 0 0 9px;
  white-space: normal;
}
.rtp-ai-answer p:last-child {
  margin-bottom: 0;
}
.rtp-ai-answer ul {
  margin: 5px 0 9px;
  padding-left: 20px;
}
.rtp-ai-answer li {
  margin: 0 0 5px;
}
.rtp-ai-answer strong {
  font-weight: 800;
}
.rtp-ai-thinking {
  opacity: 0.72;
}
.rtp-ai-thinking .rtp-ai-answer::after {
  content: "•••";
  display: inline-block;
  margin-left: 5px;
  color: var(--ocean, #0a6bcb);
  letter-spacing: 2px;
  animation: rtpAiDots 1s infinite ease-in-out;
}
.rtp-ai-live {
  display: inline-flex;
  align-items: center;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--sea-50, #e3f8f5);
  color: var(--sea-text, #06776e);
  padding: 4px 7px;
  font-size: 10px;
  font-weight: 800;
}
.rtp-ai-links {
  display: grid;
  gap: 7px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--rule, #e3ecf4);
}
.rtp-ai-links > b {
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: 0.35px;
  text-transform: uppercase;
  color: var(--ink-2, #46607a);
}
.rtp-ai-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--sky-line, #c4ddf0);
  border-radius: 11px;
  background: var(--sky-50, #f0f8ff);
  padding: 7px 9px;
  color: var(--ocean-deep, #07509a);
  text-decoration: none;
  font-size: 11px;
  font-weight: 750;
}
.rtp-ai-links a:hover {
  border-color: var(--ocean, #0a6bcb);
  background: var(--ocean-sub, #e6f2ff);
}
.rtp-ai-links a b {
  flex: none;
  font-size: 16px;
  line-height: 1;
}
.rtp-ai-sources {
  margin-top: 9px;
  border-top: 1px solid var(--rule, #e3ecf4);
  padding-top: 8px;
}
.rtp-ai-sources summary {
  display: flex;
  align-items: center;
  gap: 7px;
  width: max-content;
  cursor: pointer;
  color: var(--ink-2, #46607a);
  font-size: 10px;
  font-weight: 800;
}
.rtp-ai-sources summary small {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--lock, #e4eaf1);
  color: var(--ink, #10304e);
  font-size: 9px;
}
.rtp-ai-source-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
.rtp-ai-source-list a {
  display: grid;
  gap: 2px;
  border: 1px solid var(--rule, #e3ecf4);
  border-radius: 10px;
  padding: 7px 8px;
  color: var(--ocean-deep, #07509a);
  text-decoration: none;
}
.rtp-ai-source-list a:hover {
  background: var(--sky-50, #f0f8ff);
}
.rtp-ai-source-list a span {
  font-size: 10px;
  line-height: 1.25;
  font-weight: 750;
}
.rtp-ai-source-list a small {
  color: var(--ink-2, #46607a);
  font-size: 9px;
  line-height: 1.2;
}
.rtp-ai-quick {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 9px 11px;
  background: #fff;
  border-top: 1px solid var(--rule, #e3ecf4);
  scrollbar-width: none;
}
.rtp-ai-quick::-webkit-scrollbar {
  display: none;
}
.rtp-ai-quick button {
  flex: none;
  min-height: 32px;
  border: 1.5px solid var(--sky-line, #c4ddf0);
  background: var(--sky-50, #f0f8ff);
  color: var(--ink, #10304e);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.rtp-ai-quick button:hover {
  border-color: var(--ocean, #0a6bcb);
  background: var(--ocean-sub, #e6f2ff);
}
.rtp-ai-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px 11px 8px;
  background: #fff;
  border-top: 1px solid var(--rule, #e3ecf4);
}
.rtp-ai-compose {
  min-width: 0;
  position: relative;
}
.rtp-ai-form textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  max-height: 112px;
  resize: none;
  overflow-y: auto;
  border: 2px solid var(--sky-line, #c4ddf0);
  border-radius: 14px;
  background: #fff;
  color: var(--ink, #10304e);
  padding: 10px 54px 10px 11px;
  font-size: 12px;
  line-height: 1.4;
  outline: none;
}
.rtp-ai-form textarea::placeholder {
  color: var(--control, #7f93a8);
}
.rtp-ai-form textarea:focus {
  border-color: var(--ocean, #0a6bcb);
  box-shadow: 0 0 0 3px var(--ocean-sub, #e6f2ff);
}
.rtp-ai-enter-hint {
  position: absolute;
  right: 8px;
  bottom: 7px;
  pointer-events: none;
  color: var(--control, #7f93a8);
  font-size: 8px;
  font-weight: 700;
}
.rtp-ai-form button {
  min-width: 82px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px solid var(--ink, #10304e);
  border-radius: 14px;
  background: var(--sun, #ffc933);
  color: var(--ink, #10304e);
  box-shadow: 0 4px 0 var(--sun-deep, #e0a200);
  padding: 0 11px;
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}
.rtp-ai-form button:hover {
  transform: translateY(-1px);
}
.rtp-ai-form button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--sun-deep, #e0a200);
}
.rtp-ai-form button b {
  font-size: 16px;
  line-height: 1;
}
.rtp-ai-form button:disabled {
  opacity: 0.45;
  cursor: wait;
  transform: none;
}
.rtp-ai-privacy {
  margin: 0;
  padding: 0 12px 10px;
  background: #fff;
  color: var(--ink-2, #46607a);
  font-size: 9px;
  line-height: 1.3;
  opacity: 0.72;
}

/* Road to Permit visual polish: match the site's blue/yellow card language. */
.rtp-ai-launch {
  background: var(--sun, #ffc933);
  color: var(--ink, #10304e);
  border-color: var(--ink, #10304e);
  box-shadow:
    0 6px 0 var(--sun-deep, #e0a200),
    0 18px 42px rgba(16, 48, 78, 0.2);
}
.rtp-ai-launch:hover {
  box-shadow:
    0 7px 0 var(--sun-deep, #e0a200),
    0 20px 46px rgba(16, 48, 78, 0.22);
}
.rtp-ai-launch:active {
  box-shadow:
    0 2px 0 var(--sun-deep, #e0a200),
    0 10px 26px rgba(16, 48, 78, 0.16);
}
.rtp-ai-spark {
  background: #fff;
}
.rtp-ai-panel {
  width: min(448px, calc(100vw - 28px));
  border: 2px solid var(--ink, #10304e);
  box-shadow:
    0 14px 0 rgba(16, 48, 78, 0.1),
    0 34px 80px rgba(16, 48, 78, 0.24);
}
.rtp-ai-head {
  position: relative;
  background: linear-gradient(135deg, var(--ocean, #0a6bcb) 0%, var(--ocean-deep, #07509a) 100%);
  padding-bottom: 16px;
}
.rtp-ai-head::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  background: var(--sun, #ffc933);
}
.rtp-ai-state {
  background: #fff;
  padding: 10px 12px;
}
.rtp-ai-state select {
  background: var(--sky-50, #f0f8ff);
}
.rtp-ai-chat {
  padding: 16px 14px 22px;
  background:
    radial-gradient(circle at 94% 4%, rgba(255, 201, 51, 0.2), transparent 20%),
    linear-gradient(180deg, var(--sky-50, #f0f8ff), #f8fbfe);
}
.rtp-ai-msg {
  box-shadow: 0 4px 0 rgba(16, 48, 78, 0.06);
}
.rtp-ai-msg--assistant {
  border-color: rgba(10, 107, 203, 0.22);
}
.rtp-ai-msg--user {
  background: var(--ocean, #0a6bcb);
  border-color: var(--ink, #10304e);
  color: #fff;
}
.rtp-ai-msg--user .rtp-ai-answer,
.rtp-ai-msg--user .rtp-ai-answer strong {
  color: #fff;
}
.rtp-ai-links {
  border-top-color: rgba(10, 107, 203, 0.15);
}
.rtp-ai-links a {
  min-height: 40px;
  background: #fff8dd;
  border: 1.5px solid var(--sun-line, #f6d873);
  color: var(--ink, #10304e);
}
.rtp-ai-links a:hover {
  background: var(--sun-50, #fff4cc);
  border-color: var(--sun-deep, #e0a200);
}
.rtp-ai-sources summary {
  color: var(--ocean-deep, #07509a);
}
.rtp-ai-quick {
  gap: 8px;
  padding: 10px 11px;
}
.rtp-ai-quick button {
  min-height: 34px;
  background: #fff;
  border: 1.5px solid rgba(10, 107, 203, 0.25);
}
.rtp-ai-quick button:hover {
  border-color: var(--ocean, #0a6bcb);
  background: var(--sky-50, #f0f8ff);
}
.rtp-ai-form {
  padding: 10px 11px 9px;
}
.rtp-ai-form textarea {
  min-height: 48px;
  border-radius: 16px;
  background: #f9fcff;
  padding-top: 12px;
  padding-bottom: 12px;
}
.rtp-ai-form button {
  min-height: 48px;
  border-radius: 16px;
  background: var(--sun, #ffc933);
  box-shadow: 0 4px 0 var(--sun-deep, #e0a200);
}
.rtp-ai-privacy {
  padding-bottom: 11px;
}

html[dir="rtl"] .rtp-ai-launch-copy {
  text-align: right;
}
html[dir="rtl"] .rtp-ai-form textarea {
  padding-right: 11px;
  padding-left: 54px;
}
html[dir="rtl"] .rtp-ai-enter-hint {
  right: auto;
  left: 8px;
}
@media (max-width: 600px) {
  .rtp-ai {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
  }
  .rtp-ai-panel {
    position: fixed;
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    top: calc(var(--rtp-ai-vv-top, 0px) + 8px);
    bottom: auto;
    width: auto;
    height: calc(var(--rtp-ai-vv-height, 100dvh) - 16px);
    max-height: none;
    border-radius: 20px;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto auto;
    overscroll-behavior: contain;
  }
  .rtp-ai-launch {
    min-height: 50px;
    padding: 7px 13px 7px 8px;
    touch-action: manipulation;
  }
  .rtp-ai-spark {
    width: 32px;
    height: 32px;
  }
  .rtp-ai-independent {
    display: none;
  }
  .rtp-ai-head {
    min-height: 60px;
    padding: 10px 12px 13px;
  }
  .rtp-ai-brandmark {
    width: 34px;
    height: 34px;
  }
  .rtp-ai-head strong {
    font-size: 17px;
  }
  .rtp-ai-head small {
    font-size: 10px;
  }
  .rtp-ai-state {
    padding: 7px 10px;
  }
  .rtp-ai-state label {
    width: 100%;
    justify-content: space-between;
    font-size: 11px;
  }
  .rtp-ai-state select {
    flex: 1;
    max-width: none;
    min-height: 40px;
    font-size: 16px;
    padding: 7px 30px 7px 10px;
  }
  .rtp-ai-chat {
    padding: 11px 10px 13px;
    gap: 9px;
  }
  .rtp-ai-msg {
    max-width: 94%;
    padding: 10px 11px;
    border-radius: 16px;
  }
  .rtp-ai-answer {
    font-size: 14px;
    line-height: 1.45;
  }
  .rtp-ai-quick {
    gap: 6px;
    padding: 7px 9px;
  }
  .rtp-ai-quick button {
    min-height: 30px;
    padding: 5px 9px;
    font-size: 12px;
    white-space: nowrap;
    touch-action: manipulation;
  }
  .rtp-ai-form {
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 7px;
    padding: 8px 9px 7px;
  }
  .rtp-ai-form textarea {
    min-height: 48px;
    max-height: 96px;
    border-radius: 15px;
    padding: 11px 48px 11px 11px;
    font-size: 16px;
    line-height: 1.35;
  }
  .rtp-ai-enter-hint {
    display: none;
  }
  .rtp-ai-form button {
    min-width: 48px;
    width: 48px;
    min-height: 48px;
    padding: 0;
    border-radius: 15px;
    touch-action: manipulation;
  }
  .rtp-ai-form button span {
    display: none;
  }
  .rtp-ai-form button b {
    font-size: 20px;
  }
  .rtp-ai-privacy {
    padding: 0 10px calc(8px + env(safe-area-inset-bottom));
    font-size: 8px;
  }

  /* iOS keyboard mode: fit the chat to the actual visual viewport instead of letting Safari
     pan/zoom the whole fixed dialog around the focused textarea. */
  .rtp-ai-keyboard .rtp-ai-panel,
  .rtp-ai-input-focus .rtp-ai-panel {
    top: calc(var(--rtp-ai-vv-top, 0px) + 4px);
    height: calc(var(--rtp-ai-vv-height, 100dvh) - 8px);
    border-radius: 17px;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }
  .rtp-ai-keyboard .rtp-ai-head,
  .rtp-ai-input-focus .rtp-ai-head {
    min-height: 52px;
    padding: 7px 9px 10px;
  }
  .rtp-ai-keyboard .rtp-ai-brandmark,
  .rtp-ai-input-focus .rtp-ai-brandmark {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }
  .rtp-ai-keyboard .rtp-ai-head strong,
  .rtp-ai-input-focus .rtp-ai-head strong {
    font-size: 15px;
  }
  .rtp-ai-keyboard .rtp-ai-head small,
  .rtp-ai-input-focus .rtp-ai-head small {
    display: none;
  }
  .rtp-ai-keyboard .rtp-ai-close,
  .rtp-ai-input-focus .rtp-ai-close {
    width: 34px;
    height: 34px;
    font-size: 22px;
  }
  .rtp-ai-keyboard .rtp-ai-state,
  .rtp-ai-input-focus .rtp-ai-state {
    padding: 5px 8px;
  }
  .rtp-ai-keyboard .rtp-ai-state label > span,
  .rtp-ai-input-focus .rtp-ai-state label > span {
    display: none;
  }
  .rtp-ai-keyboard .rtp-ai-state select,
  .rtp-ai-input-focus .rtp-ai-state select {
    min-height: 36px;
    font-size: 16px;
  }
  .rtp-ai-keyboard .rtp-ai-quick,
  .rtp-ai-keyboard .rtp-ai-privacy,
  .rtp-ai-input-focus .rtp-ai-quick,
  .rtp-ai-input-focus .rtp-ai-privacy {
    display: none;
  }
  .rtp-ai-keyboard .rtp-ai-chat,
  .rtp-ai-input-focus .rtp-ai-chat {
    padding: 8px 9px;
  }
  .rtp-ai-keyboard .rtp-ai-form,
  .rtp-ai-input-focus .rtp-ai-form {
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: no-preference) {
  .rtp-ai-launch {
    transition:
      transform 0.15s ease,
      box-shadow 0.15s ease;
  }
  .rtp-ai-panel {
    animation: rtpAiIn 0.18s ease-out;
  }
  @keyframes rtpAiIn {
    from {
      opacity: 0;
      transform: translateY(10px) scale(0.985);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
  @keyframes rtpAiDots {
    0%,
    100% {
      opacity: 0.35;
    }
    50% {
      opacity: 1;
    }
  }
}
