/* Narendi chat for wiply.net. Follows Sngine's light and night mode (body.night-mode). */
:root {
  --narendi-accent: #7e5ba6;
  --narendi-accent-strong: #6a4a91;
  --narendi-on-accent: #ffffff;
  --narendi-bg: #ffffff;
  --narendi-surface: #f0f2f5;
  --narendi-text: #1c1e21;
  --narendi-muted: #65676b;
  --narendi-hover: rgba(126, 91, 166, 0.1);
  --narendi-border: rgba(0, 0, 0, 0.08);
  --narendi-theirs: #e9e9ef;
  --narendi-online: #31a24c;
  --narendi-danger: #e4144b;
  --narendi-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  --narendi-rail-w: 264px;
  --narendi-rail-narrow: 68px;
  --narendi-top: 0px;
}
body.night-mode {
  --narendi-bg: #242526;
  --narendi-surface: #3a3b3c;
  --narendi-text: #e4e6eb;
  --narendi-muted: #b0b3b8;
  --narendi-hover: rgba(167, 139, 201, 0.16);
  --narendi-border: rgba(255, 255, 255, 0.08);
  --narendi-theirs: #3a3b3c;
  --narendi-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
}

/* The old Sngine chat, in case anything of it is still rendered */
.chat-sidebar,
.chat-widget,
.js_chat-widget-master {
  display: none !important;
}

.narendi-rail,
.narendi-dock,
.narendi-call,
.narendi-dialog,
.narendi-fab,
.narendi-toast {
  font-size: 14px;
  line-height: 1.35;
}
.narendi-rail *,
.narendi-dock *,
.narendi-call *,
.narendi-dialog * {
  box-sizing: border-box;
}

/* ---------- shared bits ---------- */

.narendi-icon-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--narendi-accent);
  cursor: pointer;
}
.narendi-icon-button:hover,
.narendi-icon-button:focus-visible {
  background: var(--narendi-hover);
  outline: none;
}
.narendi-button {
  padding: 8px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--narendi-accent);
  color: var(--narendi-on-accent);
  font-weight: 600;
  cursor: pointer;
}
.narendi-button:hover {
  background: var(--narendi-accent-strong);
}
.narendi-button:disabled {
  opacity: 0.5;
  cursor: default;
}
.narendi-button-quiet {
  background: var(--narendi-surface);
  color: var(--narendi-text);
}
.narendi-button-quiet:hover {
  background: var(--narendi-hover);
}
.narendi-link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--narendi-accent);
  font-weight: 600;
  cursor: pointer;
}
.narendi-avatar {
  position: relative;
  display: inline-flex;
  flex: none;
  width: 36px;
  height: 36px;
}
.narendi-avatar-small {
  width: 30px;
  height: 30px;
}
.narendi-avatar-large {
  width: 88px;
  height: 88px;
}
.narendi-avatar img,
.narendi-initials {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.narendi-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--narendi-accent);
  color: var(--narendi-on-accent);
  font-size: 13px;
  font-weight: 600;
}
.narendi-avatar-large .narendi-initials {
  font-size: 30px;
}
.narendi-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--narendi-bg);
  border-radius: 50%;
  background: var(--narendi-online);
}
.narendi-badge,
.narendi-link-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--narendi-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.narendi-avatar .narendi-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  border: 2px solid var(--narendi-bg);
}
.narendi-link-badge {
  margin-left: 6px;
}
.narendi-link-badge[hidden],
.narendi-badge[hidden] {
  display: none;
}
.narendi-empty {
  margin: 0;
  padding: 14px 16px;
  color: var(--narendi-muted);
  text-align: center;
}
.narendi-search,
.narendi-field {
  width: 100%;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--narendi-surface);
  color: var(--narendi-text);
  font-size: 14px;
}
.narendi-field {
  border-radius: 8px;
}
.narendi-search:focus,
.narendi-field:focus {
  outline: 2px solid var(--narendi-accent);
}

/* ---------- the column on the right ---------- */

body.narendi-rail-on {
  padding-right: var(--narendi-rail-w);
}
body.narendi-rail-on.narendi-rail-narrow {
  padding-right: var(--narendi-rail-narrow);
}
.narendi-rail {
  position: fixed;
  top: var(--narendi-top);
  right: 0;
  bottom: 0;
  z-index: 1030;
  display: flex;
  flex-direction: column;
  width: var(--narendi-rail-w);
  border-left: 1px solid var(--narendi-border);
  background: var(--narendi-bg);
  color: var(--narendi-text);
}
.narendi-rail-head {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 10px 8px 4px 16px;
}
.narendi-rail-title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
}
.narendi-rail .narendi-search {
  width: auto;
  margin: 6px 12px 6px;
}
.narendi-rail-notice {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 4px 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--narendi-surface);
  color: var(--narendi-muted);
  font-size: 13px;
}
.narendi-rail-notice[hidden] {
  display: none;
}
.narendi-rail-body {
  flex: 1;
  padding: 0 6px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.narendi-rail-section + .narendi-rail-section {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--narendi-border);
}
.narendi-rail-heading {
  margin: 8px 10px 4px;
  color: var(--narendi-muted);
  font-size: 13px;
  font-weight: 600;
}
.narendi-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.narendi-row:hover,
.narendi-row:focus-visible {
  background: var(--narendi-hover);
  outline: none;
}
.narendi-row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.narendi-row-name,
.narendi-row-sub {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.narendi-row-name {
  font-weight: 500;
}
.narendi-row-sub {
  color: var(--narendi-muted);
  font-size: 12px;
}
.narendi-row-unread .narendi-row-name,
.narendi-row-unread .narendi-row-sub {
  color: var(--narendi-text);
  font-weight: 700;
}
.narendi-invite {
  margin-bottom: 4px;
}
.narendi-invite-actions {
  display: flex;
  gap: 8px;
  padding: 0 10px 6px 58px;
}
.narendi-invite-actions .narendi-button {
  padding: 5px 12px;
}
.narendi-more {
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--narendi-accent);
  font-weight: 600;
  cursor: pointer;
}
.narendi-more:hover {
  background: var(--narendi-hover);
}

/* Closed: only pictures, like the old chat */
.narendi-rail-collapsed {
  width: var(--narendi-rail-narrow);
}
.narendi-rail-collapsed .narendi-rail-head {
  flex-direction: column-reverse;
  padding: 8px 0 4px;
}
.narendi-rail-collapsed .narendi-rail-title,
.narendi-rail-collapsed .narendi-search,
.narendi-rail-collapsed .narendi-rail-heading,
.narendi-rail-collapsed .narendi-row-text,
.narendi-rail-collapsed .narendi-invite-actions,
.narendi-rail-collapsed .narendi-rail-notice span {
  display: none;
}
.narendi-rail-collapsed .narendi-rail-body {
  padding: 0 4px 12px;
  scrollbar-width: none;
}
.narendi-rail-collapsed .narendi-row {
  justify-content: center;
  padding: 6px 0;
}
.narendi-rail-collapsed .narendi-rail-notice {
  margin: 4px;
  padding: 4px;
}

/* Phones: the column becomes a full-screen list opened from a round button */
.narendi-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1040;
  display: none;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--narendi-accent);
  color: var(--narendi-on-accent);
  box-shadow: var(--narendi-shadow);
  cursor: pointer;
}
.narendi-fab .narendi-badge {
  position: absolute;
  top: 0;
  right: 0;
}
@media (max-width: 767px) {
  .narendi-fab {
    display: inline-flex;
  }
  .narendi-rail {
    top: 0;
    z-index: 1060;
    width: 100%;
    border-left: 0;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0.2s;
  }
  .narendi-rail.narendi-rail-mobile-open {
    transform: none;
    visibility: visible;
  }
}

/* ---------- chat boxes ---------- */

.narendi-dock {
  position: fixed;
  bottom: 0;
  z-index: 1035;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}
.narendi-box {
  display: flex;
  flex-direction: column;
  width: 328px;
  height: 455px;
  max-height: calc(100vh - var(--narendi-top) - 16px);
  border-radius: 10px 10px 0 0;
  background: var(--narendi-bg);
  color: var(--narendi-text);
  box-shadow: var(--narendi-shadow);
  pointer-events: auto;
}
.narendi-box-min {
  height: auto;
}
.narendi-box-head {
  display: flex;
  flex: none;
  align-items: center;
  padding: 4px 4px 4px 6px;
  border-bottom: 1px solid var(--narendi-border);
}
.narendi-box-min .narendi-box-head {
  border-bottom: 0;
}
.narendi-box-unread .narendi-box-head {
  background: var(--narendi-accent);
  border-radius: 10px 10px 0 0;
}
.narendi-box-unread .narendi-box-head,
.narendi-box-unread .narendi-box-head .narendi-icon-button {
  color: var(--narendi-on-accent);
}
.narendi-box-title {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.narendi-box-title:hover {
  background: var(--narendi-hover);
}
.narendi-box-title-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.narendi-box-name {
  overflow: hidden;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.narendi-box-status {
  color: var(--narendi-muted);
  font-size: 12px;
}
.narendi-box-unread .narendi-box-status {
  color: inherit;
}
.narendi-box-actions {
  display: flex;
  flex: none;
}
.narendi-box-actions .narendi-icon-button {
  width: 30px;
  height: 30px;
}
.narendi-box-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}
.narendi-box-body[hidden] {
  display: none;
}
.narendi-box-notice {
  margin: 8px 10px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--narendi-surface);
  color: var(--narendi-muted);
  font-size: 12px;
}
.narendi-box-notice[hidden] {
  display: none;
}
.narendi-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  padding: 10px 10px 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.narendi-messages:focus-visible {
  outline: 2px solid var(--narendi-accent);
  outline-offset: -2px;
}
.narendi-time {
  margin: 10px 0 6px;
  color: var(--narendi-muted);
  font-size: 11px;
  text-align: center;
}
.narendi-msg {
  display: flex;
  flex-direction: column;
  max-width: 78%;
}
.narendi-msg-mine {
  align-self: flex-end;
  align-items: flex-end;
}
.narendi-msg-theirs {
  align-self: flex-start;
  align-items: flex-start;
}
.narendi-msg-name {
  margin: 6px 0 2px 12px;
  color: var(--narendi-muted);
  font-size: 11px;
}
.narendi-bubble {
  padding: 7px 12px;
  border-radius: 18px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.narendi-msg-mine .narendi-bubble {
  background: var(--narendi-accent);
  color: var(--narendi-on-accent);
}
.narendi-msg-theirs .narendi-bubble {
  background: var(--narendi-theirs);
  color: var(--narendi-text);
}
.narendi-msg-mine .narendi-bubble a {
  color: inherit;
  text-decoration: underline;
}
.narendi-bubble svg {
  vertical-align: -3px;
}
.narendi-bubble-muted,
.narendi-msg-mine .narendi-bubble-muted,
.narendi-msg-theirs .narendi-bubble-muted {
  border: 1px solid var(--narendi-border);
  background: transparent;
  color: var(--narendi-muted);
  font-style: italic;
  font-size: 13px;
}
.narendi-bubble-media,
.narendi-msg-mine .narendi-bubble-media,
.narendi-msg-theirs .narendi-bubble-media {
  padding: 0;
  background: transparent;
}
.narendi-bubble-emoji,
.narendi-msg-mine .narendi-bubble-emoji,
.narendi-msg-theirs .narendi-bubble-emoji {
  padding: 0 4px;
  background: transparent;
  font-size: 32px;
  line-height: 1.2;
}
.narendi-image {
  display: block;
  max-width: 220px;
  max-height: 260px;
  min-width: 60px;
  min-height: 40px;
  border-radius: 14px;
  background: var(--narendi-surface);
  object-fit: cover;
  cursor: zoom-in;
}
.narendi-bubble-file,
.narendi-msg-mine .narendi-bubble-file,
.narendi-msg-theirs .narendi-bubble-file {
  padding: 4px;
}
.narendi-file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  max-width: 240px;
  padding: 6px 10px 6px 6px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.narendi-msg-theirs .narendi-file-card {
  background: var(--narendi-bg);
}
.narendi-file-card:disabled {
  opacity: 0.6;
  cursor: progress;
}
.narendi-file-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
}
.narendi-file-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}
.narendi-file-name {
  overflow: hidden;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.narendi-file-size {
  font-size: 12px;
  opacity: 0.8;
}
.narendi-file-download {
  display: inline-flex;
  flex: none;
}
.narendi-video {
  display: block;
  max-width: 240px;
  max-height: 260px;
  border-radius: 12px;
  background: #000;
}
.narendi-audio {
  display: block;
  width: 240px;
}
.narendi-msg-sending {
  opacity: 0.6;
}
.narendi-msg-failed .narendi-bubble {
  outline: 1px solid var(--narendi-danger);
}
.narendi-msg-failed .narendi-link-button {
  margin-top: 2px;
  color: var(--narendi-danger);
  font-size: 12px;
}
.narendi-seen {
  align-self: flex-end;
  margin-top: 2px;
  color: var(--narendi-muted);
  font-size: 11px;
}
.narendi-typing {
  min-height: 18px;
  padding: 0 14px;
  color: var(--narendi-muted);
  font-size: 12px;
  font-style: italic;
}
.narendi-composer {
  display: flex;
  flex: none;
  align-items: flex-end;
  gap: 4px;
  padding: 6px 6px 8px;
}
.narendi-input {
  flex: 1;
  max-height: 120px;
  padding: 8px 12px;
  border: 0;
  border-radius: 18px;
  background: var(--narendi-surface);
  color: var(--narendi-text);
  font: inherit;
  resize: none;
}
.narendi-input:focus {
  outline: 2px solid var(--narendi-accent);
}

@media (max-width: 767px) {
  .narendi-dock {
    right: 0 !important;
    left: 0;
  }
  .narendi-box {
    width: 100%;
    height: calc(100dvh - 56px);
    border-radius: 12px 12px 0 0;
  }
  .narendi-box-min {
    height: auto;
  }
}

/* ---------- calls ---------- */

.narendi-call {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(340px, calc(100vw - 32px));
  padding: 24px 20px 20px;
  border-radius: 16px;
  background: #18191a;
  color: #fff;
  box-shadow: var(--narendi-shadow);
  transform: translateX(-50%);
}
.narendi-call[hidden] {
  display: none;
}
.narendi-call-media {
  display: none;
}
.narendi-call-video {
  top: 24px;
  bottom: 24px;
  width: min(960px, calc(100vw - 32px));
  padding: 0;
  overflow: hidden;
}
.narendi-call-video .narendi-call-media {
  position: relative;
  display: block;
  flex: 1;
  width: 100%;
  min-height: 0;
  background: #000;
}
.narendi-call-video .narendi-call-info {
  display: none;
}
.narendi-call-remote {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.narendi-call-local {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 28%;
  max-width: 220px;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transform: scaleX(-1);
}
.narendi-call-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.narendi-call-info strong {
  font-size: 18px;
}
.narendi-call-info span {
  color: #b0b3b8;
}
.narendi-call-controls {
  display: flex;
  gap: 16px;
  padding-bottom: 4px;
}
.narendi-call-video .narendi-call-controls {
  padding: 12px 0 16px;
}
.narendi-call-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: #3a3b3c;
  color: #fff;
  cursor: pointer;
}
.narendi-call-button:hover {
  background: #4e4f50;
}
.narendi-call-hangup,
.narendi-call-hangup:hover {
  background: #e41e3f;
}
.narendi-call-answer,
.narendi-call-answer:hover {
  background: var(--narendi-online);
}

/* ---------- dialogs and toast ---------- */

.narendi-dialog {
  width: min(400px, calc(100vw - 32px));
  padding: 20px;
  border: 0;
  border-radius: 12px;
  background: var(--narendi-bg);
  color: var(--narendi-text);
  box-shadow: var(--narendi-shadow);
}
.narendi-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}
.narendi-dialog-title {
  margin: 0 0 12px;
  font-size: 18px;
}
.narendi-dialog p {
  margin: 0 0 12px;
  color: var(--narendi-muted);
}
.narendi-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.narendi-dialog .narendi-dialog-label {
  margin: 4px 0 0;
  color: var(--narendi-text);
  font-weight: 600;
}
.narendi-dialog-error {
  margin-top: 8px;
  color: var(--narendi-danger) !important;
}
.narendi-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.narendi-key-field {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.04em;
}
.narendi-key-text {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--narendi-surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 1.6;
  word-spacing: 0.2em;
  user-select: all;
}
.narendi-key-text[hidden],
.narendi-key-field[hidden] {
  display: none;
}
.narendi-rail-collapsed .narendi-key-button {
  display: none;
}
.narendi-pick-list {
  max-height: 260px;
  overflow-y: auto;
}
.narendi-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-radius: 8px;
  cursor: pointer;
}
.narendi-pick:hover {
  background: var(--narendi-hover);
}
.narendi-pick input {
  accent-color: var(--narendi-accent);
}

.narendi-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 2000;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 8px;
  background: #1c1e21;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s, transform 0.2s;
}
.narendi-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  .narendi-toast,
  .narendi-rail {
    transition: none;
  }
}

/* ---------- emoji and reactions ---------- */

.narendi-msg-row {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
}
.narendi-msg-mine .narendi-msg-row {
  flex-direction: row-reverse;
}
.narendi-react {
  position: relative;
  flex: none;
}
.narendi-react-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--narendi-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.narendi-msg:hover .narendi-react-button,
.narendi-react-button:focus-visible,
.narendi-react-button[aria-expanded='true'] {
  opacity: 1;
}
@media (hover: none) {
  .narendi-react-button {
    opacity: 0.55;
  }
}
.narendi-react-button:hover {
  background: var(--narendi-hover);
  color: var(--narendi-text);
}
.narendi-quick-react {
  position: absolute;
  bottom: calc(100% + 4px);
  z-index: 5;
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--narendi-border);
  border-radius: 999px;
  background: var(--narendi-bg);
  box-shadow: var(--narendi-shadow);
}
.narendi-quick-react[hidden] {
  display: none;
}
.narendi-msg-theirs .narendi-quick-react {
  left: -40px;
}
.narendi-msg-mine .narendi-quick-react {
  right: -40px;
}
.narendi-quick-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--narendi-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s ease;
}
.narendi-quick-emoji:hover,
.narendi-quick-emoji:focus-visible {
  background: var(--narendi-hover);
  transform: scale(1.18);
}
.narendi-quick-emoji.narendi-quick-mine {
  background: var(--narendi-hover);
}
.narendi-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: -4px;
  padding: 0 6px;
  position: relative;
}
.narendi-reaction {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 22px;
  padding: 1px 7px;
  border: 1px solid var(--narendi-border);
  border-radius: 999px;
  background: var(--narendi-bg);
  color: var(--narendi-muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.narendi-reaction-emoji {
  font-size: 14px;
}
.narendi-reaction:hover {
  background: var(--narendi-hover);
}
.narendi-reaction.narendi-reaction-mine {
  border-color: var(--narendi-accent);
  color: var(--narendi-text);
  background: var(--narendi-hover);
}
.narendi-emoji-pop {
  position: fixed;
  z-index: 100000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--narendi-shadow);
}
.narendi-emoji-pop[hidden] {
  display: none;
}
.narendi-emoji-pop emoji-picker {
  width: 100%;
  height: 100%;
  --background: var(--narendi-bg);
  --border-color: var(--narendi-border);
  --indicator-color: var(--narendi-accent);
  --input-border-color: var(--narendi-border);
  --input-font-color: var(--narendi-text);
  --input-placeholder-color: var(--narendi-muted);
  --outline-color: var(--narendi-accent);
  --category-font-color: var(--narendi-muted);
  --button-active-background: var(--narendi-hover);
  --button-hover-background: var(--narendi-hover);
  --num-columns: 8;
}
@media (prefers-reduced-motion: reduce) {
  .narendi-react-button,
  .narendi-quick-emoji {
    transition: none;
  }
  .narendi-quick-emoji:hover,
  .narendi-quick-emoji:focus-visible {
    transform: none;
  }
}

/* ---------- chat backgrounds ---------- */
/* Each background is data: a gradient plus an optional pattern tinted by --narendi-wall-ink. */

.narendi-stage {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.narendi-stage > .narendi-messages {
  position: relative;
  z-index: 1;
}
.narendi-wall {
  --narendi-wall-doodle: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22180%22 height=%22180%22 viewBox=%220 0 180 180%22 fill=%22none%22 stroke=%22%23000%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E %3Cpath d=%22M18 22h30a8 8 0 0 1 8 8v14a8 8 0 0 1-8 8H32l-9 7v-7h-5a8 8 0 0 1-8-8V30a8 8 0 0 1 8-8z%22/%3E %3Cpath d=%22M128 30c4-7 15-6 15 3 0 7-15 16-15 16s-15-9-15-16c0-9 11-10 15-3z%22/%3E %3Cpath d=%22M150 104l3 8 8 3-8 3-3 8-3-8-8-3 8-3z%22/%3E %3Ccircle cx=%2252%22 cy=%22124%22 r=%2214%22/%3E%3Cpath d=%22M46 128a8 8 0 0 0 12 0M47 120h.01M57 120h.01%22/%3E %3Cpath d=%22M98 88v-18l14-3v18%22/%3E%3Ccircle cx=%2294%22 cy=%2288%22 r=%224%22/%3E%3Ccircle cx=%22108%22 cy=%2285%22 r=%224%22/%3E %3Cpath d=%22M112 150l4 9 10 1-7 7 2 10-9-5-9 5 2-10-7-7 10-1z%22/%3E %3Cpath d=%22M76 46c4 0 7-3 7-7%22/%3E%3Ccircle cx=%2220%22 cy=%2296%22 r=%223%22/%3E%3Ccircle cx=%22168%22 cy=%2262%22 r=%222.5%22/%3E%3Ccircle cx=%2284%22 cy=%22168%22 r=%222.5%22/%3E %3Cpath d=%22M150 150h16a5 5 0 0 1 5 5v8a5 5 0 0 1-5 5h-3l-5 4v-4h-8a5 5 0 0 1-5-5v-8a5 5 0 0 1 5-5z%22/%3E %3C/svg%3E");
  --narendi-wall-dots: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2222%22 height=%2222%22%3E%3Ccircle cx=%225%22 cy=%225%22 r=%221.6%22 fill=%22%23000%22/%3E%3Ccircle cx=%2216%22 cy=%2216%22 r=%221.6%22 fill=%22%23000%22/%3E%3C/svg%3E");
  --narendi-wall-stars: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22140%22 height=%22140%22 fill=%22%23000%22%3E%3Ccircle cx=%2212%22 cy=%2218%22 r=%221.2%22/%3E%3Ccircle cx=%2260%22 cy=%228%22 r=%220.8%22/%3E%3Ccircle cx=%22104%22 cy=%2230%22 r=%221.5%22/%3E%3Ccircle cx=%2234%22 cy=%2270%22 r=%220.9%22/%3E%3Ccircle cx=%2288%22 cy=%2284%22 r=%221.1%22/%3E%3Ccircle cx=%22128%22 cy=%2296%22 r=%220.8%22/%3E%3Ccircle cx=%2220%22 cy=%22120%22 r=%221.4%22/%3E%3Ccircle cx=%2270%22 cy=%22128%22 r=%220.9%22/%3E%3Cpath d=%22M118 52l2 5 5 2-5 2-2 5-2-5-5-2 5-2z%22/%3E%3Cpath d=%22M46 100l1.5 3.5 3.5 1.5-3.5 1.5-1.5 3.5-1.5-3.5-3.5-1.5 3.5-1.5z%22/%3E%3C/svg%3E");
  --narendi-wall-pattern: none;
  --narendi-wall-ink: transparent;
  --narendi-wall-bg: transparent;
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--narendi-wall-bg);
}
.narendi-wall::before,
.narendi-wall::after {
  content: '';
  position: absolute;
  inset: 0;
}
.narendi-wall::before {
  background: var(--narendi-wall-ink);
  -webkit-mask: var(--narendi-wall-pattern) repeat;
  mask: var(--narendi-wall-pattern) repeat;
}
.narendi-wall[data-preset='image'] {
  inset: calc(-2 * var(--narendi-wall-blur, 0px));
  background: var(--narendi-wall-image, var(--narendi-surface)) center / cover no-repeat;
  filter: blur(var(--narendi-wall-blur, 0px));
}
.narendi-wall[data-preset='image']::after {
  background: rgba(0, 0, 0, var(--narendi-wall-dim, 0));
}
.narendi-wall[data-preset='wiply'] {
  --narendi-wall-bg: linear-gradient(135deg, #fde2f0 0%, #ece2fb 55%, #ffe7dc 100%);
  --narendi-wall-pattern: var(--narendi-wall-doodle);
  --narendi-wall-ink: rgba(126, 91, 166, 0.2);
}
.narendi-wall[data-preset='sunset'] {
  --narendi-wall-bg: linear-gradient(160deg, #ffe4d4 0%, #ffd2ca 50%, #fbd6ea 100%);
  --narendi-wall-pattern: var(--narendi-wall-doodle);
  --narendi-wall-ink: rgba(214, 72, 92, 0.16);
}
.narendi-wall[data-preset='lavender'] {
  --narendi-wall-bg: #ece6f7;
  --narendi-wall-pattern: var(--narendi-wall-dots);
  --narendi-wall-ink: rgba(126, 91, 166, 0.22);
}
.narendi-wall[data-preset='night'] {
  --narendi-wall-bg: linear-gradient(180deg, #1b1340 0%, #2d1650 60%, #4a1942 100%);
  --narendi-wall-pattern: var(--narendi-wall-stars);
  --narendi-wall-ink: rgba(255, 255, 255, 0.55);
}
.narendi-wall[data-preset='mint'] {
  --narendi-wall-bg: linear-gradient(150deg, #dcf6ec 0%, #e2f0fb 100%);
  --narendi-wall-pattern: var(--narendi-wall-doodle);
  --narendi-wall-ink: rgba(20, 120, 100, 0.14);
}
.narendi-wall[data-preset='sky'] {
  --narendi-wall-bg: linear-gradient(170deg, #dbeafe 0%, #ede9fe 100%);
  --narendi-wall-pattern: var(--narendi-wall-dots);
  --narendi-wall-ink: rgba(59, 90, 170, 0.18);
}
.narendi-wall[data-preset='paper'] {
  --narendi-wall-bg: #f6efe3;
  --narendi-wall-pattern: var(--narendi-wall-doodle);
  --narendi-wall-ink: rgba(120, 90, 60, 0.15);
}
body.night-mode .narendi-wall[data-preset='wiply'] {
  --narendi-wall-bg: linear-gradient(135deg, #3a1030 0%, #241a3d 55%, #3a1e17 100%);
  --narendi-wall-ink: rgba(255, 255, 255, 0.07);
}
body.night-mode .narendi-wall[data-preset='sunset'] {
  --narendi-wall-bg: linear-gradient(160deg, #3e1e15 0%, #3c1626 50%, #2b1731 100%);
  --narendi-wall-ink: rgba(255, 200, 190, 0.07);
}
body.night-mode .narendi-wall[data-preset='lavender'] {
  --narendi-wall-bg: #231d30;
  --narendi-wall-ink: rgba(200, 180, 240, 0.12);
}
body.night-mode .narendi-wall[data-preset='mint'] {
  --narendi-wall-bg: linear-gradient(150deg, #10302a 0%, #12263a 100%);
  --narendi-wall-ink: rgba(180, 255, 230, 0.07);
}
body.night-mode .narendi-wall[data-preset='sky'] {
  --narendi-wall-bg: linear-gradient(170deg, #10203b 0%, #1f1a41 100%);
  --narendi-wall-ink: rgba(190, 210, 255, 0.1);
}
body.night-mode .narendi-wall[data-preset='paper'] {
  --narendi-wall-bg: #2b2620;
  --narendi-wall-ink: rgba(255, 240, 220, 0.07);
}

/* Times, "Seen" and empty notes stay readable on any background */
.narendi-has-wall .narendi-time,
.narendi-has-wall .narendi-empty {
  align-self: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--narendi-bg) 78%, transparent);
  color: var(--narendi-text);
}
.narendi-has-wall .narendi-seen,
.narendi-has-wall .narendi-msg-name {
  padding: 1px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--narendi-bg) 78%, transparent);
  color: var(--narendi-text);
}
.narendi-has-wall .narendi-msg-theirs .narendi-bubble:not(.narendi-bubble-emoji):not(.narendi-bubble-media) {
  background: var(--narendi-bg);
  box-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.12);
}
.narendi-has-wall .narendi-bubble-muted {
  background: color-mix(in srgb, var(--narendi-bg) 85%, transparent);
}

/* ---------- the "more" menu in a chat header ---------- */

.narendi-menu-wrap {
  position: relative;
}
.narendi-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 10;
  min-width: 200px;
  padding: 6px;
  border: 1px solid var(--narendi-border);
  border-radius: 10px;
  background: var(--narendi-bg);
  box-shadow: var(--narendi-shadow);
}
.narendi-menu[hidden] {
  display: none;
}
.narendi-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--narendi-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.narendi-menu-item:hover,
.narendi-menu-item:focus-visible {
  background: var(--narendi-hover);
}
.narendi-menu-icon {
  display: inline-flex;
  color: var(--narendi-accent);
}

/* ---------- background picker ---------- */

.narendi-wall-dialog {
  gap: 12px;
}
.narendi-wall-preview {
  height: 150px;
  flex: none;
  border-radius: 10px;
  border: 1px solid var(--narendi-border);
}
.narendi-wall-preview-msgs {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  height: 100%;
  padding: 12px;
}
.narendi-wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 8px;
}
.narendi-wall-swatch {
  position: relative;
  aspect-ratio: 3 / 4;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--narendi-border);
  border-radius: 10px;
  background: var(--narendi-bg);
  cursor: pointer;
}
.narendi-wall-swatch[aria-checked='true'] {
  border-color: var(--narendi-accent);
  box-shadow: 0 0 0 2px var(--narendi-hover);
}
.narendi-wall-swatch:focus-visible {
  outline: 2px solid var(--narendi-accent);
  outline-offset: 2px;
}
.narendi-wall-mini {
  --narendi-wall-blur: 0px;
}
.narendi-wall-mini[data-preset='image'] {
  background: var(--narendi-surface);
  filter: none;
}
.narendi-wall-swatch-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--narendi-accent);
  font-size: 24px;
  font-weight: 600;
}
.narendi-wall-controls {
  display: grid;
  gap: 8px;
}
.narendi-wall-controls[hidden] {
  display: none;
}
.narendi-wall-slider {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: center;
  gap: 10px;
  color: var(--narendi-text);
}
.narendi-wall-slider input {
  accent-color: var(--narendi-accent);
}
.narendi-wall-scope {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--narendi-text);
}
.narendi-wall-scope legend {
  margin-bottom: 4px;
  padding: 0;
  font-weight: 600;
}
.narendi-wall-scope-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.narendi-wall-scope-option input {
  accent-color: var(--narendi-accent);
}

/* Narendi add-on for the Narendi web app (Element): chat backgrounds behind the timeline */
.narendi-el-stage {
  position: relative;
  overflow: hidden;
}
.narendi-el-stage > .narendi-wall {
  z-index: 0;
}
.narendi-el-stage > :not(.narendi-wall) {
  position: relative;
  z-index: 1;
}
body.narendi-el-has-wall .narendi-el-stage .mx_RoomView_messagePanel,
body.narendi-el-has-wall .narendi-el-stage .mx_RoomView_MessageList {
  background: transparent;
}
/* Element shows messages without bubbles: give each line a soft backing so text stays readable */
body.narendi-el-has-wall .mx_EventTile:not(.mx_EventTile_info) .mx_EventTile_line,
body.narendi-el-has-wall .mx_GenericEventListSummary,
body.narendi-el-has-wall .mx_EventTile_info .mx_EventTile_line,
body.narendi-el-has-wall .mx_DateSeparator h2,
body.narendi-el-has-wall .mx_NewRoomIntro {
  background: color-mix(in srgb, var(--cpd-color-bg-canvas-default, #ffffff) 84%, transparent);
  border-radius: 12px;
}
body.narendi-el-has-wall .mx_DateSeparator h2 {
  padding: 2px 12px;
}
body.narendi-el-has-wall .mx_NewRoomIntro {
  padding: 12px 16px;
}
.narendi-el-wall-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--cpd-color-icon-secondary, #656d77);
  cursor: pointer;
}
.narendi-el-wall-button svg {
  width: 22px;
  height: 22px;
}
.narendi-el-wall-button:hover {
  background: var(--cpd-color-bg-subtle-primary, rgba(0, 0, 0, 0.06));
  color: var(--cpd-color-icon-primary, #1b1d22);
}
.narendi-el-wall-button:focus-visible {
  outline: 2px solid var(--cpd-color-border-focused, #7e5ba6);
}
.narendi-dialog {
  font-family: inherit;
}
body.narendi-el-has-wall .mx_EventTile .mx_DisambiguatedProfile {
  padding: 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cpd-color-bg-canvas-default, #ffffff) 84%, transparent);
}
