:root {
  color-scheme: light;
  --canvas: #f6f4ed;
  --canvas-deep: #ece8dc;
  --surface: #ffffff;
  --surface-soft: #fbfaf6;
  --surface-warm: #f3efe4;
  --ink: #18312d;
  --ink-soft: #38514c;
  --muted: #687a76;
  --muted-light: #8d9a96;
  --line: #dce3de;
  --line-strong: #c5d2cc;
  --brand: #176b5c;
  --brand-deep: #0e5549;
  --brand-soft: #e5f3ee;
  --accent: #e9a23b;
  --accent-soft: #fff2d8;
  --danger: #a7423f;
  --danger-soft: #fff0ee;
  --focus: 0 0 0 4px rgba(23, 107, 92, 0.16);
  --shadow-shell: 0 26px 70px rgba(28, 56, 49, 0.12);
  --shadow-float: 0 16px 44px rgba(28, 56, 49, 0.17);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  font-family: Inter, "Avenir Next", "PingFang SC", "Microsoft YaHei", ui-sans-serif, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--canvas);
  color: var(--ink);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 9% 4%, rgba(233, 162, 59, 0.12), transparent 25rem),
    radial-gradient(circle at 91% 94%, rgba(23, 107, 92, 0.1), transparent 30rem),
    var(--canvas);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
}

button:not(:disabled) {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.visuallyHidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.skipLink {
  position: fixed;
  z-index: 100001;
  top: 10px;
  left: 10px;
  border-radius: 4px;
  padding: 9px 13px;
  background: var(--brand-deep);
  color: #fff;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 160ms var(--ease-out);
}

.skipLink:focus {
  transform: translateY(0);
}

:where(button, a, input, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

::selection {
  background: rgba(233, 162, 59, 0.28);
  color: var(--ink);
}

.chatPage {
  min-height: 100vh;
  padding: 18px;
}

.loginPage {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.loginLayout { width: min(440px, 100%); }

.loginCard {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 36px;
  background: #fff;
  box-shadow: var(--shadow-shell);
  backdrop-filter: none;
}

.companyLogo {
  width: 180px;
  height: auto;
  margin: -24px 0;
  object-fit: contain;
}

.authHeading { margin-bottom: 24px; }
.authHeading h1 { margin: 4px 0 6px; font-size: 28px; }
.authHeading > p:last-child { margin: 0; color: var(--muted); }

.loginVersion {
  position: fixed;
  right: 18px;
  bottom: 14px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  text-align: right;
  pointer-events: none;
  user-select: none;
}
.authModeTabs { display: flex; gap: 4px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 5px; padding: 4px; background: var(--surface-warm); }
.authModeTab { flex: 1; min-height: 42px; border: 0; border-radius: 3px; background: transparent; color: var(--muted); font-weight: 680; }
.authModeTab.isActive { background: #fff; color: var(--brand-deep); box-shadow: 0 4px 14px rgba(28, 56, 49, 0.08); }
.authForm { display: grid; gap: 15px; }
.authField { display: grid; gap: 7px; color: var(--ink-soft); font-size: 13px; font-weight: 650; }
.authField input { min-height: 48px; border: 1px solid var(--line-strong); border-radius: 5px; padding: 0 14px; background: #fff; color: var(--ink); outline: 0; }
.authField input:focus { border-color: var(--brand); box-shadow: var(--focus); }
.authSubmit { min-height: 48px; margin-top: 4px; border: 0; border-radius: 5px; background: var(--brand); color: #fff; font-weight: 720; }
.authSubmit:disabled { opacity: 0.65; }
.authError { margin: 16px 0 0; border-radius: 4px; padding: 10px 12px; background: var(--danger-soft); color: var(--danger); }
@media (max-width: 520px) {
  .loginPage { padding: 14px; }
  .loginCard { padding: 28px 24px; }
  .companyLogo { margin-inline: auto; }
  .authHeading { text-align: center; }
}

.appShell {
  position: relative;
  display: flex;
  width: min(1280px, 100%);
  height: calc(100vh - 36px);
  min-height: 560px;
  margin: 0 auto;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid rgba(197, 210, 204, 0.9);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-shell);
}

.appHeader {
  position: relative;
  z-index: 12;
  display: flex;
  min-height: 72px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(220, 227, 222, 0.88);
  padding: 13px 18px 13px 22px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px) saturate(125%);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.brandMark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: none;
  place-items: center;
  border: 1px solid rgba(14, 85, 73, 0.18);
  border-radius: 15px 15px 18px 13px;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.52), transparent 34%),
    linear-gradient(145deg, #2a8272, var(--brand-deep));
  color: #fff9e9;
  font-family: "Songti SC", "STSong", serif;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(14, 85, 73, 0.18);
  transform: rotate(-2deg);
}

.brandName {
  overflow: hidden;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.headerActions {
  display: flex;
  min-width: 0;
  flex: none;
  align-items: center;
  gap: 8px;
}

.utilityButton {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 11px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-weight: 680;
}

.utilityButton {
  transition: background-color 150ms ease, border-color 150ms ease, transform 130ms var(--ease-out);
}

.utilityButton:active,
.iconButton:active,
.sendButton:active,
.textButton:active,
.factUndo button:active,
.updateDialog button:active,
.panelClose:active,
.profileClose:active,
.profileActions button:active,
.userAvatarButton:active,
.accountMenuItem:active,
.jumpLatest:active,
.removeAttachment:active,
.factItem button:active {
  transform: scale(0.97);
}

.countBadge {
  display: grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--brand-deep);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.accountMenu {
  position: fixed;
  z-index: 1000;
  width: 206px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 40px rgba(28, 56, 49, 0.18);
  opacity: 1;
  transform: translateY(0) scale(1);
  transform-origin: var(--account-menu-origin, top right);
  transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out);
}

@starting-style {
  .accountMenu[data-placement="bottom"] {
    opacity: 0;
    transform: translateY(-4px) scale(0.97);
  }

  .accountMenu[data-placement="top"] {
    opacity: 0;
    transform: translateY(4px) scale(0.97);
  }
}

.accountMenu[data-keyboard="true"] {
  transition-duration: 0ms;
}

.accountMenuItem {
  text-decoration: none;
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  transition: background-color 140ms ease, color 140ms ease, transform 130ms var(--ease-out);
}

.accountMenuItem svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

.accountMenuItem:disabled {
  opacity: 0.55;
}

.accountMenuDivider {
  height: 1px;
  margin: 5px 4px;
  background: var(--line);
}

.accountMenuLogout {
  color: var(--danger);
}

.profileDialog {
  width: min(440px, calc(100% - 28px));
  max-width: none;
  max-height: min(720px, calc(100dvh - 28px));
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 0;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(20, 46, 65, 0.3);
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.profileDialog::backdrop {
  background: rgba(16, 40, 61, 0.42);
  backdrop-filter: blur(5px);
}

@starting-style {
  .profileDialog[open] {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
}

.profileForm {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.profileHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.profileHeader .eyebrow {
  margin: 0 0 2px;
}

.profileHeader h2 {
  margin: 0;
  color: var(--ink);
  font-size: 21px;
  letter-spacing: -0.025em;
}

.profileClose {
  display: grid;
  width: 38px;
  height: 38px;
  flex: none;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 25px;
  line-height: 1;
  transition: background-color 140ms ease, color 140ms ease, transform 130ms var(--ease-out);
}

.profilePreview {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface-soft);
}

.profilePreviewInitial {
  display: grid;
  width: 42px;
  height: 42px;
  flex: none;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-weight: 760;
}

.profilePreview div {
  display: grid;
  min-width: 0;
}

.profilePreview strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profilePreview small,
.profileField small {
  color: var(--muted);
  font-size: 11px;
}

.profileField {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 680;
}

.profileField input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  outline: 0;
  font-weight: 520;
}

.profileField input:focus {
  border-color: var(--brand);
  box-shadow: var(--focus);
}

.profileField input[readonly] {
  background: var(--surface-warm);
  color: var(--muted);
}

.profileStatus {
  min-height: 20px;
  margin: -6px 0 0;
  color: var(--danger);
  font-size: 12px;
}

.profileActions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.profileActions button {
  min-width: 84px;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 700;
  transition: background-color 140ms ease, border-color 140ms ease, transform 130ms var(--ease-out);
}

.profileCancel {
  background: #fff;
  color: var(--ink-soft);
}

.profileSubmit {
  border-color: var(--brand) !important;
  background: var(--brand);
  color: #fff;
}

.profileActions button:disabled {
  opacity: 0.58;
}

.appLayout {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) 328px;
}

.conversationPanel {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  background:
    radial-gradient(circle at 50% 0, rgba(233, 162, 59, 0.06), transparent 22rem),
    var(--surface-soft);
}

.messageViewport {
  position: relative;
  min-width: 0;
  min-height: 0;
}

.messages {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px clamp(18px, 4vw, 48px) 36px;
  scroll-behavior: smooth;
  scroll-padding-block: 22px;
}

.messages.isEmpty {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: center;
}

.emptyState {
  width: min(560px, 100%);
  margin: auto;
  padding: 24px 0 40px;
  text-align: center;
}

.emptyMark {
  display: grid;
  width: 66px;
  height: 66px;
  margin: 0 auto 16px;
  place-items: center;
  border: 1px solid rgba(233, 162, 59, 0.24);
  border-radius: 22px 22px 26px 19px;
  background: var(--accent-soft);
  color: #8e5b15;
  font-family: "Songti SC", "STSong", serif;
  font-size: 34px;
  font-weight: 800;
  transform: rotate(-2deg);
}

.emptyState h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: clamp(22px, 3vw, 29px);
  letter-spacing: -0.035em;
}

.emptyState > p {
  max-width: 480px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 14px;
}

.conversationTime {
  display: flex;
  width: 100%;
  margin: 2px 0 18px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.conversationTime time {
  border-radius: 999px;
  padding: 3px 9px;
  background: rgba(104, 122, 118, 0.07);
}

.message {
  width: 100%;
  margin: 0 0 24px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.72;
}

.messageSegments {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.messageSegment {
  display: flex;
  width: 100%;
  align-items: flex-start;
  gap: 11px;
}

.message.user .messageSegment {
  justify-content: flex-end;
}

.messageAvatar {
  display: grid;
  width: 38px;
  height: 38px;
  margin-top: 2px;
  flex: none;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px 14px 16px 11px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-family: "Songti SC", "STSong", serif;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 6px 15px rgba(28, 56, 49, 0.09);
}

.message.user .messageAvatar {
  border-radius: 50%;
  background: var(--surface-warm);
  font-family: inherit;
  font-size: 12px;
}

.messageContent {
  min-width: 0;
  max-width: 720px;
  flex: 0 1 720px;
}

.message.user .messageContent {
  text-align: right;
}

.messageMeta {
  display: flex;
  margin: 0 4px 6px;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.message.user .messageMeta {
  justify-content: flex-end;
}

.messageMeta .sender {
  color: var(--ink-soft);
  font-weight: 700;
}

.messageMeta .deliveryState {
  color: var(--muted-light);
}

.messageBubble {
  width: fit-content;
  max-width: 100%;
  overflow-wrap: anywhere;
  border: 1px solid rgba(220, 227, 222, 0.96);
  border-radius: 17px 17px 17px 6px;
  padding: 12px 15px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 7px 22px rgba(28, 56, 49, 0.055);
  text-align: left;
}

.message.user .messageBubble {
  margin-left: auto;
  border-color: rgba(23, 107, 92, 0.13);
  border-radius: 17px 17px 6px;
  background: var(--brand-soft);
  color: #17483f;
  white-space: pre-wrap;
}

.messageBubble > :first-child {
  margin-top: 0;
}

.messageBubble > :last-child {
  margin-bottom: 0;
}

.messageBubble p {
  margin: 0 0 9px;
}

.messageBubble ul,
.messageBubble ol {
  margin: 0 0 9px;
  padding-left: 22px;
}

.messageBubble li {
  margin-bottom: 3px;
}

.messageBubble h1,
.messageBubble h2,
.messageBubble h3,
.messageBubble h4 {
  margin: 14px 0 7px;
  line-height: 1.4;
  letter-spacing: -0.015em;
}

.messageBubble h1 {
  font-size: 18px;
}

.messageBubble h2 {
  font-size: 17px;
}

.messageBubble h3 {
  font-size: 16px;
}

.messageBubble h4 {
  font-size: 15px;
}

.messageBubble blockquote {
  margin: 0 0 9px;
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  padding: 5px 10px 5px 12px;
  background: var(--accent-soft);
  color: #694818;
}

.messageBubble blockquote p {
  margin: 0;
}

.messageBubble code {
  border-radius: 5px;
  padding: 1px 5px;
  background: var(--surface-warm);
  color: var(--brand-deep);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
}

.messageBubble pre {
  max-width: 100%;
  margin: 0 0 10px;
  overflow-x: auto;
  border-radius: 5px;
  padding: 13px 14px;
  background: #17332e;
  color: #eef7f3;
  font-size: 13px;
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
}

.messageBubble pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  white-space: pre;
}

.messageBubble a {
  color: var(--brand-deep);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.tableScroll {
  max-width: 100%;
  margin: 0 0 10px;
  overflow-x: auto;
  border-radius: 4px;
  -webkit-overflow-scrolling: touch;
}

.tableScroll:focus-visible {
  box-shadow: var(--focus);
}

.messageBubble table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 13px;
}

.messageBubble th,
.messageBubble td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.messageBubble th {
  background: var(--surface-warm);
  font-weight: 720;
}

.messageBubble tr:nth-child(even) td {
  background: rgba(243, 239, 228, 0.48);
}

.messageBubble hr {
  margin: 13px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.messageAttachments {
  display: grid;
  width: min(560px, calc(100% - 49px));
  margin-top: 10px;
  margin-left: 49px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.message.user .messageAttachments {
  margin-right: 49px;
  margin-left: auto;
}

.messageAttachment {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-warm);
  color: var(--ink-soft);
  text-decoration: none;
}

.messageAttachment img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.messageAttachment span {
  display: block;
  overflow: hidden;
  padding: 6px 9px;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jumpLatest {
  position: absolute;
  z-index: 5;
  right: 22px;
  bottom: 16px;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 9px 25px rgba(28, 56, 49, 0.13);
  transition: background-color 150ms ease, border-color 150ms ease, transform 130ms var(--ease-out);
}

.composerDock {
  position: relative;
  z-index: 7;
  flex: none;
  padding: 0 16px calc(13px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(251, 250, 246, 0), var(--surface-soft) 20%);
}

.attachmentPreview {
  display: flex;
  max-width: 100%;
  margin: 0 4px 9px;
  overflow-x: auto;
  gap: 8px;
  scrollbar-width: thin;
}

.attachmentPreviewItem {
  position: relative;
  width: 78px;
  height: 78px;
  flex: none;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--surface-warm);
}

.attachmentPreviewItem img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.removeAttachment {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  padding: 0;
  background: rgba(24, 49, 45, 0.82);
  color: #fff;
  font-size: 17px;
  line-height: 1;
  backdrop-filter: blur(8px);
  transition: background-color 130ms ease, transform 130ms var(--ease-out);
}

.attachmentStatus {
  margin: 0 5px 7px;
  color: var(--muted);
  font-size: 12px;
}

.attachmentStatus.error {
  color: var(--danger);
}

.attachmentStatus:empty {
  display: none;
}

.composer {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  gap: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 19px;
  padding: 7px 7px 7px 15px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 34px rgba(28, 56, 49, 0.1);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.composer:focus-within {
  border-color: var(--brand);
  box-shadow: var(--focus), 0 12px 34px rgba(28, 56, 49, 0.1);
}

.composer.isDragTarget {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(233, 162, 59, 0.16), 0 12px 34px rgba(28, 56, 49, 0.1);
}

.composer textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  max-height: 160px;
  flex: 1;
  resize: none;
  border: 0;
  padding: 10px 2px 8px;
  background: transparent;
  color: var(--ink);
  line-height: 1.52;
  outline: 0;
}

.composer textarea::placeholder {
  color: var(--muted-light);
}

.composerActions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 5px;
}

.iconButton,
.sendButton {
  display: grid;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  padding: 0;
  transition: background-color 140ms ease, color 140ms ease, transform 130ms var(--ease-out);
}

.iconButton {
  background: var(--surface-warm);
  color: var(--brand-deep);
  font-size: 25px;
  font-weight: 400;
}

.sendButton {
  background: var(--brand);
  color: #fff;
  font-size: 22px;
  font-weight: 760;
  box-shadow: 0 7px 16px rgba(23, 107, 92, 0.22);
}

.iconButton:disabled,
.sendButton:disabled {
  opacity: 0.48;
  box-shadow: none;
}

.composerFooter {
  display: flex;
  min-height: 22px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 5px 0;
}

.composerFooter > p {
  margin: 0;
  color: var(--muted-light);
  font-size: 11px;
}

.statusActions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.chatStatus {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.chatStatus.error {
  color: var(--danger);
}

.textButton {
  min-height: 32px;
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 0 10px;
  background: #fff;
  color: var(--brand-deep);
  font-size: 11px;
  font-weight: 720;
  transition: background-color 140ms ease, border-color 140ms ease, transform 130ms var(--ease-out);
}

.factsPanel {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  flex-direction: column;
  border-left: 1px solid var(--line);
  padding: 21px 18px 17px;
  background:
    radial-gradient(circle at 100% 0, rgba(233, 162, 59, 0.1), transparent 18rem),
    #f0f5f1;
  outline: 0;
}

.factsPanel:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -3px;
}

.factsHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 3px;
  color: #9a6418;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.factsHeader h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.018em;
}

.panelClose {
  display: none;
  width: 44px;
  height: 44px;
  flex: none;
  place-items: center;
  border: 0;
  border-radius: 11px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  transition: background-color 140ms ease, transform 130ms var(--ease-out);
}

.factsStatus {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.factsStatus.error {
  color: var(--danger);
}

.factsStatus:empty {
  display: none;
}

.factsList {
  margin-top: 6px;
}

.factItem {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.58;
}

.factText {
  min-width: 0;
  flex: 1;
  white-space: pre-wrap;
}

.factItem button {
  min-width: 44px;
  min-height: 44px;
  flex: none;
  border: 0;
  border-radius: 9px;
  padding: 0 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  transition: background-color 140ms ease, color 140ms ease, transform 130ms var(--ease-out);
}

.factUndo {
  position: sticky;
  bottom: 0;
  display: flex;
  margin-top: auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.97);
  color: var(--ink);
  font-size: 12px;
  box-shadow: 0 9px 24px rgba(28, 56, 49, 0.12);
}

.factUndo button {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  padding: 0 7px;
  background: transparent;
  color: var(--brand-deep);
  font-weight: 750;
  transition: background-color 140ms ease, transform 130ms var(--ease-out);
}

.drawerBackdrop {
  display: none;
}

.dropOverlay {
  position: absolute;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  border: 3px dashed rgba(233, 162, 59, 0.9);
  border-radius: inherit;
  background: rgba(246, 244, 237, 0.9);
  color: var(--ink);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.dropOverlay > div {
  display: grid;
  min-width: min(320px, 80%);
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px;
  background: #fff;
  box-shadow: var(--shadow-float);
}

.dropOverlay span {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 12px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: #8e5b15;
  font-size: 30px;
}

.dropOverlay strong {
  font-size: 17px;
}

.dropOverlay small {
  margin-top: 3px;
  color: var(--muted);
}

.updateOverlay {
  position: fixed;
  z-index: 100000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(24, 49, 45, 0.52);
  backdrop-filter: blur(6px);
}

.updateDialog {
  width: min(420px, 100%);
  border: 1px solid rgba(197, 210, 204, 0.9);
  border-radius: 23px;
  padding: 28px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 26px 76px rgba(24, 49, 45, 0.26);
  text-align: center;
}

.updateMark {
  margin: 0 auto 15px;
}

.updateDialog h2 {
  margin: 0 0 8px;
  font-size: 23px;
  letter-spacing: -0.025em;
}

.updateDialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.updateDialog button {
  min-width: 148px;
  min-height: 46px;
  margin-top: 21px;
  border: 0;
  border-radius: 12px;
  padding: 0 20px;
  background: var(--brand);
  color: #fff;
  font-weight: 750;
  transition: background-color 140ms ease, transform 130ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .userAvatarButton:hover {
    box-shadow: 0 0 0 3px rgba(23, 102, 159, 0.13);
  }

  .accountMenuItem:hover:not(:disabled),
  .profileClose:hover {
    background: var(--brand-soft);
    color: var(--brand-deep);
  }

  .accountMenuLogout:hover:not(:disabled) {
    background: var(--danger-soft);
    color: var(--danger);
  }

  .profileCancel:hover:not(:disabled) {
    border-color: var(--brand);
    background: var(--surface-soft);
  }

  .profileSubmit:hover:not(:disabled) {
    background: var(--brand-deep);
  }

  .utilityButton:hover,
  .jumpLatest:hover,
  .textButton:hover {
    border-color: var(--brand);
    background: #fff;
  }

  .iconButton:hover:not(:disabled) {
    background: var(--brand-soft);
  }

  .sendButton:hover:not(:disabled),
  .updateDialog button:hover {
    background: var(--brand-deep);
  }

  .removeAttachment:hover {
    background: var(--danger);
  }

  .panelClose:hover,
  .factUndo button:hover {
    background: var(--brand-soft);
  }

  .factItem button:hover:not(:disabled) {
    background: var(--danger-soft);
    color: var(--danger);
  }

  .messageAttachment:hover {
    border-color: var(--brand);
  }
}

@media (max-width: 1024px) {
  .appLayout {
    grid-template-columns: minmax(0, 1fr);
  }

  .factsPanel {
    position: fixed;
    z-index: 40;
    inset: 0 0 0 auto;
    width: min(92vw, 390px);
    overflow-y: auto;
    visibility: hidden;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 22px 0 0 22px;
    padding: calc(20px + env(safe-area-inset-top, 0px)) 20px calc(18px + env(safe-area-inset-bottom, 0px));
    box-shadow: var(--shadow-float);
    pointer-events: none;
    transform: translateX(105%);
    transition: transform 240ms var(--ease-drawer), visibility 240ms;
  }

  body.factsOpen {
    overflow: hidden;
  }

  body.factsOpen .factsPanel {
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
  }

  .panelClose {
    display: grid;
  }

  .drawerBackdrop {
    position: fixed;
    z-index: 35;
    inset: 0;
    display: block;
    background: rgba(24, 49, 45, 0.36);
    backdrop-filter: blur(2px);
  }
}

@media (max-width: 760px) {
  input,
  textarea {
    font-size: 16px !important;
  }

  .chatPage {
    padding: 0;
  }

  .appShell {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
  }

  .appHeader {
    min-height: calc(62px + env(safe-area-inset-top, 0px));
    padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 8px;
  }

  .brandMark {
    width: 39px;
    height: 39px;
    border-radius: 13px 13px 15px 10px;
    font-size: 21px;
  }

  .utilityButton {
    padding: 4px 9px;
  }

  .messages {
    padding: 20px 13px 30px;
  }

  .message {
    font-size: 16px;
  }

  .messageContent {
    max-width: calc(100% - 49px);
    flex: 1 1 auto;
  }

  .messageAttachments {
    width: calc(100% - 49px);
  }

  .composerDock {
    padding: 0 10px calc(9px + env(safe-area-inset-bottom, 0px));
  }

  .composer {
    padding: 7px 7px 7px 13px;
  }

  .composerFooter > p {
    display: none;
  }

  .statusActions {
    width: 100%;
  }

  .chatStatus {
    text-align: left;
  }

  .attachmentPreview {
    margin-inline: 2px;
  }
}

@media (max-width: 480px) {
  .headerActions {
    gap: 4px;
  }

  .utilityButton > span:first-child {
    font-size: 12px;
  }

  .countBadge {
    min-width: 20px;
    height: 20px;
  }

  .messageAvatar {
    width: 34px;
    height: 34px;
    border-radius: 12px 12px 14px 9px;
  }

  .messageContent {
    max-width: calc(100% - 45px);
  }

  .messageAttachments {
    width: calc(100% - 45px);
    margin-left: 45px;
  }

  .message.user .messageAttachments {
    margin-right: 45px;
  }

  .messageAttachment span {
    display: none;
  }

  .composerActions {
    gap: 3px;
  }

  .iconButton,
  .sendButton {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  .brandMark {
    transform: none;
  }
}

/* ── Emil-inspired blue conversation skin ────────────────── */

:root {
  --canvas: #eaf3fa;
  --canvas-deep: #dcebf6;
  --surface: #ffffff;
  --surface-soft: #f8fbfe;
  --surface-warm: #edf6fc;
  --ink: #10283d;
  --ink-soft: #284761;
  --muted: #5e7487;
  --muted-light: #8295a5;
  --line: #cfdeea;
  --line-strong: #afc7d9;
  --brand: #17669f;
  --brand-deep: #104f7d;
  --brand-soft: #e1f1fc;
  --accent: #d28a2d;
  --accent-soft: #fff2dd;
  --danger: #a44a54;
  --danger-soft: #fff0f2;
  --focus: 0 0 0 3px rgba(23, 102, 159, 0.18);
  --shadow-shell: 0 18px 44px rgba(18, 64, 99, 0.13);
  --shadow-float: 0 14px 34px rgba(18, 64, 99, 0.17);
}

html {
  background: var(--canvas);
}

body {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), transparent 42%),
    var(--canvas);
  color: var(--ink);
}

::selection {
  background: rgba(91, 148, 193, 0.28);
  color: #0f2c45;
}

.chatPage {
  padding: 20px;
}

.appShell {
  width: min(1180px, 100%);
  height: calc(100vh - 40px);
  min-height: 600px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-shell);
}

.appHeader {
  min-height: 64px;
  gap: 16px;
  border-bottom-color: rgba(207, 220, 231, 0.75);
  padding: 10px 20px;
  background: #fff;
  backdrop-filter: none;
}

.brand {
  gap: 0;
}

.factsButton {
  min-height: 38px;
  border: 1px solid #c8dbe9;
  border-radius: 8px;
  padding: 0 9px;
  background: #f4f9fc;
  color: var(--brand-deep);
  box-shadow: none;
}

.factsButtonLabel {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.countBadge {
  position: static;
  min-width: 19px;
  height: 19px;
  border: 0;
  border-radius: 5px;
  padding: 0 5px;
  background: var(--brand);
  color: #fff;
  font-size: 9px;
  font-weight: 760;
  line-height: 19px;
  box-shadow: none;
}

.brandName {
  color: #101d2c;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.headerActions {
  gap: 6px;
}

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

.conversationPanel {
  background: #ededed;
}

.messageViewport::after {
  content: none;
}

.messages {
  position: relative;
  z-index: 1;
  padding: 26px clamp(18px, 4vw, 46px) 42px;
  scroll-padding-block: 24px;
}

.messages.isEmpty {
  justify-content: flex-start;
}

.emptyState {
  position: relative;
  width: min(610px, calc(100% - 18px));
  margin: 26px auto auto;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 8px;
  padding: 24px 26px 25px 74px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(18, 64, 99, 0.07);
  text-align: left;
  backdrop-filter: none;
}

.emptyMark {
  position: absolute;
  top: 23px;
  left: 23px;
  width: 38px;
  height: 38px;
  margin: 0;
  border: 1px solid var(--brand-deep);
  border-radius: 5px;
  background: var(--brand-deep);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  box-shadow: none;
  transform: none;
}

.emptyMark::after,
.messageAvatar::after {
  position: absolute;
  right: -2px;
  bottom: -1px;
  width: 8px;
  height: 8px;
  border: 2px solid #f8fbfe;
  border-radius: 50%;
  background: #6ba7d4;
  content: "";
}

.emptyState h2 {
  margin: 0 0 7px;
  font-size: clamp(20px, 2.4vw, 25px);
  font-weight: 720;
  letter-spacing: -0.035em;
}

.emptyState > p {
  max-width: none;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.conversationTime {
  margin: 3px 0 16px;
  color: #8997a6;
  font-size: 10px;
}

.conversationTime time {
  border-radius: 3px;
  padding: 0;
  background: transparent;
}

.message {
  margin-bottom: 20px;
  color: #111;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
}

.messageSegments {
  gap: 20px;
}

.messageSegment {
  align-items: flex-start;
  gap: 14px;
}

.messageAvatar {
  position: relative;
  width: 34px;
  height: 34px;
  margin: 0;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  box-shadow: none;
}

.messageAvatar img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: contain;
  object-position: center;
}

.messageAvatar::after {
  content: none;
}

.message.user .messageAvatar {
  border: 0;
  border-radius: 4px;
  background: var(--brand-soft);
  color: #173d5c;
  font-size: 11px;
}

.message.user .messageAvatar::after {
  background: #8d77c9;
}

.userAvatarButton {
  appearance: none;
  padding: 0;
  line-height: 1;
  text-align: center;
  transition: box-shadow 140ms ease, transform 130ms var(--ease-out);
}

.userAvatarButton[aria-expanded="true"] {
  box-shadow: 0 0 0 3px rgba(23, 102, 159, 0.18);
}

.messageContent {
  display: flex;
  max-width: min(520px, 72%);
  flex: 0 1 auto;
  flex-direction: column;
  align-items: flex-start;
}

.message.user .messageContent {
  max-width: min(520px, 72%);
  align-items: flex-end;
  text-align: right;
}

.messageMeta {
  order: 2;
  margin: 5px 8px 0;
  color: #7c8998;
  font-size: 10px;
  line-height: 1.25;
}

.messageMeta .sender {
  display: none;
}

.messageMeta .deliveryState {
  color: #9aa7b5;
}

.messageBubble {
  position: relative;
  width: fit-content;
  max-width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 5px 12px;
  background: #fff;
  color: #111;
  line-height: 1.5;
  box-shadow: none;
  text-align: left;
  backdrop-filter: none;
}

.message.user .messageBubble {
  border: 0;
  border-radius: 6px;
  padding: 5px 12px;
  background: #95ec69;
  color: #111;
  box-shadow: none;
}

.message.assistant .messageBubble::before,
.message.user .messageBubble::before {
  position: absolute;
  top: 12px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: inherit;
  content: "";
  transform: rotate(45deg);
}

.message.assistant .messageBubble::before {
  left: -5px;
}

.message.user .messageBubble::before {
  right: -5px;
}

.messageBubble blockquote {
  border-left-color: #7199bb;
  background: #edf4f9;
  color: #315571;
}

.message.user .messageBubble a,
.message.user .messageBubble code {
  color: #111;
}

.messageBubble code {
  background: #e9f1f7;
  color: #245475;
}

.messageBubble pre {
  background: #173a55;
  color: #f1f7fb;
}

.messageBubble th {
  background: #eaf1f7;
}

.messageBubble tr:nth-child(even) td {
  background: rgba(235, 242, 248, 0.6);
}

.messageAttachments {
  width: min(560px, calc(82% - 44px));
  margin-top: 9px;
  margin-left: 44px;
  gap: 8px;
}

.message.user .messageAttachments {
  margin-right: 44px;
}

.messageAttachment {
  border-color: rgba(190, 207, 220, 0.9);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(18, 64, 99, 0.07);
}

.jumpLatest {
  right: 20px;
  bottom: 15px;
  width: 48px;
  min-width: 48px;
  height: 48px;
  min-height: 48px;
  border-color: var(--brand-deep);
  border-radius: 6px;
  padding: 0;
  background: var(--brand-deep);
  color: #fff;
  font-size: 0;
  box-shadow: 0 7px 16px rgba(18, 64, 99, 0.18);
}

.jumpLatest::before {
  content: "↓";
  font-size: 22px;
  font-weight: 700;
}

.composerDock {
  padding: 0 0 env(safe-area-inset-bottom, 0px);
  border-top: 1px solid #d9d9d9;
  background: #fff;
}

.attachmentPreview {
  margin: 0 6px 10px;
  gap: 9px;
}

.attachmentPreviewItem {
  width: 76px;
  height: 76px;
  border: 1px solid #d9d9d9;
  border-radius: 5px;
  background: #f5f5f5;
  box-shadow: none;
}

.removeAttachment {
  border-radius: 4px;
  background: rgba(26, 58, 83, 0.8);
}

.composer {
  display: grid;
  min-height: 156px;
  grid-template-areas:
    "tools"
    "input"
    "send";
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 34px minmax(58px, 1fr) 32px;
  gap: 5px;
  border: 0;
  border-radius: 0;
  padding: 10px 16px 12px;
  background: #fff;
  box-shadow: none;
  backdrop-filter: none;
  transition: background-color 160ms ease;
}

.composer:focus-within {
  background: #fff;
  box-shadow: none;
}

.composer.isDragTarget {
  background: #f3fbea;
  box-shadow: inset 0 0 0 2px #95ec69;
}

.composer textarea {
  grid-area: input;
  min-height: 58px;
  max-height: 180px;
  padding: 3px 0;
  color: #111;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: #999;
}

.composerActions {
  grid-area: tools;
  justify-content: flex-start;
  gap: 12px;
}

.iconButton,
.sendButton {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
}

.iconButton {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #222;
  font-size: 0;
}

.iconButton svg,
.sendButton svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.sendButton {
  width: 64px;
  height: 32px;
  min-width: 64px;
  min-height: 32px;
  grid-area: send;
  justify-self: end;
  border-radius: 4px;
  background: #95ec69;
  color: #111;
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
}

.sendButton:disabled {
  background: #f0f0f0;
  color: #b2b2b2;
  opacity: 1;
}

.composerFooter {
  min-height: 0;
  padding: 7px 7px 0;
}

.composerFooter:not(:has(.chatStatus:not(:empty), .textButton:not([hidden]))) {
  display: none;
}

.composerFooter > p {
  color: #91a0ae;
  font-size: 10px;
}

.chatStatus {
  color: #728398;
}

.textButton {
  border-color: #bdcedb;
  border-radius: 5px;
  background: #fff;
  color: var(--brand-deep);
}

.factsPanel {
  border-left-color: rgba(195, 210, 223, 0.9);
  padding: 24px 20px 18px;
  background: #f0f7fc;
}

.eyebrow {
  color: #5780a0;
  font-size: 9px;
  letter-spacing: 0.15em;
}

.factsHeader h2 {
  color: #172638;
  font-size: 19px;
}

.panelClose {
  color: #60798e;
}

.factsList {
  display: grid;
  margin-top: 10px;
  gap: 8px;
}

.factItem {
  border: 1px solid rgba(191, 207, 220, 0.88);
  border-radius: 5px;
  padding: 11px 10px 11px 13px;
  background: #fff;
  color: #26394d;
}

.factUndo {
  border-color: rgba(182, 201, 216, 0.9);
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(18, 64, 99, 0.12);
}

.drawerBackdrop {
  background: rgba(20, 43, 63, 0.32);
  backdrop-filter: blur(4px);
}

.dropOverlay {
  border-color: rgba(75, 135, 181, 0.84);
  background: rgba(229, 237, 244, 0.88);
  color: #182a3d;
}

.dropOverlay > div {
  border-color: rgba(190, 207, 220, 0.9);
  border-radius: 7px;
  background: #fff;
}

.dropOverlay span {
  border-radius: 5px;
  background: #e2edf6;
  color: #315f85;
}

.updateOverlay {
  background: rgba(18, 42, 62, 0.52);
}

.updateDialog {
  border-color: rgba(184, 202, 217, 0.9);
  border-radius: 8px;
  background: #fff;
  color: #162333;
  box-shadow: 0 28px 80px rgba(17, 42, 62, 0.28);
}

.brandMark {
  border-color: rgba(38, 84, 121, 0.2);
  border-radius: 5px;
  background: var(--brand-deep);
  color: #fff;
  font-family: inherit;
  transform: none;
}

.updateDialog button {
  border-radius: 5px;
  background: var(--brand-deep);
}

@media (hover: hover) and (pointer: fine) {
  .factsButton:hover {
    border-color: #75a9cd;
    background: #fff;
    color: #214f73;
    box-shadow: 0 6px 16px rgba(21, 88, 137, 0.16);
  }

  .textButton:hover {
    border-color: #7ba3c2;
    background: rgba(255, 255, 255, 0.96);
  }

  .jumpLatest:hover {
    border-color: rgba(255, 255, 255, 0.86);
    background: #244f72;
  }

  .iconButton:hover:not(:disabled) {
    background: rgba(226, 237, 246, 0.95);
    color: #285a80;
  }

  .sendButton:hover:not(:disabled),
  .updateDialog button:hover {
    background: #244f72;
  }

  .panelClose:hover,
  .factUndo button:hover {
    background: rgba(210, 225, 237, 0.8);
  }

  .messageAttachment:hover {
    border-color: #7ba3c2;
  }
}

@media (max-width: 1024px) {
  .appLayout {
    grid-template-columns: minmax(0, 1fr);
  }

  .factsPanel {
    width: min(92vw, 390px);
    border-left: 1px solid rgba(184, 202, 217, 0.9);
    border-radius: 8px 0 0 8px;
    box-shadow: -14px 0 44px rgba(24, 56, 82, 0.18);
    transition:
      transform 240ms var(--ease-drawer),
      visibility 240ms;
  }
}

@media (max-width: 760px) {
  .chatPage {
    padding: 0;
  }

  .appShell {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .appHeader {
    min-height: calc(64px + env(safe-area-inset-top, 0px));
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
    background: rgba(239, 244, 248, 0.8);
  }

  .brand {
    gap: 0;
  }

  .brandName {
    font-size: 17px;
  }

  .messages {
    padding: 18px 12px 30px;
  }

  .emptyState {
    width: calc(100% - 10px);
    margin-top: 16px;
    padding: 21px 20px 22px 66px;
  }

  .emptyMark {
    top: 20px;
    left: 18px;
  }

  .message {
    font-size: 16px;
  }

  .messageContent {
    max-width: calc(86% - 38px);
  }

  .message.user .messageContent {
    max-width: calc(80% - 20px);
  }

  .messageAttachments {
    width: calc(86% - 38px);
    margin-left: 44px;
  }

  .message.user .messageAttachments {
    width: calc(80% - 20px);
  }

  .composerDock {
    padding: 0 0 env(safe-area-inset-bottom, 0px);
  }

  .composer {
    min-height: 144px;
    grid-template-areas:
      "tools"
      "input"
      "send";
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 34px minmax(58px, 1fr) 32px;
    border-radius: 0;
    padding: 10px 12px 12px;
  }

  .composer textarea {
    min-height: 58px;
    padding: 3px 0;
  }

  .composerActions {
    width: 100%;
    justify-content: flex-start;
  }

  .composerFooter {
    padding-inline: 6px;
  }
}

@media (max-width: 520px) {
  .factsButton {
    min-height: 34px;
    padding: 0 6px;
  }

  .factsButtonLabel {
    font-size: 10px;
  }

  .countBadge {
    min-width: 18px;
    height: 18px;
    line-height: 18px;
  }

  .brandName {
    max-width: 38vw;
  }

  .accountMenu {
    width: min(214px, calc(100vw - 24px));
  }

  .profileForm {
    gap: 16px;
    padding: 20px;
  }

  .messageSegment {
    gap: 12px;
  }

  .messageAvatar {
    width: 34px;
    height: 34px;
    font-size: 12px;
  }

  .messageContent {
    max-width: calc(82% - 34px);
  }

  .message.user .messageContent {
    max-width: calc(82% - 34px);
  }

  .messageBubble {
    border-radius: 6px;
    padding: 5px 12px;
  }

  .message.user .messageBubble {
    border-radius: 6px;
    padding: 5px 12px;
  }

  .messageAttachments {
    width: calc(88% - 35px);
    margin-left: 39px;
  }

  .message.user .messageAttachments {
    width: calc(82% - 10px);
    margin-right: 39px;
  }

  .jumpLatest {
    right: 14px;
    width: 46px;
    min-width: 46px;
    height: 46px;
    min-height: 46px;
  }

  .iconButton {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
  }

  .sendButton {
    width: 64px;
    height: 32px;
    min-width: 64px;
    min-height: 32px;
  }
}

@supports not (backdrop-filter: blur(1px)) {
  .appHeader,
  .composer,
  .messageBubble,
  .emptyState {
    background: rgba(248, 251, 253, 0.97);
  }

  .message.user .messageBubble {
    background: #95ec69;
  }
}

@media (prefers-reduced-motion: reduce) {
  .factsButton,
  .composer,
  .factsPanel {
    transition-duration: 0.01ms;
  }
}

.voiceButton,
.voiceStatus,
.moreButton,
.mobileAttachmentTray {
  display: none;
}

/* Mixed image and document attachments */
.attachmentPreviewItem.isDocument {
  display: flex;
  width: min(220px, calc(100vw - 44px));
  align-items: center;
  gap: 10px;
  padding: 10px 38px 10px 10px;
  background: #fff;
}

.attachmentFileBadge,
.messageFileBadge {
  display: grid;
  flex: none;
  place-items: center;
  border: 1px solid #bed1df;
  border-radius: 5px;
  background: #e9f2f8;
  color: #285a80;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.025em;
}

.attachmentFileBadge {
  width: 43px;
  height: 52px;
}

.attachmentFileDetails,
.messageFileDetails {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.attachmentFileDetails strong,
.messageFileDetails strong {
  overflow: hidden;
  color: #1d3549;
  font-size: 12px;
  font-weight: 560;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachmentFileDetails small,
.messageFileDetails small {
  color: #718598;
  font-size: 10px;
  line-height: 1.2;
}

.messageAttachment.isDocument {
  display: flex;
  min-width: 0;
  min-height: 66px;
  grid-column: 1 / -1;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
}

.messageFileBadge {
  width: 42px;
  height: 48px;
}

.messageFileDetails {
  flex: 1;
}

.messageAttachment.isDocument .messageFileDownload {
  display: grid;
  width: 28px;
  height: 28px;
  flex: none;
  place-items: center;
  border-radius: 4px;
  padding: 0;
  background: #edf4f9;
  color: #315f85;
  font-size: 17px;
  line-height: 1;
}

/* Attachment messages use the same avatar-and-bubble row as text messages. */
.attachmentMessageContent {
  width: min(430px, 72%);
  flex-basis: auto;
}

.attachmentBubble {
  width: 100%;
  padding: 5px;
  white-space: normal;
}

.chatPage .attachmentBubble .messageAttachments,
.chatPage .message.user .attachmentBubble .messageAttachments {
  width: 100%;
  margin: 0;
}

.attachmentBubble .messageAttachments.isSingle {
  grid-template-columns: minmax(0, 1fr);
}

.attachmentBubble .messageAttachment {
  border: 0;
  border-radius: 3px;
  background: transparent;
  box-shadow: none;
}

.message.assistant .imageAttachmentBubble,
.message.user .imageAttachmentBubble {
  width: fit-content;
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.message.assistant .imageAttachmentBubble::before,
.message.user .imageAttachmentBubble::before {
  content: none;
}

.imageAttachmentBubble .messageAttachments {
  justify-items: start;
}

.message.user .imageAttachmentBubble .messageAttachments {
  justify-items: end;
}

.imageAttachmentBubble .messageAttachment {
  width: fit-content;
  max-width: min(260px, 100%);
  overflow: visible;
}

.imageAttachmentBubble .messageAttachment img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 420px;
  aspect-ratio: auto;
  border-radius: 6px;
  object-fit: contain;
}

.attachmentBubble .messageAttachment.isDocument {
  min-height: 82px;
  padding: 14px 13px 14px 16px;
  background: transparent;
}

.message.user .documentAttachmentBubble {
  background: #fff;
}

.attachmentBubble .messageFileDetails strong {
  color: #111;
  font-size: 16px;
  font-weight: 500;
}

.attachmentBubble .messageFileDetails small {
  color: #999;
  font-size: 12px;
}

.attachmentBubble .messageFileBadge {
  width: 52px;
  height: 62px;
  border: 0;
  border-radius: 3px;
  background: #f26346;
  color: #fff;
  font-size: 14px;
}

.attachmentBubble .messageAttachment.isKnowledgeCard {
  display: grid;
  min-height: 184px;
  grid-template-columns: minmax(0, 1fr) 76px;
  grid-template-rows: minmax(88px, auto) 42px;
  align-items: start;
  gap: 14px 18px;
  border-radius: 10px;
  padding: 22px 20px 0;
  background: #fff;
  color: #171717;
  box-shadow: 0 1px 0 rgba(20, 35, 31, 0.04);
}

.knowledgeCardTitle {
  display: -webkit-box;
  overflow: hidden;
  align-self: center;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.45;
  letter-spacing: -0.02em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.messageAttachment .knowledgeCardCover {
  width: 76px;
  height: 76px;
  align-self: center;
  aspect-ratio: 1;
  border-radius: 3px;
  object-fit: cover;
}

.knowledgeCardSource {
  display: flex;
  min-width: 0;
  grid-column: 1 / -1;
  align-items: center;
  gap: 7px;
  border-top: 1px solid #e7e7e7;
  padding: 10px 0 12px;
  color: #969696;
  font-size: 13px;
  line-height: 1;
}

.messageAttachment .knowledgeCardSource img {
  width: 20px;
  height: 20px;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
}

.knowledgeCardSource span {
  overflow: hidden;
  padding: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.messageAttachment.isKnowledgeCard {
  width: 100%;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

button.messageAttachment.isKnowledgeCard:hover {
  background: #fbfaf7;
}

button.messageAttachment.isKnowledgeCard:focus-visible {
  outline: 3px solid rgba(47, 121, 105, 0.28);
  outline-offset: 2px;
}

.articleDialog {
  width: min(920px, calc(100vw - 40px));
  height: min(960px, calc(100dvh - 40px));
  max-width: none;
  max-height: none;
  border: 0;
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  background: #fff;
  color: #202020;
  box-shadow: 0 28px 90px rgba(20, 28, 25, 0.26);
}

.articleDialog::backdrop {
  background: rgba(24, 29, 27, 0.58);
  backdrop-filter: blur(5px);
}

.articleReader {
  display: grid;
  height: 100%;
  grid-template-rows: 56px minmax(0, 1fr);
}

.articleReaderHeader {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #ededed;
  padding: 0 14px 0 20px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px) saturate(130%);
}

.articleReaderBrand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #2d3330;
  font-size: 14px;
  font-weight: 650;
}

.articleReaderBrand img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.articleReaderBrand small {
  border-left: 1px solid #dadeda;
  padding-left: 8px;
  color: #8a918d;
  font-size: 12px;
  font-weight: 500;
}

.articleClose {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #5d635f;
  font-size: 25px;
  font-weight: 300;
  line-height: 1;
  transition: background-color 140ms ease, transform 130ms var(--ease-out);
}

.articleClose:active {
  transform: scale(0.94);
}

.articleProgress {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  overflow: hidden;
  pointer-events: none;
}

.articleProgress > span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: left center;
}

.articleScroll {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  background: #fff;
}

.articlePage {
  width: min(680px, calc(100% - 56px));
  margin: 0 auto;
  padding: 50px 0 82px;
}

.articleHero {
  display: grid;
  gap: 0;
}

.articleTags {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 17px;
  flex-wrap: wrap;
}

.articleTag,
.articlePublisherTags span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 3px;
  padding: 2px 8px;
  background: #f1f3f2;
  color: #747c78;
  font-size: 12px;
  line-height: 1.4;
}

.articleTag.isBrand {
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-weight: 680;
}

.articleHero > h1 {
  margin: 0;
  color: #1f1f1f;
  font-size: clamp(30px, 4vw, 38px);
  font-weight: 720;
  line-height: 1.34;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.articleByline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
}

.articleByline img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.articleByline > div {
  display: grid;
  gap: 1px;
}

.articleByline strong {
  color: var(--brand);
  font-size: 14px;
  font-weight: 680;
}

.articleByline span {
  color: #9a9f9c;
  font-size: 12px;
}

.articleStatus {
  margin: 18px 0 0;
  color: #858b87;
  font-size: 14px;
}

.articleStatus:empty {
  display: none;
}

.articleStatus.error,
.articleActionStatus.error,
.articleCommentStatus.error {
  color: #b34135;
}

.articleContent {
  margin-top: 46px;
  color: #262626;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.92;
  overflow-wrap: anywhere;
}

.articleContent h2 {
  position: relative;
  margin: 54px 0 20px;
  padding-left: 14px;
  color: #1f2422;
  font-size: 23px;
  font-weight: 720;
  line-height: 1.5;
  letter-spacing: -0.015em;
}

.articleContent h2::before {
  position: absolute;
  top: 0.3em;
  bottom: 0.3em;
  left: 0;
  width: 4px;
  border-radius: 2px;
  background: var(--brand);
  content: "";
}

.articleContent h3,
.articleContent h4 {
  margin: 40px 0 15px;
  color: #292e2c;
  font-size: 19px;
  line-height: 1.55;
}

.articleContent p,
.articleContent ul,
.articleContent ol,
.articleContent blockquote {
  margin: 0 0 22px;
}

.articleContent ul,
.articleContent ol {
  padding-left: 1.4em;
}

.articleContent li + li {
  margin-top: 7px;
}

.articleContent strong {
  color: #124f44;
  font-weight: 700;
}

.articleContent a {
  color: var(--brand);
  text-decoration-color: rgba(23, 107, 92, 0.35);
  text-underline-offset: 3px;
}

.articleContent blockquote {
  border-left: 3px solid #74a99a;
  padding: 12px 17px;
  background: #f5f8f7;
  color: #5f6763;
}

.articleContent blockquote > :last-child {
  margin-bottom: 0;
}

.articleContent hr {
  height: 1px;
  border: 0;
  margin: 48px 0;
  background: #e7e9e8;
}

.articleContent .tableScroll {
  overflow-x: auto;
  margin: 28px 0;
}

.articleContent table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.6;
}

.articleContent th,
.articleContent td {
  border: 1px solid #dfe3e1;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.articleContent th {
  background: #f5f7f6;
  color: #34403b;
}

.articleEngagement {
  margin-top: 54px;
}

.articleReadCount {
  margin: 0 0 46px;
  color: #a9afac;
  font-size: 14px;
  line-height: 1.5;
}

.articleReadCount strong {
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.articleComments {
  border-top: 1px solid #e5e7e6;
  padding-top: 34px;
}

.articleComments h2 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 22px;
  color: #242725;
  font-size: 22px;
  line-height: 1.4;
}

.articleComments h2 strong {
  font-size: 0.86em;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.articleCommentForm {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  min-height: 82px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 13px 14px;
  background: #f5f6f5;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.articleCommentForm:focus-within {
  border-color: #79a99b;
  box-shadow: 0 0 0 3px rgba(23, 107, 92, 0.08);
}

.articleCommentForm textarea {
  width: 100%;
  min-height: 54px;
  resize: vertical;
  border: 0;
  padding: 0;
  background: transparent;
  color: #252a27;
  font: inherit;
  font-size: 15px;
  line-height: 1.6;
  outline: 0;
}

.articleCommentForm textarea::placeholder {
  color: #a4aaa7;
}

.articleCommentForm button {
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  padding: 0 15px;
  background: #397a65;
  color: #fff;
  font: inherit;
  font-size: 13px;
  transition: background-color 140ms ease, transform 130ms var(--ease-out);
}

.articleCommentForm button:active {
  transform: scale(0.97);
}

.articleCommentForm button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.articleCommentStatus {
  margin: 10px 0 0;
  color: #39715e;
  font-size: 13px;
}

.articleCommentStatus:empty {
  display: none;
}

.articleCommentsList {
  margin-top: 26px;
}

.articleComment {
  border-top: 1px solid #e5e8e6;
  padding: 20px 0;
}

.articleComment header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.articleComment header strong {
  color: #333a36;
  font-size: 14px;
}

.articleComment time {
  color: #929994;
  font-size: 12px;
}

.articleComment p {
  margin: 9px 0 0;
  color: #4b524e;
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.articleCommentsEmpty {
  margin: 0;
  border-top: 1px solid #e5e8e6;
  padding: 22px 0;
  color: #8a918d;
  font-size: 14px;
}

.articleEngagementFooter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 42px;
  border-top: 1px solid #e5e7e6;
  padding-top: 24px;
}

.articlePublisher {
  display: grid;
  min-width: 0;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.articlePublisher > img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
}

.articlePublisher > div {
  min-width: 0;
}

.articlePublisher strong {
  color: #1d2522;
  font-size: 16px;
}

.articlePublisher p {
  margin: 2px 0 8px;
  color: #7d8581;
  font-size: 12px;
  line-height: 1.5;
}

.articlePublisherTags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.articlePublisherTags span {
  min-height: 20px;
  padding: 1px 6px;
  background: #edf5f2;
  color: #52766c;
  font-size: 10px;
}

.articleActions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  flex: 0 0 auto;
}

.articleActions button {
  display: inline-flex;
  min-width: 54px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 6px;
  padding: 0 8px;
  background: transparent;
  color: #3a403d;
  font: inherit;
  font-size: 14px;
  transition: background-color 140ms ease, color 140ms ease, transform 130ms var(--ease-out);
}

.articleActions button.isActive {
  background: #edf7f3;
  color: #23634f;
}

.articleActions button:active {
  transform: scale(0.97);
}

.articleActions button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.articleActions button > span:first-child {
  font-size: 25px;
  line-height: 1;
}

.articleActions strong {
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.articleCommentIcon {
  position: relative;
  width: 21px;
  height: 17px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.articleCommentIcon::after {
  position: absolute;
  bottom: -5px;
  left: 4px;
  width: 6px;
  height: 6px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  background: #fff;
  transform: skewY(-35deg);
  content: "";
}

.articleActionStatus {
  margin: 10px 0 0;
  color: #39715e;
  font-size: 13px;
  text-align: right;
}

.articleActionStatus:empty {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .articleClose:hover {
    background: #f1f3f2;
  }

  .articleActions button:hover {
    background: #f2f5f3;
    color: #315e53;
  }

  .articleCommentForm button:hover {
    background: var(--brand-deep);
  }
}

@media (max-width: 720px) {
  .articleDialog {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }

  .articleReader {
    grid-template-rows: 52px minmax(0, 1fr);
  }

  .articleReaderHeader {
    padding: 0 8px 0 14px;
  }

  .articlePage {
    width: auto;
    margin: 0;
    padding: 34px 20px 68px;
  }

  .articleHero > h1 {
    font-size: 28px;
    line-height: 1.36;
    letter-spacing: -0.02em;
  }

  .articleTags {
    margin-bottom: 14px;
  }

  .articleByline {
    margin-top: 18px;
  }

  .articleContent {
    margin-top: 38px;
    font-size: 17px;
    line-height: 1.88;
  }

  .articleContent h2 {
    margin-top: 46px;
    font-size: 22px;
  }

  .articleEngagement {
    margin-top: 48px;
  }

  .articleReadCount {
    margin-bottom: 38px;
  }

  .articleComments {
    padding-top: 30px;
  }

  .articleEngagementFooter {
    align-items: stretch;
    flex-direction: column;
    gap: 18px;
    margin-top: 34px;
    padding-top: 20px;
  }

  .articlePublisher {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .articlePublisher > img {
    width: 46px;
    height: 46px;
  }

  .articleActions {
    justify-content: space-between;
  }

  .articleActions button {
    flex: 1 1 0;
    justify-content: center;
    padding-inline: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .articleClose,
  .articleActions button,
  .articleCommentForm button {
    transition: background-color 140ms ease, color 140ms ease;
  }

  .articleClose:active,
  .articleActions button:active,
  .articleCommentForm button:active {
    transform: none;
  }
}

@media (max-width: 720px) {
  .chatPage .attachmentMessageContent,
  .chatPage .message.user .attachmentMessageContent {
    width: min(430px, calc(100% - 52px));
    max-width: calc(100% - 52px);
  }

  .chatPage .attachmentBubble .messageAttachments,
  .chatPage .message.user .attachmentBubble .messageAttachments {
    width: 100%;
    margin: 0;
  }
}

/* Phone conversation experience */
@media (max-width: 760px), (pointer: coarse) and (max-height: 520px) {
  html,
  body.chatPage {
    min-height: 100%;
    overflow: hidden;
    background: #ededed;
  }

  .chatPage {
    padding: 0;
  }

  .chatPage .appShell {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .chatPage .appHeader {
    min-height: calc(54px + env(safe-area-inset-top, 0px));
    justify-content: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: calc(6px + env(safe-area-inset-top, 0px)) 12px 6px;
    background: #ededed;
    backdrop-filter: none;
  }

  .chatPage .brandName {
    max-width: 58vw;
    color: #111;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
  }

  .chatPage .headerActions {
    position: absolute;
    right: 10px;
    bottom: 7px;
  }

  .chatPage .factsButton {
    min-height: 38px;
    border-color: transparent;
    background: transparent;
    color: #222;
  }

  .chatPage .conversationPanel,
  .chatPage .messages {
    background: #ededed;
  }

  .chatPage .messages {
    padding: 18px 12px 24px;
    scroll-padding-block: 18px;
  }

  .chatPage .message {
    margin-bottom: 22px;
    font-size: 16px;
    line-height: 1.55;
  }

  .chatPage .messageSegments {
    gap: 18px;
  }

  .chatPage .messageSegment {
    gap: 12px;
  }

  .chatPage .messageAvatar {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    font-size: 12px;
  }

  .chatPage .messageAvatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .chatPage .messageContent,
  .chatPage .message.user .messageContent {
    max-width: 76%;
  }

  .chatPage .messageBubble,
  .chatPage .message.user .messageBubble {
    min-height: 40px;
    border-radius: 6px;
    padding: 8px 12px;
    line-height: 1.55;
  }

  .chatPage .message.assistant .messageBubble::before,
  .chatPage .message.user .messageBubble::before {
    top: 14px;
  }

  .chatPage .messageAttachments {
    width: calc(76% - 8px);
    margin-left: 52px;
  }

  .chatPage .message.user .messageAttachments {
    width: calc(76% - 8px);
    margin-right: 52px;
  }

  .chatPage .jumpLatest {
    right: 12px;
    bottom: 12px;
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    border-radius: 50%;
  }

  .chatPage .composerDock {
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #d7d7d7;
    background: #f7f7f7;
  }

  .chatPage .attachmentPreview {
    margin: 0 2px 8px;
  }

  .chatPage .attachmentStatus,
  .chatPage .voiceStatus {
    margin: 0 6px 7px;
    color: #666;
    font-size: 12px;
    line-height: 1.45;
  }

  .chatPage .voiceStatus {
    display: block;
  }

  .chatPage .voiceStatus.error {
    color: var(--danger);
  }

  .chatPage .voiceStatus.listening {
    color: #24754a;
  }

  .chatPage .mobileAttachmentTray {
    width: fit-content;
    margin: 0 0 8px 48px;
    grid-template-columns: repeat(2, 68px);
    gap: 8px;
    border: 1px solid #dedede;
    border-radius: 10px;
    padding: 10px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.09);
  }

  .chatPage .mobileAttachmentTray:not([hidden]) {
    display: grid;
  }

  .chatPage .mobileAttachmentTray button {
    display: grid;
    min-height: 64px;
    place-items: center;
    gap: 3px;
    border: 0;
    border-radius: 8px;
    padding: 7px;
    background: #f5f5f5;
    color: #222;
    font-size: 12px;
    transition: background-color 140ms ease, transform 130ms var(--ease-out);
  }

  .chatPage .mobileAttachmentTray button:active {
    background: #e9e9e9;
    transform: scale(0.97);
  }

  .chatPage .mobileAttachmentTray button:disabled {
    opacity: 0.45;
  }

  .chatPage .mobileAttachmentTray svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.65;
  }

  .chatPage .composer {
    display: grid;
    min-height: 0;
    grid-template-areas: "voice input more";
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    grid-template-rows: minmax(48px, auto);
    align-items: center;
    gap: 4px;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }

  .chatPage .composer:focus-within,
  .chatPage .composer.isDragTarget {
    background: transparent;
    box-shadow: none;
  }

  .chatPage .composer textarea {
    width: 100%;
    min-height: 48px;
    max-height: 112px;
    grid-area: input;
    overflow-y: auto;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 12px 13px;
    background: #fff;
    color: #111;
    line-height: 22px;
  }

  .chatPage .composer textarea:focus {
    border-color: #cfcfcf;
    box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.08);
  }

  .chatPage .voiceButton {
    position: relative;
    display: grid;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    grid-area: voice;
    place-items: center;
    border: 0;
    border-radius: 10px;
    padding: 0;
    background: transparent;
    color: #222;
    transition: color 140ms ease, transform 130ms var(--ease-out);
  }

  .chatPage .voiceButton::before,
  .chatPage .moreButton::before {
    position: absolute;
    inset: 5px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    background: transparent;
    content: "";
    transition: border-color 140ms ease, background-color 140ms ease;
  }

  .chatPage .voiceButton svg {
    position: relative;
    z-index: 1;
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
  }

  .chatPage .voiceButton:active {
    transform: scale(0.96);
  }

  .chatPage .voiceButton.isListening {
    color: #c83d38;
  }

  .chatPage .voiceButton.isListening::before {
    background: #fff0ef;
  }

  .chatPage .voiceButton.isListening::after {
    position: absolute;
    z-index: 2;
    top: 4px;
    right: 4px;
    width: 7px;
    height: 7px;
    border: 2px solid #f7f7f7;
    border-radius: 50%;
    background: #e24d48;
    content: "";
  }

  .chatPage .voiceButton[data-unsupported="true"] {
    color: #777;
  }

  .chatPage .composerActions {
    display: none;
  }

  .chatPage .moreButton {
    position: relative;
    display: grid;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    grid-area: more;
    place-items: center;
    border: 0;
    border-radius: 10px;
    padding: 0;
    background: transparent;
    color: #222;
    transition: color 140ms ease, transform 130ms var(--ease-out);
  }

  .chatPage .moreButton svg {
    position: relative;
    z-index: 1;
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.65;
  }

  .chatPage .moreButton:active {
    transform: scale(0.96);
  }

  .chatPage .moreButton.isOpen::before {
    background: #dedede;
  }

  .chatPage .sendButton {
    display: none;
  }

  .chatPage .composer.isVoiceActive .sendButton,
  .chatPage .composer.isVoiceActive .moreButton {
    display: none;
  }

  .chatPage .composerFooter {
    padding: 6px 5px 0;
  }

  .chatPage .composerFooter > p {
    display: none;
  }
}

@media (max-width: 360px) {
  .chatPage .messageContent,
  .chatPage .message.user .messageContent {
    max-width: 74%;
  }
}
