:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --sidebar: #f0f0ed;
  --surface: #ffffff;
  --surface-soft: #f0f0ed;
  --line: #deded8;
  --text: #202123;
  --muted: #6b6f76;
  --accent: #111827;
  --accent-hover: #2f3541;
  --user: #ececec;
  --danger: #b42318;
  --shadow: 0 18px 55px rgba(17, 24, 39, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.server-version-notice {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 100;
  display: flex;
  width: min(680px, calc(100vw - 28px));
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #e7b86b;
  border-radius: 8px;
  background: #fff8e8;
  box-shadow: 0 8px 28px rgba(32, 33, 35, 0.14);
  color: #5e410e;
  padding: 11px 12px 11px 15px;
  transform: translateX(-50%);
  font-size: 13px;
  line-height: 1.45;
}

.server-version-notice code {
  border-radius: 4px;
  background: #f3e5c5;
  padding: 1px 4px;
}

.server-version-notice button {
  flex: 0 0 auto;
  border: 1px solid #c88b2d;
  border-radius: 6px;
  background: #fff;
  color: #69440b;
  padding: 6px 10px;
  cursor: pointer;
}

.server-version-notice button:hover {
  background: #fff2d4;
}

button,
textarea,
input {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.app.dragging::after {
  position: fixed;
  inset: 14px;
  display: grid;
  place-items: center;
  border: 2px dashed #8b919e;
  border-radius: 18px;
  background: rgba(247, 247, 245, 0.82);
  color: var(--accent);
  content: "松开以上传文件";
  font-size: 22px;
  font-weight: 700;
  pointer-events: none;
  z-index: 20;
}

.sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  padding: 14px;
  min-height: 0;
  overflow: hidden;
}

.account-panel {
  display: grid;
  gap: 5px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.account-profile {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  padding: 7px;
  text-align: left;
  cursor: pointer;
}

.account-profile:hover,
.account-action:hover {
  background: #e3e3de;
}

.account-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #d8e7dc;
  color: #225c38;
  font-weight: 750;
}

.account-profile strong,
.account-profile small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-profile small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.account-action {
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 0 8px;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
}

.danger-text {
  color: var(--danger);
}

.sidebar-head {
  display: grid;
  gap: 14px;
}

.workspace-nav {
  display: grid;
  gap: 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px;
}

.mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 750;
}

.new-chat,
.nav-action,
.session-open {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.new-chat {
  background: var(--surface);
  padding: 0 12px;
  font-weight: 650;
}

.nav-action {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 0 10px;
  font-weight: 600;
}

.nav-action:hover,
.nav-action.active {
  background: #e3e3de;
}

.nav-action strong {
  min-width: 22px;
  border-radius: 999px;
  background: #dfe5e1;
  color: #315944;
  padding: 2px 6px;
  font-size: 11px;
  text-align: center;
}

.new-chat:hover,
.session-item:hover,
.session-item.active {
  background: #e3e3de;
}

.session-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  overflow: auto;
}

.session-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  border-radius: 8px;
}

.session-item.external {
  grid-template-columns: minmax(0, 1fr);
}

.session-open {
  overflow: hidden;
  background: transparent;
  padding: 0 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-open:has(.session-source) {
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-source {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  border-radius: 5px;
  background: #3370ff;
  color: #fff;
  font-size: 11px;
  font-weight: 750;
}

.session-delete {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  opacity: 0;
}

.session-item:hover .session-delete,
.session-item.active .session-delete {
  opacity: 1;
}

.session-delete:hover {
  background: #d6d6cf;
  color: var(--text);
}

.main {
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid transparent;
  padding: 0 22px;
}

.topbar-actions {
  display: flex;
  align-items: center;
}

.chat-context {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.chat-context > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#chatAssignmentSelect {
  min-height: 34px;
  max-width: 260px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 0 30px 0 10px;
  cursor: pointer;
  font-size: 12px;
}

.mobile-view-toggle {
  display: none;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.topbar-actions .primary-btn {
  min-height: 34px;
}

.chat-wrap {
  min-height: 0;
  overflow: hidden;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 28px max(18px, calc((100vw - 1140px) / 2)) 26px;
  scrollbar-gutter: stable;
}

.chat-log::-webkit-scrollbar,
.session-list::-webkit-scrollbar {
  width: 10px;
}

.chat-log::-webkit-scrollbar-thumb,
.session-list::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: #c8c8c1;
  background-clip: content-box;
}

.chat-log::-webkit-scrollbar-track,
.session-list::-webkit-scrollbar-track {
  background: transparent;
}

.empty-state {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 60%;
  color: var(--muted);
  text-align: center;
}

.empty-state h1 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 30px;
}

.empty-state p {
  margin: 0;
}

.message-wrap {
  display: grid;
  max-width: 780px;
  gap: 5px;
}

.message {
  display: grid;
  gap: 7px;
  min-width: 0;
  line-height: 1.72;
}

.message-wrap.user {
  justify-self: end;
  align-self: flex-end;
  max-width: min(680px, 86%);
}

.message.user {
  border-radius: 18px;
  background: var(--user);
  padding: 11px 15px;
}

.message-wrap.collaboration-member .message {
  border-left: 2px solid #6f9c7d;
  padding-left: 12px;
}

.message-wrap.collaboration-member .message-meta {
  color: #2f6e47;
  font-weight: 650;
}

.message-wrap.collaboration-coordinator .message {
  border-left-color: #7b6aa8;
}

.message-wrap.collaboration-coordinator .message-meta {
  color: #66528f;
}

.message.error {
  border-left: 3px solid var(--danger);
  color: var(--danger);
  padding-left: 12px;
}

.thinking {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 14px;
  padding-top: 6px;
}

.tool-process {
  width: min(620px, 100%);
  overflow: visible;
  border: 0;
  background: transparent;
  color: var(--muted);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.tool-process.finished {
  background: transparent;
}

.tool-process-header {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto 14px;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  padding: 4px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.tool-process-header::-webkit-details-marker {
  display: none;
}

.process-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.process-headline {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.process-chevron {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid #777b82;
  border-bottom: 1.5px solid #777b82;
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.tool-process[open] .process-chevron {
  transform: rotate(225deg);
}

.process-check {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: #e3f2e8;
  color: #137333;
  font-size: 12px;
}

.process-check.failed {
  background: #fbe9e7;
  color: var(--danger);
}

.process-check.stopped {
  background: #eeeeea;
  color: #74746d;
  font-size: 9px;
}

.tool-steps {
  display: grid;
  gap: 8px;
  padding: 5px 0 8px;
}

.tool-activity-group {
  width: min(560px, 100%);
}

.tool-activity-summary {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto 10px;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 3px 0;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.tool-activity-summary::-webkit-details-marker {
  display: none;
}

.tool-activity-summary strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-activity-summary > span:nth-child(3) {
  font-size: 11px;
}

.tool-activity-group[open] > .tool-activity-summary .tool-step-chevron {
  transform: rotate(45deg);
}

.activity-group-icon {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid #cfd8d1;
  border-radius: 50%;
  color: #2f7650;
  font-size: 10px;
}

.tool-activity-group.running .activity-group-icon {
  border-color: #d5c58e;
  color: #8a6b20;
}

.tool-activity-group.running .activity-group-icon::after {
  width: 8px;
  height: 8px;
  border: 1.5px solid #d8c997;
  border-top-color: #8a6b20;
  border-radius: 50%;
  content: "";
  animation: activity-spin 0.8s linear infinite;
}

.tool-activity-group.running .tool-activity-summary strong {
  color: transparent;
  background: linear-gradient(100deg, #4b504d 18%, #b9c4bd 43%, #267044 55%, #4b504d 76%);
  background-size: 240% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  animation: activity-shimmer 1.8s ease-in-out infinite;
}

@keyframes activity-spin {
  to { transform: rotate(360deg); }
}

@keyframes activity-shimmer {
  from { background-position: 110% 0; }
  to { background-position: -110% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tool-activity-group.running .activity-group-icon::after,
  .tool-activity-group.running .tool-activity-summary strong {
    animation: none;
  }

  .tool-activity-group.running .tool-activity-summary strong {
    color: #4b504d;
    background: none;
  }
}

.tool-activity-group.failed .activity-group-icon {
  border-color: #e2aaa5;
  color: var(--danger);
}

.tool-activity-body {
  display: grid;
  gap: 3px;
  margin-left: 4px;
  padding: 2px 0 4px 25px;
  border-left: 1px solid #e1e4df;
}

.process-completion-summary {
  display: grid;
  gap: 3px;
  border-left: 2px solid #76a987;
  border-radius: 4px;
  background: #eef6f0;
  padding: 8px 10px;
  color: #536057;
  font-size: 11px;
  line-height: 1.45;
}

.process-completion-summary strong {
  color: #225c36;
  font-size: 12px;
}

.process-completion-summary.failed {
  border-left-color: #cf7c75;
  background: #fbefed;
}

.process-completion-summary.failed strong {
  color: #9f2f27;
}

.process-commentary {
  display: block;
  align-items: start;
  padding: 7px 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
}

.process-commentary p {
  margin: 0;
  overflow-wrap: anywhere;
}

.process-commentary.running {
  color: var(--text);
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 8px;
}

.process-commentary .spinner {
  width: 13px;
  height: 13px;
  margin-top: 2px;
}

.tool-step {
  width: min(540px, 100%);
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 12px;
}

.tool-step-title {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto 10px;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 3px 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.tool-step-title::-webkit-details-marker {
  display: none;
}

.tool-step-title strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-step-title > span:last-child {
  color: inherit;
}

.tool-step-title > span:nth-child(3) {
  color: var(--muted);
  font-size: 11px;
}

.tool-step-chevron {
  width: 6px;
  height: 6px;
  border-right: 1.5px solid #8a8d92;
  border-bottom: 1.5px solid #8a8d92;
  transform: rotate(-45deg);
  transition: transform 0.16s ease;
}

.tool-step[open] .tool-step-chevron {
  transform: rotate(45deg);
}

.tool-step-body {
  display: grid;
  gap: 6px;
  margin: 3px 0 5px 29px;
  border: 1px solid #e5e6e2;
  border-radius: 4px;
  padding: 7px 8px 8px;
}

.tool-kind-icon {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 5px;
  background: #eceeeb;
  color: #4d535a;
  font: 700 10px/1 "Cascadia Mono", Consolas, monospace;
}

.tool-kind-icon.command {
  background: #e8eaed;
  color: #34383f;
}

.tool-kind-icon.python {
  background: #e7eef8;
  color: #24578b;
}

.tool-kind-icon.edit {
  background: #e7f2e9;
  color: #267044;
  font: 700 14px/1 sans-serif;
}

.tool-kind-icon.read {
  background: #f4eedf;
  color: #7b5b1f;
  font: 700 15px/1 sans-serif;
}

.tool-kind-icon.web {
  background: #e5f1f0;
  color: #276b67;
}

.tool-kind-icon.excel {
  background: #e4f1e8;
  color: #176b3a;
}

.tool-kind-icon.computer {
  background: #e8f2ff;
  color: #1769aa;
}

.computer-observation-preview {
  display: block;
  width: min(100%, 520px);
  margin-top: 10px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #d7dde5;
  border-radius: 6px;
  background: #fff;
  cursor: zoom-in;
}

.computer-observation-preview img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: #f3f5f7;
}

.computer-observation-preview span {
  display: block;
  border-top: 1px solid #e2e6eb;
  padding: 7px 9px;
  color: #5f6872;
  font-size: 11px;
  text-align: left;
}

.tool-step.failed {
  color: var(--danger);
}

.tool-step.running {
  color: #8a6b20;
}

.tool-step-body > code {
  display: block;
  overflow-x: auto;
  border: 0;
  border-radius: 5px;
  background: #f1f2f3;
  color: #3d4148;
  padding: 7px 9px;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
}

.command-group-body {
  gap: 0;
  padding: 0;
}

.command-entry {
  border-bottom: 1px solid #e6e7e4;
}

.command-entry:last-child {
  border-bottom: 0;
}

.command-entry-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 10px;
  align-items: center;
  gap: 12px;
  min-height: 36px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  list-style: none;
}

.command-entry-header::-webkit-details-marker {
  display: none;
}

.command-entry[open] .command-entry-header .tool-step-chevron {
  transform: rotate(45deg);
}

.command-entry-header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 12px;
}

.command-entry-body {
  display: grid;
  gap: 7px;
  border-top: 1px solid #ecece8;
  padding: 9px 10px 10px;
}

.command-entry-body > code {
  display: block;
  overflow-x: auto;
  border-radius: 5px;
  background: #202124;
  color: #f1f3f4;
  padding: 9px 10px;
  font: 11px/1.55 "Cascadia Mono", Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tool-diff {
  overflow: hidden;
  border: 1px solid #dde0dc;
  border-radius: 6px;
  background: #fff;
}

.tool-diff-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 31px;
  border-bottom: 1px solid #e5e7e3;
  background: #f6f7f5;
  padding: 5px 9px;
  color: #555b61;
  font-size: 11px;
}

.tool-diff-summary > span:first-child {
  margin-right: auto;
  color: #353a40;
  font-weight: 650;
}

.diff-added {
  color: #18713d;
  font-weight: 700;
}

.diff-removed {
  color: #b3352d;
  font-weight: 700;
}

.tool-diff-lines {
  max-height: 300px;
  overflow: auto;
  font: 11px/1.55 "Cascadia Mono", Consolas, monospace;
}

.diff-line {
  display: grid;
  grid-template-columns: 18px 38px minmax(0, 1fr);
  min-height: 20px;
  border-bottom: 1px solid #f0f1ee;
}

.diff-line:last-child {
  border-bottom: 0;
}

.diff-line.add {
  background: #edf8f0;
}

.diff-line.remove {
  background: #fff0ee;
}

.diff-line.skip {
  background: #f7f7f5;
  color: #84888d;
  font-style: italic;
}

.diff-marker,
.diff-number {
  display: grid;
  align-items: start;
  padding-top: 2px;
  color: #95999e;
  text-align: right;
  user-select: none;
}

.diff-marker {
  justify-content: center;
  color: #6c7278;
}

.diff-line.add .diff-marker {
  color: #1c7a43;
}

.diff-line.remove .diff-marker {
  color: #bf3930;
}

.diff-line code {
  min-width: 0;
  overflow-wrap: anywhere;
  background: transparent;
  color: #30343a;
  padding: 2px 8px;
  white-space: pre-wrap;
}

.tool-output {
  max-height: 180px;
  overflow: auto;
  margin: 0;
  border-radius: 5px;
  border: 1px solid #e1e2df;
  background: #f8f8f6;
  color: #31343a;
  padding: 8px 9px;
  font: 11px/1.5 Consolas, "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.command-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 2px;
}

.command-confirm-actions button {
  min-height: 30px;
  border: 1px solid #d8d9d5;
  border-radius: 6px;
  padding: 5px 11px;
  font: inherit;
  cursor: pointer;
}

.command-confirm-actions button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.command-confirm-cancel {
  background: #fff;
  color: var(--text);
}

.command-confirm-approve {
  border-color: #c53b32 !important;
  background: #c53b32;
  color: #fff;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #d6d6d0;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.message-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.message-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  min-height: 22px;
  padding: 0 2px;
}

.message-time {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.message-wrap.user .message-footer {
  justify-content: flex-end;
}

.message-copy-btn {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #8b8e91;
  cursor: pointer;
  opacity: 0.58;
  transition: background 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}

.message-wrap:hover .message-copy-btn,
.message-copy-btn:focus-visible,
.message-copy-btn.copied {
  opacity: 1;
}

.message-copy-btn:hover,
.message-copy-btn.copied {
  background: #e9eae6;
  color: var(--text);
}

.message-copy-btn.copied .copy-symbol {
  border-color: transparent;
}

.message-copy-btn.copied .copy-symbol::before {
  top: -3px;
  left: -3px;
  display: grid;
  width: 14px;
  height: 14px;
  place-items: center;
  border: 0;
  background: transparent;
  color: #18713d;
  content: "✓";
  font-size: 12px;
  font-weight: 800;
}

.copy-symbol {
  position: relative;
  width: 10px;
  height: 10px;
  border: 1.4px solid currentColor;
  border-radius: 2px;
}

.copy-symbol::before {
  position: absolute;
  top: -4px;
  left: -4px;
  width: 8px;
  height: 8px;
  border: 1.4px solid currentColor;
  border-radius: 2px;
  background: var(--surface);
  content: "";
}

.message-wrap.user .copy-symbol::before {
  background: var(--user);
}

.message-wrap.user .message-copy-btn.copied .copy-symbol::before {
  background: transparent;
}

@media (hover: none) {
  .message-copy-btn {
    opacity: 0.72;
  }
}

.message-content > :first-child {
  margin-top: 0;
}

.message.streaming .message-content {
  white-space: pre-wrap;
}

.message-content > :last-child {
  margin-bottom: 0;
}

.message-content p {
  margin: 0 0 12px;
}

.message-content {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Empty streaming placeholders must not introduce extra grid rows or gaps. */
.message-content:empty,
.tool-steps:empty {
  display: none;
}

.message-content h1,
.message-content h2,
.message-content h3 {
  margin: 18px 0 8px;
  line-height: 1.28;
}

.message-content h1 {
  font-size: 24px;
}

.message-content h2 {
  font-size: 20px;
}

.message-content h3 {
  font-size: 17px;
}

.message-content ul,
.message-content ol {
  margin: 8px 0 14px;
  padding-left: 24px;
}

.message-content code {
  border-radius: 5px;
  background: #eeeeea;
  padding: 2px 5px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.92em;
}

.code-block {
  position: relative;
  overflow: hidden;
  max-width: 100%;
  margin: 12px 0;
  border: 1px solid #2f343b;
  border-radius: 8px;
  background: #171a1f;
  color: #d8dee9;
}

.code-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  border-bottom: 1px solid #30353d;
  background: #20242a;
  color: #aeb6c2;
  padding: 0 8px 0 12px;
  font: 11px/1 "Segoe UI", sans-serif;
}

.code-copy-btn {
  min-height: 25px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #bdc5d0;
  padding: 0 8px;
  cursor: pointer;
  font-size: 11px;
}

.code-copy-btn:hover,
.code-copy-btn.copied {
  background: #343a43;
  color: #fff;
}

.message-content .code-block pre {
  overflow: auto;
  max-width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 14px 16px 16px;
}

.message-content .code-block pre code {
  display: block;
  min-width: max-content;
  background: transparent;
  color: #d8dee9;
  padding: 0;
  font: 13px/1.65 "Cascadia Mono", Consolas, monospace;
  tab-size: 2;
}

.syntax-comment {
  color: #7f8c98;
  font-style: italic;
}

.syntax-string {
  color: #a8d279;
}

.syntax-keyword {
  color: #d2a8ff;
}

.syntax-number {
  color: #79c0ff;
}

.syntax-tag {
  color: #ff7b72;
}

.tool-json-hidden {
  border-left: 3px solid #c58b2b;
  color: #6f562c;
  padding-left: 10px;
}

.message-content a {
  color: var(--accent);
  font-weight: 650;
  text-decoration: underline;
  text-decoration-color: #b7b9b3;
  text-underline-offset: 3px;
}

.message-content a:hover {
  color: #000;
  text-decoration-color: currentColor;
}

.chat-image {
  overflow: hidden;
  width: 160px;
  max-width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: zoom-in;
  padding: 0;
}

.chat-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-image img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
}

.download-card {
  display: inline-grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: min(360px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
}

.download-card:hover {
  border-color: #c9c9c2;
  background: #fbfbfa;
}

.download-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 10px;
  background: #e8f4ec;
  color: #166534;
  font-size: 11px;
  font-weight: 800;
}

.download-card strong,
.download-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download-card small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.composer-wrap {
  display: grid;
  gap: 8px;
  padding: 0 18px 18px;
  min-height: 0;
}

.task-view {
  min-height: 0;
  overflow: auto;
  padding: 20px 24px 32px;
}

.task-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  max-width: 1050px;
  margin: 0 auto 18px;
}

.task-summary {
  display: flex;
  gap: 26px;
}

.task-summary div {
  display: grid;
  gap: 2px;
}

.task-summary strong {
  font-size: 22px;
  line-height: 1;
}

.task-summary span {
  color: var(--muted);
  font-size: 11px;
}

.task-filters {
  display: flex;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 3px;
}

.task-filters button {
  min-height: 30px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  cursor: pointer;
  font-size: 12px;
}

.task-filters button.active {
  background: #e8ebe8;
  color: var(--text);
  font-weight: 650;
}

.task-list {
  display: grid;
  gap: 8px;
  max-width: 1050px;
  margin: 0 auto;
}

.task-empty {
  display: grid;
  min-height: 280px;
  place-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}

.task-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1.7fr) minmax(170px, 0.8fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 13px 14px 13px 10px;
}

.task-row:hover {
  border-color: #c9cbc6;
}

.task-state {
  width: 4px;
  height: 34px;
  border-radius: 3px;
  background: #2f7d4c;
}

.task-row.paused .task-state {
  background: #b38424;
}

.task-row.completed .task-state {
  background: #9a9ea3;
}

.task-copy {
  min-width: 0;
}

.task-copy strong,
.task-copy p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-copy strong {
  display: block;
  font-size: 14px;
}

.task-copy p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.task-timing {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.task-timing strong,
.task-timing span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-timing strong {
  font-size: 12px;
}

.task-timing span {
  color: var(--muted);
  font-size: 11px;
}

.task-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.task-icon-btn {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
}

.task-icon-btn:hover {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

.task-dialog {
  width: min(620px, calc(100vw - 28px));
}

.task-dialog textarea,
.task-dialog select,
.task-dialog input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

.task-dialog textarea {
  min-height: 92px;
  resize: vertical;
}

.task-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.weekday-field {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 0;
  border: 0;
  padding: 0;
}

.weekday-field legend {
  grid-column: 1 / -1;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
}

.weekday-field label {
  display: grid;
  min-height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
}

.weekday-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  opacity: 0;
}

.weekday-field label:has(input:checked) {
  border-color: #7d9b87;
  background: #e6efe9;
  color: #24583a;
  font-weight: 700;
}

.task-dialog-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 8px;
}

.runtime-view {
  min-height: 0;
  overflow: auto;
  padding: 20px 24px 32px;
  scrollbar-gutter: stable;
}

.runtime-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  max-width: 1120px;
  margin: 0 auto 16px;
}

.runtime-summary {
  display: flex;
  gap: 26px;
}

.runtime-summary div {
  display: grid;
  gap: 2px;
}

.runtime-summary strong {
  font-size: 22px;
  line-height: 1;
}

.runtime-summary span {
  color: var(--muted);
  font-size: 11px;
}

.runtime-controls {
  display: flex;
  align-items: end;
  gap: 8px;
}

.runtime-controls > label:not(.runtime-live) {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
}

.runtime-controls select {
  min-width: 105px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 0 28px 0 9px;
  outline: none;
}

.runtime-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.runtime-live input {
  width: 15px;
  height: 15px;
  min-height: 0;
}

.runtime-refresh {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
}

.runtime-refresh.loading {
  animation: spin 0.8s linear infinite;
}

.runtime-list {
  display: grid;
  gap: 7px;
  max-width: 1120px;
  margin: 0 auto;
}

.runtime-empty {
  display: grid;
  min-height: 280px;
  place-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.runtime-event {
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 3px solid #789b84;
  border-radius: 7px;
  background: var(--surface);
}

.runtime-event.running {
  border-left-color: #b68b2e;
}

.runtime-event.failed {
  border-left-color: #c5554d;
}

.runtime-event-head {
  display: grid;
  grid-template-columns: 26px minmax(180px, 1fr) auto auto 125px 12px;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 7px 12px;
  cursor: pointer;
  list-style: none;
}

.runtime-event-head::-webkit-details-marker {
  display: none;
}

.runtime-event-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.runtime-event-copy strong,
.runtime-event-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-event-copy strong {
  font-size: 13px;
}

.runtime-event-copy small,
.runtime-event time {
  color: var(--muted);
  font-size: 11px;
}

.runtime-source,
.runtime-status {
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 10px;
  white-space: nowrap;
}

.runtime-source {
  background: #e8edf3;
  color: #40566e;
}

.runtime-status {
  background: #e8f1ea;
  color: #326044;
}

.runtime-event.running .runtime-status {
  background: #f7eed8;
  color: #765918;
}

.runtime-event.failed .runtime-status {
  background: #fae8e6;
  color: #8f342e;
}

.runtime-chevron {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid #81858a;
  border-bottom: 1.5px solid #81858a;
  transform: rotate(-45deg);
  transition: transform 0.16s ease;
}

.runtime-event[open] .runtime-chevron {
  transform: rotate(45deg);
}

.runtime-event-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  gap: 10px;
  border-top: 1px solid var(--line);
  background: #f7f7f5;
  padding: 10px 12px 12px;
}

.runtime-payload {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #dfe1dd;
  border-radius: 6px;
  background: var(--surface);
}

.runtime-payload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  border-bottom: 1px solid #e5e6e2;
  padding: 5px 9px;
}

.runtime-payload-head strong {
  font-size: 11px;
}

.runtime-payload-head button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}

.runtime-payload-output {
  max-height: 320px;
  min-height: 54px;
  overflow: auto;
  margin: 0;
  background: #fafaf8;
  color: #30343a;
  padding: 9px;
  font: 11px/1.55 "Cascadia Mono", Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.auth-page {
  display: grid;
  place-items: center;
  overflow: auto;
  min-height: 100%;
  padding: 24px;
  background: #f4f5f2;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(300px, 420px);
  width: min(860px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-brand {
  display: grid;
  align-content: center;
  min-height: 410px;
  border-right: 1px solid var(--line);
  background: #20252b;
  color: #fff;
  padding: 50px;
}

.auth-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  background: #eef2ef;
  color: #20252b;
  font-size: 20px;
  font-weight: 800;
}

.auth-brand h1 {
  margin: 22px 0 8px;
  font-size: 32px;
}

.auth-brand p {
  margin: 0;
  color: #bfc6ce;
}

.auth-form {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 46px;
}

.auth-form label,
.dialog-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.auth-form input,
.dialog-form input,
.create-user-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

.auth-form input:focus,
.dialog-form input:focus,
.create-user-form input:focus {
  border-color: #8a9099;
  box-shadow: 0 0 0 3px rgba(32, 37, 43, 0.08);
}

.primary-btn,
.secondary-btn,
.danger-btn {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 650;
}

.primary-btn {
  background: var(--accent);
  color: #fff;
}

.primary-btn:hover {
  background: var(--accent-hover);
}

.secondary-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.danger-btn {
  background: #fbe9e7;
  color: var(--danger);
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 12px;
}

.form-success {
  color: #1f7a46;
}

.management-view {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}

.management-head {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
}

.management-head h1,
.management-head p,
.settings-form h2,
.settings-form p,
.skill-detail h2,
.skill-detail p {
  margin: 0;
}

.management-head h1 {
  font-size: 20px;
}

.management-head p,
.settings-form p,
.skill-detail p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.app-dialog {
  width: min(520px, calc(100vw - 28px));
  max-height: min(780px, calc(100vh - 28px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  box-shadow: var(--shadow);
}

.app-dialog::backdrop {
  background: rgba(15, 18, 22, 0.45);
  backdrop-filter: blur(2px);
}

.admin-dialog {
  width: min(760px, calc(100vw - 28px));
}

.agents-dialog {
  width: min(920px, calc(100vw - 28px));
  height: min(760px, calc(100vh - 28px));
}

.agent-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
}

.agent-tabs button {
  min-height: 42px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
  cursor: pointer;
}

.agent-tabs button.active {
  border-bottom-color: #27804d;
  color: var(--text);
  font-weight: 700;
}

.management-view > .agent-tabs {
  background: #fafaf8;
}

.agent-pane {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(380px, 1.45fr);
  min-height: 0;
  overflow: hidden;
}

.agent-pane[hidden] {
  display: none;
}

.agent-list,
.binding-list {
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #f6f7f4;
  padding: 12px;
}

.agent-list-item,
.binding-row {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 11px;
  text-align: left;
}

button.agent-list-item {
  cursor: pointer;
}

.agent-list-item:hover,
.agent-list-item.active {
  border-color: #cdd8d0;
  background: var(--surface);
}

.agent-list-item strong,
.agent-list-item small,
.binding-row strong,
.binding-row small {
  display: block;
}

.agent-list-item small,
.binding-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.agent-list-item .agent-kind {
  display: inline-block;
  margin-top: 7px;
  border-radius: 4px;
  background: #e5f2e9;
  color: #23633d;
  padding: 2px 6px;
  font-size: 10px;
}

.agent-editor {
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: auto;
  padding: 18px 20px;
}

.agent-resources {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.resource-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.file-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.resource-list {
  display: grid;
  gap: 6px;
}

.resource-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

.resource-row strong,
.resource-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.resource-row button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: #fbe9e7;
  color: var(--danger);
  cursor: pointer;
}

.skill-install-panel {
  display: grid;
  align-content: start;
  gap: 24px;
  overflow: auto;
  padding: 22px;
}

.skill-install-box {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.skill-install-box strong {
  margin-right: auto;
}

.skill-detail {
  display: grid;
  gap: 16px;
}

.skill-detail dl {
  display: grid;
  gap: 1px;
  margin: 0;
  background: var(--line);
}

.skill-detail dl div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  background: var(--surface);
  padding: 10px 0;
}

.skill-detail dt {
  color: var(--muted);
}

.skill-detail dd {
  margin: 0;
}

.skill-detail .danger-btn {
  justify-self: start;
}

.agent-editor label,
.binding-editor label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.agent-editor input,
.agent-editor textarea,
.agent-editor select,
.binding-editor select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

.agent-editor textarea {
  min-height: 210px;
  resize: vertical;
  line-height: 1.55;
}

.agent-form-grid {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 12px;
}

.agent-editor-actions {
  gap: 8px;
}

.agent-editor-actions .secondary-btn {
  margin-right: auto;
}

.agent-member-field {
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 0;
  padding: 12px;
}

.agent-member-field legend {
  color: var(--muted);
  padding: 0 5px;
  font-size: 12px;
}

.agent-member-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.agent-member-options label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
}

.agent-member-options input {
  width: 16px;
  min-height: 16px;
}

.binding-editor {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  grid-column: 1 / -1;
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
}

.binding-editor .form-error {
  grid-column: 1 / -1;
}

.binding-list {
  display: grid;
  align-content: start;
  gap: 7px;
  grid-column: 1 / -1;
  border-right: 0;
}

.binding-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  align-items: center;
  gap: 14px;
  border-color: var(--line);
  background: var(--surface);
}

.binding-row button {
  width: 32px;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: #fbe9e7;
  color: var(--danger);
  cursor: pointer;
}

.dialog-form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.settings-pane {
  min-height: 0;
  overflow: auto;
  padding: 24px;
}

.settings-form {
  display: grid;
  width: min(620px, 100%);
  gap: 16px;
}

.settings-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.settings-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 10px;
}

.service-settings {
  align-content: start;
}

.service-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.service-status-row > div {
  display: grid;
  gap: 4px;
}

.service-status-row small {
  color: var(--muted);
}

.service-actions {
  justify-content: flex-start;
  gap: 10px;
}

.service-actions button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.service-actions button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.account-management-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 24px;
  padding-top: 18px;
}

.compact-settings-form {
  align-content: start;
  border-left: 1px solid var(--line);
  padding-left: 24px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding: 16px 20px;
}

.dialog-head h2,
.dialog-head p {
  margin: 0;
}

.dialog-head h2 {
  font-size: 18px;
}

.dialog-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.dialog-close {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
}

.dialog-close:hover {
  background: var(--surface-soft);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
}

.create-user-form {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(180px, 1.5fr) auto;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 16px 20px;
}

.create-user-form .permission-grid,
.create-user-form .form-error {
  grid-column: 1 / -1;
}

.create-user-form > .primary-btn {
  grid-column: 3;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.inline-check input,
.permission-option input {
  width: 16px;
  height: 16px;
  min-height: 0;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.permission-option {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.user-admin-list {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.user-admin-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(220px, 2fr) auto;
  gap: 14px;
  align-items: start;
  background: var(--surface);
  padding: 14px 20px;
}

.user-identity strong,
.user-identity small {
  display: block;
}

.user-identity small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.user-permissions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.permission-tag {
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 3px 6px;
  font-size: 10px;
}

.user-actions {
  display: flex;
  gap: 6px;
}

@media (max-width: 700px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    min-height: 180px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 30px;
  }

  .auth-brand h1 {
    margin-top: 12px;
  }

  .auth-form {
    padding: 30px;
  }

  .create-user-form {
    grid-template-columns: 1fr;
  }

  .create-user-form > *,
  .create-user-form > .primary-btn,
  .create-user-form .permission-grid {
    grid-column: 1;
  }

  .permission-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-admin-row {
    grid-template-columns: 1fr;
  }

  .feishu-columns {
    grid-template-columns: 1fr;
  }

  .pairing-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .agents-dialog {
    height: calc(100vh - 16px);
    width: calc(100vw - 16px);
  }

  .management-head {
    min-height: 64px;
    padding: 12px 16px;
  }

  .management-view > .agent-tabs {
    overflow-x: auto;
    padding: 0 8px;
  }

  .agent-pane {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .agent-list {
    max-height: 180px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .agent-form-grid,
  .binding-editor,
  .binding-row {
    grid-template-columns: 1fr;
  }

  .agent-member-options {
    grid-template-columns: 1fr;
  }

  .skill-install-box {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-management-grid {
    grid-template-columns: 1fr;
  }

  .compact-settings-form {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding-top: 18px;
    padding-left: 0;
  }
}

.composer {
  width: min(860px, 100%);
  justify-self: center;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 10px;
}

.composer-options {
  display: flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 4px 0;
}

/* Two-row composer: text above, controls on the lower edge. */
.composer .input-row { display: block; padding: 0 4px; }
.composer #messageInput { display: block; width: 100%; min-height: 52px; padding: 4px 0 8px; border: 0; background: transparent; font-size: 15px; line-height: 1.6; resize: none; }
.composer .composer-options { gap: 10px; min-height: 34px; padding: 4px 0 0; }
.composer-options #uploadBtn { width: 30px; height: 30px; flex: 0 0 30px; padding: 0; border: 0; background: transparent; color: #333; font-size: 24px; border-radius: 6px; }
.composer-options #uploadBtn:hover { background: #f1f1f1; }
.composer-model-controls { display: flex; align-items: center; gap: 5px; min-width: 0; margin-left: auto; color: #666; }
.composer-model-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reasoning-control { display: flex; align-items: center; }
.reasoning-control select { padding: 5px 2px; border: 0; border-radius: 4px; color: #888; background: transparent; cursor: pointer; font: inherit; font-size: 13px; }
.reasoning-control select:hover { background: #f5f5f5; }
.reasoning-control { position: relative; height: 34px; }
.composer .composer-options { align-items: center; }
.composer-options #uploadBtn, .composer-options #sendBtn, .composer-options #stopBtn { display: grid; place-items: center; padding: 0; line-height: 1; margin: 0; }
.composer-options #uploadBtn { height: 34px; }
.composer-options #uploadBtn svg { display: block; width: 20px; height: 20px; stroke-width: 1.8; }
.composer-options #sendBtn svg { display: block; width: 21px; height: 21px; stroke-width: 1.8; }
.composer-options #sendBtn[hidden], .composer-options #stopBtn[hidden] { display: none; }
.composer-model-controls, .composer-options .permission-picker { display: flex; align-items: center; height: 34px; }
.composer-model-name { display: flex; align-items: center; height: 34px; line-height: 1; }
#reasoningTrigger { display: flex; align-items: center; justify-content: center; gap: 5px; height: 34px; padding: 0 4px; border: 0; border-radius: 5px; background: transparent; color: #858585; font: inherit; font-size: 13px; line-height: 1; cursor: pointer; }
#reasoningTrigger:hover { background: #f2f2f2; }
#reasoningTrigger > svg { width: 12px; height: 12px; }
.reasoning-menu { position: absolute; bottom: calc(100% + 12px); right: 0; z-index: 45; width: min(268px, calc(100vw - 48px)); padding: 7px; border: 1px solid #e2e2e2; border-radius: 10px; background: #fff; box-shadow: 0 6px 24px #00000012; }
.reasoning-menu[hidden] { display: none; }
.reasoning-menu > p { margin: 5px 8px 7px; color: #999; font-size: 12px; }
.reasoning-menu > button { display: grid; grid-template-columns: minmax(0,1fr) 16px; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 6px; background: transparent; color: #666; text-align: left; cursor: pointer; }
.reasoning-menu > button:hover, .reasoning-menu > button:focus-visible { background: #f3f3f3; outline: none; }
.reasoning-menu strong { display: block; color: #333; font-size: 14px; font-weight: 500; }
.reasoning-menu small { display: block; margin-top: 3px; color: #999; font-size: 12px; line-height: 1.5; }
.reasoning-menu svg { width: 14px; height: 14px; }
.composer-options #sendBtn, .composer-options #stopBtn { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; }
.composer-options #sendBtn { background: #397ff5; color: #fff; border: 0; font-size: 24px; }
.composer-options #sendBtn:disabled { background: #a7c5f8; cursor: default; }
.composer-options #permissionTrigger { background: transparent; padding: 4px 0; }
.composer-wrap > .hint { display: none; }
@media (max-width: 520px) {
  .composer .composer-options { gap: 5px; }
  .composer-model-name { max-width: 116px; font-size: 12px; }
  .composer-model-controls { gap: 1px; }
  .composer-options #permissionTrigger { font-size: 11px; gap: 3px; }
  .composer-options #permissionTrigger > svg:last-child { display: none; }
}

.permission-mode-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.permission-mode-control select {
  max-width: 132px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  padding: 4px 24px 4px 8px;
  cursor: pointer;
  font: inherit;
  line-height: 1.3;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.permission-mode-control select:hover {
  border-color: #c9c9c2;
  color: var(--text);
}

.permission-mode-control select:focus-visible {
  border-color: var(--accent);
  background: var(--surface);
  color: var(--text);
  outline: none;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

.pending-queue-bar {
  display: grid;
  gap: 5px;
  margin: 0 2px 8px;
  border-bottom: 1px solid var(--line);
  padding: 0 2px 9px;
}

.pending-queue-bar[hidden] {
  display: none;
}

.pending-queue-head,
.pending-queue-item,
.pending-queue-actions {
  display: flex;
  align-items: center;
}

.pending-queue-head,
.pending-queue-item {
  justify-content: space-between;
  gap: 10px;
}

.pending-queue-head {
  min-height: 26px;
  color: var(--muted);
  padding: 0 4px;
  font-size: 11px;
}

.pending-queue-list {
  display: grid;
  gap: 3px;
  max-height: 174px;
  overflow: auto;
}

.pending-queue-item {
  min-height: 42px;
  border-radius: 6px;
  background: #f4f5f2;
  padding: 6px 7px 6px 10px;
}

.pending-queue-detail {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.pending-queue-detail strong,
.pending-queue-detail small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-queue-detail strong {
  font-size: 12px;
  font-weight: 600;
}

.pending-queue-detail small {
  color: var(--muted);
  font-size: 10px;
}

.pending-queue-actions {
  gap: 6px;
  flex: 0 0 auto;
}

.pending-queue-bar button {
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.pending-queue-head button {
  color: var(--muted);
  padding: 0 5px;
}

.queue-steer-btn {
  padding: 0 8px;
  color: #2f643f !important;
  font-size: 11px !important;
}

.queue-icon-btn {
  width: 28px;
  min-width: 28px;
  padding: 0;
  font-size: 16px !important;
}

.pending-queue-bar button:hover {
  background: #e5e7e2;
}

.queue-icon-btn.danger:hover {
  background: #f8e7e5;
  color: #a23a34;
}

.message-wrap.queued .message {
  border: 1px dashed #c8cbc6;
  background: #f5f6f3;
  color: #666b68;
  box-shadow: none;
}

.message-wrap.queued .message-time {
  color: #9a9e9a;
}

.composer.read-only {
  box-shadow: none;
  background: #f4f4f1;
}

.composer.read-only .send-btn {
  background: #b8b8b1;
}

.feishu-admin {
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.feishu-admin-head,
.pairing-row,
.compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feishu-admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feishu-admin h3,
.feishu-admin p {
  margin: 0;
}

.feishu-config-form {
  grid-template-columns: minmax(180px, 0.7fr) minmax(220px, 1fr) minmax(240px, 1.15fr) auto;
  align-items: end;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.feishu-config-form .dialog-actions {
  align-self: end;
}

.feishu-config-form .form-error {
  grid-column: 1 / -1;
}

@media (max-width: 860px) {
  .feishu-config-form {
    grid-template-columns: 1fr;
  }

  .feishu-config-form .form-error {
    grid-column: 1;
  }
}

.feishu-admin-head p,
.pairing-row small,
.compact-empty {
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b9b9b2;
}

.status-dot.online {
  background: #1f9d55;
  box-shadow: 0 0 0 3px #ddf3e6;
}

.pairing-row code {
  display: block;
  margin-top: 4px;
  font-size: 14px;
}

.feishu-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.feishu-approval-section {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.approval-section-head,
.approval-title,
.approval-actions {
  display: flex;
  align-items: center;
}

.approval-section-head {
  justify-content: space-between;
  margin-bottom: 9px;
}

.approval-section-head > span {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  line-height: 22px;
  text-align: center;
}

.approval-list {
  display: grid;
  gap: 8px;
}

.approval-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid #d4a72c;
  border-radius: 6px;
  background: var(--surface);
}

.approval-resuming {
  border-left-color: #2563eb;
}

.approval-failed {
  border-left-color: #c2413a;
}

.approval-copy {
  min-width: 0;
}

.approval-title {
  gap: 8px;
}

.approval-title strong,
.approval-copy p,
.approval-copy small {
  overflow-wrap: anywhere;
}

.approval-title span {
  color: #8a6515;
  font-size: 12px;
}

.approval-copy p {
  margin: 4px 0 2px;
  color: var(--text);
  font-size: 13px;
}

.approval-copy small {
  color: var(--muted);
}

.approval-actions {
  align-self: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.approval-actions .primary-btn,
.approval-actions .secondary-btn {
  min-height: 32px;
  padding: 0 11px;
  font-size: 12px;
  line-height: 30px;
  text-decoration: none;
}

.text-danger-btn {
  border: 0;
  background: transparent;
  color: #b42318;
  cursor: pointer;
  font-size: 12px;
}

.text-danger-btn:disabled {
  cursor: default;
  opacity: .45;
}

@media (max-width: 720px) {
  .approval-item {
    grid-template-columns: 1fr;
  }

  .approval-actions {
    justify-content: flex-start;
  }
}

.compact-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.compact-row {
  min-width: 0;
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 7px 9px;
  font-size: 12px;
}

.compact-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-row button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 17px;
}

.attachment-bar[hidden] {
  display: none;
}

.attachment-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  margin: 0 0 8px 4px;
  border: 0;
  background: transparent;
  padding: 0;
}

.attachment-card {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: min(320px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 7px 9px 7px 11px;
  font-size: 13px;
}

.attachment-preview,
.attachment-file-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
}

.attachment-preview {
  object-fit: cover;
}

.attachment-file-icon {
  display: grid;
  place-items: center;
  background: #e4e4df;
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
}

.attachment-card span {
  overflow: hidden;
  max-width: min(480px, 62vw);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-card button {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.attachment-card button:hover {
  background: #ddddd6;
}

.input-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  align-items: end;
  gap: 8px;
}

.icon-btn,
.send-btn,
.stop-btn {
  display: grid;
  width: 36px;
  height: 36px;
  min-width: 36px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.icon-btn {
  background: var(--surface-soft);
  color: var(--text);
}

.icon-btn:hover {
  background: #e4e4df;
}

.send-btn {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.send-btn:hover {
  background: var(--accent-hover);
}

.stop-btn {
  background: var(--accent);
  color: #fff;
}

.stop-btn span {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: currentColor;
}

.stop-btn:hover {
  background: #303236;
}

.stop-btn.stopping span {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  background: transparent;
  animation: spin 0.7s linear infinite;
}

.send-btn[hidden],
.stop-btn[hidden] {
  display: none;
}

button:disabled,
textarea:disabled {
  cursor: wait;
  opacity: 0.65;
}

.composer.busy #messageInput {
  opacity: 1;
}

@media (max-width: 640px) {
  .queue-steer-btn {
    width: 28px;
    overflow: hidden;
    padding: 0;
    color: transparent !important;
  }

  .queue-steer-btn::before {
    color: #2f643f;
    content: "↳";
    font-size: 17px;
  }
}

#messageInput {
  width: 100%;
  max-height: 180px;
  min-height: 36px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--text);
  line-height: 1.55;
  padding: 7px 2px;
}

.hint {
  justify-self: center;
  width: min(820px, 100%);
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.preview-modal[hidden] {
  display: none;
}

.preview-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(17, 24, 39, 0.78);
  padding: 28px;
  z-index: 50;
}

.preview-modal img {
  max-width: min(1080px, 94vw);
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

.preview-modal button {
  position: fixed;
  top: 18px;
  right: 22px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

@media (max-width: 760px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .main {
    grid-template-rows: 54px minmax(0, 1fr) auto;
  }

  .topbar {
    gap: 6px;
    justify-content: flex-start;
    padding: 0 8px;
  }

  .chat-context {
    margin-left: auto;
  }

  .chat-context > strong {
    display: none;
  }

  #chatAssignmentSelect {
    width: min(132px, 31vw);
    padding-left: 7px;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .mobile-view-toggle {
    display: inline-flex;
    align-items: center;
  }

  .task-view {
    padding: 14px;
  }

  .runtime-view {
    padding: 14px;
  }

  .task-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .runtime-toolbar,
  .runtime-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .runtime-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .runtime-controls select {
    width: 100%;
  }

  .runtime-live {
    align-self: center;
  }

  .runtime-refresh {
    justify-self: end;
  }

  .runtime-event-head {
    grid-template-columns: 26px minmax(0, 1fr) auto 12px;
  }

  .runtime-source,
  .runtime-event time {
    display: none;
  }

  .task-filters {
    overflow-x: auto;
  }

  .task-row {
    grid-template-columns: 7px minmax(0, 1fr) auto;
  }

  .task-timing {
    grid-column: 2 / -1;
    border-top: 1px solid var(--line);
    padding-top: 9px;
  }

  .task-actions {
    grid-column: 3;
    grid-row: 1;
  }

  .task-form-grid {
    grid-template-columns: 1fr;
  }
}
.skill-instructions {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  font-size: 13px;
  line-height: 1.7;
  max-height: 55vh;
  overflow: auto;
}
.assistant-live-text { white-space: pre-wrap; line-height: 1.72; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.markdown-table-scroll { overflow-x: auto; max-width: 100%; margin: 16px 0; }
.message-content table { border-collapse: collapse; width: 100%; font-size: 13px; line-height: 1.6; }
.message-content th, .message-content td { border: 1px solid #dedfe2; padding: 9px 12px; text-align: left; min-width: 80px; vertical-align: top; }
.message-content th { background: #f2f3f5; font-weight: 600; }
.message-content tbody tr:nth-child(even) { background: #fafafa; }
.file-result { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 8px; box-shadow: none; }
.file-result-open { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.file-result-open > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.file-result-open strong, .file-result-open small { display: block; }
.file-result-open strong { font-size: 14px; }
.file-result-open small { font-size: 12px; color: #777; margin-top: 3px; }
.file-download-action { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; color: #666; border-radius: 6px; font-size: 22px; text-decoration: none; }
.file-download-action:hover { background: #eceef0; color: #222; }
.message-content .markdown-image-preview { display: block; width: min(320px, 100%); max-width: 100%; margin: 10px 0; padding: 0; overflow: hidden; border: 1px solid #e0e0e0; border-radius: 8px; background: #f3f3f3; cursor: zoom-in; line-height: 0; }
.message-content .markdown-image-preview img { display: block; width: auto; height: auto; max-width: min(320px, 100%); max-height: 220px; object-fit: contain; }
.download-card.file-result { width: min(320px, 100%); gap: 10px; padding: 10px 12px; background: #fff; border-color: #dedede; }
.file-result .download-icon { width: 36px; height: 40px; border: 1px solid #e5e5e5; border-radius: 5px; background: #f5f5f5; color: #737373; font-size: 10px; font-weight: 600; }
.file-result .file-result-open { gap: 10px; }
.file-result .file-result-open strong { font-size: 13px; font-weight: 500; }
.file-result .file-result-open small { font-size: 11px; }
.file-result .file-download-action { width: 30px; height: 30px; flex-basis: 30px; border: 0; background: transparent; color: #828282; }
.file-result .file-download-action:hover { background: #eee; color: #333; }
.file-download-action svg { width: 16px; height: 16px; }
.file-preview-page { display: block; min-height: 100vh; height: auto; overflow: auto; background: #fff; }
.file-preview-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; border-bottom: 1px solid #e5e5e5; gap: 12px; }
.file-preview-header strong { overflow-wrap: anywhere; font-size: 14px; }
.file-preview-content { max-width: 1000px; margin: 28px auto; padding: 0 24px 40px; }
.tool-process { width: 100%; }
.tool-process.finished > summary { font-weight: 400; }
.session-save-error { position: fixed; right: 20px; bottom: 20px; padding: 10px 16px; background: #fff4e5; color: #8a4b00; border: 1px solid #f2d8af; border-radius: 6px; z-index: 100; font-size: 12px; }
.archived-app-label { margin-left: 6px; color: #92969d; font-size: 10px; font-weight: 400; }

/* Monochrome, aligned operation transcript. */
.tool-activity-summary, .tool-step-title { grid-template-columns: 18px minmax(0, 1fr) auto 10px; gap: 7px; color: #888; }
.tool-activity-summary strong, .tool-step-title strong { color: #858585; font-weight: 400; }
.tool-activity-summary strong, .tool-step-title strong { font-size: 14px; }
.tool-activity-body { margin-left: 0; padding: 0; border: 0; gap: 0; }
.tool-step { width: 100%; border-radius: 0; }
.tool-kind-icon, .activity-group-icon, .tool-activity-group.running .activity-group-icon, .tool-activity-group.failed .activity-group-icon { width: 18px; height: 18px; border: 0; border-radius: 0; color: #888; background: transparent; font: inherit; }
.tool-kind-icon svg, .activity-group-icon svg { display: block; width: 16px; height: 16px; }
.tool-step .tool-kind-icon, .runtime-event .tool-kind-icon { background: transparent; color: #888; }
.tool-activity-group.running .activity-group-icon::after { display: none; }
.tool-activity-group.running .tool-activity-summary strong, .tool-step.running .tool-step-title strong { color: transparent; background: linear-gradient(105deg, #858585 30%, #e7e7e7 48%, #858585 66%); background-size: 240% 100%; background-clip: text; -webkit-background-clip: text; animation: activity-shimmer 4.8s linear infinite; }
.tool-step-body { margin: 5px 0 10px; padding: 0; border: 0; background: none; }
.shell-panel { min-width: 0; overflow: hidden; border: 1px solid #d9dadb; border-radius: 8px; background: #f1f2f2; color: #666; }
.shell-panel > header { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; font-size: 13px; }
.shell-panel pre { margin: 0; padding: 6px 10px 14px; max-height: 420px; overflow: auto; color: inherit; background: transparent; border: 0; border-radius: 0; font: 12px/1.8 Consolas, "Cascadia Mono", monospace; white-space: pre-wrap; overflow-wrap: anywhere; text-align: left; }
.shell-panel > footer { padding: 3px 10px 8px; color: #999; text-align: right; font-size: 12px; }
.shell-copy { display: grid; place-items: center; width: 26px; height: 26px; border: 0; background: none; color: #888; cursor: pointer; border-radius: 4px; }
.shell-copy:hover { background: #e4e5e5; color: #444; }
.tool-process.finished > .tool-process-header { grid-template-columns: minmax(0, 1fr) auto 10px; color: #999; }
.tool-process > .tool-process-header,.tool-process.finished > .tool-process-header{grid-template-columns:minmax(0,1fr) 10px;color:#999;font-size:14px;font-weight:400;border-bottom:1px solid #eee;padding:8px 0;margin-bottom:12px}
.thinking{font-size:14px;color:#858585;font-weight:400;line-height:1.5;gap:0}
.execution-queue-indicator{font-size:14px;color:#858585;padding:10px 0}
.execution-jobs-panel{border:1px solid #e5e5e5;border-radius:10px;padding:14px 18px;margin:0 0 18px;background:#fff}.execution-jobs-panel h3{font-size:14px;margin:0 0 8px}.execution-jobs-panel p{font-size:12px;color:#858585;margin:6px 0}.execution-job-row{display:flex;gap:12px;align-items:center;padding:7px 0;border-top:1px solid #f0f0f0;font-size:12px}.execution-job-row>span{flex:1;overflow-wrap:anywhere}.execution-job-row small{color:#858585}.execution-job-row button{font-size:12px;padding:4px 8px}
.thinking-label,.tool-activity-group.thinking-activity.running>.tool-activity-summary strong{color:transparent;background:linear-gradient(105deg,#858585 30%,#fff 48%,#858585 66%);background-size:240% 100%;background-clip:text;-webkit-background-clip:text;animation:activity-shimmer 4.8s linear infinite}
.thinking-activity>.tool-activity-summary{grid-template-columns:minmax(0,1fr) auto 10px}
.thinking-activity>.tool-activity-summary .activity-group-icon{display:none}
@media(prefers-reduced-motion:reduce){.thinking-label,.tool-activity-group.thinking-activity.running>.tool-activity-summary strong{animation:none;color:#858585;background:none}}
.permission-mode-control[hidden] { display: none; }
.permission-picker { position: relative; }
#permissionTrigger { display: flex; align-items: center; gap: 6px; border: 0; background: none; color: #777; padding: 4px 6px; font: inherit; font-size: 12px; cursor: pointer; border-radius: 5px; }
#permissionTrigger:hover { background: #eee; }
#permissionTrigger:disabled { opacity: .5; cursor: default; }
.permission-menu { position: absolute; left: 0; bottom: calc(100% + 12px); z-index: 40; width: min(350px, calc(100vw - 48px)); padding: 8px; border: 1px solid #dedede; border-radius: 12px; background: #fff; box-shadow: 0 8px 28px #00000014; }
.permission-menu[hidden] { display: none; }
.permission-menu > p { margin: 3px 6px 8px; color: #999; font-size: 12px; }
.permission-menu > button { display: grid; grid-template-columns: 18px minmax(0,1fr) 18px; gap: 9px; align-items: center; width: 100%; border: 0; background: none; border-radius: 6px; padding: 8px 6px; text-align: left; color: #666; cursor: pointer; }
.permission-menu > button:hover, .permission-menu > button:focus-visible { background: #f4f4f4; outline: none; }
.permission-menu strong { display: block; font-size: 14px; font-weight: 400; color: #333; }
.permission-menu small { display: block; margin-top: 2px; font-size: 12px; line-height: 1.4; color: #999; }
.permission-menu > button { grid-template-columns: 16px minmax(0, 1fr) 16px; }
.permission-menu > button > svg, #permissionTrigger > svg { width: 14px; height: 14px; }
.permission-menu > button[data-mode="full_access"], .permission-menu > button[data-mode="full_access"] strong, .permission-menu > button[data-mode="full_access"] small, #permissionTrigger[data-mode="full_access"] { color: #e86a18; }
.approval-tray { width: min(860px, 100%); justify-self: center; margin-bottom: 10px; max-height: min(45vh, 360px); overflow: auto; }
.approval-tray[hidden] { display: none; }
.approval-request { padding: 14px 16px; background: #fff; border: 1px solid #c7c7c7; border-radius: 8px; box-shadow: 0 3px 14px #0000000c; }
.approval-request + .approval-request { margin-top: 8px; }
.approval-request > strong { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.approval-request > p { margin: 8px 0; color: #777; font-size: 12px; line-height: 1.5; }
.approval-request > pre { margin: 8px 0; padding: 9px 10px; max-height: 120px; overflow: auto; border-radius: 5px; background: #f2f3f3; color: #555; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.6 Consolas, monospace; }
.approval-request .command-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.approval-request .command-confirm-approve { color: #fff; background: #303030; border: 1px solid #303030; }
.approval-request .command-confirm-cancel { background: #fff; border: 1px solid #ddd; }
@media (prefers-reduced-motion: reduce) { .tool-activity-group.running .tool-activity-summary strong, .tool-step.running .tool-step-title strong { animation: none; color: #858585; background: none; } }

.session-pin{font-size:10px;color:#929292;white-space:nowrap;margin-right:5px}.session-item.pinned{background:#eef0ec}.session-context-menu{position:fixed;z-index:10000;min-width:140px;padding:5px;background:#fff;border:1px solid #ddd;border-radius:9px;box-shadow:0 6px 24px #0002}.session-context-menu button{display:block;width:100%;padding:9px 12px;text-align:left;border:0;background:none;color:#444;font:inherit;font-size:13px;border-radius:5px;cursor:pointer}.session-context-menu button:hover,.session-context-menu button:focus{background:#f1f2f1;outline:none}
#knowledgeView{width:100%;max-width:none;max-height:none;height:100%;min-height:0;overflow:auto;border:0;border-radius:0;grid-row:2;box-sizing:border-box}#knowledgeView[hidden]{display:none}.pinned-session-group{margin:0 0 12px}.pinned-session-group>summary{display:flex;align-items:center;gap:8px;list-style:none;padding:8px 10px;color:#999;font-size:12px;cursor:pointer}.pinned-session-group>summary::-webkit-details-marker{display:none}.pinned-session-group>summary small{font-size:10px;color:#aaa}.pinned-chevron{margin-left:auto;transform:rotate(-90deg)}.pinned-session-group[open] .pinned-chevron{transform:none}.pinned-session-group .session-item.pinned{background:transparent}.pinned-session-group .session-item.active,.pinned-session-group .session-item:hover{background:#e5e6e0}.session-section-label{padding:6px 10px;font-size:12px;color:#999}.conversation-delete-dialog{width:min(420px,calc(100vw - 40px));padding:26px;border:1px solid #e3e3e3;border-radius:16px;color:#333;box-shadow:0 20px 80px #0002;background:#fff}.conversation-delete-dialog::backdrop{background:#0005}.conversation-delete-dialog h2{margin:14px 0 10px;font-size:20px}.conversation-delete-dialog p{font-size:14px;line-height:1.7;overflow-wrap:anywhere}.conversation-delete-dialog .delete-dialog-hint{font-size:12px;color:#888}.delete-dialog-icon{display:grid;place-items:center;width:36px;height:36px;border-radius:10px;color:#c14f4f;background:#fff1f1;font-size:27px}.delete-dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:24px}
.pinned-session-group,.session-section-label{flex-shrink:0}
.mobile-topbar-button,.mobile-sidebar-close,.sidebar-backdrop{display:none}
@media(max-width:760px){
.app,.main{height:100dvh}.topbar .mobile-view-toggle{display:none}.mobile-topbar-button{display:grid;place-items:center;width:40px;height:40px;flex:0 0 40px;border:0;border-radius:9px;background:transparent;color:#444;font-size:23px;cursor:pointer}.mobile-new-chat{margin-left:auto}.mobile-topbar-button:active{background:#ecece8}.topbar .chat-context{margin-left:0;min-width:0;flex:1}.topbar .chat-context>strong{display:block;font-size:14px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.topbar .topbar-actions{margin-left:0}.topbar .topbar-actions .primary-btn{padding:7px;font-size:12px}.mobile-sales-return{font-size:11px;white-space:nowrap}
.sidebar{display:grid;position:fixed;inset:0 auto 0 0;width:min(320px,85vw);height:100dvh;box-sizing:border-box;z-index:80;padding-top:max(16px,env(safe-area-inset-top));padding-bottom:max(14px,env(safe-area-inset-bottom));transform:translateX(-100%);visibility:hidden;transition:transform .22s ease,visibility .22s;box-shadow:8px 0 35px #0002}.mobile-sidebar-open .sidebar{transform:translateX(0);visibility:visible}.mobile-sidebar-close{display:grid;place-items:center;position:absolute;right:12px;top:12px;width:32px;height:32px;border:0;background:transparent;color:#888;font-size:24px}.sidebar-backdrop:not([hidden]){display:block;position:fixed;inset:0;z-index:70;background:#0004;border:0;padding:0}.mobile-sidebar-open{overflow:hidden}.permission-menu{position:fixed;width:min(320px,calc(100vw - 24px));box-sizing:border-box;max-height:280px;overflow-y:auto;overscroll-behavior:contain;z-index:60;padding:6px}.permission-menu>button{padding:7px 5px}.permission-menu strong{font-size:13px}.permission-menu small{font-size:11px}.permission-menu>p{font-size:11px}.composer-wrap{padding-bottom:max(10px,env(safe-area-inset-bottom))}.session-delete{opacity:1}
}
@media(prefers-reduced-motion:reduce){.sidebar{transition:none}}

/* Sidebar navigation: consistent vector icons and a distinct return button. */
.workspace-nav .nav-action {
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 11px;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 11px;
}
.nav-action .nav-icon {
  display: block;
  width: 24px;
  height: 24px;
  stroke-width: 1.9;
  color: #4c5851;
}
.nav-action.active .nav-icon,
.nav-action:hover .nav-icon { color: #253f31; }
.workspace-nav .sales-return-link {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 11px;
  min-height: 48px;
  margin-bottom: 5px;
  padding: 9px 12px;
  border: 1px solid #d6ded8;
  border-radius: 12px;
  background: #fafcf9;
  color: #2b4636;
  text-decoration: none;
  box-shadow: 0 1px 2px #18332308;
}
.workspace-nav .sales-return-link .nav-icon {
  width: 26px;
  height: 26px;
  stroke-width: 2.1;
  color: inherit;
}
.workspace-nav .sales-return-link:hover { background: #e7eee7; border-color: #b5c7ba; }
.workspace-nav .sales-return-link:focus-visible { outline: 2px solid #3b7250; outline-offset: 3px; }
a.mobile-sales-return {
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid #d6ded8;
  border-radius: 10px;
  background: #fafcf9;
  color: #2b4636;
  font-size: 12px;
}
.mobile-sales-return .nav-icon { width: 20px; height: 20px; stroke-width: 2; flex: 0 0 20px; }

/* Fill the usable body after the native app reserves its status-bar inset. */
html,body { overscroll-behavior-y:none; }
body { height:var(--app-viewport-height,100%); }
.app { height:100%; }
.main { height:100%; min-height:0; }
.chat-wrap,.task-view,.settings-view,.skill-view,.knowledge-view,.runtime-view,.session-list {
  overscroll-behavior-y:contain;
}
@media(max-width:760px) {
  .app,.main { height:100%; }
  .sidebar { top:var(--aopai-native-safe-top,0px); bottom:0; height:auto; }
  .topbar .chat-context > strong { font-size:15px; }
}
