/* Ask ReN — the omnipresent chat (floating bar + side panel).
   A port of ReN-frontend's OmniRen (OmniRenPanel.tsx, ChatInputNoLoader.tsx,
   ChatMessageComponent.tsx): same layout, sizes and colours, Tailwind classes
   translated to plain CSS. Behaviour lives in /js/ask-ren.js. */

:root {
  --ar-primary-100: rgba(67, 105, 244, 0.1);
  --ar-primary-200: #bfdbfe;
  --ar-primary-300: #93c5fd;
  --ar-primary-800: #4369f4;
  --ar-neutral-100: #f3f3f8;
  --ar-neutral-200: #e7e9f3;
  --ar-neutral-300: #dfe2ef;
  --ar-neutral-700: #676780;
  --ar-neutral-900: #343456;
  --ar-neutral-1000: #01012c;
  --ar-panel-bg: #ffffff;
  --ar-bubble-bg: #ffffff;
  --ar-text: #2a2520;
  --ar-tip-bg: #343456;
  --ar-bar-bg: rgba(231, 233, 243, 0.25);
}
html[data-theme="dark"] {
  --ar-primary-100: rgba(67, 105, 244, 0.18);
  --ar-primary-200: rgba(67, 105, 244, 0.32);
  --ar-primary-300: #2563eb;
  --ar-neutral-100: #161b22;
  --ar-neutral-200: #21262d;
  --ar-neutral-300: #30363d;
  --ar-neutral-700: #7d8590;
  --ar-neutral-900: #e6edf3;
  --ar-panel-bg: #0d1117;
  --ar-bubble-bg: #161b22;
  --ar-text: #e6edf3;
  --ar-tip-bg: #010409;
  --ar-bar-bg: rgba(22, 27, 34, 0.7);
}

#askren-root,
#askren-root * {
  box-sizing: border-box;
}
#askren-root {
  font-family: "Work Sans", sans-serif;
}
#askren-root[hidden] {
  display: none;
}
.askren-bot {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: inline-flex;
}
.askren-bot svg {
  width: 100%;
  height: 100%;
}
.askren-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ar-primary-800);
  cursor: pointer;
}
.askren-iconbtn:hover {
  background: var(--ar-neutral-200);
}
.askren-iconbtn:disabled {
  opacity: 0.45;
  cursor: default;
}
.askren-iconbtn.is-active {
  background: var(--ar-primary-100);
}
.askren-iconbtn svg {
  width: 22px;
  height: 22px;
  display: block;
}
html[data-theme="dark"] .askren-iconbtn .askren-close path {
  fill: var(--ar-neutral-900);
}

/* ── Floating bar (ChatInputNoLoader with showIcon + history) ── */
#askren-bar {
  position: fixed;
  z-index: 8400;
  bottom: 10px;
  left: 50%;
  width: min(720px, calc(100vw - 32px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  /* Its entrance (a bounce up) is animated from ask-ren.js (barEntrance). */
}
#askren-bar[hidden] {
  display: none;
}
/* The bar's z-index puts it above every in-app dialog (.modal-overlay at
   999-1001, .wf-modal-overlay at 3000), so it would sit on top of a dialog's
   footer buttons. Step aside while one is open, as it does for the panel. */
body:has(.modal-overlay.open, .wf-modal-overlay) #askren-bar {
  display: none;
}
.askren-pill {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-height: 60px;
  padding: 8px 20px;
  border-radius: 9999px;
  border: 1px solid var(--ar-primary-800);
  background: var(--ar-bar-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
#askren-bar .askren-pill {
  box-shadow: 0 8px 24px rgba(1, 1, 44, 0.08);
}
.askren-pill textarea {
  flex: 1;
  min-width: 0;
  height: auto;
  max-height: 44px;
  padding: 5px 0;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ar-neutral-1000);
  caret-color: var(--ar-primary-800);
}
html[data-theme="dark"] .askren-pill textarea {
  color: var(--ar-neutral-900);
}
.askren-pill textarea::placeholder {
  color: var(--ar-neutral-700);
}
.askren-send {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.askren-send:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.askren-send .askren-stop {
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  background: var(--ar-primary-800);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.askren-send .askren-stop::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #fff;
}
.askren-histbtn {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 1px solid var(--ar-primary-800);
  background: var(--ar-bar-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: background 0.15s;
}
.askren-histbtn:hover {
  background: var(--ar-primary-100);
}
.askren-histbtn svg {
  width: 34px;
  height: 34px;
}

/* ── Panel (OmniRenPanel) ── */
#askren-panel {
  position: fixed;
  z-index: 8500;
  top: 0;
  right: 0;
  height: 100vh;
  height: 100dvh;
  width: 520px;
  display: flex;
  flex-direction: column;
  background: var(--ar-panel-bg);
  color: var(--ar-text);
  border-left: 1px solid var(--ar-neutral-300);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: translateX(100%);
  opacity: 0.4;
  visibility: hidden;
  transition:
    transform 0.3s ease-out,
    opacity 0.3s ease-out,
    visibility 0s linear 0.3s;
}
#askren-panel.is-open {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  transition:
    transform 0.3s ease-out,
    opacity 0.3s ease-out;
}
#askren-panel.is-resizing {
  transition: none;
}
/* Tucked away like a blind (ask-ren.js setBlind): slid to the right edge,
   leaving a thin edge with the handle on it. */
#askren-panel.is-open.is-blind {
  transform: translateX(calc(100% - 4px));
  box-shadow: none;
}
#askren-panel.is-open:not(.is-resizing) {
  transition:
    transform 0.45s cubic-bezier(0.22, 0.9, 0.24, 1),
    opacity 0.3s ease-out;
}
#askren-panel.is-blind .askren-resizer-grip {
  transform: translate(-90%, -50%);
}
#askren-panel.is-blind .askren-resizer:hover .askren-resizer-grip,
#askren-panel.is-blind .askren-resizer:focus-visible .askren-resizer-grip {
  transform: translate(-90%, -50%) scale(1.1);
}
body.askren-resizing {
  cursor: col-resize;
  user-select: none;
}
@media (max-width: 768px) {
  #askren-panel {
    width: 100% !important;
  }
  .askren-resizer {
    display: none;
  }
}

.askren-resizer {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 12px;
  transform: translateX(-50%);
  cursor: col-resize;
  z-index: 10;
  outline: none;
}
.askren-resizer-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 9999px;
  background: var(--ar-primary-300);
  transition: background 0.15s;
}
.askren-resizer-grip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 32px;
  padding: 0 6px;
  border-radius: 9999px;
  border: 1px solid var(--ar-primary-300);
  background: var(--ar-panel-bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.15s;
}
.askren-resizer-grip span {
  width: 1.5px;
  height: 14px;
  border-radius: 9999px;
  background: var(--ar-primary-800);
}
.askren-resizer:hover .askren-resizer-line,
.askren-resizer:focus-visible .askren-resizer-line,
#askren-panel.is-resizing .askren-resizer-line {
  background: var(--ar-primary-800);
}
.askren-resizer:hover .askren-resizer-grip,
.askren-resizer:focus-visible .askren-resizer-grip,
#askren-panel.is-resizing .askren-resizer-grip {
  background: var(--ar-primary-800);
  border-color: var(--ar-primary-800);
  transform: translate(-50%, -50%) scale(1.1);
}
.askren-resizer:hover .askren-resizer-grip span,
.askren-resizer:focus-visible .askren-resizer-grip span,
#askren-panel.is-resizing .askren-resizer-grip span {
  background: #fff;
}

.askren-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ar-neutral-300);
}
.askren-head-id {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.askren-head-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.askren-head-title {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.askren-head-sub {
  font-size: 12px;
  color: var(--ar-neutral-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.askren-head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.askren-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.askren-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 24px;
  text-align: center;
  color: var(--ar-neutral-700);
  font-size: 15px;
  line-height: 1.5;
}
.askren-empty b {
  font-weight: 600;
  color: var(--ar-text);
}
.askren-starters {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  width: 100%;
}
/* The ten portfolio risk questions: a tighter list under a small label. */
.askren-starters-label {
  margin: 14px 0 -4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ar-neutral-700);
}
.askren-starters.is-many {
  gap: 6px;
  margin-top: 8px;
  padding-bottom: 12px;
}
.askren-starters.is-many .askren-chip {
  padding: 8px 12px;
  font-size: 13.5px;
}

/* Messages (ChatMessageComponent) */
.askren-row {
  display: flex;
  gap: 10px;
  width: 100%;
}
.askren-row.is-me {
  justify-content: flex-end;
}
.askren-row .askren-spacer {
  flex: 0 0 46px;
}
.askren-bubble {
  width: fit-content;
  max-width: 75%;
  min-width: 0;
  padding: 12px 15px;
  border-radius: 16px;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.6;
}
@media (max-width: 1024px) {
  .askren-bubble {
    max-width: 100%;
  }
}
.askren-row.is-me .askren-bubble {
  background: var(--ar-primary-800);
  color: #fff;
  white-space: pre-wrap;
}
.askren-row.is-bot .askren-bubble {
  background: var(--ar-bubble-bg);
  color: var(--ar-text);
  max-width: calc(100% - 56px);
  padding-top: 4px;
}
.askren-tail {
  position: relative;
  display: flex;
}
.askren-tail::after {
  content: "";
  position: absolute;
  right: 0;
  top: 15px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 10px solid var(--ar-primary-800);
}
.askren-initials {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ar-neutral-1000);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  text-transform: uppercase;
}
html[data-theme="dark"] .askren-initials {
  background: var(--ar-neutral-200);
  color: var(--ar-primary-800);
}

/* Answer markdown (contentClassName / .aiMessage) */
.askren-md {
  margin-top: 8px;
}
.askren-md > :first-child {
  margin-top: 0;
}
.askren-md p {
  margin: 0 0 12px;
}
.askren-md p:last-child {
  margin-bottom: 0;
}
.askren-md h1,
.askren-md h2,
.askren-md h3,
.askren-md h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 12px 0 6px;
}
.askren-md strong {
  font-weight: 600;
}
.askren-md ul,
.askren-md ol {
  padding-left: 22px;
  margin: 0 0 12px;
}
.askren-md ul {
  list-style: disc;
}
.askren-md ol {
  list-style: decimal;
}
.askren-md li {
  margin: 4px 0;
}
.askren-md li > ul,
.askren-md li > ol {
  margin: 4px 0;
}
.askren-md a {
  color: var(--ar-primary-800);
}
.askren-md blockquote {
  margin: 6px 0 12px;
  padding: 6px 12px;
  border-left: 3px solid var(--ar-primary-800);
  background: var(--ar-primary-100);
  border-radius: 0 8px 8px 0;
  font-style: italic;
}
.askren-md blockquote p {
  margin: 0;
}
.askren-md hr {
  border: 0;
  border-top: 1px solid var(--ar-neutral-300);
  margin: 12px 0;
}
.askren-md code {
  font-size: 13px;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--ar-neutral-200);
}
.askren-tablewrap {
  overflow-x: auto;
  margin: 8px 0 12px;
}
.askren-md table {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 100%;
}
.askren-md th,
.askren-md td {
  border: 1px solid var(--ar-neutral-300);
  padding: 6px 8px;
  text-align: left;
  white-space: nowrap;
}
.askren-md th {
  background: var(--ar-neutral-100);
  font-weight: 600;
}
.askren-caret {
  display: inline-block;
  width: 1px;
  height: 8px;
  margin-left: 16px;
  margin-top: 8px;
  background: currentColor;
  animation: askren-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes askren-ping {
  75%, 100% { transform: scale(2); opacity: 0; }
}

/* Citations */
.askren-cite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin: 0 1px;
  padding: 0 5px;
  border: 0;
  border-radius: 9px;
  background: var(--ar-primary-100);
  color: var(--ar-primary-800);
  font: 600 11px/1 "Work Sans", sans-serif;
  font-style: normal;
  vertical-align: 2px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.askren-cite:hover,
.askren-cite:focus-visible {
  background: var(--ar-primary-800);
  color: #fff;
  outline: none;
}
.askren-tip {
  position: fixed;
  z-index: 8600;
  max-width: 340px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--ar-tip-bg);
  color: #fff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  font: 12px/1.5 "Work Sans", sans-serif;
  pointer-events: auto;
}
.askren-tip[hidden] {
  display: none;
}
.askren-tip-title {
  font-weight: 600;
  margin-bottom: 2px;
}
.askren-tip-meta {
  color: #bbbbcb;
  font-size: 11px;
  margin-bottom: 6px;
}
.askren-tip-quote {
  font-style: italic;
  color: #e7e9f3;
  display: -webkit-box;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.askren-tip-open {
  margin-top: 8px;
  color: #93c5fd;
  font-weight: 600;
}

.askren-sources {
  margin-top: 10px;
  border-top: 1px solid var(--ar-neutral-300);
  padding-top: 8px;
  font-size: 13px;
}
.askren-sources summary {
  cursor: pointer;
  color: var(--ar-neutral-700);
  font-weight: 600;
  list-style: none;
}
.askren-sources summary::-webkit-details-marker {
  display: none;
}
/* Disclosure carets: the Lucide chevron (as in static/js/ren-icons.js), rotated when open. */
.askren-sources summary::before {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.25em;
  vertical-align: -0.15em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.15s;
}
.askren-sources[open] summary::before {
  transform: rotate(90deg);
}
.askren-src {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  margin-top: 6px;
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.askren-src:hover {
  background: var(--ar-primary-100);
}
.askren-src .askren-cite {
  flex: 0 0 auto;
}
.askren-src-text {
  min-width: 0;
}
.askren-src-title {
  font-weight: 500;
}
.askren-src-meta {
  color: var(--ar-neutral-700);
  font-size: 12px;
}

.askren-actions {
  display: flex;
  justify-content: flex-start;
  gap: 4px;
  padding-top: 8px;
}
.askren-actions button {
  width: 32px;
  height: 32px;
  padding: 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ar-primary-800);
  cursor: pointer;
}
.askren-actions button:hover {
  background: var(--ar-neutral-200);
}
.askren-actions button.is-done {
  background: rgba(67, 105, 244, 0.5);
}
.askren-actions svg {
  width: 100%;
  height: 100%;
}

.askren-error {
  color: #d03b3b;
}
.askren-error button {
  margin-left: 8px;
  padding: 4px 12px;
  border: 1px solid #d03b3b;
  border-radius: 9999px;
  background: transparent;
  color: #d03b3b;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

/* Thinking loader: spinning ring around the bot (ChatMessageComponent showLoader) */
.askren-ring {
  position: relative;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.askren-ring::before {
  content: "";
  position: absolute;
  width: calc(100% + 14px);
  height: calc(100% + 14px);
  border: 4px solid var(--ar-primary-800);
  border-top-color: transparent;
  border-radius: 9999px;
  animation: askren-spin 1s linear infinite;
}
.askren-ring .askren-bot {
  width: 100%;
  height: 100%;
}
@keyframes askren-spin {
  to { transform: rotate(360deg); }
}
.askren-thinking {
  align-self: center;
  color: var(--ar-neutral-700);
  font-weight: 500;
}

/* Follow-up questions */
.askren-followups {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}
.askren-followups-label {
  font-size: 14px;
  font-weight: 600;
}
.askren-chip {
  width: fit-content;
  max-width: 85%;
  padding: 10px;
  border: 1px solid var(--ar-primary-100);
  border-radius: 12px;
  background: var(--ar-primary-100);
  color: var(--ar-text);
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}
.askren-chip:hover {
  background: var(--ar-primary-200);
  border-color: var(--ar-primary-200);
}

.askren-foot {
  border-top: 1px solid var(--ar-neutral-300);
  padding: 12px;
}

/* History */
.askren-hist-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ar-neutral-700);
  margin: 0 0 8px;
}
.askren-hist-empty {
  margin-top: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--ar-neutral-700);
}
.askren-hist-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.askren-hist-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
}
.askren-hist-item:hover {
  background: var(--ar-primary-100);
}
.askren-hist-item.is-current {
  background: var(--ar-neutral-200);
}
.askren-hist-open {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.askren-hist-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.askren-hist-date {
  font-size: 12px;
  color: var(--ar-neutral-700);
}
.askren-hist-del {
  flex: 0 0 auto;
  margin-right: 6px;
  padding: 4px 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ar-neutral-700);
  cursor: pointer;
  opacity: 0;
}
.askren-hist-item:hover .askren-hist-del,
.askren-hist-del:focus-visible {
  opacity: 1;
}
.askren-hist-del:hover {
  color: #d03b3b;
}
.askren-hist-share {
  margin-right: 0;
  display: inline-flex;
  align-items: center;
}
.askren-hist-share.is-on {
  opacity: 1;
  color: var(--ar-primary-800);
}
.askren-hist-share:hover {
  color: var(--ar-primary-800);
}
.askren-hist-sub {
  margin-top: 20px;
}
.askren-shared-note {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--ar-neutral-700);
  background: var(--ar-primary-100);
}

/* ── Pill extras: response options + voice input ── */
.askren-pill {
  position: relative;
  gap: 4px;
}
.askren-pillbtn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 5px;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: var(--ar-neutral-700);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.askren-pillbtn:hover {
  background: var(--ar-primary-100);
  color: var(--ar-primary-800);
}
.askren-pillbtn svg {
  width: 18px;
  height: 18px;
}
.askren-pillbtn:disabled {
  cursor: default;
}
.askren-optbtn {
  margin-left: -10px;
}
.askren-optbtn.is-on {
  background: var(--ar-primary-100);
  color: var(--ar-primary-800);
}

.askren-options {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 5;
  width: min(340px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid var(--ar-neutral-300);
  border-radius: 16px;
  background: var(--ar-panel-bg);
  color: var(--ar-text);
  box-shadow: 0 20px 50px rgba(1, 1, 44, 0.18);
}
.askren-options[hidden] {
  display: none;
}
.askren-options-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ar-neutral-700);
  margin: 0 4px 6px;
}
.askren-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 6px;
  border-radius: 10px;
  cursor: pointer;
}
.askren-opt:hover {
  background: var(--ar-neutral-100);
}
.askren-opt-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.askren-opt-name {
  font-size: 14px;
  font-weight: 600;
}
.askren-opt-hint {
  font-size: 12px;
  line-height: 1.4;
  color: var(--ar-neutral-700);
}
.askren-switch {
  position: relative;
  flex: 0 0 auto;
  width: 36px;
  height: 20px;
}
.askren-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.askren-switch span {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: var(--ar-neutral-300);
  transition: background 0.15s;
  pointer-events: none;
}
.askren-switch span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 9999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s;
}
.askren-switch input:checked + span {
  background: var(--ar-primary-800);
}
.askren-switch input:checked + span::after {
  transform: translateX(16px);
}
.askren-switch input:focus-visible + span {
  outline: 2px solid var(--ar-primary-300);
  outline-offset: 2px;
}

/* Voice */
.askren-pill.is-recording {
  border-color: #e5484d;
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.15);
}
.askren-pill.is-recording textarea::placeholder,
.askren-pill.is-transcribing textarea::placeholder {
  color: var(--ar-text);
}
.askren-mic .askren-rec {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: #e5484d;
  animation: askren-rec-pulse 1.2s ease-in-out infinite;
}
.askren-pill.is-recording .askren-mic {
  background: rgba(229, 72, 77, 0.12);
}
@keyframes askren-rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(229, 72, 77, 0); }
}
.askren-spin {
  width: 14px;
  height: 14px;
  border: 2px solid var(--ar-primary-800);
  border-top-color: transparent;
  border-radius: 9999px;
  animation: askren-spin 0.8s linear infinite;
}

/* Show logic */
.askren-logic {
  margin: 8px 0 4px;
  border: 1px solid var(--ar-neutral-300);
  border-radius: 12px;
  background: var(--ar-neutral-100);
  font-size: 13px;
}
.askren-logic summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
  color: var(--ar-neutral-700);
  font-weight: 600;
}
.askren-logic summary::-webkit-details-marker {
  display: none;
}
.askren-logic summary svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--ar-primary-800);
}
.askren-logic summary::after {
  /* Lucide chevron-down (static/js/ren-icons.js) as a mask, in the text colour. */
  content: "";
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin-left: auto;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.15s;
}
.askren-logic:not([open]) summary::after {
  transform: rotate(-90deg);
}
.askren-logic-live {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: var(--ar-primary-800);
  animation: askren-rec-pulse-blue 1.2s ease-in-out infinite;
}
@keyframes askren-rec-pulse-blue {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
/* A timeline: each item's dot, and a connector from that dot's centre down to
   the next one, on the same axis (x = 6px) — so the line always meets the
   dots, and stops at the last one. */
.askren-logic-list {
  list-style: none;
  margin: 0;
  padding: 2px 14px 10px 15px;
}
.askren-logic-list li {
  position: relative;
  padding: 4px 0 6px 26px;
  color: var(--ar-neutral-700);
  line-height: 1.5;
}
.askren-logic-list li::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: 1px;
  top: 9px;
  width: 10px;
  height: 10px;
  box-sizing: border-box;
  border-radius: 9999px;
  border: 2px solid var(--ar-primary-300);
  background: var(--ar-neutral-100);
}
.askren-logic-list li::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 19px;
  bottom: -9px;
  width: 2px;
  border-radius: 1px;
  background: var(--ar-primary-200);
}
.askren-logic-list li.is-last::after,
.askren-logic-list li:last-child::after {
  display: none;
}
.askren-logic-step::before {
  background: var(--ar-primary-800) !important;
  border-color: var(--ar-primary-800) !important;
}
/* The item being worked on. A static ring, not a pulse: the message is
   re-rendered around this element as events stream, which would restart a
   CSS animation every time. */
.askren-logic-list li.is-active::before {
  border-color: var(--ar-primary-800);
  box-shadow: 0 0 0 3px var(--ar-primary-100);
}
.askren-logic-step {
  font-weight: 500;
  color: var(--ar-text) !important;
}
.askren-type-caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.15em;
  border-radius: 1px;
  background: var(--ar-primary-800);
  animation: askren-type-blink 1s steps(1) infinite;
}
@keyframes askren-type-blink {
  50% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .askren-type-caret {
    animation: none;
  }
}
.askren-logic-thought .askren-md {
  margin: 0;
  font-size: 13px;
}
.askren-logic-thought .askren-md p {
  margin: 0 0 6px;
}
.askren-logic-thought .askren-md strong {
  color: var(--ar-text);
}

/* Live input level while recording — the ring grows with the voice. */
.askren-pill.is-recording .askren-mic {
  box-shadow: 0 0 0 calc(var(--askren-lvl, 0) * 7px) rgba(229, 72, 77, 0.28);
  transition: box-shadow 0.08s linear;
}

/* Usage against the monthly Ask ReN allowance, in the options popover. */
.askren-usage {
  margin: 8px 6px 2px;
  padding-top: 10px;
  border-top: 1px solid var(--ar-neutral-300);
  font-size: 12px;
  color: var(--ar-neutral-700);
}
.askren-usage:empty {
  display: none;
}
.askren-usage-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
  color: var(--ar-text);
}
.askren-usage-bar {
  height: 6px;
  margin: 6px 0 4px;
  border-radius: 9999px;
  background: var(--ar-neutral-200);
  overflow: hidden;
}
.askren-usage-bar span {
  display: block;
  height: 100%;
  border-radius: 9999px;
  background: var(--ar-primary-800);
}
.askren-usage.is-high .askren-usage-bar span {
  background: #e5484d;
}

/* "Contact us" / "Book a call" at the usage limit. */
.askren-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.askren-contact-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1px solid var(--ar-primary-800);
  border-radius: 9999px;
  background: transparent;
  color: var(--ar-primary-800);
  font: 600 13px/1.2 "Work Sans", sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.askren-contact-btn:hover {
  background: var(--ar-primary-100);
}
.askren-contact-btn.is-primary {
  background: var(--ar-primary-800);
  color: #fff;
}
.askren-contact-btn.is-primary:hover {
  background: #323ab6;
}
.askren-error .askren-contact {
  color: var(--ar-text);
}

/* Charts in answers (ask-ren.js chartFigure) */
.askren-row.is-bot .askren-bubble.askren-has-chart {
  width: calc(100% - 56px);
}
.askren-chart {
  margin: 10px 0 14px;
  padding: 10px 12px 8px;
  border: 1px solid var(--ar-neutral-200);
  border-radius: 12px;
}
.askren-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.askren-chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ar-text);
}
.askren-chart-box {
  position: relative;
  width: 100%;
}
.askren-chart-data {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ar-neutral-700);
}
.askren-chart-data summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}
.askren-chart-data summary::-webkit-details-marker {
  display: none;
}
.askren-chart-toggle {
  font-weight: 600;
}
.askren-chart-toggle::before {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.25em;
  vertical-align: -0.15em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.15s;
}
.askren-chart-data[open] .askren-chart-toggle::before {
  transform: rotate(90deg);
}
.askren-chart-src {
  text-align: right;
}

/* Download menus (ask-ren.js dlMenu): chat, answer, table and chart */
.askren-dl {
  position: relative;
  display: inline-flex;
}
.askren-dl-pop {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  min-width: 170px;
  padding: 4px;
  border: 1px solid var(--ar-neutral-300);
  border-radius: 8px;
  background: var(--ar-panel-bg);
  box-shadow: 0 8px 24px rgba(1, 1, 44, 0.14);
}
.askren-dl.is-left .askren-dl-pop {
  right: auto;
  left: 0;
}
.askren-dl-pop[hidden] {
  display: none;
}
.askren-dl-pop .askren-dl-item {
  display: block;
  width: 100%;
  height: auto;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ar-text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.askren-dl-pop .askren-dl-item:hover,
.askren-dl-pop .askren-dl-item:focus-visible {
  background: var(--ar-neutral-200);
}
.askren-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 5px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ar-neutral-700);
  cursor: pointer;
}
.askren-mini:hover,
.askren-mini[aria-expanded="true"] {
  background: var(--ar-neutral-200);
  color: var(--ar-primary-800);
}
.askren-mini svg {
  width: 100%;
  height: 100%;
}
.askren-tabletools {
  display: flex;
  justify-content: flex-end;
  margin: 6px 0 -6px;
}

/* Disclaimer under the panel's input (ask-ren.js disclaimerLine) */
.askren-disclaimer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ar-neutral-700);
  text-align: center;
}
.askren-info {
  display: inline-flex;
  width: 18px;
  height: 18px;
  padding: 2px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ar-neutral-700);
  cursor: pointer;
}
.askren-info:hover,
.askren-info[aria-expanded="true"] {
  color: var(--ar-primary-800);
}
.askren-info svg {
  width: 100%;
  height: 100%;
}
.askren-dl-pop.askren-info-pop {
  top: auto;
  bottom: calc(100% + 6px);
  width: min(320px, 80vw);
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ar-text);
  text-align: left;
}

/* ── Share a chat: everyone, or chosen members ── */
.askren-share-btn.is-on {
  color: var(--ar-primary-800);
}
.askren-share-pop {
  position: fixed;
  z-index: 10050;
  max-width: calc(100vw - 16px);
  padding: 14px;
  border: 1px solid var(--ar-neutral-300);
  border-radius: 10px;
  background: var(--ar-panel-bg);
  color: var(--ar-text);
  box-shadow: 0 12px 32px rgba(1, 1, 44, 0.18);
  font-size: 13px;
}
.askren-share-head {
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 600;
}
.askren-share-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
}
.askren-share-opt:hover {
  background: var(--ar-neutral-100);
}
.askren-share-opt.is-disabled {
  opacity: 0.55;
  cursor: default;
}
.askren-share-opt input {
  margin-top: 3px;
  accent-color: var(--ar-primary-800);
}
.askren-share-opt span,
.askren-share-who {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.askren-share-opt b,
.askren-share-who b {
  font-weight: 600;
}
.askren-share-opt small,
.askren-share-who small {
  color: var(--ar-neutral-700);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.askren-share-people {
  margin: 2px 0 4px 28px;
}
.askren-share-people[hidden] {
  display: none;
}
.askren-share-search {
  width: 100%;
  margin-bottom: 6px;
  padding: 6px 9px;
  border: 1px solid var(--ar-neutral-300);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12.5px;
}
.askren-share-list {
  max-height: 200px;
  overflow-y: auto;
}
.askren-share-person {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.askren-share-person[hidden] {
  display: none;
}
.askren-share-person:hover {
  background: var(--ar-neutral-100);
}
.askren-share-person input {
  accent-color: var(--ar-primary-800);
}
.askren-share-av {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ar-primary-100);
  color: var(--ar-primary-800);
  font-size: 11px;
  font-weight: 700;
}
.askren-share-count {
  margin-top: 4px;
  padding-left: 6px;
  color: var(--ar-neutral-700);
  font-size: 12px;
}
.askren-share-note {
  margin: 8px 0 12px;
  color: var(--ar-neutral-700);
  font-size: 12px;
  line-height: 1.4;
}
.askren-share-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}
.askren-share-gap {
  flex: 1;
}
.askren-share-btns button {
  padding: 6px 12px;
  border: 1px solid var(--ar-neutral-300);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
}
.askren-share-btns .askren-share-go {
  border-color: var(--ar-primary-800);
  background: var(--ar-primary-800);
  color: #fff;
  font-weight: 600;
}
.askren-share-btns .askren-share-go:disabled {
  opacity: 0.5;
  cursor: default;
}
.askren-share-btns .askren-share-stop {
  border-color: transparent;
  padding-left: 0;
  color: #d03b3b;
}

/* An answer the server couldn't save to history (ask-ren.js "unsaved" event) */
.askren-unsaved {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: #9a5b00;
}
html[data-theme="dark"] .askren-unsaved {
  color: #f0b44c;
}

/* Minimising the bar (ask-ren.js setBarCollapsed): the fingerprint is a
   button, and when minimised it is all that's left, docked bottom-right. */
.askren-barlogo {
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.askren-barlogo:hover {
  transform: scale(1.06);
}
.askren-barlogo:focus-visible,
.askren-barclose:focus-visible {
  outline: 2px solid var(--ar-primary-800);
  outline-offset: 2px;
}
.askren-barclose {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--ar-neutral-300);
  border-radius: 9999px;
  background: var(--ar-bar-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--ar-neutral-700);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
#askren-bar:hover .askren-barclose,
.askren-barclose:focus-visible {
  opacity: 1;
}
.askren-barclose:hover {
  color: var(--ar-primary-800);
  background: var(--ar-primary-100);
}
.askren-barclose svg {
  width: 12px;
  height: 12px;
}
#askren-bar.is-collapsed {
  left: auto;
  right: 24px;
  bottom: 20px;
  width: auto;
  transform: none;
}
#askren-bar.is-collapsed > :not(.askren-barlogo) {
  display: none;
}
#askren-bar.is-collapsed .askren-barlogo {
  width: 52px;
  height: 52px;
  flex-basis: 52px;
  filter: drop-shadow(0 8px 18px rgba(67, 105, 244, 0.35));
}
@media (max-width: 600px) {
  #askren-bar.is-collapsed {
    right: 16px;
    bottom: 16px;
  }
}
/* The animated copies of the pill and buttons, under the fingerprint. */
.askren-ghost {
  z-index: 8399;
  pointer-events: none;
  overflow: hidden;
  box-sizing: border-box;
}
.askren-ripple {
  position: fixed;
  z-index: 8399;
  pointer-events: none;
  box-sizing: border-box;
  border-radius: 9999px;
  border: 2px solid var(--ar-primary-800);
}
