@font-face {
  font-family: 'Montserrat';
  src: url('/fonts/montserrat-light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  src: url('/fonts/montserrat-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  src: url('/fonts/montserrat-medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ===== Apple 亮色基线 tokens(参考 webui/develop/frontend/css/theme.css) ===== */
:root {
  color-scheme: light;
  --content-bg: #f5f5f7;
  --card-bg: #ffffff;
  --border: #e3e3e6;
  --border-strong: #d2d2d7;
  --text-1: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --primary: #c7161e;
  --primary-hover: #a81118;
  --primary-soft: rgba(199, 22, 30, .10);
  --ok: #248a3d;
  --warn: #a05a00;
  --danger: #d70015;
  --sidebar-bg: #f5f5f7;
  --sidebar-text: #3a3a3c;
  --sidebar-title: #1d1d1f;
  --sidebar-muted: #6e6e73;
  --sidebar-line: #e3e3e6;
  --sidebar-hover: rgba(0, 0, 0, .055);
  --sidebar-active: #c7161e;
  --sidebar-active-text: #ffffff;
  --bubble: #f5f5f7;
  --bubble-me: rgba(199, 22, 30, .10);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  --shadow-pop: 0 11px 34px rgba(0, 0, 0, .12);
  --input-bg: #ffffff;
  --radius-input: 10px;
  --radius-card: 14px;
  --radius-card-sm: 12px;
  --radius-pill: 980px;
  --radius-modal: 18px;
  --font-apple: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-ui: var(--font-apple);
  --font-brand: Montserrat, var(--font-apple);
  --font-code: "SF Mono", "JetBrains Mono", Consolas, "Microsoft YaHei", monospace;
  /* 旧变量名 → 统一基线(布局层继续工作,不保留冲突覆盖) */
  --bg-base: var(--content-bg);
  --layer-1: var(--card-bg);
  --layer-2: var(--card-bg);
  --platform: var(--sidebar-bg);
  --sidebar: var(--sidebar-bg);
  --subtle: var(--sidebar-bg);
  --hover: var(--sidebar-hover);
  --overlay: #e9ecf2;
  --border-l1: var(--border);
  --border-l2: var(--border-strong);
  --border-l3: var(--border-strong);
  --border-l4: #c7c7cc;
  --label-primary: var(--text-1);
  --label-secondary: var(--text-2);
  --muted: var(--text-3);
  --muted-2: var(--text-3);
  --idle: #d2d2d7;
  --brand: var(--primary);
  --brand-hover: var(--primary-hover);
  --info: var(--primary);
  --info-strong: #a81118;
  --info-weak: var(--primary-soft);
  --success: var(--ok);
  --success-weak: rgba(36, 138, 61, .10);
  --error: var(--danger);
  --error-weak: rgba(215, 0, 21, .08);
  --warn-weak: rgba(160, 90, 0, .10);
  --agent: #6e56cf;
  --agent-weak: rgba(110, 86, 207, .10);
  --line: var(--border);
  --panel: var(--card-bg);
  --text: var(--text-1);
  --sub: var(--text-2);
  --accent: var(--primary);
  --accent-weak: var(--primary-soft);
  --bg: var(--content-bg);
  --ok-weak: var(--success-weak);
  --err: var(--danger);
  --radius: var(--radius-card-sm);
}

/* ===== 基础排版 ===== */
html, body {
  height: 100%;
}
::selection {
  background: rgba(199, 22, 30, .16);
  color: var(--text-1);
}
* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, .20) transparent;
}
button {
  font: inherit;
  cursor: pointer;
  border-radius: var(--radius-pill);
  font-weight: 500;
  font-size: 13px;
  padding: 7px 16px;
}
input, textarea {
  font: inherit;
  color: inherit;
}
#app {
  display: flex;
  height: 100vh;
}
#sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-line);
  display: flex;
  flex-direction: column;
}
.side-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--sidebar-line);
}
.side-head h1 {
  font-size: 17px;
  margin: 0 0 6px;
  color: var(--sidebar-title);
}
.conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--sidebar-muted);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--idle);
  display: inline-block;
}
.conn.on .dot {
  background: var(--success);
}
.conn.connecting .dot {
  background: var(--warn);
}
.conn.off .dot {
  background: var(--idle);
}
.card {
  padding: 14px 16px;
  border-bottom: 1px solid var(--sidebar-line);
}
#register-form label {
  display: block;
  font-size: 12px;
  color: var(--text-2);
  margin: 8px 0 4px;
}
#register-form input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-l2);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  outline: none;
  color: var(--label-primary);
}
#register-form input:focus {
  border-color: var(--info);
  box-shadow: 0 0 0 2px rgba(199, 22, 30, .15);
}
#join-btn {
  margin-top: 10px;
  width: 100%;
  padding: 8px 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: var(--card-bg);
  font-weight: 500;
}
#join-btn:hover {
  filter: none;
  background: var(--brand-hover);
}
.hint {
  font-size: 12px;
  color: var(--text-3);
  margin: 8px 0 0;
  line-height: 1.5;
}
.me-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.me-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex: none;
}
.me-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.me-text small {
  color: var(--text-3);
}
.ghost:hover {
  border-color: var(--border-strong);
  color: var(--text-1);
  background: var(--sidebar-hover);
  filter: none;
}
.member-row .del:hover {
  background: var(--error-weak);
  color: var(--danger);
}
.member:hover {
  background: var(--sidebar-hover);
}
#roster {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  background: var(--sidebar-bg);
}
#channels {
  padding: 8px 8px 0;
  border-bottom: 1px solid var(--sidebar-line);
}
.channel-title {
  font-size: 12px;
  color: var(--muted);
  padding: 3px 8px 6px;
}
.channel-item {
  display: flex;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 7px 8px;
  text-align: left;
  color: var(--sidebar-text);
}
.channel-item:hover, .channel-item.active {
  background: var(--hover);
  color: var(--label-primary);
}
.roster-title {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 8px;
}
#decisions-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#decisions-view[hidden] {
  display: none;
}
#dec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
#mailbox-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#mailbox-view[hidden] {
  display: none;
}
#mb-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
#mb-header strong {
  margin-right: auto;
}
#mb-who {
  max-width: 220px;
  background: var(--platform);
}
#mb-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
}
.mb-item {
  border: 1px solid var(--border-l1);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 8px;
  background: var(--card-bg);
}
.mb-item.reply {
  background: var(--success-weak);
}
.mb-item.mb-task {
  background: var(--warn-weak);
  border-color: rgba(160, 90, 0, .3);
}
.mb-item.mb-receipt {
  background: var(--info-weak);
  border-color: rgba(199, 22, 30, .25);
}
.mb-item .mb-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.mb-item .mb-meta .mb-unread {
  color: var(--err);
  font-weight: 600;
}
.mb-item .mb-meta .mb-ref {
  color: var(--muted);
  font-size: 11px;
}
.mb-item .mb-text {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--label-primary);
}
.mb-empty {
  color: var(--muted);
  text-align: center;
  padding: 32px 0;
}
#dec-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
}
.dec-item {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card-bg);
  border: 1px solid var(--border-l1);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 8px;
}
.dec-item:hover {
  border-color: rgba(199, 22, 30, .35);
  background: var(--platform);
}
.dec-item strong {
  display: block;
  margin-bottom: 2px;
  color: var(--label-primary);
}
.dec-item small {
  color: var(--muted);
}
#dec-detail {
  max-height: 55%;
  overflow-y: auto;
  margin: 0 20px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border-l2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}
#dec-detail[hidden] {
  display: none;
}
.dec-head {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--label-primary);
}
.dec-line {
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-l2);
  line-height: 1.5;
  color: var(--label-secondary);
}
.m-state.unread {
  color: var(--error);
  font-weight: 600;
}
#pending-box {
  padding: 10px 12px;
  background: rgba(160, 90, 0, .08);
  border-bottom: 1px solid rgba(160, 90, 0, .25);
}
#pending-box[hidden] {
  display: none;
}
.pending-head {
  font-size: 12px;
  color: var(--warn);
  margin-bottom: 6px;
  font-weight: 600;
}
.pending-card {
  background: var(--card-bg);
  border: 1px solid rgba(160, 90, 0, .25);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  margin-bottom: 6px;
}
.pending-q {
  font-size: 12px;
  line-height: 1.4;
  word-break: break-all;
  color: var(--label-primary);
}
.pending-ops {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.pending-ops button {
  border: 0;
  border-radius: 6px;
  padding: 3px 12px;
  font-size: 12px;
}
.pending-ops .ok {
  background: var(--ok);
  color: #fff;
  border-radius: var(--radius-pill);
}
.pending-ops .no {
  background: var(--sidebar-bg);
  color: var(--text-2);
  border-radius: var(--radius-pill);
}
.member-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
}
.member-row .member {
  flex: 1;
  min-width: 0;
}
.member-row .del {
  flex: none;
  width: 28px;
  border: 0;
  background: transparent;
  color: var(--text-3);
  border-radius: 8px;
  font-size: 13px;
}
.member-row .del.armed {
  background: var(--danger);
  color: #fff;
  width: auto;
  padding: 0 8px;
  font-size: 12px;
}
.member-wrap {
  display: flex;
  flex-direction: column;
}
.sess-chip {
  align-self: center;
  flex: none;
  border: 1px solid var(--line);
  background: var(--layer-2);
  color: var(--sub);
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
}
.sess-chip:hover {
  background: var(--sidebar-hover);
}
.sess-list {
  margin: 2px 0 4px 14px;
  padding: 6px 8px;
  background: var(--layer-1);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sess-item {
  font-size: 12px;
  color: var(--sub);
  word-break: break-all;
}
.member {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  margin: 2px 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-text);
}
.member.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
}
.member .dot {
  flex: none;
}
.member.online .dot {
  background: var(--ok);
}
.member.offline .dot {
  background: var(--idle);
}
.member .m-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.member .m-name {
  font-weight: 500;
  color: var(--text-1);
}
.member .m-id {
  font-size: 11px;
  color: var(--muted);
}
.user-group {
  margin: 4px 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card-sm);
  background: var(--card-bg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.user-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  background: var(--card-bg);
  border-radius: var(--radius-card-sm) var(--radius-card-sm) 0 0;
}
.user-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 2px;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--sidebar-text);
}
.user-toggle:hover {
  color: var(--primary);
  background: var(--hover);
}
.user-summary {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-summary strong {
  font-size: 13px;
  color: var(--text-1);
  font-weight: 600;
}
.user-summary > span {
  font-size: 10px;
  color: var(--muted);
}
.user-chevron {
  flex: none;
  color: var(--muted);
  font-size: 13px;
}
.session-options {
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.session-options[hidden] {
  display: none;
}
.session-option {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 8px;
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-1);
}
.session-option:hover {
  background: var(--sidebar-hover);
}
.session-option.active {
  background: var(--sidebar-active);
}
.session-option:disabled {
  cursor: default;
  opacity: .6;
}
.session-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.session-name {
  font-size: 12.5px;
  color: var(--text-1);
  word-break: break-word;
  font-weight: 600;
  line-height: 1.35;
}
.session-body small {
  font-size: 10px;
  color: var(--text-3);
  word-break: break-all;
}
.member .m-state {
  font-size: 11px;
  color: var(--muted);
}
.side-foot {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--sidebar-muted);
  border-top: 1px solid var(--sidebar-line);
  background: var(--sidebar-bg);
}
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--content-bg);
}
#empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
}
.empty-inner {
  text-align: center;
  color: var(--text-2);
  max-width: 420px;
}
.empty-inner h2 {
  color: var(--text-1);
  margin-bottom: 8px;
  font-size: 20px;
}
#conversation {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#empty-state[hidden], #conversation[hidden] {
  display: none;
}
#conv-header {
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.conv-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.conv-title .dot {
  width: 9px;
  height: 9px;
}
.conv-title .dot.on {
  background: var(--ok);
}
.conv-title .dot.off {
  background: var(--idle);
}
#conv-sub {
  font-size: 12px;
}
.muted {
  color: var(--muted);
}
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--card-bg);
}
.thread {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}
.msg {
  max-width: 76%;
  padding: 8px 12px;
  border-radius: var(--radius-card-sm);
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
  font-size: 13.5px;
  color: var(--label-primary);
}
.msg.me {
  align-self: flex-end;
  background: var(--bubble-me);
  color: var(--text-1);
  border-bottom-right-radius: 4px;
  border: 1px solid rgba(199, 22, 30, .16);
}
.msg.them {
  align-self: flex-start;
  background: var(--bubble);
  border-bottom-left-radius: 4px;
  color: var(--text-1);
  border: 1px solid transparent;
}
.msg .meta {
  margin-top: 4px;
  font-size: 11px;
  opacity: .85;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.msg.them .meta {
  color: var(--muted);
}
.status-line {
  align-self: flex-start;
  font-size: 12px;
  color: var(--text-3);
  padding: 2px 4px;
}
.status-line.err {
  color: var(--danger);
}
.status-line.ok {
  color: var(--ok);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.chip {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--layer-1);
  color: var(--muted);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.perm-badge {
  align-self: center;
  flex: none;
  margin-left: 6px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
}
.perm-readonly {
  background: var(--sidebar-bg);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.perm-edits {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(199, 22, 30, .24);
}
.perm-full {
  background: var(--warn-weak);
  color: var(--warn);
  border: 1px solid rgba(160, 90, 0, .22);
}
.inject-badge {
  align-self: center;
  flex: none;
  margin-left: 4px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
}
.inject-direct {
  background: var(--agent-weak);
  color: var(--agent);
  border: 1px solid rgba(110, 86, 207, .24);
}
.inject-mailbox {
  background: rgba(0, 130, 127, .10);
  color: #00827f;
  border: 1px solid rgba(0, 130, 127, .24);
}
/* v0.41:执行能力徽标（Hub 花名册/会话行可见） */
.cap-badge { font-weight: 600; }
.cap-exec {
  background: rgba(137, 87, 229, .10);
  color: #6b46c1;
  border: 1px solid rgba(137, 87, 229, .24);
}
.cap-ps_run {
  background: rgba(0, 112, 192, .10);
  color: #0070c0;
  border: 1px solid rgba(0, 112, 192, .24);
}
.cap-matlab_run {
  background: rgba(230, 126, 34, .12);
  color: #b35c00;
  border: 1px solid rgba(230, 126, 34, .28);
}
.session-option.active .cap-badge { color: #fff; border-color: rgba(255,255,255,.45); }
#ask-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 12px 16px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
#ask-input {
  flex: 1;
  resize: none;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--layer-1);
  outline: none;
  max-height: 120px;
}
#ask-input:focus {
  border-color: var(--accent);
}
#send-btn {
  padding: 9px 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: var(--card-bg);
  font-weight: 500;
}
#send-btn:disabled {
  background: var(--platform);
  cursor: not-allowed;
  color: var(--idle);
}
#disc-form {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 16px;
  background: var(--info-weak);
  border-bottom: 1px solid var(--line);
}
#disc-form[hidden] {
  display: none;
}
#disc-topic {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--layer-1);
  outline: none;
}
#disc-form label {
  font-size: 12px;
  color: var(--label-secondary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
#disc-rounds {
  width: 52px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
#disc-start {
  padding: 6px 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: var(--card-bg);
}
#disc-form .ghost {
  padding: 6px 12px;
}
.divider {
  align-self: center;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  background: var(--sidebar-bg);
  border-radius: var(--radius-pill);
  padding: 3px 14px;
  margin: 8px 0;
}
.divider.done {
  background: var(--success-weak);
  color: var(--ok);
}
.divider.bad {
  background: var(--error-weak);
  color: var(--danger);
}
.divider.escal {
  background: var(--warn-weak);
  color: var(--warn);
  border-radius: var(--radius-card);
  padding: 8px 14px;
}
.divider.escal .escal-line {
  font-size: 12px;
  text-align: left;
  margin-top: 4px;
  color: var(--label-primary);
}
.divider.escal .escal-tip {
  font-size: 11px;
  margin-top: 6px;
  color: var(--muted);
}
#app-footer {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  padding: 6px 0 2px;
  border-top: 1px solid var(--sidebar-line);
  background: var(--sidebar-bg);
}
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .28);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal[hidden] {
  display: none;
}
.modal-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}
#stats-body {
  padding: 12px 16px;
  overflow-y: auto;
  color: var(--label-primary);
}
.stats-counters {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.stats-counters .sc {
  flex: 1;
  text-align: center;
  background: var(--platform);
  border: 1px solid var(--border-l1);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
}
.stats-counters .sc b {
  display: block;
  font-size: 20px;
  color: var(--label-primary);
}
.stats-counters .sc span {
  font-size: 12px;
  color: var(--muted);
}
.stats-act {
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stats-act .sa {
  display: flex;
  gap: 8px;
  color: var(--label-secondary);
}
.stats-act .sa time {
  color: var(--muted);
  flex: none;
  font-size: 12px;
}
.search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 14px 0;
  color: var(--muted);
}
#msg-search {
  flex: 1;
  background: var(--layer-2);
  border: 1px solid var(--border-l2);
  color: var(--label-primary);
  border-radius: var(--radius-sm);
}
.msg-content {
  display: block;
}
.msg-role {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  line-height: 1.5;
  margin-bottom: 3px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  font-weight: 500;
}
.msg.me .msg-role {
  background: rgba(255, 255, 255, .75);
  border-color: rgba(199, 22, 30, .24);
  color: var(--text-1);
}
.msg.them .msg-role {
  background: var(--layer-1);
}
.msg-role.role-user {
  color: var(--primary);
  border-color: rgba(199, 22, 30, .3);
}
.msg.me .msg-role.role-user {
  color: var(--primary);
  border-color: rgba(199, 22, 30, .3);
}
.msg-role.role-agent {
  color: var(--agent);
  border-color: rgba(110, 86, 207, .3);
}
.msg-role.role-system {
  color: var(--warn);
  border-color: rgba(160, 90, 0, .3);
}
.msg-role-tag {
  font-size: 10px;
  line-height: 1.6;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--sidebar-bg);
  color: var(--text-2);
  white-space: nowrap;
}
.msg-role-tag.role-user {
  color: var(--primary);
  border-color: rgba(199, 22, 30, .24);
  background: var(--primary-soft);
}
.msg-role-tag.role-agent {
  color: var(--agent);
  border-color: rgba(110, 86, 207, .24);
  background: var(--agent-weak);
}
.msg-role-tag.role-system {
  color: var(--warn);
  border-color: rgba(160, 90, 0, .22);
  background: var(--warn-weak);
}
.agent-badge {
  align-self: center;
  flex: none;
  margin-left: 4px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  background: var(--agent-weak);
  color: var(--agent);
  border: 1px solid rgba(110, 86, 207, .24);
}
#aiteam-tabs {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex: none;
  padding: 6px 14px 0;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}
.aiteam-tab:hover {
  color: var(--text-1);
  background: var(--sidebar-hover);
}
.aiteam-tab.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
  margin-bottom: -1px;
  padding-bottom: 8px;
  border-bottom-color: var(--card-bg);
}
#aiteam-board-view, #aiteam-files-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-base);
}
#aiteam-board-view[hidden], #aiteam-files-view[hidden] {
  display: none;
}
#aiteam-board-header, #aiteam-files-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: 11px 20px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-l2);
}
#aiteam-board-header > strong, #aiteam-files-header > strong {
  font-size: 15px;
  color: var(--label-primary);
}
#aiteam-board-summary, #aiteam-files-scope {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aiteam-board-error, .aiteam-files-error {
  margin: 8px 16px 0;
  padding: 8px 12px;
  border-radius: var(--radius-card-sm);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--error-weak);
  color: var(--danger);
  border: 1px solid rgba(215, 0, 21, .22);
}
#aiteam-board-create-form {
  display: grid;
  flex: none;
  grid-template-columns: minmax(220px, 2fr) minmax(150px, 1fr) minmax(180px, 1.2fr) 108px minmax(150px, 1fr) auto;
  gap: 8px;
  padding: 12px 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}
#aiteam-board-create-form input, #aiteam-board-create-form select, #aiteam-board-create-form textarea {
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--border-l2);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  outline: none;
  color: var(--label-primary);
}
#aiteam-board-create-form input:focus, #aiteam-board-create-form select:focus, #aiteam-board-create-form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
#aiteam-board-new-body {
  grid-column: 1 / -1;
  resize: vertical;
}
#aiteam-board-create-btn {
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: var(--card-bg);
  white-space: nowrap;
  font-weight: 500;
}
#aiteam-board-create-btn:disabled {
  background: var(--platform);
  cursor: not-allowed;
  color: var(--idle);
}
#aiteam-board-columns {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(380px, 1fr));
  gap: 12px;
  padding: 14px 16px 20px;
  align-items: start;
  background: transparent;
}
.aiteam-board-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--platform);
  border: 1px solid var(--border-l1);
  border-top: 3px solid var(--idle);
  border-radius: var(--radius-md);
  padding: 10px;
  min-height: 140px;
  min-width: 380px;
  border-top-width: 3px;
}
.aiteam-board-col-todo {
  border-top-color: var(--idle);
}
.aiteam-board-col-doing {
  border-top-color: var(--accent);
}
.aiteam-board-col-blocked {
  border-top-color: var(--warn);
}
.aiteam-board-col-done {
  border-top-color: var(--ok);
}
.aiteam-board-col-failed {
  border-top-color: var(--err);
}
.aiteam-board-col-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px 7px;
  border-bottom: 1px solid var(--border-l1);
}
.aiteam-board-col-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--label-primary);
}
.aiteam-board-col-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-2);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0 8px;
}
.aiteam-board-empty {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 16px 0;
}
.aiteam-board-card-prio-0 {
  border-left-color: var(--idle);
}
.aiteam-board-card-prio-1 {
  border-left-color: var(--warn);
}
.aiteam-board-card-prio-2 {
  border-left-color: var(--error);
}
.aiteam-board-card-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.aiteam-board-card-title {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
  color: var(--label-primary);
  letter-spacing: -.01em;
}
.aiteam-board-prio {
  flex: none;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.aiteam-board-prio-2 {
  background: var(--error-weak);
  color: var(--danger);
  border: 1px solid rgba(215, 0, 21, .22);
}
.aiteam-board-prio-1 {
  background: var(--warn-weak);
  color: var(--warn);
  border: 1px solid rgba(160, 90, 0, .22);
}
.aiteam-board-prio-0 {
  background: var(--sidebar-bg);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.aiteam-board-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-3);
}
.aiteam-board-card-meta .aiteam-board-assignee {
  color: var(--text-1);
  font-weight: 500;
  word-break: break-all;
}
.aiteam-board-card-ops {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.aiteam-board-op {
  border: 1px solid var(--border-l2);
  background: var(--card-bg);
  color: var(--label-secondary);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  white-space: nowrap;
}
.aiteam-board-op:hover {
  border-color: var(--info);
  color: var(--info);
  background: var(--info-weak);
}
.aiteam-board-op-ok:hover {
  border-color: var(--ok);
  color: var(--ok);
  background: var(--success-weak);
}
.aiteam-board-op-bad:hover {
  border-color: var(--error);
  color: var(--error);
  background: var(--error-weak);
}
.aiteam-board-detail {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px dashed var(--border-l2);
  padding-top: 6px;
  font-size: 12px;
}
.aiteam-board-detail-title {
  font-weight: 600;
  color: var(--label-primary);
}
.aiteam-board-detail-row {
  color: var(--muted);
  word-break: break-word;
  line-height: 1.5;
}
.aiteam-board-detail-body {
  color: var(--label-primary);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}
.aiteam-board-notes {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.aiteam-board-note {
  background: var(--platform);
  border: 1px solid var(--border-l1);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  color: var(--label-secondary);
}
.aiteam-board-note small {
  color: var(--muted);
}
.aiteam-board-result {
  margin: 0;
  padding: 6px 8px;
  max-height: 160px;
  overflow: auto;
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  font-size: 11px;
  font-family: Consolas, "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--label-primary);
}
.aiteam-board-attachment {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--label-primary);
}
.aiteam-board-attachment .aiteam-board-attachment-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aiteam-board-linkbtn {
  border: 0;
  background: transparent;
  color: var(--primary);
  padding: 0 2px;
  font-size: 11px;
  border-radius: 4px;
}
.aiteam-board-linkbtn:hover {
  text-decoration: underline;
  color: var(--primary-hover);
}
.aiteam-board-hint {
  font-size: 12px;
  color: var(--muted);
}
#aiteam-board-dispatch-body {
  padding: 12px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--card-bg);
  color: var(--label-primary);
}
#aiteam-board-dispatch-body label {
  font-size: 12px;
  color: var(--label-secondary);
}
#aiteam-board-dispatch-body input, #aiteam-board-dispatch-body textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-l2);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  outline: none;
  color: var(--label-primary);
}
#aiteam-board-dispatch-body input:focus, #aiteam-board-dispatch-body textarea:focus {
  border-color: var(--info);
  box-shadow: 0 0 0 2px rgba(199, 22, 30, .15);
}
.aiteam-board-dispatch-task {
  font-size: 12px;
  color: var(--label-secondary);
  word-break: break-word;
  background: var(--platform);
  border: 1px solid var(--border-l1);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}
#aiteam-board-dispatch-ops {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}
#aiteam-board-dispatch-submit {
  padding: 7px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: var(--card-bg);
  font-weight: 500;
}
.aiteam-board-view-switch {
  display: inline-flex;
  gap: 2px;
  flex: none;
  background: var(--platform);
  border: 1px solid var(--border-l1);
  border-radius: 8px;
  padding: 2px;
}
.aiteam-board-view-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.aiteam-board-view-btn:hover {
  color: var(--text-1);
  background: var(--sidebar-hover);
}
.aiteam-board-view-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  box-shadow: none;
}
.aiteam-board-team {
  display: flex;
  flex: none;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-l2);
}
.aiteam-board-team-info {
  flex: 1 1 260px;
  min-width: 0;
  font-size: 12px;
  color: var(--label-primary);
  word-break: break-word;
}
.aiteam-board-lead-badge {
  flex: none;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--warn-weak);
  color: var(--warn);
  border: 1px solid rgba(160, 90, 0, .22);
  white-space: nowrap;
}
.aiteam-board-lead-badge.is-mine {
  background: var(--success-weak);
  color: var(--ok);
  border-color: rgba(36, 138, 61, .22);
}
.aiteam-board-team-ops {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.aiteam-board-team-ops input {
  width: 150px;
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid var(--border-l2);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  outline: none;
  color: var(--label-primary);
}
.aiteam-board-team-ops input:focus {
  border-color: var(--info);
  box-shadow: 0 0 0 2px rgba(199, 22, 30, .15);
}
.aiteam-board-team-ops .ghost {
  padding: 5px 10px;
  font-size: 12px;
}
.aiteam-board-team-ops .ghost:disabled {
  opacity: .55;
  cursor: not-allowed;
  border-color: var(--line);
  color: var(--muted);
}
#aiteam-board-insights {
  display: grid;
  grid-template-columns: minmax(300px, 1.35fr) minmax(280px, 1fr);
  gap: 10px;
  flex: none;
  padding: 10px 16px 0;
}
.aiteam-board-panel {
  min-width: 0;
  background: var(--card-bg);
  border: 1px solid var(--border-l2);
  border-radius: var(--radius-md);
  padding: 8px 10px;
}
.aiteam-board-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--label-primary);
  margin-bottom: 6px;
}
.aiteam-board-panel-title .muted {
  font-weight: 400;
  font-size: 11px;
  margin-left: 6px;
}
.aiteam-board-summary-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(56px, 1fr));
  gap: 6px;
}
.aiteam-board-summary-card {
  text-align: center;
  background: var(--platform);
  border: 1px solid var(--border-l1);
  border-radius: var(--radius-sm);
  padding: 5px 4px;
}
.aiteam-board-summary-card b {
  display: block;
  font-size: 16px;
  line-height: 1.25;
  color: var(--label-primary);
}
.aiteam-board-summary-card span {
  font-size: 10px;
  color: var(--muted);
}
.aiteam-board-sum-overdue b {
  color: var(--error);
}
.aiteam-board-capacity {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  word-break: break-word;
}
.aiteam-board-capacity.is-enough {
  color: var(--ok);
}
.aiteam-board-capacity.is-short {
  color: var(--warn);
  font-weight: 600;
}
.aiteam-board-hosts {
  max-height: 150px;
  overflow-y: auto;
}
.aiteam-board-hosts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.aiteam-board-hosts-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  padding: 2px 4px;
  border-bottom: 1px solid var(--border-l2);
  white-space: nowrap;
  background: var(--platform);
}
.aiteam-board-hosts-table td {
  padding: 3px 4px;
  border-bottom: 1px dashed var(--border-l1);
  vertical-align: middle;
  color: var(--label-primary);
}
.aiteam-board-hosts-table tr:last-child td {
  border-bottom: 0;
}
.aiteam-board-hosts-table td small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}
.aiteam-board-host-pct {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.aiteam-board-host-pct b {
  font-weight: 500;
  font-size: 10px;
  color: var(--muted);
  min-width: 26px;
}
.aiteam-board-host-bar {
  display: inline-block;
  width: 44px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, .08);
  overflow: hidden;
}
.aiteam-board-host-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--success);
}
.aiteam-board-host-bar i.mid {
  background: var(--warn);
}
.aiteam-board-host-bar i.high {
  background: var(--danger);
}
.aiteam-board-host-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  background: var(--idle);
}
.aiteam-board-host-dot.on {
  background: var(--success);
}
.aiteam-board-card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 11px;
  color: var(--muted);
}
.aiteam-board-metric {
  white-space: nowrap;
  color: var(--muted);
}
.aiteam-board-status-chip {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--sidebar-bg);
  color: var(--text-2);
}
.aiteam-board-status-chip.status-doing {
  color: var(--primary);
  border-color: rgba(199, 22, 30, .24);
  background: var(--primary-soft);
}
.aiteam-board-status-chip.status-blocked {
  color: var(--warn);
  border-color: rgba(160, 90, 0, .22);
  background: var(--warn-weak);
}
.aiteam-board-status-chip.status-done {
  color: var(--ok);
  border-color: rgba(36, 138, 61, .22);
  background: var(--success-weak);
}
.aiteam-board-status-chip.status-failed {
  color: var(--danger);
  border-color: rgba(215, 0, 21, .22);
  background: var(--error-weak);
}
.aiteam-board-due.is-overdue {
  color: var(--error);
  font-weight: 600;
}
.aiteam-board-participants {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aiteam-board-detail-v08 {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--label-primary);
}
.aiteam-board-report {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px dashed var(--border-l2);
  padding-top: 6px;
}
.aiteam-board-report-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.aiteam-board-report-input {
  width: 72px;
  padding: 3px 6px;
  font: inherit;
  font-size: 11px;
  border: 1px solid var(--border-l2);
  border-radius: 6px;
  background: var(--card-bg);
  outline: none;
  color: var(--label-primary);
}
.aiteam-board-report-input:focus {
  border-color: var(--info);
  box-shadow: 0 0 0 2px rgba(199, 22, 30, .15);
}
.aiteam-board-report-blocked {
  width: 132px;
  flex: 1 1 110px;
  min-width: 90px;
}
#aiteam-board-columns[hidden], #aiteam-board-list-view[hidden] {
  display: none;
}
.aiteam-board-list-view {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 16px 20px;
  background: transparent;
}
.aiteam-board-table {
  width: 100%;
  border-collapse: separate;
  font-size: 12.5px;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-l2);
  border-spacing: 0;
  min-width: 1180px;
}
.aiteam-board-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--sidebar-bg);
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-2);
  font-size: 12px;
}
.aiteam-board-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-1);
}
.aiteam-board-table tr.status-done td {
  color: var(--text-3);
}
.aiteam-board-table tr.status-failed td {
  color: var(--danger);
}
.aiteam-board-table td.is-overdue {
  color: var(--error);
  font-weight: 600;
}
.aiteam-board-tr-title {
  font-size: 12.5px;
  color: var(--label-primary);
  text-align: left;
  white-space: normal;
}
.aiteam-board-tr-ops {
  white-space: nowrap;
}
.aiteam-board-progress {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.aiteam-board-progress-bar {
  display: inline-block;
  width: 56px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, .08);
  overflow: hidden;
}
.aiteam-board-progress-bar i {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--primary);
}
.aiteam-board-progress-bar i.done {
  background: var(--ok);
}
.aiteam-board-progress b {
  font-size: 11px;
  font-weight: 500;
  color: var(--label-secondary);
}
#aiteam-files-upload-btn {
  padding: 7px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: var(--card-bg);
  font-weight: 500;
}
#aiteam-files-upload-btn:disabled {
  background: var(--platform);
  cursor: not-allowed;
  color: var(--idle);
}
.aiteam-files-status {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 16px 0;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
  background: var(--info-weak);
  color: var(--label-primary);
  border: 1px solid rgba(199, 22, 30, .25);
}
#aiteam-files-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--label-primary);
}
.aiteam-files-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border-l2);
  border-radius: var(--radius-md);
  padding: 9px 12px;
}
.aiteam-files-icon {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--info-weak);
  color: var(--info);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.aiteam-files-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.aiteam-files-name {
  font-size: 13px;
  word-break: break-all;
  color: var(--label-primary);
}
.aiteam-files-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 11px;
  color: var(--muted);
}
.aiteam-files-meta .aiteam-files-task {
  color: var(--info);
}
.aiteam-files-ops {
  flex: none;
  display: flex;
  gap: 6px;
}
.aiteam-files-op {
  border: 1px solid var(--border-l2);
  background: var(--card-bg);
  color: var(--label-secondary);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11px;
  white-space: nowrap;
}
.aiteam-files-op:hover {
  border-color: var(--info);
  color: var(--info);
  background: var(--info-weak);
}
.aiteam-files-op-danger:hover {
  border-color: var(--error);
  color: var(--error);
  background: var(--error-weak);
}
.aiteam-files-empty {
  color: var(--muted);
  text-align: center;
  padding: 40px 0;
  font-size: 13px;
  line-height: 1.8;
}
#aiteam-files-filter {
  flex: 1 1 160px;
  min-width: 120px;
  max-width: 260px;
  padding: 6px 10px;
  border: 1px solid var(--border-l2);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  outline: none;
  color: var(--label-primary);
}
#aiteam-files-filter:focus {
  border-color: var(--info);
  box-shadow: 0 0 0 2px rgba(199, 22, 30, .15);
}
#aiteam-files-count {
  flex: none;
  font-size: 12px;
  white-space: nowrap;
}
.aiteam-files-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--label-primary);
}
.aiteam-files-status-row #aiteam-files-upload-summary {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}
#aiteam-files-total-progress {
  width: 100%;
  height: 8px;
  accent-color: var(--info);
}
#aiteam-files-queue {
  margin: 8px 16px 0;
  max-height: 26vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: transparent;
}
#aiteam-files-queue:empty {
  display: none;
}
.aiteam-files-queue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border-l2);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  color: var(--label-primary);
}
.aiteam-files-queue-icon {
  flex: none;
}
.aiteam-files-queue-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--label-primary);
}
.aiteam-files-queue-size {
  flex: none;
  color: var(--muted);
  font-size: 11px;
}
.aiteam-files-queue-item progress {
  flex: none;
  width: 120px;
  height: 6px;
  accent-color: var(--info);
}
.aiteam-files-queue-state {
  flex: none;
  min-width: 78px;
  text-align: right;
  font-size: 11px;
  color: var(--muted);
}
.aiteam-files-queue-item.state-hashing .aiteam-files-queue-state {
  color: var(--warn);
}
.aiteam-files-queue-item.state-uploading .aiteam-files-queue-state {
  color: var(--info);
}
.aiteam-files-queue-item.state-success .aiteam-files-queue-state {
  color: var(--ok);
}
.aiteam-files-queue-item.state-failed {
  border-color: rgba(215, 0, 21, .3);
}
.aiteam-files-queue-item.state-failed .aiteam-files-queue-state, .aiteam-files-queue-item.state-failed .aiteam-files-queue-name {
  color: var(--error);
}
.side-head h1, .empty-inner h2 {
  font-family: var(--font-brand);
  font-weight: 500;
  letter-spacing: .02em;
}
code, pre, kbd, samp, .aiteam-board-result {
  font-family: var(--font-code);
}
a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  color: var(--primary-hover);
}
*:focus-visible {
  outline: 2px solid rgba(199, 22, 30, .45);
  outline-offset: 2px;
  border-radius: 6px;
}
::placeholder {
  color: var(--text-3);
  opacity: 1;
}
.me-text strong {
  color: var(--text-1);
}
.ghost:disabled {
  background: var(--sidebar-bg);
  border-color: var(--border);
  color: var(--text-3);
  cursor: not-allowed;
}
.channel-title, .roster-title {
  color: var(--sidebar-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
}
.member .m-id, .member .m-state {
  color: var(--text-3);
}
.user-summary > span, .user-chevron {
  color: var(--text-3);
}
.sess-chip, .sess-list {
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  border-radius: 8px;
}
#conv-header, #dec-header, #mb-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}
#conv-name {
  color: var(--text-1);
  word-break: break-word;
  overflow-wrap: anywhere;
  font-weight: 600;
}
#conv-sub, .muted {
  color: var(--text-3);
}
.msg .meta, .msg.them .meta {
  color: var(--text-3);
  opacity: 1;
}
.msg.me .meta {
  color: var(--text-2);
}
.chips .chip {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: var(--radius-pill);
}
#ask-form, #disc-form {
  background: var(--card-bg);
  border-color: var(--border);
}
#ask-input, #disc-topic, #disc-rounds, #mb-who {
  background: var(--layer-2);
  border: 1px solid var(--border-l2);
  color: var(--label-primary);
  border-radius: var(--radius-sm);
}
#ask-input:focus, #disc-topic:focus, #disc-rounds:focus, #mb-who:focus, #msg-search:focus {
  border-color: var(--info);
  box-shadow: 0 0 0 2px rgba(199, 22, 30, .15);
}
#send-btn:hover {
  filter: none;
  background: var(--brand-hover);
}
#dec-list, #mb-list {
  color: var(--label-secondary);
}
#aiteam-board-summary, #aiteam-files-scope, #aiteam-files-count {
  color: var(--muted);
}
select option {
  background: var(--card-bg);
  color: var(--text-1);
}
#aiteam-board-create-btn:hover {
  filter: none;
  background: var(--brand-hover);
}
#aiteam-board-dispatch-submit:hover {
  filter: brightness(.93);
  background: var(--brand-hover);
}
.aiteam-files-queue-size, .aiteam-files-queue-state {
  color: var(--muted);
}
#aiteam-files-upload-btn:hover {
  filter: none;
  background: var(--brand-hover);
}
progress {
  accent-color: var(--primary);
  background: rgba(0, 0, 0, .08);
  color-scheme: light;
  border: 0;
  border-radius: var(--radius-pill);
  overflow: hidden;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .18);
  border: 2px solid transparent;
  background-clip: content-box;
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, .30);
  background-clip: content-box;
}
::-webkit-scrollbar-corner {
  background: transparent;
}
progress::-webkit-progress-bar {
  background: rgba(0, 0, 0, .08);
  border-radius: var(--radius-pill);
}
progress::-webkit-progress-value {
  background: var(--primary);
  border-radius: var(--radius-pill);
}
progress::-moz-progress-bar {
  background: var(--primary);
  border-radius: var(--radius-pill);
}
#join-btn:disabled {
  background: var(--platform);
  color: var(--muted);
}
#ask-input, #disc-topic, #disc-rounds, #mb-who, #msg-search {
  background: var(--card-bg);
  border: 1px solid var(--border-l2);
  color: var(--label-primary);
  border-radius: var(--radius-sm);
}
#disc-start:hover {
  background: var(--brand-hover);
}
button, input, select, textarea {
  font-family: var(--font-apple);
  font-size: 13px;
}
.channel-item:hover {
  background: var(--sidebar-hover);
  color: var(--text-1);
}
.channel-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-active-text);
}
.member.active .m-name, .member.active .m-id, .member.active .m-state {
  color: var(--sidebar-active-text);
}
.session-option.active .session-name, .session-option.active small, .session-option.active .agent-badge, .session-option.active .perm-badge, .session-option.active .inject-badge {
  color: var(--sidebar-active-text);
  border-color: rgba(255, 255, 255, .45);
}
#ask-input, #disc-topic, #disc-rounds, #mb-who, #msg-search, input, select, textarea {
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  color: var(--text-1);
  border-radius: var(--radius-input);
  padding: 7px 11px;
  outline: none;
}
#ask-input:focus, #disc-topic:focus, #disc-rounds:focus, #mb-who:focus, #msg-search:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
#join-btn, #send-btn, #aiteam-board-create-btn, #aiteam-board-dispatch-submit, #aiteam-files-upload-btn, #disc-start {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  padding: 8px 18px;
}
#join-btn:hover, #send-btn:hover, #aiteam-board-create-btn:hover, #aiteam-board-dispatch-submit:hover, #aiteam-files-upload-btn:hover, #disc-start:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  filter: none;
}
#join-btn:disabled, #send-btn:disabled, #aiteam-board-create-btn:disabled, #aiteam-board-dispatch-submit:disabled, #aiteam-files-upload-btn:disabled {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary);
  filter: none;
}
.aiteam-board-op, .aiteam-files-op {
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  color: var(--text-1);
  border-radius: var(--radius-pill);
  padding: 4px 11px;
  font-size: 11.5px;
}
.aiteam-board-op:hover, .aiteam-files-op:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--card-bg);
}
.aiteam-board-op-bad:hover, .aiteam-files-op-danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}
.card, .user-group, .aiteam-board-card, .aiteam-files-row, .mb-item, .dec-item, .aiteam-board-panel, .aiteam-board-summary-card, .aiteam-board-table, .aiteam-board-col, .stats-counters .sc, .sess-chip {
  border-radius: var(--radius-card);
  border-color: var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow-card);
}
.aiteam-board-summary-card, .stats-counters .sc, .aiteam-board-col {
  box-shadow: none;
}
.aiteam-board-note, .aiteam-board-dispatch-task, .aiteam-files-status, .aiteam-board-view-switch {
  background: var(--sidebar-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card-sm);
}
.aiteam-board-report-input, .aiteam-board-team-ops input, #aiteam-files-filter, #aiteam-board-create-form input, #aiteam-board-create-form select, #aiteam-board-create-form textarea, #aiteam-board-dispatch-body input, #aiteam-board-dispatch-body textarea, #register-form input {
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  color: var(--text-1);
  border-radius: var(--radius-input);
}
#aiteam-board-create-form select:disabled {
  background: var(--sidebar-bg);
  color: var(--text-3);
  cursor: not-allowed;
}
#aiteam-board-new-assignee, #aiteam-board-new-target-session {
  min-width: 0;
  width: 100%;
}
.aiteam-board-target-session {
  color: var(--primary);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.aiteam-board-card .aiteam-board-target-session {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.aiteam-board-table td .aiteam-board-target-session {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
}
.aiteam-board-host-bar i.low {
  background: var(--ok);
}
#join-btn, #send-btn, #aiteam-board-create-btn, #aiteam-board-dispatch-submit, #aiteam-files-upload-btn, #disc-start, .ghost, .pending-ops button, .aiteam-board-view-btn, .aiteam-board-op, .aiteam-files-op, .aiteam-board-linkbtn, #aiteam-files-upload-btn, .aiteam-tab, .channel-item, .session-option, .member {
  border-radius: var(--radius-pill);
}
.session-option, .member, .aiteam-tab {
  border-radius: 10px;
}
#aiteam-files-filter, #ask-input, #msg-search, #mb-who, #disc-topic, #disc-rounds, #register-form input, #aiteam-board-new-assignee, #aiteam-board-new-target-session, #aiteam-board-create-form input, #aiteam-board-create-form select, #aiteam-board-create-form textarea, #aiteam-board-dispatch-body input, #aiteam-board-dispatch-body textarea, .aiteam-board-report-input, .aiteam-board-team-ops input {
  border-radius: var(--radius-input);
}
.card, .user-group, .aiteam-board-card, .aiteam-files-row, .mb-item, .dec-item, .aiteam-board-panel, .aiteam-board-summary-card, .aiteam-board-table, .aiteam-board-col, .stats-counters .sc, .sess-chip, .aiteam-board-note, .aiteam-board-result, .aiteam-board-dispatch-task, .aiteam-files-status, .aiteam-board-view-switch {
  border-radius: var(--radius-card);
}
body {
  background: var(--content-bg);
  color: var(--text-1);
  font-family: var(--font-apple);
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  letter-spacing: -.006em;
}
.ghost {
  border: 1px solid var(--border-strong);
  background: var(--card-bg);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  color: var(--text-1);
}
.aiteam-tab {
  border: 1px solid transparent;
  border-bottom: 0;
  background: transparent;
  color: var(--text-2);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
}
#join-btn, #send-btn, #aiteam-board-create-btn, #aiteam-board-dispatch-submit, #aiteam-files-upload-btn, #disc-start, .aiteam-board-op, .aiteam-files-op, .aiteam-board-view-btn, .pending-ops button {
  border-radius: var(--radius-pill);
}
.session-option, .member {
  border-radius: 10px;
}
input, select, textarea, #ask-input, #msg-search, #mb-who, #disc-topic, #disc-rounds, #aiteam-board-new-assignee, #aiteam-board-new-target-session, #aiteam-files-filter, #register-form input, #aiteam-board-create-form input, #aiteam-board-create-form select, #aiteam-board-create-form textarea, #aiteam-board-dispatch-body input, #aiteam-board-dispatch-body textarea, .aiteam-board-report-input, .aiteam-board-team-ops input {
  border-radius: var(--radius-input);
}
.card, .user-group, .aiteam-files-row, .mb-item, .dec-item, .aiteam-board-panel, .aiteam-board-summary-card, .aiteam-board-table, .aiteam-board-col, .stats-counters .sc, .sess-chip, .aiteam-board-note, .aiteam-board-result, .aiteam-board-dispatch-task, .aiteam-files-status, .aiteam-board-view-switch {
  border-radius: var(--radius-card);
}
.aiteam-board-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border-l2);
  border-left: 3px solid var(--line);
  border-radius: var(--radius-card-sm);
  padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  width: 100%;
  box-sizing: border-box;
}
.modal-card {
  background: var(--card-bg);
  border-radius: var(--radius-modal);
  width: min(560px, 92vw);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-pop);
  border: 1px solid var(--border);
}
@media (max-width: 720px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  #sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: 45vh;
  }
  #roster {
    max-height: 24vh;
  }
  #main {
    min-width: 0;
  }
  .conv-title strong {
    font-size: 15px;
  }
  #ask-input {
    font-size: 16px;
  }
}
@media (max-width: 900px) {
  #aiteam-board-create-form {
    grid-template-columns: 1fr 1fr;
    padding: 8px 12px;
  }
  #aiteam-board-new-title, #aiteam-board-new-body, #aiteam-board-create-btn {
    grid-column: 1 / -1;
  }
  #aiteam-board-columns {
    grid-template-columns: repeat(5, minmax(380px, 88vw));
    padding: 10px 12px 16px;
  }
  #aiteam-board-header, #aiteam-files-header {
    flex-wrap: wrap;
    padding: 10px 12px;
  }
  #aiteam-board-summary, #aiteam-files-scope {
    flex-basis: 100%;
    order: 3;
  }
  .aiteam-files-row {
    flex-wrap: wrap;
  }
  .aiteam-files-ops {
    width: 100%;
    justify-content: flex-end;
  }
  #aiteam-files-filter {
    flex-basis: 100%;
    order: 2;
    max-width: none;
  }
  #aiteam-files-count {
    order: 2;
  }
  .aiteam-files-queue-item {
    flex-wrap: wrap;
  }
  .aiteam-files-queue-item progress {
    width: 100%;
  }
  #aiteam-board-insights {
    grid-template-columns: 1fr;
    padding: 8px 12px 0;
  }
  .aiteam-board-team {
    padding: 8px 12px;
  }
  .aiteam-board-team-ops {
    width: 100%;
  }
  .aiteam-board-team-ops input {
    flex: 1 1 120px;
    width: auto;
  }
  .aiteam-board-list-view {
    padding: 8px 12px 14px;
  }
  .aiteam-board-table {
    min-width: 1180px;
  }
}

/* ==========================================================================
   v0.14 任务板完整化:工具栏 / 拖拽 / 卡片菜单 / 列快速新建 / 详情抽屉
   ========================================================================== */

/* ---------- 创建/发布表单升级 ---------- */
#aiteam-board-create-form {
  grid-template-columns: minmax(220px, 2fr) minmax(140px, 1fr) minmax(180px, 1.2fr) 104px 96px 150px minmax(150px, 1fr) auto;
  align-items: center;
}
#aiteam-board-new-body { grid-column: 1 / -1; resize: vertical; min-height: 34px; }
.aiteam-board-create-dispatch {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--text-2); flex-wrap: wrap;
}
.aiteam-board-create-dispatch label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.aiteam-board-create-dispatch input[type="checkbox"] { width: auto; height: auto; padding: 0; margin: 0; accent-color: var(--primary); }
#aiteam-board-create-dispatch-question { flex: 1 1 240px; min-width: 160px; }
#aiteam-board-create-dispatch:not(:checked) ~ #aiteam-board-create-dispatch-question { opacity: .55; }

/* ---------- 筛选工具栏 ---------- */
.aiteam-board-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--card-bg); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 3;
}
.aiteam-board-toolbar input#aiteam-board-search { flex: 1 1 220px; min-width: 180px; }
.aiteam-board-toolbar select { min-width: 112px; }
.aiteam-board-filter-check {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px;
  color: var(--text-2); cursor: pointer; user-select: none;
}
.aiteam-board-filter-check input { width: auto; height: auto; padding: 0; margin: 0; accent-color: var(--primary); }
#aiteam-board-filter-clear { padding: 5px 12px; font-size: 12px; }

/* ---------- 卡片:信息完善 / 拖拽 / 菜单 ---------- */
.aiteam-board-col.is-drop-target {
  border-color: var(--primary); outline: 2px dashed var(--primary-soft); outline-offset: -2px;
  transition: border-color .12s, outline-color .12s;
}
.aiteam-board-card { cursor: grab; position: relative; transition: box-shadow .12s, border-color .12s; }
.aiteam-board-card:active { cursor: grabbing; }
.aiteam-board-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-card); }
.aiteam-board-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.aiteam-board-card-metrics { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--text-3); }
.aiteam-board-card-body {
  font-size: 12.5px; line-height: 1.5; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-word;
}
.aiteam-board-card-head { align-items: flex-start; }
.aiteam-board-card-menu-btn {
  margin-left: auto; flex: none; width: 24px; height: 24px; padding: 0; line-height: 20px;
  border: 1px solid transparent; border-radius: var(--radius-pill);
  background: transparent; color: var(--text-3); font-size: 15px; cursor: pointer;
}
.aiteam-board-card-menu-btn:hover { background: var(--sidebar-hover); color: var(--text-1); border-color: var(--border); }
.aiteam-board-deps { color: var(--warn); }
.aiteam-board-card-menu {
  position: fixed; z-index: 60; min-width: 176px; padding: 6px;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-card-sm);
  box-shadow: var(--shadow-pop); display: flex; flex-direction: column; gap: 2px;
}
.aiteam-board-menu-item {
  width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-1); font-size: 12.5px; cursor: pointer;
}
.aiteam-board-menu-item:hover { background: var(--primary-soft); color: var(--primary); }
.aiteam-board-menu-item.is-ok:hover { background: var(--success-weak); color: var(--ok); }
.aiteam-board-menu-item.is-bad:hover { background: var(--error-weak); color: var(--danger); }
.aiteam-board-menu-title { margin: 4px 8px 2px; font-size: 10.5px; color: var(--text-3); font-weight: 600; letter-spacing: .02em; }

/* ---------- 列头/列脚 ---------- */
.aiteam-board-col-head { display: flex; align-items: center; gap: 8px; }
.aiteam-board-col-count { margin-left: auto; }
.aiteam-board-wip {
  font-size: 10px; color: var(--warn); border: 1px solid rgba(160, 90, 0, .22);
  background: var(--warn-weak); border-radius: var(--radius-pill); padding: 1px 7px;
}
.aiteam-board-col-foot { margin-top: auto; padding-top: 4px; }
.aiteam-board-quick-btn {
  width: 100%; padding: 6px 10px; border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card-sm); background: transparent; color: var(--text-2);
  font-size: 12px; cursor: pointer; text-align: left;
}
.aiteam-board-quick-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.aiteam-board-quick-create { display: flex; gap: 6px; align-items: center; }
.aiteam-board-quick-create input { flex: 1; min-width: 0; padding: 5px 8px; font-size: 12px; }
.aiteam-board-quick-create .aiteam-board-op { padding: 4px 9px; font-size: 11.5px; }

/* ---------- 详情抽屉 ---------- */
.aiteam-board-drawer { position: fixed; inset: 0; z-index: 80; }
.aiteam-board-drawer[hidden] { display: none; }
.aiteam-board-drawer-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, .28); }
.aiteam-board-drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(520px, 96vw);
  display: flex; flex-direction: column; background: var(--card-bg);
  border-left: 1px solid var(--border); box-shadow: var(--shadow-pop);
}
.aiteam-board-drawer-header {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.aiteam-board-drawer-header strong { flex: 1; min-width: 0; font-size: 15px; color: var(--text-1); word-break: break-word; }
.aiteam-board-drawer-body { flex: 1; min-height: 0; overflow: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.aiteam-board-drawer-body > label,
.aiteam-board-drawer-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-2); }
.aiteam-board-drawer-body input,
.aiteam-board-drawer-body textarea,
.aiteam-board-drawer-body select { width: 100%; box-sizing: border-box; }
.aiteam-board-drawer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.aiteam-board-drawer-meta { font-size: 12px; color: var(--text-3); line-height: 1.6; }
.aiteam-board-drawer-section { display: flex; flex-direction: column; gap: 6px; }
.aiteam-board-drawer-section-title { font-size: 12px; font-weight: 600; color: var(--text-1); }
.aiteam-board-drawer-note {
  font-size: 12px; color: var(--text-2); background: var(--content-bg);
  border: 1px solid var(--border); border-radius: var(--radius-card-sm); padding: 7px 10px;
  white-space: pre-wrap; word-break: break-word;
}
.aiteam-board-drawer-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 18px; border-top: 1px solid var(--border); background: var(--card-bg);
}
.aiteam-board-drawer-actions button { padding: 7px 16px; }
#aiteam-board-edit-save { margin-right: auto; }

/* ---------- 清单视图行 ---------- */
.aiteam-board-table tbody tr { cursor: pointer; }
.aiteam-board-table tbody tr:hover td { background: var(--primary-soft); }
.aiteam-board-table tbody tr:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  #aiteam-board-create-form { grid-template-columns: minmax(180px, 2fr) minmax(130px, 1fr) minmax(160px, 1.2fr) 96px 90px 140px; }
  #aiteam-board-create-form #aiteam-board-new-deps { grid-column: 1 / span 3; }
  #aiteam-board-create-btn { grid-column: -2 / -1; }
}
@media (max-width: 900px) {
  .aiteam-board-toolbar { padding: 8px 12px; }
  .aiteam-board-toolbar input#aiteam-board-search { flex-basis: 100%; }
  .aiteam-board-drawer-panel { width: 100vw; }
  .aiteam-board-drawer-grid { grid-template-columns: 1fr; }
  #aiteam-board-create-form { grid-template-columns: 1fr 1fr; }
  #aiteam-board-create-form > * { grid-column: auto; }
  #aiteam-board-new-title, #aiteam-board-new-body, #aiteam-board-create-btn, .aiteam-board-create-dispatch { grid-column: 1 / -1; }
}

/* ==========================================================================
   v0.15 视觉对齐参考 webui(实际渲染基线)
   层级:侧栏 #F5F5F7(248) / 主区与顶栏 #FFFFFF / 卡片面板 #F5F5F7 圆角18
   结构:品牌块 + 侧栏导航 + 白色 cmdbar(标题/时钟/状态) + 主区 padding 20 22 28
   ========================================================================== */

/* ---------- 基础字体/字号(参考 body 14px) ---------- */
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "HarmonyOS Sans SC", "Source Han Sans SC", "Noto Sans SC", "Microsoft YaHei UI",
    "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--text-1);
  background: var(--card-bg);
}
#app { display: flex; height: 100vh; background: var(--card-bg); }

/* ---------- 侧栏:248px 灰底,品牌蓝块 + 导航 ---------- */
#sidebar {
  width: 248px;
  min-width: 248px;
  background: var(--content-bg);
  border-right: 1px solid var(--border-strong);
  padding: 20px 16px 18px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.side-head {
  padding: 0;
  border: 0;
  margin: 0;
}
.side-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo {
  width: 34px; height: 34px; flex: none;
  border-radius: 10px; background: var(--primary); color: #fff;
  font-size: 13px; font-weight: 700; letter-spacing: .02em;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-brand);
}
.brand-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.side-head h1 {
  margin: 0; font-family: inherit; font-size: 14px; font-weight: 700;
  line-height: 1.25; color: var(--text-1); letter-spacing: -.01em;
}
.brand-sub { font-size: 12px; color: var(--text-2); line-height: 1.3; }

/* 侧栏导航(原顶部 tabs 移入) */
#aiteam-tabs {
  display: flex; flex-direction: column; gap: 4px;
  padding: 0; margin: 0; background: transparent; border: 0;
}
.aiteam-tab {
  width: 100%; justify-content: flex-start; text-align: left;
  padding: 9px 12px; border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--sidebar-text);
  font-size: 13.5px; font-weight: 500; cursor: pointer;
}
.aiteam-tab:hover { background: var(--sidebar-hover); color: var(--text-1); border-color: transparent; }
.aiteam-tab.active { background: var(--sidebar-active); color: var(--sidebar-active-text); border-color: var(--sidebar-active); }
.aiteam-tab.active:hover { background: var(--primary-hover); }

/* 侧栏内卡片/面板:灰底上不再白卡,会员卡改为浅色块 */
#sidebar .card {
  background: transparent; border: 0; box-shadow: none;
  padding: 0; border-radius: 0;
}
#sidebar #me-card { padding: 0; }
#sidebar #me-card .me-avatar { background: var(--card-bg); border: 1px solid var(--border); color: var(--primary); }
#sidebar #register-card { margin-top: 0; }
#sidebar input { background: var(--input-bg); }
#channels, #roster { flex: none; }
#roster { background: transparent; }
#sidebar .side-foot {
  margin-top: auto; padding: 12px 0 0; border-top: 1px solid var(--border-strong);
  background: transparent; font-size: 12px; color: var(--text-2);
}
#sidebar .side-foot .conn { margin-bottom: 8px; font-size: 12px; }
#sidebar .side-foot .ghost { background: var(--card-bg); border-radius: var(--radius-pill); padding: 3px 0; font-size: 11.5px; }
#sidebar .user-group { background: var(--card-bg); border-radius: 12px; box-shadow: none; }
#sidebar .session-option.active { background: var(--sidebar-active); }
#sidebar .session-option.active .session-name,
#sidebar .session-option.active small { color: var(--sidebar-active-text); }

/* ---------- 主区:白底 + 白色 cmdbar ---------- */
#main {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  background: var(--card-bg); padding: 0; min-height: 0;
}
#aiteam-cmdbar {
  display: flex; align-items: center; gap: 14px; flex: none;
  padding: 12px 22px; background: rgba(255, 255, 255, .8);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-strong); position: sticky; top: 0; z-index: 20;
  box-sizing: border-box;
}
#aiteam-page-title {
  font-size: 16px; font-weight: 700; letter-spacing: -.01em;
  color: var(--text-1); flex: 1; min-width: 0;
}
.aiteam-cmdbar-right { display: inline-flex; align-items: center; gap: 12px; flex: none; }
.aiteam-clock {
  font-family: var(--font-code); font-size: 12px; color: var(--text-2);
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.aiteam-cmd-state { font-size: 12px; color: var(--text-2); display: inline-flex; align-items: center; gap: 5px; }
.aiteam-cmd-state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--idle); }
.aiteam-cmd-state.on::before { background: var(--ok); }
.aiteam-cmd-state.connecting::before { background: var(--warn); }
.aiteam-cmd-state.off::before { background: var(--text-3); }
.aiteam-cmd-version { font-size: 12px; color: var(--text-3); font-family: var(--font-code); }

/* 主区内容 padding 20/22/28 */
#empty-state, #conversation, #decisions-view, #mailbox-view,
#aiteam-board-view, #aiteam-files-view { padding: 20px 22px 28px; box-sizing: border-box; }
#empty-state { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
#conversation { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
#conversation #messages { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--card-bg); }
#conv-header, #dec-header, #mb-header, #aiteam-board-header, #aiteam-files-header {
  background: transparent; border-bottom: 0; padding: 0 0 10px;
}
#conv-header { gap: 12px; }
#conv-name { font-size: 15px; font-weight: 600; }
#aiteam-board-header > strong, #aiteam-files-header > strong { display: none; }
#aiteam-board-header { gap: 10px; }
#aiteam-board-summary { font-size: 12.5px; color: var(--text-2); }
#app-footer { display: none; }
#ask-form, #disc-form { border: 1px solid var(--border-strong); border-radius: var(--radius-card); padding: 8px; background: var(--card-bg); }
#ask-input, #disc-topic { border: 0; background: transparent; }

/* ---------- 卡片/面板:浅灰 #F5F5F7 + 圆角18 ---------- */
.aiteam-board-panel,
.aiteam-board-summary-card,
.aiteam-board-col,
.aiteam-board-toolbar,
#aiteam-board-create-form,
.aiteam-files-row,
#aiteam-files-upload-status,
.aiteam-board-table {
  background: var(--content-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: none;
}
.aiteam-board-panel { padding: 14px 16px; }
.aiteam-board-toolbar {
  padding: 12px; margin: 0 0 12px; position: static;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.aiteam-board-toolbar input, .aiteam-board-toolbar select { background: var(--input-bg); border: 1px solid var(--border-strong); }
#aiteam-board-create-form {
  padding: 12px; margin: 0 0 12px; gap: 8px;
  background: var(--content-bg); border: 1px solid var(--border); border-radius: var(--radius-card);
}
#aiteam-board-create-form input, #aiteam-board-create-form select, #aiteam-board-create-form textarea {
  background: var(--input-bg); border: 1px solid var(--border-strong);
}
.aiteam-board-col { padding: 12px; gap: 10px; min-width: 380px; }
.aiteam-board-col-head { padding: 2px 4px 8px; }
.aiteam-board-col-title { font-size: 13.5px; font-weight: 600; }
.aiteam-board-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: none;
}
.aiteam-board-card:hover { box-shadow: var(--shadow-card); border-color: var(--border-strong); }
.aiteam-board-quick-btn { background: var(--card-bg); border: 1px dashed var(--border-strong); border-radius: 12px; }
.aiteam-board-quick-btn:hover { background: var(--card-bg); border-color: var(--primary); }
.aiteam-board-quick-create input { background: var(--input-bg); }
.aiteam-board-list-view .aiteam-board-table { background: var(--content-bg); }
.aiteam-board-table th { background: var(--content-bg); }

/* ---------- 文件面板 ---------- */
#aiteam-files-view { flex: 1; min-height: 0; overflow: auto; }
.aiteam-files-row { padding: 14px 16px; }
.aiteam-files-queue-item { background: var(--content-bg); border: 1px solid var(--border); border-radius: 12px; }
#aiteam-files-list { display: flex; flex-direction: column; gap: 10px; }

/* ---------- 详情抽屉:白底/灰头 ---------- */
.aiteam-board-drawer-panel { background: var(--card-bg); border-left: 1px solid var(--border-strong); border-radius: 18px 0 0 18px; }
.aiteam-board-drawer-header { background: var(--content-bg); border-bottom: 1px solid var(--border); padding: 14px 18px; }
.aiteam-board-drawer-body { background: var(--card-bg); }
.aiteam-board-drawer-actions { background: var(--card-bg); border-top: 1px solid var(--border); }
.aiteam-board-drawer-note { background: var(--content-bg); border-radius: 12px; }
.aiteam-board-menu-item { border-radius: 10px; }

/* ---------- 登录/游客模式:全屏灰底 + 白色卡片 ---------- */
#app.is-guest { display: block; height: 100vh; }
#app.is-guest #main,
#app.is-guest #app-footer,
#app.is-guest #aiteam-tabs,
#app.is-guest #roster,
#app.is-guest #channels,
#app.is-guest #pending-box,
#app.is-guest #me-card,
#app.is-guest .side-foot,
#app.is-guest #register-card .hint { display: none !important; }
#app.is-guest #sidebar {
  width: 100%; min-width: 0; max-width: none; min-height: 100vh; height: 100vh;
  background: var(--content-bg); border: 0; padding: 32px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-sizing: border-box;
}
#app.is-guest .side-head { margin-bottom: 18px; display: flex; justify-content: center; }
#app.is-guest .side-brand { gap: 12px; }
#app.is-guest .brand-logo { width: 40px; height: 40px; border-radius: 11px; font-size: 14px; }
#app.is-guest .side-head h1 { font-size: 18px; }
#app.is-guest #register-card {
  width: min(380px, 92vw); background: var(--card-bg);
  border: 1px solid var(--border); border-radius: var(--radius-modal);
  box-shadow: var(--shadow-pop); padding: 28px; box-sizing: border-box;
  display: block;
}
#app.is-guest #register-form { display: flex; flex-direction: column; gap: 8px; }
#app.is-guest #register-form label { font-size: 13px; color: var(--text-2); margin-top: 4px; }
#app.is-guest #register-form input { height: 38px; }
#app.is-guest #join-btn {
  margin-top: 14px; width: 100%; height: 40px; font-size: 14px;
  border-radius: var(--radius-pill); background: var(--primary); color: #fff;
}
#app.is-guest #join-btn:hover { background: var(--primary-hover); }
#app.is-guest .side-head .brand-sub { display: block; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  #sidebar { width: 220px; min-width: 220px; padding: 16px 12px; }
  #aiteam-cmdbar { padding: 10px 14px; }
  #empty-state, #conversation, #decisions-view, #mailbox-view,
  #aiteam-board-view, #aiteam-files-view { padding: 14px 14px 22px; }
  #aiteam-board-columns { grid-template-columns: repeat(5, minmax(320px, 84vw)); }
}
/* ---------- v0.15 发布表单横向收口(避免 发布任务 按钮被裁切) ---------- */
#aiteam-board-create-form {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
#aiteam-board-create-form #aiteam-board-new-title { flex: 1 1 300px; min-width: 220px; }
#aiteam-board-create-form #aiteam-board-new-assignee,
#aiteam-board-create-form #aiteam-board-new-target-session { flex: 1 1 150px; min-width: 130px; }
#aiteam-board-create-form #aiteam-board-new-priority,
#aiteam-board-create-form #aiteam-board-new-estimate,
#aiteam-board-create-form #aiteam-board-new-due { flex: 0 1 140px; min-width: 110px; }
#aiteam-board-create-form #aiteam-board-new-deps { flex: 1 1 180px; min-width: 140px; }
#aiteam-board-create-form #aiteam-board-create-btn { flex: 0 0 auto; }
#aiteam-board-create-form #aiteam-board-new-body { flex: 1 1 100%; order: 9; min-height: 34px; }
#aiteam-board-create-form .aiteam-board-create-dispatch { flex: 1 1 100%; order: 11; }

/* ==========================================================================
   v0.16 看板查看体验(空列折叠/状态 chips/面板折叠/列区填充) + 互聊会话多选
   ========================================================================== */

/* ---------- 状态计数 chips + 隐藏空列开关 ---------- */
.aiteam-board-chipsbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 10px;
}
.aiteam-board-status-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.aiteam-board-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong); background: var(--card-bg);
  color: var(--text-2); font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.aiteam-board-chip b { color: var(--text-1); font-variant-numeric: tabular-nums; }
.aiteam-board-chip.is-zero { opacity: .72; border-style: dashed; }
.aiteam-board-chip:hover { border-color: var(--primary); color: var(--primary); }
.aiteam-board-chip.is-temp-shown { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.aiteam-board-viewopts { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.aiteam-board-viewopts .ghost { padding: 4px 10px; font-size: 12px; }
.aiteam-board-viewopts .ghost.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* 折叠面板:hidden 优先于 display 声明 */
#aiteam-board-insights[hidden], #aiteam-board-team[hidden], #aiteam-board-create-form[hidden] { display: none !important; }

/* ---------- 列区填满高度 / 列头 sticky / 列内滚动 / 可见列自适应 ---------- */
#aiteam-board-view { display: flex; flex-direction: column; min-height: 0; }
#aiteam-board-columns {
  flex: 1; min-height: 0; align-items: stretch;
  overflow-x: auto; overflow-y: hidden;
}
.aiteam-board-col {
  max-height: 100%; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
}
.aiteam-board-col-head {
  position: sticky; top: 0; z-index: 2;
  background: var(--content-bg); border-radius: 12px 12px 0 0;
}
.aiteam-board-col-body {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px; padding: 2px 2px 6px;
}
.aiteam-board-col-foot { flex: none; padding-top: 8px; }
#aiteam-board-columns.is-single-column .aiteam-board-col {
  width: 100%; max-width: 920px; justify-self: center;
}
.aiteam-board-empty-state {
  grid-column: 1 / -1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  min-height: 220px; padding: 28px; text-align: center;
  background: var(--content-bg); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-card); color: var(--text-2);
}
.aiteam-board-empty-state strong { font-size: 15px; color: var(--text-1); }

/* ---------- AI 互聊:会话多选 ---------- */
#disc-form {
  display: flex; flex-direction: column; gap: 10px; flex-wrap: nowrap;
  padding: 14px; background: var(--content-bg);
  border: 1px solid var(--border); border-radius: var(--radius-card);
}
#disc-form > input#disc-topic { width: 100%; }
.disc-session-picker { display: flex; flex-direction: column; gap: 8px; }
.disc-session-picker-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-2);
}
.disc-session-picker-head button { padding: 3px 10px; font-size: 11.5px; }
#disc-members {
  width: 100%; min-height: 132px; padding: 6px;
  background: var(--input-bg); border: 1px solid var(--border-strong);
  border-radius: 10px; color: var(--text-1); font-size: 12.5px;
}
#disc-members optgroup { color: var(--text-2); font-size: 11.5px; }
#disc-members option { color: var(--text-1); padding: 3px 4px; }
.disc-selected-sessions { display: flex; gap: 6px; flex-wrap: wrap; min-height: 22px; }
.disc-session-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  background: var(--primary-soft); color: var(--primary);
  border: 1px solid rgba(199, 22, 30, .24); font-size: 11.5px;
}
.disc-session-remove {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  font-size: 11px; padding: 0 2px; text-decoration: underline;
}
.disc-session-hint { font-size: 11.5px; color: var(--text-3); }
.disc-actions { display: flex; gap: 8px; align-items: center; }
#disc-form label { font-size: 12px; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }

@media (max-width: 900px) {
  .aiteam-board-viewopts { margin-left: 0; }
  #aiteam-board-columns.is-single-column .aiteam-board-col { max-width: none; }
}
/* v0.16 互聊主题/轮次输入恢复白底细边 */
#disc-form #disc-topic, #disc-form #disc-rounds {
  background: var(--input-bg); border: 1px solid var(--border-strong);
  border-radius: var(--radius-input); padding: 7px 10px; color: var(--text-1);
}
#disc-form #disc-topic { flex: 1 1 100%; width: 100%; }
#disc-form #disc-topic:focus, #disc-form #disc-rounds:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }

/* ==========================================================================
   v0.17 品牌红 v4 对齐线上参考 webui
   页面/侧栏/顶栏 #f5f5f7;主内容白色大面板圆角18;面板内白卡圆角14
   红主色 #c7161e / hover #a81118 / 顶栏 active 红色下划线;KPI 五色 tinted
   ========================================================================== */

/* ---------- 页面/壳层 ---------- */
html, body { background: var(--content-bg); }
#app { background: var(--content-bg); }
#sidebar {
  width: 248px; min-width: 248px;
  background: var(--content-bg);
  border-right: 1px solid var(--border);
  padding: 16px 16px 14px;
  gap: 12px;
}
.side-head { padding: 2px 0 10px; border-bottom: 1px solid transparent; }
.brand-logo {
  background: #a81118; color: #ffffff;
  border-radius: 9px; width: 34px; height: 34px;
  font-size: 13px; font-weight: 700;
}
.side-head h1 { font-size: 14px; font-weight: 700; }
.brand-sub { font-size: 12px; color: var(--text-2); }
#sidebar .card { background: transparent; border: 0; box-shadow: none; padding: 0; }
#sidebar .side-foot { border-top: 1px solid var(--border); padding-top: 10px; }
#sidebar .side-foot .ghost { background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); }
#sidebar .user-group { background: #fff; border: 1px solid var(--border); box-shadow: none; }
#sidebar .me-avatar { background: #fff; border: 1px solid var(--border); color: var(--primary); }
.session-option.active, .member.active, .channel-item.active { background: var(--primary); }
.session-option.active .session-name, .session-option.active small,
.session-option.active .agent-badge, .member.active .m-name, .member.active .m-id { color: #fff; }

/* ---------- 顶栏:薄条 + 标签导航(红色 active 下划线) ---------- */
#aiteam-cmdbar {
  height: 48px; min-height: 48px; padding: 0 18px;
  background: var(--content-bg);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  display: flex; align-items: stretch; gap: 14px;
  position: static;
}
#aiteam-tabs {
  display: flex; flex-direction: row; align-items: stretch; gap: 4px;
  height: 100%; background: transparent; padding: 0; margin: 0;
}
.aiteam-tab {
  height: 100%; padding: 0 14px; width: auto;
  display: inline-flex; align-items: center;
  border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: transparent; color: var(--text-2);
  font-size: 13.5px; font-weight: 500; letter-spacing: 0;
}
.aiteam-tab:hover { background: transparent; color: var(--text-1); border-color: transparent; }
.aiteam-tab.active {
  color: var(--primary); border-bottom-color: var(--primary);
  background: transparent; font-weight: 600;
}
.aiteam-tab.active:hover { background: transparent; color: var(--primary-hover); }
.aiteam-cmdbar-right { margin-left: auto; display: inline-flex; align-items: center; gap: 12px; }
.aiteam-clock { font-size: 12px; color: var(--text-2); }
.aiteam-cmd-state { font-size: 12px; color: var(--text-2); }
.aiteam-cmd-version { font-size: 12px; color: var(--text-3); }

/* ---------- 主内容:白色大面板 ---------- */
#main { background: var(--content-bg); padding: 16px 20px 20px; display: flex; flex-direction: column; min-height: 0; }
#aiteam-main-panel {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  background: #ffffff; border: 1px solid var(--border); border-radius: 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 30px rgba(0, 0, 0, .04);
  padding: 18px 20px 22px; box-sizing: border-box; overflow: hidden;
}
#aiteam-panel-header { flex: none; padding: 0 0 12px; display: flex; align-items: center; gap: 10px; }
#aiteam-page-title { font-size: 16px; font-weight: 700; letter-spacing: -.01em; color: var(--text-1); }
#empty-state, #conversation, #decisions-view, #mailbox-view,
#aiteam-board-view, #aiteam-files-view { padding: 0; background: transparent; }
#empty-state { flex: 1; min-height: 0; }
#empty-state .empty-inner h2 { font-size: 18px; }
#conversation { flex: 1; min-height: 0; gap: 10px; }
#messages { border: 1px solid var(--border); border-radius: 14px; }
#conv-header, #dec-header, #mb-header, #aiteam-board-header, #aiteam-files-header { padding: 0 0 10px; border: 0; background: transparent; }
#ask-form { border: 1px solid var(--border); border-radius: 14px; }

/* ---------- 看板:白色面板内重排,列浅灰/卡片白 ---------- */
#aiteam-board-view { flex: 1; min-height: 0; }
#aiteam-board-chipsbar { margin: 0 0 10px; }
.aiteam-board-chip { background: #fff; border-color: var(--border-strong); }
.aiteam-board-chip.is-temp-shown { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.aiteam-board-viewopts .ghost { background: #fff; }
.aiteam-board-toolbar {
  background: var(--content-bg); border: 1px solid var(--border);
  border-radius: 14px; padding: 10px 12px; margin: 0 0 10px;
}
.aiteam-board-toolbar input, .aiteam-board-toolbar select { background: #fff; border-color: var(--border-strong); }
#aiteam-board-create-form {
  background: var(--content-bg); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px; margin: 0 0 10px;
}
#aiteam-board-create-form input, #aiteam-board-create-form select, #aiteam-board-create-form textarea { background: #fff; }
.aiteam-board-col {
  background: var(--content-bg); border: 1px solid var(--border);
  border-radius: 14px; padding: 10px;
}
.aiteam-board-col-head { background: var(--content-bg); }
.aiteam-board-col-title { font-size: 13.5px; font-weight: 600; }
.aiteam-board-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: none;
}
.aiteam-board-card:hover { border-color: var(--border-strong); box-shadow: 0 2px 10px rgba(0, 0, 0, .06); }
.aiteam-board-empty-state { background: var(--content-bg); border-radius: 14px; }
.aiteam-board-quick-btn { background: #fff; border-radius: 14px; }
.aiteam-board-table { background: #fff; border-radius: 14px; }
.aiteam-board-table th { background: var(--content-bg); }
.aiteam-board-list-view { padding: 0; }
#aiteam-board-insights .aiteam-board-panel { background: #fff; border: 1px solid var(--border); border-radius: 14px; }

/* ---------- KPI 摘要卡:tinted 五色 + 顶部色条 + 数字着色 ---------- */
.aiteam-board-summary-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.aiteam-board-summary-card {
  position: relative; overflow: hidden; padding: 12px 14px 10px;
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: none;
}
.aiteam-board-summary-card::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--border-strong);
}
.aiteam-board-summary-card b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--text-1); line-height: 1.25; }
.aiteam-board-summary-card span { font-size: 11.5px; color: var(--text-2); }
.aiteam-board-summary-card:nth-child(1) { background: #fdecec; border-color: #f3d2d2; }
.aiteam-board-summary-card:nth-child(1)::before { background: #c7161e; }
.aiteam-board-summary-card:nth-child(1) b { color: #c7161e; }
.aiteam-board-summary-card:nth-child(2) { background: #f2f2f4; border-color: #e3e3e6; }
.aiteam-board-summary-card:nth-child(2)::before { background: #9b9ba1; }
.aiteam-board-summary-card:nth-child(3) { background: #fff6e8; border-color: #f1e2c9; }
.aiteam-board-summary-card:nth-child(3)::before { background: #d98a00; }
.aiteam-board-summary-card:nth-child(3) b { color: #a05a00; }
.aiteam-board-summary-card:nth-child(4) { background: #f1efff; border-color: #ddd8fb; }
.aiteam-board-summary-card:nth-child(4)::before { background: #6355d8; }
.aiteam-board-summary-card:nth-child(4) b { color: #4f43c4; }
.aiteam-board-summary-card:nth-child(5) { background: #e9f8fb; border-color: #cdeef3; }
.aiteam-board-summary-card:nth-child(5)::before { background: #0e8a94; }
.aiteam-board-summary-card:nth-child(5) b { color: #0e7c86; }
.aiteam-board-summary-card:nth-child(n+6) { background: #fff; }
.aiteam-board-summary-card:nth-child(n+6)::before { background: var(--border-strong); }
.aiteam-board-summary-card:nth-child(n+6) b { color: var(--text-2); }

/* ---------- 红主色语义 ---------- */
#join-btn, #send-btn, #aiteam-board-create-btn, #aiteam-board-dispatch-submit,
#aiteam-files-upload-btn, #disc-start, .pending-ops .ok {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
#join-btn:hover, #send-btn:hover, #aiteam-board-create-btn:hover,
#aiteam-board-dispatch-submit:hover, #aiteam-files-upload-btn:hover, #disc-start:hover {
  background: var(--primary-hover); border-color: var(--primary-hover);
}
#disc-form { background: var(--content-bg); border: 1px solid var(--border); border-radius: 14px; }
#disc-form #disc-topic, #disc-form #disc-rounds { background: #fff; }
.disc-session-tag { background: var(--primary-soft); color: var(--primary); border-color: rgba(199, 22, 30, .24); }
.disc-session-remove { color: var(--primary); }
.aiteam-board-drawer-header { background: var(--content-bg); }
.aiteam-board-drawer-panel { border-left: 1px solid var(--border-strong); }
.aiteam-board-menu-item:hover { background: var(--primary-soft); color: var(--primary); }
.aiteam-board-view-btn.active { background: var(--primary-soft); color: var(--primary); }
.divider.done { background: var(--success-weak); color: var(--ok); }
.aiteam-board-status-chip.status-doing { background: var(--primary-soft); color: var(--primary); border-color: rgba(199, 22, 30, .24); }
.aiteam-board-progress-bar i { background: var(--primary); }
.aiteam-board-linkbtn { color: var(--primary); }
.aiteam-files-meta .aiteam-files-task { color: var(--primary); }
.aiteam-files-icon { background: var(--primary-soft); color: var(--primary); }

/* ---------- 登录游客态 ---------- */
#app.is-guest #sidebar { background: var(--content-bg); }
#app.is-guest #register-card { background: #fff; border: 1px solid var(--border); border-radius: 18px; }
#app.is-guest #join-btn { background: var(--primary); color: #fff; }
#app.is-guest .brand-logo { background: #a81118; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  #main { padding: 10px; }
  #aiteam-main-panel { padding: 14px; border-radius: 16px; }
  #aiteam-cmdbar { padding: 0 10px; }
  .aiteam-tab { padding: 0 10px; }
  .aiteam-board-summary-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* v0.18 会话工作区标签:过长截断,title 完整 */
.session-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.aiteam-board-target-session { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
#conv-sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#conv-name { max-width: min(60vw, 720px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== v0.22 任务多会话协作 ===== */
.aiteam-board-collab-hint { flex: 1 1 100%; font-size: 11.5px; color: var(--text-3); line-height: 1.4; }
#aiteam-board-new-participants {
  min-width: 240px; min-height: 78px; padding: 6px;
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-input);
  color: var(--text-1); font-size: 12.5px;
}
.aiteam-board-participants-badge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: var(--radius-pill); background: var(--primary-soft); color: var(--primary);
  border: 1px solid rgba(199, 22, 30, .24); font-size: 11px;
}
.aiteam-board-collab-badge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: var(--radius-pill); background: var(--primary); color: #fff; font-size: 11px; font-weight: 600;
}
.aiteam-board-collab-row { font-size: 12px; color: var(--text-2); margin: 3px 0; line-height: 1.5; }
.aiteam-board-collab-row.is-owner { color: var(--text-1); font-weight: 600; }
.aiteam-board-collab-status { margin: 6px 0; font-size: 12.5px; font-weight: 600; color: var(--primary); }
.aiteam-board-collab-status.done { color: var(--ok); }
.aiteam-board-collab-status.bad { color: var(--danger); }
.aiteam-board-collab-statement {
  margin: 4px 0; padding-left: 8px; border-left: 2px solid var(--border-strong);
  font-size: 12px; color: var(--text-2); line-height: 1.5;
}
.aiteam-board-collab-open {
  margin-top: 8px; padding: 6px 12px; border-radius: var(--radius-input);
  border: 1px solid var(--primary); background: var(--primary); color: #fff;
  font-size: 12.5px; cursor: pointer;
}
.aiteam-board-collab-open:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.aiteam-board-collab-card { width: min(560px, 92vw); max-height: 86vh; overflow: auto; }
.aiteam-board-collab-task { font-size: 12.5px; color: var(--text-2); margin: 4px 0 10px; }
.aiteam-board-collab-card label { display: block; font-size: 12px; color: var(--text-2); margin: 8px 0 4px; }
.aiteam-board-collab-card input[type="text"],
.aiteam-board-collab-card input:not([type]) { width: 100%; }
.aiteam-board-collab-card input { box-sizing: border-box; }
.aiteam-board-collab-card input[type="number"] { width: 96px; }
#aiteam-board-collab-sessions {
  width: 100%; min-height: 132px; box-sizing: border-box; padding: 6px;
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-input);
  color: var(--text-1); font-size: 12.5px;
}
.aiteam-board-collab-selected { margin: 6px 0; font-size: 11.5px; color: var(--text-2); line-height: 1.5; }
.aiteam-board-collab-error { margin: 6px 0; font-size: 12px; color: var(--danger); }
.aiteam-board-collab-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.aiteam-board-collab-actions button { padding: 7px 14px; border-radius: var(--radius-input); }
@media (max-width: 900px) {
  #aiteam-board-new-participants { min-width: 0; flex: 1 1 100%; }
}

/* ===== v0.23 任务协作室 ===== */
.aiteam-board-drawer-section label[for="aiteam-board-room-targets"] {
  display: block; margin: 8px 0 4px; font-size: 12px; color: var(--text-2);
}
#aiteam-board-room-targets {
  width: 100%; min-height: 64px; box-sizing: border-box; padding: 4px;
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-input);
  color: var(--text-1); font-size: 12px;
}
.aiteam-board-room-messages {
  margin: 8px 0; max-height: 240px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px; background: var(--content-bg); border: 1px solid var(--border); border-radius: var(--radius-card-sm);
}
.aiteam-board-room-empty { padding: 16px 8px; text-align: center; color: var(--text-3); font-size: 12px; }
.aiteam-board-room-msg { max-width: 88%; display: flex; flex-direction: column; gap: 2px; }
.aiteam-board-room-msg.is-user { align-self: flex-end; align-items: flex-end; }
.aiteam-board-room-msg.is-agent { align-self: flex-start; align-items: flex-start; }
.aiteam-board-room-msg-meta { font-size: 11px; color: var(--text-3); }
.aiteam-board-room-msg-text {
  padding: 7px 10px; border-radius: 12px; font-size: 12.5px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}
.aiteam-board-room-msg.is-user .aiteam-board-room-msg-text { background: var(--primary); color: #fff; }
.aiteam-board-room-msg.is-agent .aiteam-board-room-msg-text { background: #fff; border: 1px solid var(--border); color: var(--text-1); }
.aiteam-board-room-status { font-size: 11.5px; color: var(--text-3); margin: 2px 0 6px; min-height: 16px; }
.aiteam-board-room-form { display: flex; gap: 8px; align-items: flex-end; }
.aiteam-board-room-form textarea {
  flex: 1; min-height: 54px; box-sizing: border-box; resize: vertical;
  padding: 7px 9px; background: #fff; border: 1px solid var(--border-strong);
  border-radius: var(--radius-input); color: var(--text-1); font-size: 12.5px;
}
.aiteam-board-room-form button { padding: 7px 14px; border-radius: var(--radius-input); }
.aiteam-board-room-error { font-size: 12px; color: var(--danger); margin: 4px 0; }

/* ===== v0.24 注入方式(delivery) ===== */
.delivery-field {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-2); white-space: nowrap;
}
.delivery-field select {
  padding: 4px 8px; border-radius: var(--radius-input);
  border: 1px solid var(--border-strong); background: #fff;
  color: var(--text-1); font-size: 11.5px;
}
#ask-form .delivery-field { flex: none; }
.aiteam-board-create-dispatch .delivery-field { flex: 1 1 auto; }
.aiteam-board-room-form .delivery-field { flex: none; padding-bottom: 8px; }
.aiteam-board-collab-card .delivery-field { display: flex; margin: 8px 0 0; }
#aiteam-board-dispatch-body .delivery-field { display: flex; margin: 8px 0; }

/* ===== v0.25 团队 Lead/成员在线选择 ===== */
.aiteam-board-team-hint { font-size: 11.5px; color: var(--warning, #a05a00); }
.aiteam-board-team-field { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-2); }
.aiteam-board-team-field select {
  max-width: 240px; padding: 4px 8px; border-radius: var(--radius-input);
  border: 1px solid var(--border-strong); background: #fff; color: var(--text-1); font-size: 11.5px;
}
.aiteam-board-team-members-wrap {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  flex: 1 1 100%; padding-top: 2px;
}
.aiteam-board-team-field-label { font-size: 11.5px; color: var(--text-2); }
.aiteam-board-team-members { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; }
.aiteam-board-team-member-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong); background: #fff;
  font-size: 11.5px; color: var(--text-1); cursor: pointer;
}
.aiteam-board-team-member-chip input { margin: 0; accent-color: var(--primary); }
.aiteam-board-team-member-chip:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* ===== v0.26 团队在线会话选择 ===== */
.aiteam-board-team-field select { max-width: 320px; }
.aiteam-board-team-member-chip { max-width: 100%; }
.aiteam-board-team-member-chip span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px;
}

/* ===== v0.27 自动组队 ===== */
.aiteam-board-auto-team {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  flex: 1 1 100%; padding: 8px 10px; margin: 2px 0;
  background: var(--primary-soft); border: 1px solid rgba(199, 22, 30, .22); border-radius: var(--radius-input);
}
.aiteam-board-auto-team-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-1); font-weight: 600; cursor: pointer;
}
.aiteam-board-auto-team-toggle input { accent-color: var(--primary); margin: 0; }
.aiteam-board-auto-team-preview { font-size: 11.5px; color: var(--text-2); flex: 1 1 auto; min-width: 200px; }
.aiteam-board-auto-team .ghost { padding: 4px 10px; font-size: 11.5px; }
.aiteam-board-manual-team { display: contents; }
#aiteam-board-manual-team[hidden] { display: none !important; }

/* ===== v0.30 用户输入 / Agent 输出 区分与来源会话 ===== */
.msg-role.role-user {
  background: #f2f2f4; color: #6e6e73; border-color: #d2d2d7;
}
.msg.me .msg-role.role-user {
  background: #fff; color: #6e6e73; border-color: #d2d2d7;
}
.msg-role.role-agent {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.msg.me .msg-role.role-agent,
.msg.them .msg-role.role-agent {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.msg-source {
  display: block; margin-top: 4px; font-size: 11px; line-height: 1.5;
  color: var(--text-3); word-break: break-all;
}
.msg.me .msg-source { color: var(--text-2); }
.mb-source {
  font-size: 11px; color: var(--text-3); margin-left: 4px;
}
.pending-source {
  font-size: 11px; color: var(--text-3); margin: 2px 0 4px;
}
.aiteam-board-room-msg-role {
  display: inline-flex; align-items: center; padding: 0 7px;
  border-radius: var(--radius-pill); font-size: 10.5px; font-weight: 600; line-height: 1.6;
}
.aiteam-board-room-msg-role.is-user { background: #f2f2f4; color: #6e6e73; border: 1px solid #d2d2d7; }
.aiteam-board-room-msg-role.is-agent { background: var(--primary); color: #fff; border: 1px solid var(--primary); }
.aiteam-board-room-msg-source { font-size: 11px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.aiteam-board-room-msg-user { font-size: 11px; color: var(--text-3); }
.aiteam-board-room-msg-time { font-size: 11px; color: var(--text-3); }
