:root {
  --paper: #f4f0e7;
  --paper-deep: #e8e0d2;
  --ink: #191815;
  --muted: #756f65;
  --line: rgba(25, 24, 21, 0.14);
  --signal: #e94d2b;
  --cyan: #1595a3;
  --card: rgba(255, 253, 248, 0.78);
  --user-message: #e6dac4;
  --user-message-edge: rgba(111, 86, 52, 0.18);
  --shadow: 0 24px 80px rgba(38, 31, 24, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 15%, rgba(233, 77, 43, 0.12), transparent 25%),
    radial-gradient(circle at 8% 85%, rgba(21, 149, 163, 0.1), transparent 30%),
    var(--paper);
  font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  z-index: 100;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.88' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.13'/%3E%3C/svg%3E");
}

.is-hidden {
  display: none !important;
}

.eyebrow,
.thread-kicker {
  margin: 0;
  color: var(--signal);
  font: 700 0.68rem/1.2 Consolas, monospace;
  letter-spacing: 0.15em;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  position: relative;
  width: min(660px, 100%);
  padding: clamp(30px, 7vw, 76px);
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(250, 247, 239, 0.75);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.login-card::after {
  content: "";
  position: absolute;
  width: 230px;
  height: 230px;
  right: -95px;
  top: -80px;
  border: 34px solid var(--signal);
  border-radius: 50%;
  opacity: 0.88;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 54px;
  color: var(--paper);
  background: var(--ink);
  font: 800 1rem Consolas, monospace;
}

.login-card h1 {
  max-width: 550px;
  margin: 16px 0 20px;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-size: clamp(2.6rem, 8vw, 5.7rem);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.login-copy {
  max-width: 430px;
  color: var(--muted);
  line-height: 1.75;
}

.login-card form {
  margin-top: 42px;
}

label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.78rem;
}

.token-row {
  display: flex;
  gap: 8px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
}

input:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(21, 149, 163, 0.12);
}

.token-row input {
  min-width: 0;
  padding: 15px;
}

button {
  border: 0;
  color: #fff;
  background: var(--ink);
}

.token-row button {
  padding: 0 24px;
}

.form-error {
  min-height: 1.2em;
  margin: 10px 0 0;
  color: var(--signal);
  font-size: 0.8rem;
}

.app-shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--line);
  background: rgba(238, 232, 220, 0.78);
  backdrop-filter: blur(18px);
}

.sidebar-head,
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-head {
  padding: 28px 24px 18px;
}

.sidebar-head h2 {
  margin: 7px 0 0;
  font: 400 1.55rem "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

.new-thread {
  margin: 5px 24px 16px;
  padding: 14px 16px;
  text-align: left;
  background: var(--ink);
}

.new-thread span {
  margin-right: 9px;
  color: #ff8d72;
}

.search-wrap {
  padding: 0 24px 14px;
}

.search-wrap input {
  padding: 12px;
  background: transparent;
}

.thread-list {
  flex: 1;
  overflow: auto;
  padding: 0 12px 24px;
}

.thread-item {
  width: 100%;
  padding: 16px 14px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  text-align: left;
  background: transparent;
}

.thread-item:hover,
.thread-item.is-active {
  background: rgba(255, 255, 255, 0.62);
}

.thread-item.is-active {
  box-shadow: inset 3px 0 var(--signal);
}

.thread-item strong {
  display: block;
  overflow: hidden;
  font-size: 0.92rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-meta {
  display: flex;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted);
  font: 0.7rem Consolas, monospace;
}

.status-pill {
  color: var(--cyan);
}

.sidebar-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
}

.connection-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: #35a365;
  box-shadow: 0 0 0 5px rgba(53, 163, 101, 0.13);
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.topbar {
  min-height: 88px;
  padding: 18px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid var(--line);
  background: rgba(244, 240, 231, 0.68);
  backdrop-filter: blur(18px);
}

.thread-heading {
  min-width: 0;
}

.thread-heading h1 {
  max-width: 760px;
  margin: 5px 0 0;
  overflow: hidden;
  font: 400 clamp(1.15rem, 2.2vw, 1.8rem) "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resume-button {
  flex: none;
  padding: 11px 17px;
  background: var(--signal);
}

.empty-state {
  position: relative;
  align-self: center;
  justify-self: center;
  width: min(700px, calc(100% - 40px));
  padding: 60px 0;
}

.empty-state h2 {
  margin: 18px 0;
  font: 400 clamp(2.5rem, 7vw, 6.5rem) / 0.98 "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  letter-spacing: -0.06em;
}

.empty-state > p:last-child {
  max-width: 480px;
  color: var(--muted);
  line-height: 1.8;
}

.orbit {
  position: absolute;
  right: 2%;
  top: 5%;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(233, 77, 43, 0.38);
  border-radius: 50%;
}

.orbit::before,
.orbit::after {
  content: "";
  position: absolute;
  inset: 22px -18px;
  border: 1px solid rgba(21, 149, 163, 0.35);
  border-radius: 50%;
  transform: rotate(42deg);
}

.orbit::after {
  inset: 70px -35px;
  transform: rotate(-24deg);
}

.orbit span {
  position: absolute;
  right: 28px;
  top: 22px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--signal);
}

.timeline {
  overflow: auto;
  padding: 32px clamp(16px, 5vw, 72px) 90px;
  scroll-behavior: auto;
  overflow-anchor: none;
}

.turn-block {
  width: min(920px, 100%);
  margin: 0 auto 30px;
}

.message {
  margin: 0 0 16px;
}

.message.user {
  max-width: 80%;
  margin-left: auto;
  padding: 16px 18px;
  color: var(--ink);
  border: 1px solid var(--user-message-edge);
  background: linear-gradient(135deg, #eee5d5, var(--user-message));
  box-shadow: 0 8px 22px rgba(76, 57, 34, 0.07);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.agent {
  max-width: 88%;
  padding: 4px 0 12px 22px;
  border-left: 3px solid var(--signal);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-size: 1rem;
  line-height: 1.85;
  letter-spacing: 0.012em;
  white-space: pre-wrap;
}

.message.agent.is-streaming .message-body::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 7px;
  border-radius: 50%;
  background: #2196f3;
  box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.38);
  vertical-align: 0.08em;
  animation: live-response-pulse 1.1s ease-out infinite;
}

@keyframes live-response-pulse {
  70% {
    box-shadow: 0 0 0 7px rgba(33, 150, 243, 0);
  }
}

.tool-card {
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--card);
}

.tool-card header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font: 0.72rem Consolas, monospace;
}

.tool-card pre {
  max-height: 260px;
  overflow: auto;
  margin: 12px 0 0;
  font: 0.76rem/1.55 Consolas, monospace;
  white-space: pre-wrap;
}

.composer {
  padding: 10px clamp(16px, 5vw, 72px) 18px;
  background: linear-gradient(transparent, var(--paper) 24%);
}

.composer > * {
  width: min(920px, 100%);
  margin-right: auto;
  margin-left: auto;
}

.composer-state {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font: 0.72rem Consolas, monospace;
}

.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 12px 45px rgba(39, 31, 23, 0.1);
}

.composer-box.is-dragging {
  border-color: #1689df;
  box-shadow: 0 0 0 3px rgba(22, 137, 223, 0.13), 0 12px 45px rgba(39, 31, 23, 0.1);
}

.composer-box textarea {
  max-height: 160px;
  resize: none;
  padding: 9px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.composer-box #sendButton {
  width: 43px;
  height: 43px;
  flex: none;
  border-radius: 50%;
  font-size: 1.35rem;
  background: var(--signal);
}

.composer-box .attach-button {
  width: 38px;
  height: 38px;
  flex: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: var(--paper-deep);
  font-size: 1.45rem;
  line-height: 1;
}

.attachment-tray {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 8px;
}

.attachment-chip {
  min-width: 0;
  max-width: 240px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.94);
}

.attachment-chip img {
  width: 34px;
  height: 34px;
  flex: none;
  object-fit: cover;
}

.attachment-file-icon {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--paper-deep);
  font: 0.55rem Consolas, monospace;
}

.attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
}

.attachment-remove {
  width: 24px;
  height: 24px;
  flex: none;
  padding: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  font-size: 1rem;
}

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.message-attachments span {
  max-width: 100%;
  overflow: hidden;
  padding: 4px 8px;
  border: 1px solid rgba(25, 24, 21, 0.24);
  color: var(--ink);
  background: rgba(255, 253, 248, 0.52);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.68rem;
}

.icon-button,
.text-button {
  color: var(--ink);
  background: transparent;
}

.text-button {
  color: var(--signal);
}

.mobile-only {
  display: none;
}

dialog {
  width: min(520px, calc(100% - 28px));
  padding: 28px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(19, 17, 14, 0.52);
  backdrop-filter: blur(5px);
}

dialog h2 {
  margin: 10px 0 28px;
  font: 400 2rem "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

dialog input,
dialog select {
  padding: 14px;
}

dialog select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: inherit;
  font: inherit;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 22px;
}

.dialog-actions button {
  padding: 11px 18px;
}

.dialog-actions .secondary {
  color: var(--ink);
  background: var(--paper-deep);
}

.approval-card pre {
  max-height: 300px;
  overflow: auto;
  padding: 14px;
  color: #e9e5db;
  background: #24221e;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  max-width: min(420px, calc(100% - 36px));
  padding: 13px 16px;
  color: #fff;
  background: var(--ink);
  opacity: 0;
  transform: translateY(12px);
  transition: 0.2s ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .mobile-only {
    display: inline-grid;
    place-items: center;
  }

  .sidebar {
    position: fixed;
    inset: 0 12% 0 0;
    z-index: 30;
    box-shadow: 25px 0 70px rgba(25, 24, 21, 0.24);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .topbar {
    min-height: 74px;
    gap: 12px;
    padding: 12px 14px;
  }

  .thread-heading {
    flex: 1;
  }

  .thread-heading h1 {
    font-size: 1.08rem;
  }

  .resume-button {
    padding: 9px 11px;
    font-size: 0.78rem;
  }

  .empty-state {
    padding: 38px 8px;
  }

  .orbit {
    width: 155px;
    height: 155px;
    opacity: 0.72;
  }

  .timeline {
    padding: 22px 14px 76px;
  }

  .message.user,
  .message.agent {
    max-width: 94%;
  }

  .composer {
    padding: 8px 12px max(12px, env(safe-area-inset-bottom));
  }

  .login-card::after {
    width: 150px;
    height: 150px;
    border-width: 24px;
  }
}



/* UI FIXES V2 */
html,
body {
  height: 100%;
  overflow: hidden;
}

.sidebar {
  min-height: 0;
  overflow: hidden;
}

.thread-list {
  min-height: 0;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.workspace {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.timeline {
  min-height: 0;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.thread-list::-webkit-scrollbar,
.timeline::-webkit-scrollbar {
  width: 9px;
}

.thread-list::-webkit-scrollbar-thumb,
.timeline::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 10px;
  background: rgba(25, 24, 21, 0.28);
  background-clip: padding-box;
}

.project-group {
  border-top: 1px solid var(--line);
}

.project-heading {
  width: 100%;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 7px;
  padding: 15px 12px 10px;
  color: var(--ink);
  text-align: left;
  background: transparent;
}

.project-heading strong {
  overflow: hidden;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-icon {
  width: 16px;
  height: 12px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 2px;
  color: var(--muted);
  font-size: 0;
}

.folder-icon::before {
  content: "";
  width: 7px;
  height: 3px;
  position: relative;
  left: -3px;
  top: -7px;
  border: 1px solid currentColor;
  border-bottom: 0;
  background: var(--paper-deep);
}

.project-count {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 12px;
  color: var(--muted);
  background: rgba(25, 24, 21, 0.06);
  font: 0.66rem Consolas, monospace;
  text-align: center;
}

.project-chevron {
  color: var(--muted);
  transition: transform 0.2s ease;
}

.project-group.is-collapsed .project-chevron {
  transform: rotate(-90deg);
}

.project-group.is-collapsed .project-sessions {
  display: none;
}

.project-sessions {
  padding: 0 0 9px 22px;
}

.project-sessions .thread-item {
  padding: 12px 12px;
  border-top: 0;
  border-left: 1px solid rgba(25, 24, 21, 0.11);
}

.project-sessions .thread-item.is-active {
  border-left-color: var(--signal);
  box-shadow: inset 3px 0 var(--signal);
}

.topbar-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 9px;
}

.details-button {
  padding: 10px 13px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.38);
  font-size: 0.76rem;
}

.details-button.is-active {
  color: var(--paper);
  background: var(--ink);
}

.visible-empty {
  width: min(920px, 100%);
  margin: 12vh auto;
  padding: 28px;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.empty-list-note {
  padding: 18px 12px;
}

@media (max-width: 760px) {
  .topbar-actions {
    gap: 5px;
  }

  .details-button {
    max-width: 68px;
    padding: 8px;
    line-height: 1.2;
  }
}

/* V2 multi-host controls */
.host-wrap {
  margin: 0 24px 14px;
}
.host-wrap label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font: 0.66rem Consolas, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.host-wrap select {
  width: 100%;
  padding: 11px 36px 11px 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.45);
}
.sidebar-foot {
  display: flex;
  align-items: center;
}
.sidebar-foot #connectionLabel {
  flex: 1;
}
.logout-button {
  padding: 4px 0 4px 12px;
  color: var(--signal);
  background: transparent;
  font-size: 0.72rem;
}
.connection-dot.is-offline {
  background: var(--signal);
  box-shadow: 0 0 0 5px rgba(233, 77, 43, 0.13);
}
.load-older {
  display: block;
  margin: 0 auto 24px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.5);
  font-size: 0.75rem;
}
#turns {
  min-height: 1px;
}
/* V2 task activity and unread indicators */
.thread-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.thread-title-row > strong {
  min-width: 0;
  flex: 1;
}
.session-state {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #1689df;
  font: 600 0.68rem/1 "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  white-space: nowrap;
}
.running-ring {
  width: 9px;
  height: 9px;
  box-sizing: border-box;
  border: 2px solid #2196f3;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.42);
  animation: session-pulse 1.25s ease-out infinite;
}
.unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2196f3;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.11);
}
@keyframes session-pulse {
  0% { box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.42); }
  70%, 100% { box-shadow: 0 0 0 6px rgba(33, 150, 243, 0); }
}
.message-body {
  --followup-border: rgba(25, 24, 21, 0.24);
  white-space: normal;
}

.message-body > :first-child {
  margin-top: 0;
}

.message-body > :last-child {
  margin-bottom: 0;
}

.message-body p,
.message-body ul,
.message-body ol,
.message-body blockquote,
.message-body pre {
  margin: 0.55em 0;
}

.message-body ul,
.message-body ol {
  padding-left: 1.5em;
}

.message-body h1,
.message-body h2,
.message-body h3,
.message-body h4,
.message-body h5,
.message-body h6 {
  margin: 0.8em 0 0.35em;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  line-height: 1.35;
}

.message-body h1 { font-size: 1.42em; }
.message-body h2 { font-size: 1.28em; }
.message-body h3 { font-size: 1.15em; }

.message-body code {
  padding: 0.12em 0.34em;
  border-radius: 3px;
  background: rgba(18, 24, 29, 0.08);
  font: 0.9em/1.5 Consolas, "SFMono-Regular", monospace;
}

.message.user .message-body code {
  background: rgba(25, 24, 21, 0.09);
}

.message-body .followup-button {
  display: inline-block;
  max-width: 100%;
  min-height: 44px;
  margin: 6px 8px 6px 0;
  padding: 9px 14px;
  border: 1px solid var(--followup-border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  font: inherit;
  font-size: 0.9em;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.message-body .followup-button:hover { background: rgba(255, 255, 255, 0.9); }
.message-body .followup-button:focus-visible { outline: 2px solid #ed512d; outline-offset: 3px; }

.turn-completion {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 2px 0 0 22px;
  padding-top: 10px;
  border-top: 1px solid rgba(25, 24, 21, 0.1);
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.completion-mark {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  margin-right: 2px;
  border-radius: 50%;
  color: #fff;
  background: var(--cyan);
  font-size: 0.68rem;
  font-weight: 700;
}

.details-empty {
  width: min(920px, 100%);
  margin: -8px auto 24px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  color: var(--muted);
  background: rgba(255, 253, 248, 0.42);
  font-size: 0.76rem;
  text-align: center;
}

.message-body pre {
  overflow: auto;
  padding: 12px 14px;
  background: #15191c;
  color: #f5f1e8;
  white-space: pre-wrap;
}

.message-body pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.message-body blockquote {
  padding-left: 12px;
  border-left: 2px solid var(--signal);
  color: var(--muted);
}

.message-body a {
  color: #007f9e;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

.rich-content {
  width: 100%;
  margin: 16px 0;
  overflow: hidden;
  border: 1px solid rgba(25, 24, 21, 0.13);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 34px rgba(45, 37, 26, 0.08);
}

.rich-content img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: min(76vh, 920px);
  margin: 0 auto;
  object-fit: contain;
}

.rich-content-status {
  padding: 22px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.rich-content-status.is-error {
  color: #a53a2a;
  background: rgba(199, 70, 46, 0.06);
}

.rich-content-toolbar {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px 7px 13px;
  border-bottom: 1px solid rgba(25, 24, 21, 0.1);
  color: var(--muted);
  font-size: 0.74rem;
}

.rich-content-toolbar span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rich-content-toolbar button {
  flex: 0 0 auto;
  min-height: 29px;
  padding: 4px 10px;
  border: 1px solid rgba(25, 24, 21, 0.18);
  border-radius: 6px;
  background: #191815;
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.rich-visualization-frame {
  display: block;
  width: 100%;
  height: 560px;
  border: 0;
  background: #fff;
}

.image-preview-trigger { cursor: zoom-in; }
.image-preview-trigger:focus-visible { outline: 3px solid #e8502e; outline-offset: 3px; }
dialog.image-preview {
  width: 96vw; max-width: 1800px; height: 94vh; height: 94dvh;
  max-height: 96vh; max-height: 96dvh; padding: 0; margin: auto;
  border: 1px solid #555; border-radius: 12px; background: #181818; color: #fff;
  overflow: hidden;
}
dialog.image-preview[open] { display: flex; flex-direction: column; }
.image-preview::backdrop { background: rgba(0, 0, 0, 0.86); }
.image-preview-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 12px; flex: 0 0 auto; border-bottom: 1px solid #444;
}
.image-preview-title { flex: 1 1 160px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-preview-toolbar button {
  min-height: 44px; min-width: 44px; padding: 6px 12px; border: 1px solid #888;
  border-radius: 6px; background: #303030; color: #fff; font: inherit; cursor: pointer;
}
.image-preview-toolbar button:focus-visible { outline: 3px solid #ff916f; outline-offset: 2px; }
.image-preview-scale { width: 100%; font-size: 12px; color: #ddd; }
.image-preview-stage { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 12px; }
.image-preview-stage img { display: block; max-width: none; max-height: none; margin: 0 auto; user-select: none; }
@media (max-width: 700px) {
  dialog.image-preview { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; }
  .image-preview-title { flex-basis: 100%; }
  .image-preview-toolbar { gap: 6px; padding: 8px; }
  .image-preview-toolbar button { padding: 6px 10px; }
}

@media (max-width: 700px) {
  .rich-content {
    width: calc(100vw - 28px);
    margin-left: calc((100% - (100vw - 28px)) / 2);
    border-radius: 8px;
  }

  .rich-visualization-frame {
    height: 480px;
  }
}
