.chat-page {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 0%, rgba(122, 168, 255, 0.17), transparent 28rem),
    linear-gradient(145deg, #0d1731, #040815 62%);
}

.chat-page > main {
  flex: none;
  width: 100%;
  margin: 0;
  padding: 0;
}

.chat-access-gate {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1rem;
}

.chat-access-card {
  width: min(34rem, 100%);
  padding: clamp(1.25rem, 4vw, 2rem);
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(8, 14, 34, 0.94);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.chat-access-brand,
.chat-workspace-brand {
  color: #fff;
  font-weight: 800;
}

.chat-access-kicker,
.chat-toolbar-kicker,
.chat-empty-kicker {
  margin: 1rem 0 0.3rem;
  color: #a9caff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.chat-access-card h1,
.chat-empty-state h2,
.chat-toolbar h1 {
  margin: 0;
}

#chat-access-status,
.chat-free-gate p,
#chat-mode-note,
.chat-history-status,
.chat-history-empty,
.chat-allowance,
.chat-empty-state > p {
  color: #cbd9f6;
}

.chat-access-error {
  padding: 0.8rem;
  border: 1px solid #d06c77;
  border-radius: 10px;
  color: #ffe8eb;
  background: rgba(112, 26, 40, 0.32);
}

.chat-sign-in {
  display: grid;
  place-items: center;
  min-height: 19rem;
  margin-top: 1rem;
}

.chat-access-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.chat-button,
.chat-account-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.55rem 0.85rem;
  border: 1px solid #536b9f;
  border-radius: 10px;
  color: #f3f7ff;
  font-weight: 750;
  background: rgba(22, 37, 77, 0.75);
}

.chat-button-primary {
  border-color: #91b4ff;
  background: #315fae;
}

.chat-workspace {
  display: grid;
  grid-template-columns: minmax(250px, 280px) minmax(0, 1fr);
  height: 100vh;
  min-height: 34rem;
  background: #060b1b;
}

.chat-sidebar {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  padding: 1rem;
  border-right: 1px solid var(--border);
  background: rgba(10, 18, 40, 0.98);
  transition: transform 160ms ease;
}

.chat-sidebar-top {
  display: grid;
  gap: 0.85rem;
}

.chat-sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.chat-sidebar-toggle,
.chat-sidebar-close,
.chat-sidebar-backdrop {
  display: none;
}

.chat-sidebar-toggle,
.chat-sidebar-close {
  min-width: 44px;
  min-height: 44px;
}

.chat-sidebar-close {
  padding: 0;
  border: 1px solid #536b9f;
  border-radius: 10px;
  color: #f3f7ff;
  font: inherit;
  font-size: 1.35rem;
  cursor: pointer;
  background: rgba(22, 37, 77, 0.75);
}

.chat-new-button,
.chat-history-more,
.chat-history-item {
  min-height: 42px;
  border: 1px solid #405784;
  border-radius: 10px;
  color: #eef4ff;
  font: inherit;
  cursor: pointer;
  background: rgba(24, 40, 80, 0.78);
}

.chat-new-button {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-weight: 800;
  text-align: left;
}

.chat-new-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.chat-history-group {
  display: grid;
  gap: 0.45rem;
}

.chat-history-group h2 {
  margin: 0;
  color: #a9b7dd;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-history-list {
  display: grid;
  gap: 0.3rem;
}

.chat-history-item {
  width: 100%;
  padding: 0.55rem 0.65rem;
  overflow: hidden;
  border-color: transparent;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: transparent;
}

.chat-history-item:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.chat-history-item:not(:disabled):hover,
.chat-history-item:not(:disabled):focus-visible {
  border-color: #536b9f;
  background: rgba(31, 50, 94, 0.8);
}

.chat-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.chat-folder-add,
.chat-history-menu-button,
.chat-folder-menu-button,
.chat-folder-confirm-delete,
.chat-folder-group > button,
.chat-inline-actions button {
  min-width: 42px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #dbe6ff;
  font: inherit;
  cursor: pointer;
  background: transparent;
}

.chat-folder-add {
  font-size: 1.2rem;
  line-height: 1;
}

.chat-folders-list,
.chat-folder-group {
  display: grid;
  gap: 0.35rem;
}

.chat-folder-group,
.chat-history-row {
  position: relative;
}

.chat-folder-group h3 {
  width: calc(100% - 42px - 0.35rem);
  min-height: 42px;
  margin: 0;
  overflow: hidden;
  color: #cbd9f6;
  font-size: 0.86rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-history-row {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
}

.chat-history-menu-button,
.chat-folder-menu-button {
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
}

.chat-folder-menu-button {
  position: absolute;
  top: 0;
  right: 0;
}

.chat-history-menu {
  display: grid;
  position: absolute;
  z-index: 10;
  top: calc(100% - 0.2rem);
  right: 0;
  min-width: 11rem;
  padding: 0.3rem;
  border: 1px solid #536b9f;
  border-radius: 10px;
  background: #101a35;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.chat-folder-group > .chat-history-menu {
  top: calc(42px + 0.35rem);
}

.chat-history-menu button {
  min-height: 38px;
  padding: 0.45rem 0.6rem;
  border: 0;
  border-radius: 7px;
  color: #eef4ff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  background: transparent;
}

.chat-history-menu button:disabled,
.chat-folder-add:disabled,
.chat-history-menu-button:disabled,
.chat-folder-menu-button:disabled,
.chat-folder-group > button:disabled,
.chat-inline-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.chat-history-menu button:not(:disabled):hover,
.chat-history-menu button:not(:disabled):focus-visible,
.chat-folder-add:not(:disabled):hover,
.chat-folder-add:not(:disabled):focus-visible,
.chat-history-menu-button:not(:disabled):hover,
.chat-history-menu-button:not(:disabled):focus-visible,
.chat-folder-menu-button:not(:disabled):hover,
.chat-folder-menu-button:not(:disabled):focus-visible,
.chat-inline-actions button:not(:disabled):hover,
.chat-inline-actions button:not(:disabled):focus-visible {
  outline: 2px solid #a9c1ff;
  outline-offset: 2px;
  background: rgba(83, 107, 159, 0.5);
}

.chat-history-rename,
.chat-folder-rename {
  width: 100%;
  min-height: 42px;
  padding: 0.5rem 0.6rem;
  border: 1px solid #7891ca;
  border-radius: 8px;
  color: #eef4ff;
  font: inherit;
  background: #101a35;
}

.chat-history-rename:focus-visible,
.chat-folder-rename:focus-visible {
  outline: 2px solid #a9c1ff;
  outline-offset: 2px;
}

.chat-inline-actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
  gap: 0.4rem;
}

.chat-inline-actions button {
  padding: 0.4rem 0.6rem;
}

.chat-folder-confirm-delete {
  width: max-content;
  padding: 0.4rem 0.6rem;
  border-color: #b96472;
  color: #ffdce1;
}

.chat-history-empty,
.chat-history-status,
.chat-allowance {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
}

.chat-history-more {
  padding: 0.45rem 0.6rem;
  font-size: 0.86rem;
}

.chat-history-more:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.chat-sidebar-footer {
  display: grid;
  gap: 0.65rem;
  margin-top: auto;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(83, 107, 159, 0.45);
}

.chat-conversation {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background:
    radial-gradient(circle at 50% 0%, rgba(83, 107, 159, 0.12), transparent 30rem),
    #070c1c;
}

.chat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 74px;
  padding: 0.75rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid rgba(83, 107, 159, 0.45);
  background: rgba(7, 12, 28, 0.9);
}

.chat-toolbar-kicker {
  margin: 0;
}

.chat-toolbar h1 {
  max-width: 54ch;
  overflow: hidden;
  font-size: 1.08rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-account-link {
  min-height: 38px;
  padding-block: 0.35rem;
  font-family: inherit;
  font-size: 0.92rem;
}

.chat-toolbar-actions,
.chat-share-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.chat-toolbar > div:first-child {
  min-width: 0;
}

.chat-share-panel {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(2, 5, 13, 0.78);
  backdrop-filter: blur(5px);
}

.chat-share-panel[hidden] {
  display: none;
}

.chat-share-card {
  width: min(34rem, 100%);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: clamp(1rem, 4vw, 1.5rem);
  border: 1px solid rgba(145, 180, 255, 0.42);
  border-radius: 16px;
  color: #edf3ff;
  background: #0b1430;
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.45);
}

.chat-share-card h2 {
  margin: 0.25rem 0 0.8rem;
}

.chat-share-card > p {
  line-height: 1.55;
}

.chat-share-warning {
  padding: 0.75rem;
  border: 1px solid rgba(245, 197, 107, 0.38);
  border-radius: 10px;
  color: #f5ddb0;
  background: rgba(101, 69, 12, 0.22);
}

.chat-share-url {
  width: 100%;
  min-height: 42px;
  margin: 0.25rem 0 0.75rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(145, 180, 255, 0.5);
  border-radius: 9px;
  color: #edf3ff;
  background: #070c1c;
}

.chat-share-feedback {
  min-height: 1.4rem;
  color: #c8d7f5;
}

.chat-button-danger {
  border-color: rgba(255, 142, 142, 0.55);
  color: #ffd6d6;
  background: rgba(92, 27, 37, 0.55);
}

.chat-conversation-scroll {
  /* Replaced message nodes and the sticky jump control are not scroll anchors. */
  overflow-anchor: none;
  position: relative;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(1rem, 4vw, 3rem);
}

.chat-jump-latest {
  position: sticky;
  bottom: 0.25rem;
  display: block;
  min-height: 44px;
  margin: 1rem auto 0;
  padding: 0.55rem 0.9rem;
  border: 1px solid #7891ca;
  border-radius: 999px;
  color: #f3f7ff;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  background: #16264a;
  box-shadow: 0 0.6rem 1.5rem rgba(0, 0, 0, 0.38);
}

/* Keep its footprint when hidden so approaching the bottom does not shrink
   the scrollport's content and clamp the reader's selected position. */
.chat-jump-latest[hidden] {
  display: block !important;
  visibility: hidden;
}

.chat-empty-state,
.chat-messages {
  width: min(48rem, 100%);
  margin: 0 auto;
}

.chat-empty-state {
  padding-top: clamp(3rem, 11vh, 8rem);
  text-align: center;
}

.chat-empty-kicker {
  margin: 0 0 0.35rem;
}

.chat-messages {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
}

.chat-message {
  margin: 0;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  color: #edf3ff;
  white-space: pre-wrap;
}

/* The speaker label ("You", "NTW") stays for screen readers only. */
.chat-message > strong {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chat-message p {
  margin: 0;
}

.chat-message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

.chat-message-attachment {
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(145, 171, 224, 0.45);
  border-radius: 999px;
  color: #d8e4ff;
  font-size: 0.74rem;
  background: rgba(12, 25, 53, 0.48);
}

.chat-message-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.chat-message-actions > button,
.chat-message-branch button,
.chat-message-edit-attachments button {
  min-height: 32px;
  padding: 0.3rem 0.55rem;
  border: 1px solid rgba(145, 171, 224, 0.45);
  border-radius: 8px;
  color: #d8e4ff;
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
  background: rgba(12, 25, 53, 0.58);
}

.chat-message-actions button:disabled,
.chat-message-edit-attachments button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.chat-message-actions button:focus-visible,
.chat-message-edit-attachments button:focus-visible,
.chat-message-edit-input:focus-visible {
  outline: 2px solid #a9c1ff;
  outline-offset: 2px;
}

.chat-message-branch {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.chat-message-branch button {
  min-width: 32px;
  padding-inline: 0.4rem;
  font-size: 1rem;
}

.chat-message-branch span {
  min-width: 2.4rem;
  color: #c9d7f5;
  font-size: 0.76rem;
  text-align: center;
}

.chat-message-edit-input {
  width: 100%;
  min-height: 7rem;
  padding: 0.7rem;
  resize: vertical;
  border: 1px solid #7891ca;
  border-radius: 10px;
  color: #eef4ff;
  font: inherit;
  line-height: 1.5;
  background: #101a35;
}

.chat-message-edit-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.chat-message-edit-attachments .chat-message-attachment {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.chat-message-edit-attachments button {
  min-width: 28px;
  min-height: 28px;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
}

.chat-message-user {
  max-width: min(85%, 40rem);
  margin-left: auto;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(255, 206, 72, 0.4);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(98, 75, 18, 0.42), rgba(58, 46, 17, 0.38));
}

.chat-message-assistant {
  position: relative;
  padding-inline: 0;
  background: transparent;
}

/* Formatted answers use docs/ntw-markdown.css; this sets the paid size. */
.chat-message-content {
  color: #f4f7ff;
  font-size: 1.02rem;
  line-height: 1.65;
  white-space: normal;
  overflow-wrap: anywhere;
}

.chat-composer-shell {
  min-width: 0;
  padding: 0.75rem clamp(1rem, 4vw, 3rem) max(0.85rem, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(83, 107, 159, 0.34);
  background: linear-gradient(180deg, rgba(7, 12, 28, 0.82), #070c1c 38%);
}

.chat-composer-shell form,
.chat-attachments,
.chat-composer-controls,
.chat-composer-status,
.chat-composer-meta {
  width: min(48rem, 100%);
  margin-inline: auto;
}

.chat-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.chat-attachment {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
  padding: 0.38rem 0.45rem 0.38rem 0.65rem;
  border: 1px solid #526c9d;
  border-radius: 999px;
  color: #d9e5ff;
  font-size: 0.78rem;
  background: rgba(30, 49, 91, 0.8);
}

.chat-attachment[data-status="error"] {
  border-color: #c97979;
  color: #ffd0d0;
  background: rgba(96, 35, 49, 0.78);
}

.chat-attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-attachment-remove {
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: inherit;
  font: inherit;
  background: rgba(255, 255, 255, 0.09);
  cursor: pointer;
}

.chat-composer-controls {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.55rem;
}

.chat-composer-shell textarea {
  display: block;
  width: 100%;
}

.chat-composer-button:not(.ntw-ui-send) {
  min-height: 2.8rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid #526c9d;
  border-radius: 12px;
  color: #dbe6ff;
  font: inherit;
  font-weight: 700;
  background: #16264a;
  cursor: pointer;
}

.chat-composer-button:not(.ntw-ui-send):disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.chat-composer-status {
  min-height: 1.2rem;
  margin-top: 0.4rem;
  color: #b9c8e6;
  font-size: 0.8rem;
}

.chat-network-status {
  width: min(48rem, 100%);
  min-height: 1.2rem;
  margin: 0.35rem auto 0;
  color: #f5ddb0;
  font-size: 0.8rem;
}

.chat-turnstile {
  width: min(48rem, 100%);
  margin: 0.35rem auto 0;
}

.chat-composer-meta {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.45rem;
}

#chat-mode-note {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.35;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

@media (min-width: 761px) and (max-height: 34rem) {
  .chat-page {
    overflow: auto;
  }

  .chat-workspace {
    height: auto;
    min-height: 34rem;
  }
}

@media (max-width: 760px) {
  .chat-page {
    overflow: auto;
  }

  .chat-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-workspace,
  .chat-conversation {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
  }

  .chat-sidebar {
    position: fixed;
    z-index: 31;
    inset: 0 auto 0 0;
    width: min(20rem, calc(100vw - 3rem));
    max-height: 100vh;
    max-height: 100dvh;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    transform: translateX(-105%);
    box-shadow: 1rem 0 2.5rem rgba(0, 0, 0, 0.5);
  }

  .chat-sidebar[data-open="true"] {
    transform: translateX(0);
  }

  .chat-sidebar-toggle,
  .chat-sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .chat-sidebar-backdrop {
    position: fixed;
    z-index: 30;
    inset: 0;
    display: block;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 0;
    border: 0;
    background: rgba(2, 5, 13, 0.72);
    cursor: pointer;
  }

  .chat-toolbar {
    flex-wrap: wrap;
  }

  .chat-toolbar-actions {
    justify-content: flex-end;
  }

  .chat-empty-state {
    padding-top: 2rem;
  }

  .chat-button,
  .chat-account-link,
  .chat-new-button,
  .chat-history-more,
  .chat-history-item,
  .chat-folder-add,
  .chat-history-menu-button,
  .chat-folder-menu-button,
  .chat-folder-confirm-delete,
  .chat-folder-group > button,
  .chat-inline-actions button,
  .chat-history-menu button,
  .chat-history-rename,
  .chat-folder-rename,
  .chat-attachment-remove {
    min-height: 44px;
  }

  .chat-workspace-brand,
  .chat-account-menu a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .chat-folder-add,
  .chat-history-menu-button,
  .chat-folder-menu-button,
  .chat-attachment-remove {
    min-width: 44px;
  }

  .chat-folder-group h3 {
    width: calc(100% - 44px - 0.35rem);
    min-height: 44px;
  }

  .chat-folder-group > .chat-history-menu {
    top: calc(44px + 0.35rem);
  }

  .chat-message-actions > button,
  .chat-message-branch button,
  .chat-message-edit-attachments button {
    min-width: 44px;
    min-height: 44px;
  }
}

@media (max-width: 400px) {
  .chat-toolbar,
  .chat-conversation-scroll,
  .chat-composer-shell {
    padding-inline: 0.75rem;
  }

  .chat-toolbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .chat-account-link {
    min-height: 44px;
  }

  .chat-composer-controls {
    gap: 0.35rem;
  }

  .chat-composer-button {
    min-width: 44px;
    padding-inline: 0.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-sidebar {
    scroll-behavior: auto;
    transition: none;
  }
}

/* One composer card, as in the public chat: attach and send sit inside the
   box, round, with the gold send arrow. */
.chat-composer-controls {
  gap: 0.25rem;
  padding: 0.4rem;
  border: 1px solid rgba(122, 168, 255, 0.42);
  border-radius: 26px;
  background: rgba(4, 9, 25, 0.88);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.chat-composer-controls:focus-within {
  border-color: rgba(255, 220, 115, 0.55);
}

.chat-composer-shell textarea.ntw-ui-input {
  min-height: calc(1lh + 1.1rem);
  padding: 0.55rem 0.35rem;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.chat-composer-shell textarea.ntw-ui-input:focus-visible {
  outline: none;
}

#chat-file-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.75rem;
  min-width: 2.75rem;
  height: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  border-color: rgba(122, 168, 255, 0.4);
  border-radius: 50%;
  font-size: 0;
  background: rgba(16, 27, 54, 0.94);
}

/* Drawn plus, so it sits at the true centre whatever the font. */
#chat-file-button::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0.95rem;
  height: 0.95rem;
  background:
    linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat;
}

#chat-file-button:focus-visible,
.chat-send-button:focus-visible {
  outline: 3px solid #ffce48;
  outline-offset: 2px;
}

.chat-send-button.ntw-ui-send {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.75rem;
  min-width: 2.75rem;
  height: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font-size: 0;
}

.chat-send-button.ntw-ui-send::after {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1.2rem;
  height: 1.2rem;
  content: "";
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M12%2019V5M6.25%2010.75L12%205l5.75%205.75'%20fill='none'%20stroke='black'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M12%2019V5M6.25%2010.75L12%205l5.75%205.75'%20fill='none'%20stroke='black'%20stroke-width='2.5'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.chat-send-button.ntw-ui-send[aria-label="Stop response"]::after {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 2px;
  -webkit-mask: none;
  mask: none;
}

/* Quiet answer actions, as in the public chat. */
.chat-message-assistant .chat-message-actions {
  justify-content: flex-start;
  gap: 0.25rem;
}

.chat-message-assistant .chat-message-actions > button {
  border-color: transparent;
  color: #aebddb;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 650;
}

.chat-message-assistant .chat-message-actions > button:hover:not(:disabled) {
  border-color: rgba(122, 168, 255, 0.4);
  color: #f8fbff;
  background: rgba(16, 27, 54, 0.7);
}

/* Compact small print under the composer, as in the public chat's app mode. */
.chat-composer-meta.ntw-ui-reminders {
  display: block;
  margin-top: 0.4rem;
  text-align: center;
}

.chat-composer-meta.ntw-ui-reminders p {
  display: inline;
  margin: 0;
  color: #aebddb;
  font-size: 0.78rem;
  line-height: 1.35;
}

.chat-composer-meta.ntw-ui-reminders p + p::before {
  content: " ";
}

/* One line of small print, as on a phone in the public chat; More opens the
   full notes, unchanged (Ted, Nov 26). */
.chat-notes-summary {
  display: block;
  color: #aebddb;
  line-height: 1.35;
  list-style: none;
  cursor: pointer;
}

.chat-notes-summary::-webkit-details-marker {
  display: none;
}

.chat-notes-more {
  color: #c9d8ff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chat-notes-summary:hover .chat-notes-more {
  color: #f8fbff;
}

.chat-notes-summary:focus-visible {
  outline: 3px solid #ffce48;
  outline-offset: 2px;
  border-radius: 4px;
}

.chat-notes-more-open,
.chat-notes[open] .chat-notes-more-closed {
  display: none;
}

.chat-notes[open] .chat-notes-more-open {
  display: inline;
}

.chat-notes-body {
  margin-top: 0.25rem;
}

.chat-composer-meta.ntw-ui-reminders {
  line-height: 1.35;
}

/* Phone header on one row: history on the left, the chat title, then Share
   and Account. The product name stays for screen readers. */
@media (max-width: 760px) {
  .chat-toolbar {
    position: relative;
    flex-wrap: nowrap;
    flex-shrink: 0;
    gap: 0.4rem;
    min-height: 56px;
    padding: 0.45rem 0.6rem;
  }

  .chat-toolbar > div:first-child {
    flex: 1 1 auto;
    padding-left: 52px;
  }

  .chat-toolbar-kicker {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .chat-toolbar h1 {
    margin: 0;
    font-size: 1rem;
  }

  .chat-toolbar .chat-toolbar-actions {
    flex: none;
    flex-wrap: nowrap;
    width: auto;
    gap: 0.35rem;
  }

  .chat-toolbar-actions > * {
    flex: none;
    min-height: 44px;
    padding: 0.3rem 0.65rem;
    font-size: 0.82rem;
  }

  .chat-toolbar-actions > .chat-sidebar-toggle {
    position: absolute;
    top: 50%;
    left: 0.6rem;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 44px;
    min-width: 44px;
    padding: 0;
    font-size: 0;
  }

}

.chat-composer-meta.ntw-ui-reminders {
  font-size: 0.78rem;
}

.chat-composer-controls:focus-within {
  outline: 2px solid rgba(255, 220, 115, 0.45);
  outline-offset: 2px;
}

/* Delete in a chat's menu, and its confirmation dialog, in the familiar
   chat-app pattern: a red menu item, then a small centred dialog. */
.chat-history-menu .chat-history-menu-danger {
  color: #ff9a9a;
}

.chat-history-menu .chat-history-menu-danger:not(:disabled):hover,
.chat-history-menu .chat-history-menu-danger:not(:disabled):focus-visible {
  color: #ffc2c2;
}

.chat-confirm-dialog {
  width: min(26rem, calc(100% - 2rem));
  padding: 1.5rem;
  border: 1px solid rgba(122, 168, 255, 0.35);
  border-radius: 18px;
  color: #e8efff;
  background: #0b1532;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.chat-confirm-dialog::backdrop {
  background: rgba(2, 6, 18, 0.66);
}

.chat-confirm-dialog h2 {
  margin: 0 0 0.6rem;
  font-size: 1.15rem;
}

.chat-confirm-dialog p {
  margin: 0;
  color: #c9d6f2;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.chat-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.4rem;
}

.chat-confirm-actions button {
  min-height: 2.75rem;
  padding: 0 1.1rem;
  border-radius: 999px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.chat-confirm-cancel {
  border: 1px solid rgba(122, 168, 255, 0.45);
  color: #e8efff;
  background: transparent;
}

.chat-confirm-delete {
  border: 0;
  color: #fff;
  background: #c93b3b;
}

.chat-confirm-delete:hover {
  background: #d94a4a;
}

.chat-confirm-actions button:focus-visible {
  outline: 3px solid #ffce48;
  outline-offset: 2px;
}

/* The sidebar as in familiar chat apps (Ted, November 25, 2026): plain rows with small
   text, sentence-case section labels, the open chat highlighted, ⋯ shown on
   hover, a collapse button, and one account button with a menu. Phones keep
   44 px touch targets (set above). */
.chat-icon {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
}

.chat-sidebar {
  gap: 1.1rem;
  padding: 0.6rem 0.5rem 0.75rem;
}

.chat-sidebar-top {
  gap: 0.35rem;
}

.chat-sidebar-heading {
  padding-left: 0.4rem;
}

.chat-workspace-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 36px;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
}

.chat-workspace-brand img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.chat-sidebar-close,
.chat-sidebar-toggle {
  color: #cbd9f6;
}

.chat-sidebar-close {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  min-height: 36px;
  border-color: transparent;
  border-radius: 8px;
  background: transparent;
}

.chat-sidebar-close:hover,
.chat-sidebar-close:focus-visible,
.chat-sidebar-toggle:hover,
.chat-sidebar-toggle:focus-visible {
  color: #fff;
  background: rgba(122, 168, 255, 0.12);
}

.chat-new-button,
.chat-history-item,
.chat-history-more {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  font-size: 0.875rem;
  line-height: 1.3;
  background: transparent;
}

.chat-new-button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.6rem;
  font-weight: 500;
}

.chat-new-button:not(:disabled):hover,
.chat-new-button:not(:disabled):focus-visible {
  background: rgba(122, 168, 255, 0.1);
}

.chat-history-group {
  gap: 0.15rem;
}

.chat-history-group h2,
.chat-history-heading h2 {
  padding: 0.25rem 0.6rem;
  color: #8f9cc0;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.chat-history-heading {
  padding-right: 0.15rem;
}

.chat-history-list {
  gap: 1px;
}

.chat-history-row {
  border-radius: 8px;
}

.chat-history-item {
  padding: 0.4rem 0.6rem;
}

.chat-history-item:not(:disabled):hover,
.chat-history-item:not(:disabled):focus-visible {
  border-color: transparent;
  background: transparent;
}

.chat-history-row:hover,
.chat-history-row:focus-within {
  background: rgba(122, 168, 255, 0.1);
}

.chat-history-row[data-current="true"] {
  background: rgba(122, 168, 255, 0.18);
}

.chat-history-row[data-current="true"] .chat-history-item {
  color: #fff;
}

.chat-history-menu-button {
  min-width: 32px;
  min-height: 32px;
  margin-right: 0.15rem;
  color: #b9c8ea;
  font-size: 1.05rem;
}

.chat-folder-add {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  min-height: 28px;
  font-size: 1.1rem;
}

.chat-folder-group h3 {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 0 0.6rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.chat-history-empty,
.chat-history-status {
  padding: 0.2rem 0.6rem;
  color: #8f9cc0;
  font-size: 0.8rem;
}

.chat-history-more {
  justify-self: start;
  padding: 0.3rem 0.6rem;
  color: #a9c1ff;
}

/* ⋯ appears on hover or keyboard focus where there is a mouse, and stays
   for the open chat; touch screens always show it. */
@media (hover: hover) and (pointer: fine) {
  .chat-history-row .chat-history-menu-button {
    opacity: 0;
  }

  .chat-history-row:hover .chat-history-menu-button,
  .chat-history-row:focus-within .chat-history-menu-button,
  .chat-history-row[data-current="true"] .chat-history-menu-button,
  .chat-history-menu-button[aria-expanded="true"] {
    opacity: 1;
  }
}

/* The foot of the sidebar: responses left, then the account button. */
.chat-sidebar-footer {
  gap: 0.35rem;
  padding-top: 0.5rem;
}

.chat-allowance {
  padding: 0 0.6rem;
  color: #8f9cc0;
  font-size: 0.8rem;
}

.chat-account {
  position: relative;
}

.chat-account-button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 40px;
  padding: 0.45rem 0.6rem;
  border: 0;
  border-radius: 8px;
  color: #eef4ff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  background: transparent;
}

.chat-account-button:hover,
.chat-account-button:focus-visible,
.chat-account-button[aria-expanded="true"] {
  background: rgba(122, 168, 255, 0.1);
}

.chat-account-avatar {
  padding: 0.15rem;
  border-radius: 50%;
  color: #dce8ff;
  background: rgba(122, 168, 255, 0.22);
}

.chat-account-menu {
  display: grid;
  position: absolute;
  z-index: 12;
  right: 0;
  bottom: calc(100% + 0.35rem);
  left: 0;
  padding: 0.3rem;
  border: 1px solid #405784;
  border-radius: 12px;
  background: #101a35;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.chat-account-menu a {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  color: #eef4ff;
  font-size: 0.875rem;
  text-decoration: none;
}

.chat-account-menu a:hover,
.chat-account-menu a:focus-visible {
  background: rgba(122, 168, 255, 0.14);
}

.chat-account-menu a:focus-visible {
  outline: 2px solid #a9c1ff;
  outline-offset: -2px;
}

.chat-account-menu a:last-child {
  margin-top: 0.25rem;
  border-top: 1px solid rgba(83, 107, 159, 0.45);
  border-radius: 0 0 8px 8px;
}

/* The status badge: the free chat's pill and dot, in the top bar. */
.chat-status-badge {
  flex: none;
  max-width: none;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

.chat-status-badge[data-chat-state="ready"]::before {
  background: #6de2a6;
  box-shadow: 0 0 0 4px rgba(109, 226, 166, 0.12);
}

.chat-status-badge[data-chat-state="limited"]::before {
  background: #ff6f7d;
  box-shadow: 0 0 0 4px rgba(255, 111, 125, 0.14);
}

.chat-status-badge[data-chat-state="unavailable"]::before {
  background: #ffb36b;
  box-shadow: 0 0 0 4px rgba(255, 179, 107, 0.12);
}

/* Desktop: the sidebar collapses, and the open button sits at the top left
   of the chat until it is opened again. */
@media (min-width: 761px) {
  .chat-workspace[data-sidebar="collapsed"] {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-workspace[data-sidebar="collapsed"] .chat-sidebar {
    display: none;
  }

  .chat-workspace[data-sidebar="collapsed"] .chat-toolbar {
    position: relative;
  }

  .chat-workspace[data-sidebar="collapsed"] .chat-toolbar > div:first-child {
    padding-left: 48px;
  }

  .chat-workspace[data-sidebar="collapsed"] .chat-sidebar-toggle {
    display: inline-grid;
    position: absolute;
    top: 50%;
    left: clamp(0.6rem, 2vw, 1.4rem);
    place-items: center;
    width: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    border-color: transparent;
    background: transparent;
    transform: translateY(-50%);
  }
}

@media (max-width: 760px) {
  .chat-new-button,
  .chat-history-item,
  .chat-history-more,
  .chat-account-button,
  .chat-account-menu a,
  .chat-sidebar-close {
    min-height: 44px;
    font-size: 0.95rem;
  }

  .chat-sidebar-close {
    min-width: 44px;
  }

  .chat-workspace-brand {
    min-height: 44px;
  }
}

.chat-history-status:empty {
  display: none;
}

/* Chats inside a folder sit a step in from the folder's name. */
.chat-folder-group > .chat-history-list {
  padding-left: 0.75rem;
}

.chat-folder-group h3 {
  color: #dce6ff;
}

/* The sidebar button is an icon, without a box, at every width. */
.chat-toolbar-actions > .chat-sidebar-toggle {
  border-color: transparent;
  background: transparent;
}

/* Phones keep 44 px touch targets for the compact sidebar controls too. */
@media (max-width: 760px) {
  .chat-history-menu-button,
  .chat-folder-add {
    min-width: 44px;
    min-height: 44px;
  }

  .chat-folder-group h3 {
    min-height: 44px;
  }
}

/* The top bar at the size familiar chat apps use (Ted, Nov 26): 52 px tall,
   a one-line 15 px title and 36 px controls with 8 px corners. The kicker
   stays for screen readers. The status badge and Share match each other. */
@media (min-width: 761px) {
  .chat-toolbar {
    min-height: 52px;
    padding-block: 0.5rem calc(0.5rem - 1px);
  }

  .chat-toolbar .chat-toolbar-kicker {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .chat-toolbar h1 {
    font-size: 0.94rem;
    font-weight: 600;
    line-height: 1.35;
  }
}

.chat-toolbar-actions > .chat-status-badge,
.chat-toolbar-actions > #chat-share-button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 0.8rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
}

@media (max-width: 760px) {
  .chat-toolbar-actions > .chat-status-badge,
  .chat-toolbar-actions > #chat-share-button {
    min-height: 44px;
    padding: 0 0.65rem;
    font-size: 0.82rem;
  }
}

/* The message box, measured against familiar chat apps (Ted, Nov 26): the same
   small gap above the box and between it and the small print, which only
   grows when More is opened; the buttons centred in the box; and long text
   taking the full width above a row of its own for the buttons. */
.chat-composer-shell {
  padding-top: 0.5rem;
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

/* Empty rows collapse but stay rendered, so the live regions keep announcing. */
.chat-attachments:empty,
.chat-composer-status:empty,
.chat-turnstile:empty {
  min-height: 0;
  margin: 0;
}

.chat-composer-meta.ntw-ui-reminders {
  margin-top: 0.5rem;
}

.chat-composer-controls {
  align-items: center;
}

.chat-composer-controls:has(> textarea[data-multiline="true"]) {
  row-gap: 0.25rem;
}

.chat-composer-controls > textarea[data-multiline="true"] {
  grid-column: 1 / -1;
  grid-row: 1;
  padding-inline: 0.6rem;
}

.chat-composer-controls:has(> textarea[data-multiline="true"]) > #chat-file-button {
  grid-column: 1;
  grid-row: 2;
}

.chat-composer-controls:has(> textarea[data-multiline="true"]) > .chat-send-button {
  grid-column: 3;
  grid-row: 2;
}

/* Desktop: a 52 px box with 36 px buttons and 16 px text. */
@media (min-width: 761px) {
  .chat-composer-controls {
    padding: 7px;
  }

  #chat-file-button,
  .chat-send-button.ntw-ui-send {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
  }

  .chat-composer-shell textarea.ntw-ui-input {
    min-height: 36px;
    padding: 6px 0.5rem;
    font-size: 1rem;
    line-height: 24px;
  }
}

/* The main area, measured against familiar chat apps (Ted, Nov 26). */

/* An empty chat says only its question, at 24 px. */
.chat-empty-state h2 {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.2;
}

/* Answers and questions at 16 px, as there: 26 px lines in answers, and a
   question bubble padded 10 by 16 with 22 px corners. */
.chat-message-content {
  font-size: 1rem;
  line-height: 1.625;
}

.chat-message-user {
  padding: 10px 16px;
  border-radius: 22px;
}

.chat-message-user .chat-message-content {
  line-height: 1.5;
}

/* Share is an icon, 36 px, beside the status badge. Its name stays in the
   button for screen readers, and gold marks a chat that is being shared. */
.chat-toolbar-actions > #chat-share-button {
  position: relative;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  font-size: 0;
}

.chat-toolbar-actions > #chat-share-button:hover:not(:disabled) {
  background: rgba(122, 168, 255, 0.14);
}

#chat-share-button::before {
  content: "";
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2020%2020'%3E%3Cpath%20d='M10%2012.5V3.5M6.5%207L10%203.5L13.5%207M4.5%2011v4a1.5%201.5%200%200%200%201.5%201.5h8a1.5%201.5%200%200%200%201.5-1.5v-4'%20fill='none'%20stroke='black'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2020%2020'%3E%3Cpath%20d='M10%2012.5V3.5M6.5%207L10%203.5L13.5%207M4.5%2011v4a1.5%201.5%200%200%200%201.5%201.5h8a1.5%201.5%200%200%200%201.5-1.5v-4'%20fill='none'%20stroke='black'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

#chat-share-button[data-sharing="true"] {
  color: #ffce48;
}

@media (max-width: 760px) {
  .chat-toolbar-actions > #chat-share-button {
    width: 44px;
    min-width: 44px;
    padding: 0;
  }
}

/* A small label on hover or keyboard focus, as there: "Attach files" above +,
   "Share" below Share. Touch screens skip it. */
@media (hover: hover) and (pointer: fine) {
  #chat-file-button::after,
  #chat-share-button::after {
    content: attr(data-tooltip);
    position: absolute;
    z-index: 30;
    left: 50%;
    padding: 5px 12px;
    border: 1px solid rgba(122, 168, 255, 0.28);
    border-radius: 16px;
    background: #10182e;
    color: #eef4ff;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%);
    transition: opacity 120ms ease;
  }

  #chat-file-button::after {
    bottom: calc(100% + 8px);
  }

  #chat-share-button::after {
    top: calc(100% + 8px);
    left: auto;
    right: 0;
    transform: none;
  }

  #chat-file-button:is(:hover, :focus-visible):not(:disabled)::after,
  #chat-share-button:is(:hover, :focus-visible):not(:disabled)::after {
    opacity: 1;
  }
}

/* An empty chat, as there: on desktop the question sits just above a message
   box in the middle of the page; on a phone the question is centred and the
   box stays at the bottom. Both return to normal with the first message. */
.chat-conversation:has(#chat-empty-state:not([hidden])) .chat-conversation-scroll {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.chat-conversation:has(#chat-empty-state:not([hidden])) .chat-empty-state {
  padding-top: 0;
}

@media (min-width: 761px) {
  .chat-conversation:has(#chat-empty-state:not([hidden])) {
    grid-template-rows: auto minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .chat-conversation:has(#chat-empty-state:not([hidden])) .chat-conversation-scroll {
    justify-content: flex-end;
    padding-bottom: 1.25rem;
  }

  .chat-conversation:has(#chat-empty-state:not([hidden])) .chat-composer-shell {
    border-top-color: transparent;
    background: transparent;
  }
}

#chat-share-button:disabled {
  opacity: 0.5;
}

/* The hidden "jump to latest" button keeps its space in a conversation; an
   empty chat drops it so the question sits right above the message box. */
.chat-conversation:has(#chat-empty-state:not([hidden])) .chat-jump-latest[hidden] {
  display: none !important;
}

/* Progress text repeats the top-bar badge: keep it for screen readers only. */
.chat-composer-status[data-progress="true"]:not([data-error="true"]) {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Message actions are small icons, as in familiar chat apps: copy and edit sit
   under the question bubble and appear on hover or focus; copy and regenerate
   sit under each answer. Each word stays as the button's name and tooltip. */
.chat-message-user {
  position: relative;
}

.chat-message-user:not(:has(> .chat-message-edit-input)):has(> .chat-message-actions) {
  margin-bottom: 2.5rem;
}

.chat-message-user:not(:has(> .chat-message-edit-input)) > .chat-message-actions {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  margin: 0;
  gap: 0.125rem;
  flex-wrap: nowrap;
}

.chat-message-assistant .chat-message-actions {
  margin-top: 0.5rem;
  gap: 0.125rem;
}

.chat-message-actions > .chat-message-icon-action,
.chat-message-assistant .chat-message-actions > .chat-message-icon-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: #aebddb;
  background: transparent;
  font-size: 0;
}

.chat-message-actions > .chat-message-icon-action:hover:not(:disabled) {
  color: #f8fbff;
  background: rgba(122, 168, 255, 0.14);
}

.chat-message-icon-action::before {
  content: "";
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: var(--chat-action-icon) center / contain no-repeat;
  mask: var(--chat-action-icon) center / contain no-repeat;
}

.chat-message-icon-action[data-action="copy"] {
  --chat-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2020%2020'%3E%3Crect%20x='7'%20y='7'%20width='9.5'%20height='9.5'%20rx='2'%20fill='none'%20stroke='black'%20stroke-width='1.6'/%3E%3Cpath%20d='M13%207V5.5A2%202%200%200%200%2011%203.5H5.5a2%202%200%200%200-2%202V11a2%202%200%200%200%202%202H7'%20fill='none'%20stroke='black'%20stroke-width='1.6'/%3E%3C/svg%3E");
}

.chat-message-icon-action[data-action="copy"][data-copied="true"] {
  --chat-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2020%2020'%3E%3Cpath%20d='M4.5%2010.5l3.5%203.5l7.5-8'%20fill='none'%20stroke='black'%20stroke-width='1.8'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E");
}

.chat-message-icon-action[data-action="edit"] {
  --chat-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2020%2020'%3E%3Cpath%20d='M12.5%204.5l3%203L7.5%2015.5H4.5v-3z'%20fill='none'%20stroke='black'%20stroke-width='1.6'%20stroke-linejoin='round'/%3E%3C/svg%3E");
}

.chat-message-icon-action[data-action="regenerate"] {
  --chat-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2020%2020'%3E%3Cpath%20d='M15.5%2010a5.5%205.5%200%201%201-1.6-3.9M15.5%203.5v3.5H12'%20fill='none'%20stroke='black'%20stroke-width='1.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E");
}

@media (hover: hover) and (pointer: fine) {
  .chat-message-user > .chat-message-actions > .chat-message-icon-action {
    opacity: 0;
    transition: opacity 120ms ease;
  }

  .chat-message-user:is(:hover, :focus-within) > .chat-message-actions > .chat-message-icon-action {
    opacity: 1;
  }

  .chat-message-icon-action::after {
    content: attr(data-tooltip);
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    left: 50%;
    padding: 5px 12px;
    border: 1px solid rgba(122, 168, 255, 0.28);
    border-radius: 16px;
    background: #10182e;
    color: #eef4ff;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%);
    transition: opacity 120ms ease;
  }

  .chat-message-icon-action:is(:hover, :focus-visible):not(:disabled)::after {
    opacity: 1;
  }
}

@media (max-width: 760px) {
  .chat-message-actions > .chat-message-icon-action,
  .chat-message-assistant .chat-message-actions > .chat-message-icon-action {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  .chat-message-user:not(:has(> .chat-message-edit-input)):has(> .chat-message-actions) {
    margin-bottom: 3.25rem;
  }
}

/* Before the first words arrive, a quiet "Thinking" line sits where the
   answer will start. */
.chat-message-thinking {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  min-height: 1.65rem;
  color: rgba(214, 222, 240, 0.72);
  font-size: 1rem;
  line-height: 1.65;
}

.chat-thinking-dot {
  flex: none;
  margin-top: 0.47rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: #f4f7ff;
  animation: chat-thinking-pulse 1.4s ease-in-out infinite;
}

@keyframes chat-thinking-pulse {
  0%, 100% { transform: scale(0.75); opacity: 0.55; }
  50% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .chat-thinking-dot {
    animation: none;
  }
}

/* The newest answer keeps a view's height of room while its turn is the
   latest, so the question and a short answer sit at the top of the view. */
.chat-conversation-scroll[data-response-space="true"] .chat-messages > .chat-message-assistant:last-child {
  min-height: var(--chat-response-space, 0px);
}
