/* Max's first thought opens up; later turns keep the same presence beside the composer. */
.uni-thinking-orb {
  --thinking-orb-ink: #348753;
  --thinking-orb-muted: #b9ec63;
  display: block;
  flex: none;
  position: relative;
  z-index: 2;
  pointer-events: none;
}
.uni-chat-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 12px 24px;
  text-align: center;
  min-height: 284px;
}
.uni-chat-orb-stage {
  display: grid;
  place-items: center;
  position: relative;
  width: 224px;
  height: 212px;
  isolation: isolate;
}
.uni-chat-orb-stage::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    #d4f98438 0,
    #b7ee8820 32%,
    transparent 70%
  );
  z-index: -1;
}
.uni-chat-status {
  color: var(--ink, #214b36);
  font-size: 15px;
  font-weight: 550;
  line-height: 1.5;
  margin: 4px 0 0;
  letter-spacing: -0.015em;
}
.uni-chat-status-detail {
  max-width: 350px;
  margin: 8px 0 0;
  color: var(--mut, #708079);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.uni-chat-status-inline {
  padding: 8px 0 18px;
  font-size: 13px;
  color: var(--mut, #708079);
}
body.cx-pub.cx-shell .uni-chat-form.uni-chat-voice-form {
  padding: 12px 14px 10px;
}
body.cx-pub.cx-shell
  .uni-chat-form.uni-chat-voice-form
  > .uni-chat-compose-body {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}
.uni-chat-orb-mini {
  width: 32px;
  height: 32px;
  margin-top: 2px;
}
body.cx-pub.cx-shell .uni-chat-form.uni-chat-voice-form textarea {
  padding: 4px 0;
  min-height: 44px;
}
body.cx-pub.cx-shell
  .uni-chat-form.uni-chat-voice-form
  > .uni-chat-compose-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}
body.cx-pub.cx-shell
  .uni-chat-form.uni-chat-voice-form
  .uni-chat-compose-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
body.cx-pub.cx-shell .uni-chat-form.uni-chat-voice-form button {
  position: static;
  flex: 0 0 40px;
  width: 40px;
  min-width: 40px;
  height: 40px;
}
body.cx-pub.cx-shell .uni-chat-form.uni-chat-voice-form .uni-audio-mic {
  background: transparent;
  color: var(--ink, #214b36);
  border: 1px solid transparent;
}
body.cx-pub.cx-shell .uni-chat-form.uni-chat-voice-form .uni-audio-mic:hover {
  background: var(--uni-soft, #edf4e9);
}
body.cx-pub.cx-shell
  .uni-chat-form.uni-chat-voice-form
  .uni-audio-mic[aria-pressed="true"] {
  background: #dcf7bd;
  border-color: #97c97b;
  color: #214b36;
}
body.cx-pub.cx-shell .uni-chat-form.uni-chat-voice-form .uni-audio-mic svg {
  transform: none;
  width: 21px;
  height: 21px;
}
html[data-uni-theme]:not([data-uni-theme="light"]) .uni-thinking-orb {
  --thinking-orb-ink: #b8ee71;
  --thinking-orb-muted: #51aa83;
}
html[data-uni-contrast="high"] .uni-thinking-orb {
  --thinking-orb-ink: #184d33;
  --thinking-orb-muted: #35754c;
}
/* Desktop keeps the explicit recording-cancellation label. */
body.cx-pub.cx-shell .uni-chat-form.uni-chat-voice-form .uni-audio-cancel,
body.cx-pub.cx-shell.uni-conversation-active
  .uni-chat-form.uni-chat-voice-form
  .uni-audio-cancel {
  width: auto;
  min-width: 88px;
  flex: 0 0 auto;
  padding: 0 8px;
  white-space: nowrap;
  font-size: 11px;
}
body.cx-pub.cx-shell
  .uni-chat-form.uni-chat-voice-form
  .uni-audio-cancel[hidden] {
  display: none;
}

body.cx-pub.cx-shell
  .uni-chat-form.uni-chat-voice-form
  .uni-audio-cancel
  > svg {
  display: none;
}

/* The compact title and voice caption are exclusive to the mobile conversation. */
.uni-chat-mobile-title,
.uni-chat-voice-caption {
  display: none;
}

@media (max-width: 860px) {
  body.cx-pub.cx-shell.uni-conversation-active {
    --uni-chat-header-height: calc(56px + env(safe-area-inset-top, 0px));
  }

  body.cx-pub.cx-shell.uni-conversation-active .cx-topbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    justify-content: start;
    gap: 8px;
    height: calc(56px + env(safe-area-inset-top, 0px));
    padding: calc(6px + env(safe-area-inset-top, 0px))
      max(12px, env(safe-area-inset-right, 0px)) 6px
      max(8px, env(safe-area-inset-left, 0px));
  }

  body.cx-pub.cx-shell.uni-conversation-active .cx-topbar > .cx-mobile-toggle {
    grid-column: 1;
    grid-row: 1;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    gap: 0;
    border: 0;
    background: transparent;
  }

  body.cx-pub.cx-shell.uni-conversation-active .cx-topbar > .uni-language-controls {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    margin-left: 0;
  }

  body.cx-pub.cx-shell.uni-conversation-active .cx-mobile-toggle > span {
    display: none;
  }

  body.cx-pub.cx-shell.uni-conversation-active .cx-topbar > .uni-brand {
    grid-column: 2;
    grid-row: 1;
    justify-self: start;
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    padding: 0;
    gap: 0;
  }

  body.cx-pub.cx-shell.uni-conversation-active
    .uni-brand
    > :is(.uni-brand-mark, .uni-brand-type) {
    display: none;
  }

  body.cx-pub.cx-shell.uni-conversation-active
    .uni-brand
    > .uni-chat-mobile-title {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: var(--ink, #214b36);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.025em;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  body.cx-pub.cx-shell.uni-conversation-active .uni-chat {
    grid-template-rows: minmax(0, 1fr) auto;
  }

  /* Keep the page heading available to assistive technology without a second bar. */
  body.cx-pub.cx-shell.uni-conversation-active .uni-chat-heading {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  body.cx-pub.cx-shell.uni-conversation-active .uni-chat-heading > button {
    display: none;
  }

  body.cx-pub.cx-shell.uni-conversation-active .uni-chat-intro {
    display: none;
  }

  /* The input is the floating surface; the dock keeps the conversation background. */
  body.cx-pub.cx-shell.uni-conversation-active .uni-chat-dock {
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  body.cx-pub.cx-shell.uni-conversation-active
    .uni-chat-form.uni-chat-voice-form {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    grid-template-rows: 44px;
    align-items: center;
    gap: 0 6px;
    min-width: 0;
    padding: 6px;
    border-radius: 29px;
    border-color: var(--line, #e1e6e2);
    box-shadow:
      0 4px 18px #173d2f0d,
      0 1px 3px #173d2f05;
  }

  body.cx-pub.cx-shell.uni-conversation-active
    .uni-chat-form.uni-chat-voice-form
    > :is(.uni-chat-compose-body, .uni-chat-compose-footer) {
    display: contents;
  }

  body.cx-pub.cx-shell.uni-conversation-active
    .uni-chat-form.uni-chat-voice-form
    .uni-chat-orb-mini {
    display: block;
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    width: 32px;
    height: 32px;
    margin: 0;
  }

  body.cx-pub.cx-shell.uni-conversation-active
    .uni-chat-form.uni-chat-voice-form
    textarea {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    padding: 11px 0;
    margin: 0;
    resize: none;
    overflow: hidden;
    white-space: pre;
    font-size: 16px;
    line-height: 22px;
  }

  body.cx-pub.cx-shell.uni-conversation-active
    .uni-chat-form.uni-chat-voice-form
    .uni-chat-compose-buttons {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
  }

  body.cx-pub.cx-shell.uni-conversation-active
    .uni-chat-form.uni-chat-voice-form
    .uni-audio-controls {
    gap: 4px;
    margin: 0;
  }

  body.cx-pub.cx-shell.uni-conversation-active
    .uni-chat-form.uni-chat-voice-form
    button {
    position: static;
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
  }

  body.cx-pub.cx-shell.uni-conversation-active
    .uni-chat-form.uni-chat-voice-form
    .uni-chat-keyboard-hint {
    display: none;
  }

  body.cx-pub.cx-shell.uni-conversation-active
    .uni-chat-form.uni-chat-voice-form
    .uni-audio-cancel {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
  }

  body.cx-pub.cx-shell.uni-conversation-active
    .uni-chat-form.uni-chat-voice-form
    .uni-audio-cancel[hidden],
  body.cx-pub.cx-shell.uni-conversation-active
    .uni-chat-form.uni-chat-voice-form
    .uni-audio-cancel
    > span {
    display: none;
  }

  body.cx-pub.cx-shell.uni-conversation-active
    .uni-chat-form.uni-chat-voice-form
    .uni-audio-cancel
    svg {
    display: block;
    width: 20px;
    height: 20px;
    transform: none;
  }

  /* Only deliberate typing opens a second row; focused/disabled voice input cannot. */
  body.cx-pub.cx-shell.uni-conversation-active
  .uni-chat-form.uni-chat-voice-form[data-voice-active="false"][data-chat-busy="false"]:has(
    textarea:focus
  ) {
    grid-template-rows: 44px 44px;
    row-gap: 4px;
    border-radius: 26px;
  }

  body.cx-pub.cx-shell.uni-conversation-active
    .uni-chat-form.uni-chat-voice-form[data-voice-active="false"][data-chat-busy="false"]:has(
      textarea:focus
    )
    textarea {
    grid-column: 2 / 4;
    padding-block: 0;
    overflow-y: auto;
    white-space: pre-wrap;
  }

  body.cx-pub.cx-shell.uni-conversation-active
    .uni-chat-form.uni-chat-voice-form[data-voice-active="false"][data-chat-busy="false"]:has(
      textarea:focus
    )
    .uni-chat-compose-buttons {
    grid-column: 2 / 4;
    grid-row: 2;
  }

  body.cx-pub.cx-shell.uni-conversation-active
    .uni-chat-form.uni-chat-voice-form[data-voice-active="true"]
    textarea {
    display: none;
  }

  body.cx-pub.cx-shell.uni-conversation-active
    .uni-chat-form.uni-chat-voice-form[data-voice-active="true"]
    .uni-chat-voice-caption {
    display: block;
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--ink, #214b36);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  body.cx-pub.cx-shell.uni-conversation-active
    .uni-chat-dock:has(.uni-chat-form[data-voice-active="true"])
    > .uni-audio-status {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
}
