/* The conversation surfaces share roles and spacing across the visitor, CRM and preview. */
.public-chat-card, .conversation-main {
  --chat-brand: var(--pp-chat-outgoing);
  --chat-on-brand: var(--pp-chat-on-outgoing);
  --chat-wall: var(--pp-chat-canvas);
  --chat-wall-deep: var(--pp-chat-canvas-deep);
  --chat-gutter: clamp(14px, 3vw, 24px);
}
.public-chat-card {
  --chat-wall: color-mix(in srgb, var(--chat-brand) 5%, var(--pp-chat-canvas));
  --chat-wall-deep: color-mix(in srgb, var(--chat-brand) 8%, var(--pp-chat-canvas-deep));
}
.public-chat-page:not(.embedded) {
  background: var(--pp-chat-canvas);
  background: linear-gradient(125deg, #e8f1ef, #cbdfe7);
}
.public-chat-page:not(.embedded) .public-chat-card {
  width: min(470px, 100%);
  border-color: var(--pp-chat-line);
  border-radius: 22px;
  box-shadow: 0 12px 44px #163c4b26;
}
.public-chat-card .public-chat-header {
  gap: 11px;
  padding: 16px var(--chat-gutter);
  border-bottom: 1px solid #172f3933;
}
.public-chat-card .chat-emblem {
  position: relative;
  display: grid; place-items: center;
  width: 42px; height: 42px; flex: none;
  border: 1px solid currentColor;
  border-color: color-mix(in srgb, currentColor 45%, transparent);
  border-radius: 15px;
  background: color-mix(in srgb, currentColor 12%, transparent);
  color: inherit;
}
.chat-emblem::before, .chat-emblem::after {
  content: ""; position: absolute;
  width: 15px; height: 12px;
  border: 1.8px solid currentColor; border-radius: 5px 5px 5px 1px;
}
.chat-emblem::before { transform: translate(-3px,-3px); }
.chat-emblem::after {
  transform: translate(4px,3px); background: var(--chat-brand);
  border-radius: 5px 5px 1px 5px;
}
.public-chat-card .public-chat-header strong { font-size: 18px; line-height: 1.3; letter-spacing: -.45px; }
.public-chat-card .public-chat-header small { margin-top: 3px; font-size: 12px; line-height: 1.4; opacity: 1; }
.nano-device.public-chat-card {
  width: min(100%, 315px); border: 6px solid var(--pp-chat-line); border-radius: 30px;
}
.nano-device.public-chat-card .device-chat { height: auto; min-height: 0; }
.nano-device .quick-questions button { font-size: 13px; }
.nano-device .device-input, .nano-device.public-chat-card > small { font-size: 11px; }
.conversation-main .chat-messages, .public-chat-card .public-chat-messages {
  background-color: var(--pp-chat-canvas);
  background-image: linear-gradient(150deg, var(--chat-wall-deep), var(--chat-wall) 62%, var(--chat-wall));
  padding: 16px var(--chat-gutter) 20px;
  scrollbar-gutter: stable;
  overscroll-behavior-y: contain;
  scroll-behavior: auto;
}
.conversation-main .chat-messages {
  min-height: 260px;
  max-height: clamp(340px, 52dvh, 640px);
}
.public-chat-card .chat-date, .conversation-main .chat-date, .chat-row > .chat-day {
  display: block;
  width: fit-content;
  max-width: 100%;
  justify-self: center;
  grid-column: 1 / -1;
  margin: 0 auto 15px;
  padding: 3px 12px;
  border-radius: 16px;
  background: #edf6f7;
  color: var(--pp-chat-meta);
  font-size: 12px; font-weight: 650; line-height: 1.55;
  text-align: center; letter-spacing: 0;
}
.chat-row > .chat-day { margin-block: 5px 13px; }
.public-chat-card .chat-row, .conversation-main .chat-row {
  display: grid;
  grid-template-columns: 28px minmax(0,1fr);
  column-gap: 8px; row-gap: 0;
  align-items: start;
  margin: 0 0 12px;
}
.chat-row > .chat-face {
  grid-column: 1;
  display: grid; place-items: center;
  width: 28px; height: 28px;
  margin-top: 2px;
  border: 1px solid #a6c0b6; border-radius: 10px;
  background: var(--pp-chat-face); color: #204e42;
  font: 700 13px/1 var(--pp-font-sans);
}
.chat-row > .chat-copy {
  grid-column: 2; justify-self: start;
  width: fit-content; min-width: 0;
  max-width: min(92%, 38rem);
}
.chat-row .message-author {
  display: block;
  margin: 0 2px 3px;
  color: var(--pp-chat-meta); font-weight: 650; font-size: 12px; line-height: 1.4;
}
.public-chat-card .chat-row .message-bubble, .conversation-main .chat-row .message-bubble {
  width: fit-content; max-width: 100%;
  padding: 9px 13px;
  border: 1px solid #adbec4;
  border-radius: 4px 16px 16px 16px;
  background: var(--pp-chat-incoming); color: var(--pp-chat-ink);
  box-shadow: 0 1px 2px #18394313;
  font-size: 15px; line-height: 1.55; letter-spacing: -.13px;
  text-align: start; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere;
}
.public-chat-card .chat-row .nano-welcome { white-space: normal; }
.nano-welcome p[lang] + p[lang] { padding-top: 7px; border-top: 1px solid #d5e2e5; }
.public-chat-card .chat-row.agent, .conversation-main .chat-row.agent {
  grid-template-columns: minmax(0,1fr);
}
.chat-row.agent > .chat-copy { grid-column: 1; justify-self: end; }
.public-chat-card .chat-row.agent .message-bubble, .conversation-main .chat-row.agent .message-bubble {
  margin-left: auto;
  background: var(--chat-brand); color: var(--chat-on-brand);
  border-color: var(--chat-brand);
  border-radius: 16px 4px 16px 16px;
}
.chat-row .chat-time {
  display: block; margin: 3px 2px 0;
  color: var(--pp-chat-meta);
  font-size: 11px; line-height: 1.35; font-variant-numeric: tabular-nums;
}
.chat-row.agent .chat-time { text-align: right; }
.chat-row [hidden] { display: none !important; }
.public-chat-card .chat-row.joined, .conversation-main .chat-row.joined { margin-top: -8px; }
.chat-row.joined .chat-face { visibility: hidden; }
.chat-row.joined .message-author, .public-chat-card .chat-row.agent .message-author {
  position: absolute; width: 1px; height: 1px; margin: -1px; clip-path: inset(50%); overflow: hidden;
}
.chat-row .crm-translation {
  margin-top: 4px; padding: 7px 10px; border: 0; border-left: 3px solid #56877a;
  border-radius: 3px 10px 10px 3px;
  background: #e8f4ed; color: #24483e; font-size: 13px; line-height: 1.55;
}
.chat-row .crm-translation.failed {
  color: var(--pp-translation-error); border-color: var(--pp-translation-error-border);
  background: var(--pp-translation-error-fill);
}
.public-chat-card .public-chat-form {
  display: grid; grid-template-columns: minmax(0,1fr) 44px;
  gap: 8px; align-items: center;
  padding: 11px var(--chat-gutter) 7px;
  border-top: 1px solid var(--pp-chat-line); background: var(--pp-surface);
}
.public-chat-form #name-label {
  grid-column: 1 / -1;
  display: flex; flex-direction: row; align-items: center;
  gap: var(--pp-space-8); width: 100%; margin: 0;
  color: var(--pp-chat-meta); font-size: 12px; font-weight: 650;
}
.public-chat-form #name-label input {
  flex: 1; width: 0; min-width: 0; max-width: 100%; min-height: 30px;
  margin: 0; padding: 4px 6px;
  border: 0; border-bottom: 1px solid var(--pp-control-border); border-radius: 0;
  background: transparent; color: var(--pp-chat-ink);
}
.public-chat-card .public-chat-form input[name="message"], .conversation-main .reply-form textarea {
  width: 100%; min-width: 0; margin: 0;
  border: 1px solid var(--pp-chat-line); border-radius: 16px;
  padding: 10px 13px; background: #f3f7f7; color: var(--pp-chat-ink);
  font: inherit; font-size: 15px; line-height: 1.45;
}
.public-chat-card .public-chat-form input[name="message"] { height: 44px; }
.public-chat-form input::placeholder, .reply-form textarea::placeholder { color: #556a72; }
.public-chat-card .public-chat-form .send {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 15px; color: var(--chat-on-brand); background: var(--chat-brand);
}
.public-chat-card .public-chat-form :focus-visible, .conversation-main .reply-form :focus-visible {
  outline: 2px solid #175d76; outline-offset: 2px;
}
.public-chat-card .public-chat-credit {
  padding: 2px var(--chat-gutter) 7px; background: var(--pp-surface);
  color: var(--pp-chat-meta); font-size: 11px; line-height: 1.3;
}
.public-chat-card #feedback:empty { display: none; }
.inbox-layout .conversation-list-header strong { font-size: 16px; }
.inbox-layout .conversation-list-header strong > span { font-size: 11px; border-radius: 9px; }
.inbox-layout .inbox-search input, .inbox-layout .inbox-search .text-button { font-size: 12px; }
.inbox-layout .conversation-item .conversation-name strong { font-size: 14px; }
.inbox-layout .conversation-item .conversation-name small { font-size: 11px; }
.inbox-layout .conversation-item p { font-size: 13px; line-height: 1.5; }
.inbox-layout .conversation-item .badge, .inbox-layout .conversation-item > div > div:last-child small { font-size: 11px; }
.conversation-main .conversation-header { gap: 10px; border-bottom: 1px solid var(--pp-chat-line); }
.conversation-main .conversation-header strong { font-size: 16px; line-height: 1.4; }
.conversation-main .conversation-header small { font-size: 12px; line-height: 1.5; }
.conversation-main .conversation-header .btn { font-size: 12px; }
.conversation-main .reply-form { background: var(--pp-surface); border-top: 1px solid var(--pp-chat-line); }
.conversation-main .reply-form .reply-mode { gap: 6px; color: var(--pp-chat-meta); font-size: 12px; }
.conversation-main .reply-form textarea { min-height: 62px; resize: vertical; }
.conversation-main .reply-form textarea::placeholder { font-size: 14px; }
.conversation-main .reply-form > div:last-child { margin-top: 7px; }
.conversation-main .reply-form > div:last-child > span { font-size: 11px; }
.conversation-main .reply-form button[type="submit"] {
  border: 1px solid var(--chat-brand); border-radius: 12px;
  background: var(--chat-brand); color: var(--chat-on-brand);
  min-height: 38px; padding: 7px 13px; font-size: 13px;
}
.customer-sidebar .customer-detail :is(label, dl, dd, select, textarea, input, .btn),
.customer-sidebar .customer-detail > span { font-size: 12px; }
.customer-sidebar .customer-detail select, .customer-sidebar .customer-detail .btn { min-height: 34px; }
.customer-sidebar .customer-card .badge, .customer-sidebar .customer-detail dd .badge,
.customer-sidebar .customer-brand-context small { font-size: 11px; }
.customer-sidebar .customer-brand-context strong { font-size: 12px; }
@media (max-width: 620px), (hover: none) and (pointer: coarse) {
  .nano-standalone .public-chat-page:not(.embedded) .public-chat-card {
    width: 100%; height: 100%; border: 0; border-radius: 0; box-shadow: none;
  }
  .public-chat-card .public-chat-messages { scrollbar-gutter: auto; }
  .public-chat-card .public-chat-form input, .public-chat-form #name-label input { font-size: 16px; }
  .public-chat-form #name-label input { min-height: 40px; }
}
@container nano-chat (max-height: 320px) {
  .public-chat-card .public-chat-header { padding-block: 4px; }
  .public-chat-card .chat-emblem { width: 32px; height: 32px; }
  .public-chat-card .public-chat-messages, .public-chat-card .public-chat-form { padding-block: 4px; }
  .public-chat-card .public-chat-credit { padding-block: 2px; }
  .public-chat-form #name-label input { min-height: 30px; }
}
@container nano-chat (min-width: 540px) and (max-height: 320px) {
  .public-chat-card .public-chat-form:has(#name-label:not([hidden])) {
    grid-template-columns: minmax(145px,.85fr) minmax(0,1.5fr) 44px;
  }
  .public-chat-form #name-label { grid-column: auto; }
}
@media (forced-colors: active) {
  .chat-row .message-bubble, .chat-row .chat-face, .public-chat-card .send { border: 1px solid ButtonText; }
}
