/* 将系统圆体限定于西文，让中英混排中的汉字使用霞鹜文楷。 */
@font-face {
  font-family: "AgentConnect Rounded";
  src: local("ui-rounded");
  font-weight: 100 900;
  unicode-range: U+0000-024F, U+0300-036F, U+1E00-1EFF, U+2000-206F, U+20A0-20CF;
}
:root {
  color-scheme: dark;
  font-family: var(--interface-font);
  font-optical-sizing: auto;
  font-kerning: normal;
  color: #fafafa;
  --interface-font: "AgentConnect Rounded", "SF Pro Rounded", "Nunito Variable", "LXGW WenKai", sans-serif;
  --muted: #adabb4;
  --line: #ffffff17;
  --rim: #ffffff24;
  --link: #c7c5ff;
  --glass: #1a1a1ae8;
  --field: linear-gradient(180deg, #202020, #252525 84%, #303030);
  --cta: linear-gradient(180deg, #626ad7, #3841af 8%, #3941af 78%, #5059c6);
  --glint: inset 0 1px 0 #ffffff0f, inset 0 -1px 0 #ffffff05;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(ellipse at 86% 0%,#23172b55,transparent 47%), #000;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .48; cursor: default; }
:focus-visible { outline: 2px solid #b7abff; outline-offset: 2px; }
h1, h2 { font-weight: 700; }
h1, h2, p, dl, dd { margin: 0; }
header, #console { width: min(1220px, calc(100% - 64px)); margin-inline: auto; }
header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.brand, #connection, .heading, .sidehead, .chathead, .sessionhead, footer {
  display: flex;
  align-items: center;
}
.brand { gap: 10px; font-size: 26px; font-weight: 700; letter-spacing: -.035em; line-height: 1.2; }
.mark {
  display: block; flex: none;
  width: 42px; height: auto;
}
.pair-logo { display: block; width: 60px; height: auto; }
#connection {
  gap: 8px;
  padding: 7px 12px;
  max-width: 60%;
  border: 1px solid var(--rim);
  border-radius: 20px;
  background: #191919;
  color: #dad8df;
  font-size: 12px;
}
.dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #7e8c9f; }
.online .dot { background: #80e6ab; box-shadow: 0 0 0 3px #54c78018; }
#console, .pair, dialog {
  border: 1px solid var(--rim);
  border-radius: 26px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(132%);
  backdrop-filter: blur(24px) saturate(132%);
  box-shadow: var(--glint), 0 18px 52px #0008;
}
#console {
  flex: 1;
  min-height: 0;
  margin-bottom: 28px;
  display: grid;
  grid-template-columns: clamp(274px, 31%, 375px) minmax(0, 1fr);
  overflow: hidden;
}
aside, .workspace { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
aside { padding: 24px 18px 14px; background: #121212; border-right: 1px solid var(--line); }
.sidehead, .sessionhead, footer { justify-content: space-between; gap: 10px; }
.heading { gap: 9px; }
.sidehead h1 { font-size: 34px; line-height: 1.22; letter-spacing: .025em; }
#count { border-radius: 10px; padding: 2px 8px; font-size: 12px; font-weight: 650; background: #292729; color: #d8d2db; }
.round {
  flex: none;
  display: grid; place-items: center;
  width: 42px; height: 42px;
  padding: 0;
  border: 1px solid var(--rim);
  border-radius: 50%;
  background: var(--field);
  box-shadow: var(--glint);
  color: white;
  font-size: 25px; line-height: 1;
}
.searchbox {
  display: flex; align-items: center; gap: 11px;
  margin: 19px 0 13px;
  padding: 0 13px;
  min-height: 42px;
  border: 1px solid var(--rim);
  border-radius: 24px;
  background: var(--field);
  box-shadow: var(--glint);
}
.searchbox .fa-solid { color: var(--muted); font-size: 14px; }
.round .fa-solid { font-size: 17px; }
#discover .fa-solid { font-size: 20px; }
.searchbox:focus-within, #compose:focus-within { border-color: var(--link); }
.searchbox input { flex: 1; min-width: 0; padding: 9px 0; border: 0; background: none; }
input::placeholder, textarea::placeholder { color: #9d99a2; }
nav { flex: 1; overflow-y: auto; scrollbar-width: thin; padding: 2px; }
.pinnedGroup { position: sticky; top: 0; z-index: 1; }
.session {
  display: flex; align-items: center; gap: 13px;
  width: 100%; text-align: left;
  padding: 14px 10px;
  min-height: 78px;
  border: 1px solid transparent;
  border-bottom-color: var(--line);
  background: transparent;
}
.pinnedGroup .session {
  border-color: var(--rim);
  border-radius: 18px;
  background: linear-gradient(110deg,#33283a,#242126 70%);
  box-shadow: var(--glint);
}
.pinnedGroup > .session, .pinnedGroup > .swipeRow { margin-bottom: 6px; }
.session:hover, .session:focus-visible { background-color: #ffffff0b; }
@media (min-width: 721px) {
  .session[aria-current=true] { border-radius: 17px; border: 1px solid #766184; background-color: #312b36; }
}
.swipeRow {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: 15px;
  touch-action: pan-y pinch-zoom;
}
.swipeActions {
  position: absolute;
  inset: 0 auto 0 0;
  display: grid;
  grid-template-columns: repeat(2, 72px);
}
.swipeActions[aria-hidden=true] { pointer-events: none; }
.swipeActions button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0;
  border: 0;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: .035em;
}
.pinAction { color: #f0e9ff; background: #44385c; }
.removeAction { color: #ffe5e9; background: #683c49; }
.swipeActions .fa-solid { font-size: 16px; }
.swipeRow > .session {
  position: relative;
  z-index: 1;
  padding-right: 47px;
  background-color: #121212;
  transform: translateX(var(--reveal, 0px));
  transition: transform 180ms cubic-bezier(.22,.75,.25,1);
  touch-action: pan-y pinch-zoom;
  -webkit-user-select: none;
  user-select: none;
}
.swipeRow > .session:focus-visible, .swipeActions button:focus-visible { outline-offset: -3px; }
.rowMenu {
  position: absolute;
  z-index: 2;
  top: 50%; right: 1px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #c8c1cd;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  transform: translate(var(--reveal, 0px), -50%);
  transition: transform 180ms cubic-bezier(.22,.75,.25,1), opacity 100ms;
}
.rowMenu:focus-visible { outline-offset: -3px; }
.swipeRow.open { --reveal: 144px; }
.swipeRow.dragging > .session, .swipeRow.dragging > .rowMenu { transition: none; }
.swipeRow.open > .rowMenu { pointer-events: none; }
@media (hover: hover) and (pointer: fine) {
  .rowMenu { opacity: .55; }
  .swipeRow:hover .rowMenu, .swipeRow:focus-within .rowMenu { opacity: 1; }
  .swipeRow > .session:hover { background-color: #212025; }
  .swipeActions button:hover { filter: brightness(1.15); }
}
@media (min-width: 721px) {
  .swipeRow > .session[aria-current=true] { background-color: #312b36; }
}
@media (prefers-reduced-motion: reduce) {
  .swipeRow > .session, .swipeRow > .rowMenu { transition: none; }
}
.avatar {
  position: relative;
  display: inline-grid; place-items: center;
  flex: none;
  width: 47px; height: 47px; border-radius: 16px;
  color: white;
  background: linear-gradient(145deg,#d588dc,#a33ab9 58%,#713a87);
  box-shadow: inset 0 1px 2px #ffffff60, inset 0 -2px 5px #0003;
  overflow: hidden;
}
.avatar::after {
  content: ""; position: absolute; inset: -20% -8% 48%;
  border-radius: 50%; transform: rotate(-19deg); background: linear-gradient(175deg,transparent,#ffffff3d);
}
.avatar .fa-solid { display: none; z-index: 1; font-size: 17px; }
.worker .fa-code-branch, .terminal .fa-terminal, .native .fa-code { display: inline-block; }
.chathead .avatar.supervisor { border-radius: 0; box-shadow: none; background: transparent url("/logo.svg") center / contain no-repeat; }
.avatar.supervisor::after { display: none; }
.avatar.worker { background: linear-gradient(135deg,#cb9aeb,#9364c7 70%,#7351ab); }
.avatar.terminal { background: linear-gradient(135deg,#68bcac,#297e81 65%,#266679); }
.avatar.native { background: linear-gradient(135deg,#8997ef,#7163bf 68%,#5c4b9f); }
.rowContent, .identity { min-width: 0; flex: 1; }
.rowTitle { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.rowTitle strong, .preview, .identity h2, #machine, #candidates strong, #candidates small {
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.rowTitle strong { font-size: 16px; line-height: 1.42; font-weight: 600; letter-spacing: .005em; }
.rowTitle time { flex: none; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.preview, .rowStatus { display: block; color: var(--muted); }
.preview { margin-top: 3px; font-size: 13px; line-height: 1.52; letter-spacing: .015em; }
.rowStatus { margin-top: 4px; font-size: 11px; line-height: 1.45; letter-spacing: .035em; }
.rowStatus[data-state=running] { color: #82dfb2; }
#noMatches { color: var(--muted); font-size: 14px; margin: 8px; }
#listStatus { flex: none; margin: 8px 3px 4px; color: #e2d7ed; font-size: 13px; line-height: 1.55; }
footer { margin-top: auto; padding: 12px 5px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
#machine { min-width: 0; }
.plain { border: 0; background: transparent; color: var(--link); padding: 8px 4px; flex: none; }
.workspace { background: radial-gradient(ellipse at 100% 0%,#291f3055,transparent 48%),#0c0c0c; }
.chathead { min-height: 83px; padding: 14px clamp(14px,3vw,34px); gap: 12px; border-bottom: 1px solid var(--line); background: #191919d9; }
.chathead .avatar { width: 42px; height: 42px; border-radius: 14px; }
.identity h2 { margin-bottom: 3px; font-size: 23px; line-height: 1.25; }
#state, #role { color: var(--muted); font-size: 12px; }
#state:not(:empty)::before { content: " · "; }
#info { width: 38px; height: 38px; font-size: 21px; }
#back { display: none; }
#history { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 24px clamp(16px,3vw,38px); }
.entry { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 17px; }
.entry.user { align-items: flex-end; }
.message-meta { margin: 0 5px 5px; font-size: 11px; color: var(--muted); }
.message-body {
  max-width: min(85%, 640px);
  min-width: 0;
  width: fit-content;
  padding: 11px 15px;
  border: 1px solid var(--rim);
  border-radius: 19px 19px 19px 6px;
  background: #232323;
  box-shadow: var(--glint);
  font-size: 15px; line-height: 1.72; letter-spacing: .012em;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.entry.user > .message-body {
  color: white; border-color: #6668cb;
  border-radius: 19px 19px 6px 19px;
  background: var(--cta);
  box-shadow: var(--glint);
}
.entry.error > .message-body { color: #ffb9c0; border-color: #753b46; }
.markdown { white-space: normal; }
.markdown :is(h1,h2,h3,h4,h5,h6) { font-weight: 700; line-height: 1.35; letter-spacing: normal; }
.markdown h1 { font-size: 1.48em; }
.markdown h2 { font-size: 1.3em; }
.markdown h3 { font-size: 1.16em; }
.markdown :is(h4,h5,h6) { font-size: 1em; }
.markdown :is(p,h1,h2,h3,h4,h5,h6,blockquote,pre,ol,ul,hr,.markdown-table) { margin: .75em 0 0; }
.markdown :first-child { margin-top: 0; }
.markdown :is(ol,ul) { padding-inline-start: 1.55em; }
.markdown li > :is(ol,ul), .markdown li + li { margin-top: .25em; }
.markdown .task-list-item { list-style: none; }
.markdown input[type=checkbox] { margin: 0 .35em 0 -1.3em; accent-color: var(--link); vertical-align: middle; }
.markdown blockquote { border-inline-start: 3px solid var(--link); padding-inline-start: .85em; }
.markdown a { color: var(--link); text-underline-offset: .15em; }
.user .markdown a { color: inherit; }
.markdown img { max-width: 100%; height: auto; }
.markdown code {
  font: .88em/1.5 ui-monospace, monospace;
  background: color-mix(in srgb, currentColor 9%, transparent); border-radius: 4px; padding: .1em .3em;
}
.markdown pre {
  max-width: 100%; overflow-x: auto; padding: .7em .85em; border: 1px solid var(--rim); border-radius: 8px;
  background: color-mix(in srgb, currentColor 5%, transparent); font: .88em/1.6 ui-monospace, monospace;
  white-space: pre; overflow-wrap: normal; tab-size: 4;
}
.markdown pre code { font: inherit; background: transparent; padding: 0; }
.markdown hr { height: 0; border: 0; border-top: 1px solid var(--rim); }
.markdown-table { max-width: 100%; overflow-x: auto; }
.markdown table { width: max-content; border-collapse: collapse; font-size: .95em; }
.markdown th, .markdown td { padding: .35em .65em; max-width: min(36ch, 65vw); border: 1px solid var(--rim); vertical-align: top; }
.markdown th { background: color-mix(in srgb, currentColor 7%, transparent); }
.markdown .align-left { text-align: left; }
.markdown .align-center { text-align: center; }
.markdown .align-right { text-align: right; }
.activity { margin: 3px 0 16px; padding-left: 10px; border-left: 2px solid #605367; color: var(--muted); }
.activity summary { width: fit-content; cursor: pointer; padding: 5px; font-size: 12px; }
.activity[open] summary { margin-bottom: 6px; }
.entry:is(.progress,.system,.launch) > .message-body { background: #1b1b1c; font-size: 12px; line-height: 1.65; }
#screen { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: #131513; color: #d5e8da; font: 13px/1.5 ui-monospace,monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
#empty { margin: 12vh auto 0; text-align: center; font-size: 14px; color: var(--muted); }
#compose {
  display: flex; align-items: flex-end; gap: 9px;
  margin: 0 clamp(12px,2.5vw,32px) 18px; padding: 7px;
  border: 1px solid var(--rim); border-radius: 25px;
  background: var(--field); box-shadow: var(--glint);
}
textarea {
  min-width: 0; flex: 1; resize: none; field-sizing: content;
  min-height: 40px; max-height: 20dvh;
  border: 0; background: transparent; padding: 9px 10px;
  font-size: 16px; line-height: 22px;
}
#send, #discover, .primary { background: var(--cta); color: white; border: 1px solid #666ccc; }
#send { width: 40px; height: 40px; font-weight: 600; }
#attachPhoto { width: 40px; height: 40px; flex-shrink: 0; }
#photoDraft { display: flex; align-items: center; gap: 12px; margin: 0 20px 6px; }
#photoDraft img { max-width: 96px; max-height: 80px; border-radius: 8px; }
.message-body .chat-photo { display: block; max-width: min(100%,240px); max-height: 240px; border-radius: 9px; }
.photoChoices { display: flex; gap: 18px; margin-top: 16px; }
#delivery { text-align: right; margin: 0 28px 4px; color: var(--muted); font-size: 12px; }
#nativeQueue { margin: 0 18px 6px; max-height: 20dvh; overflow-y: auto; color: var(--muted); font-size: 13px; }
#nativeQueue summary { cursor: pointer; }
#nativeQueue li { white-space: pre-wrap; overflow-wrap: anywhere; }
#login { flex: 1; display: grid; place-items: center; padding: 16px; overflow: auto; }
.pair { width: min(100%,410px); padding: 32px; }
.pair h1 { margin: 16px 0 8px; font-size: 27px; }
.pair p { margin-bottom: 20px; font-size: 14px; line-height: 1.65; color: var(--muted); }
.pair label, #lookup label, dt { color: var(--muted); font-size: 13px; }
.pair input, #lookup select, #lookup input {
  width: 100%; margin: 6px 0 10px; padding: 11px;
  border: 1px solid var(--rim); border-radius: 14px; background: var(--field);
}
.primary { min-height: 44px; padding: 9px 18px; border-radius: 999px; font-weight: 650; }
.pair .primary { width: 100%; }
#loginError, #projectError { margin-top: 7px; color: #ffb9c0; }
dialog { width: min(490px,94vw); max-height: 82dvh; padding: 22px; color: inherit; background-color: #1a1a1af5; }
dialog::backdrop { background: #0009; backdrop-filter: blur(6px); }
dialog h2 { font-size: 24px; line-height: 1.3; letter-spacing: .015em; }
#lookup { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px 10px; margin: 15px 0; }
#searchLabel, #lookup .primary, #projectError { grid-column: 1 / -1; }
#lookup select { text-overflow: ellipsis; }
#lookup option { color: #fff; background: #242424; }
#picker[open] { display: flex; flex-direction: column; }
#picker .sessionhead, #lookup, #nextPage { flex: none; }
#lookup:has(#projectLabel[hidden]) label:first-child { grid-column: 1 / -1; }
#candidates { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#lookupStatus, #candidates small { color: var(--muted); font-size: 13px; }
#candidates .session { display: block; min-height: 56px; padding: 9px; }
#candidates strong, #candidates small { display: block; }
dt { margin-top: 16px; }
dd { margin-top: 3px; overflow-wrap: anywhere; }
#editLabel { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; margin-top: 18px; }
#editLabel label, #labelStatus { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
#labelText { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 12px; font-size: 16px; }
@media (max-width: 720px) {
  header, #console { width: calc(100% - 20px); }
  header { min-height: 56px; padding: 0 5px; }
  .brand { font-size: 22px; }
  .mark { width: 38px; }
  #console { display: flex; margin-bottom: max(10px,env(safe-area-inset-bottom)); border-radius: 24px; }
  aside, .workspace { flex: 1; }
  aside { border: 0; padding: 21px 13px 12px; }
  #console[data-view=inbox] .workspace, #console[data-view=chat] aside { display: none; }
  .chathead { min-height: 70px; gap: 8px; padding: 9px 12px; }
  #back { display: grid; width: 38px; height: 38px; }
  .chathead .avatar { width: 37px; height: 37px; border-radius: 13px; }
  .identity h2 { font-size: 20px; }
  #history { padding: 16px 11px; }
  #compose { margin: 0 9px 11px; }
  .message-body { max-width: 90%; }
  .searchbox input, .pair input, #lookup input, #lookup select { font-size: 16px; }
}
@media (prefers-reduced-transparency: reduce) {
  #console, dialog, .pair { background: #1a1a1a; backdrop-filter: none; }
}

@keyframes surface-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes chat-enter {
  from { opacity: .55; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes inbox-enter {
  from { opacity: .55; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes veil-enter { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .pair, dialog[open], .entry.arriving:is(.user,.assistant,.child) { animation: surface-enter 220ms cubic-bezier(.2,.75,.25,1); }
  dialog[open]::backdrop { animation: veil-enter 160ms ease-out; }
  .round, .primary { transition: transform 140ms ease-out, filter 140ms ease-out; }
  .round:enabled:active, .primary:enabled:active { transform: scale(.94); }
  #compose, .searchbox { transition: border-color 160ms ease-out; }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .round:enabled:hover, .primary:enabled:hover { filter: brightness(1.14); }
}
@media (max-width: 720px) and (prefers-reduced-motion: no-preference) {
  #console[data-view=chat] .workspace { animation: chat-enter 220ms ease-out; }
  #console[data-view=inbox] aside { animation: inbox-enter 200ms ease-out; }
}
