* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  height: 100vh;
  overflow: hidden;
  background: #f5f7fa;
  color: #333;
}

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: linear-gradient(135deg, #4361ee, #7209b7);
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.logo { font-size: 18px; font-weight: 600; }
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.online-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff6b6b;
}
.online-indicator.online { background: #51cf66; }

/* ── Layout ── */
.layout {
  display: flex;
  height: calc(100vh - 52px);
}

/* ── Sidebar ── */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: white;
  border-right: 1px solid #e9ecef;
  display: flex;
  flex-direction: column;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #e9ecef;
}
.sidebar-header h3 { font-size: 15px; }
.thread-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.thread-item {
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 4px;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.thread-item:hover { background: #f0f3ff; }
.thread-item.active {
  background: #eef2ff;
  border-color: #4361ee;
}
.thread-title { font-size: 14px; font-weight: 600; color: #4361ee; }
.thread-meta { font-size: 12px; color: #868e96; margin-top: 2px; }
.thread-preview { font-size: 12px; color: #adb5bd; margin-top: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ── Main ── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fafbfc;
}
.thread-header {
  padding: 14px 20px;
  border-bottom: 1px solid #e9ecef;
  background: white;
}
.thread-header h2 { font-size: 16px; font-weight: 600; }

/* ── Messages ── */
.message-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.message {
  margin-bottom: 16px;
  padding: 12px 16px;
  background: white;
  border-radius: 10px;
  border: 1px solid #e9ecef;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.message.msg-decision { border-left: 4px solid #40c057; }
.message.msg-task { border-left: 4px solid #f59f00; }
.message.msg-result { border-left: 4px solid #4361ee; }
.message.msg-discussion { border-left: 4px solid #dee2e6; }
.msg-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}
.msg-author { font-weight: 600; color: #495057; }
.msg-type { color: #868e96; font-size: 12px; }
.msg-time { color: #adb5bd; font-size: 12px; margin-left: auto; }
.msg-content {
  font-size: 14px;
  line-height: 1.7;
  color: #333;
}

/* ── Input ── */
.input-area {
  padding: 12px 20px;
  border-top: 1px solid #e9ecef;
  background: white;
}
.input-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.input-toolbar select {
  padding: 6px 10px;
  border: 1px solid #dde1e6;
  border-radius: 6px;
  font-size: 13px;
  background: white;
}
.input-row {
  display: flex;
  gap: 8px;
}
.input-row textarea {
  flex: 1;
  padding: 10px;
  border: 1px solid #dde1e6;
  border-radius: 8px;
  font-size: 14px;
  resize: vertical;
  font-family: inherit;
}
.input-row textarea:focus {
  outline: none;
  border-color: #4361ee;
  box-shadow: 0 0 0 3px rgba(67,97,238,0.1);
}

/* ── Buttons ── */
.btn {
  padding: 6px 14px;
  border: 1px solid #dde1e6;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.btn:hover { background: #f0f3ff; }
.btn-primary {
  background: #4361ee;
  color: white;
  border-color: #4361ee;
}
.btn-primary:hover { background: #3451d1; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── States ── */
.loading, .empty, .placeholder {
  text-align: center;
  color: #adb5bd;
  padding: 40px 20px;
  font-size: 14px;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: white;
  padding: 24px;
  border-radius: 12px;
  width: 460px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal h3 { margin-bottom: 12px; }
.modal input, .modal textarea {
  border: 1px solid #dde1e6;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
.modal input:focus, .modal textarea:focus {
  outline: none;
  border-color: #4361ee;
}

/* ═══ IM 体验升级（2026-08-12）═══ */

/* ── 消息气泡 ── */
.message {
  display: flex;
  flex-direction: column;
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.message.own {
  align-self: flex-end;
  background: #4361ee;
  color: white;
  border: none;
  border-top-right-radius: 4px;
}
.message.own .msg-author { color: #dbe4ff; }
.message.own .msg-type { color: #a5b8ff; }
.message.own .msg-time { color: #a5b8ff; }
.message.own .msg-content { color: white; }
.message.own .msg-content a { color: #c7d2fe; }
.message.other {
  align-self: flex-start;
  background: white;
  border: 1px solid #e9ecef;
  border-top-left-radius: 4px;
}
.message.mentioned {
  border: 2px solid #f59f00 !important;
  box-shadow: 0 0 0 3px rgba(245,159,0,0.12);
}
.mention-tag {
  display: inline-block;
  background: #f59f00;
  color: white;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  margin-right: 6px;
}
.mention {
  color: #2563eb;
  font-weight: bold;
}
.message.own .mention {
  color: #ffd43b;
}
.message-area { display: flex; flex-direction: column; gap: 10px; }

/* ── 线程未读徽标 ── */
.thread-item { position: relative; }
.thread-item.unread { background: #f8f9ff; }
.thread-item.unread .thread-title { font-weight: 700; }
.unread-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #fa5252;
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.thread-item.unread .thread-preview { color: #495057; font-weight: 500; }

/* ── 顶部状态栏 ── */
.statusbar {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid rgba(255,255,255,0.25);
}
.statusbar .svc {
  display: flex;
  align-items: center;
  gap: 4px;
}
.statusbar .svc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #adb5bd;
}
.statusbar .svc-dot.up { background: #51cf66; }
.statusbar .svc-dot.down { background: #fa5252; }
.statusbar .member-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 3px;
}
.statusbar .member-dot.online { background: #51cf66; }
.statusbar .member-dot.offline { background: #fa5252; }
.statusbar .member-dot.unknown { background: #fcc419; }
.statusbar .sep { color: rgba(255,255,255,0.3); }
