/* 集群人类小帮手 · 微信风格 UI */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #EDEDED;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
#app { display: flex; flex-direction: column; height: 100vh; max-width: 860px; margin: 0 auto; background: #EDEDED; }

/* ---------- 顶部 ---------- */
#topbar {
  background: linear-gradient(135deg, #07C160 0%, #06AD56 100%);
  color: #fff; padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.15); z-index: 10;
  flex-shrink: 0;
}
.top-left .title { font-size: 19px; font-weight: 700; letter-spacing: .5px; }
.top-left .subtitle { font-size: 12px; opacity: .85; margin-top: 2px; }
.top-right { display: flex; align-items: center; gap: 8px; }
.name-tag {
  background: rgba(255,255,255,.22); border-radius: 20px;
  padding: 4px 12px; font-size: 13px; font-weight: 600;
}
.icon-btn {
  background: rgba(255,255,255,.18); border: none; color: #fff;
  width: 34px; height: 34px; border-radius: 50%;
  font-size: 17px; cursor: pointer;
}
.icon-btn:active { background: rgba(255,255,255,.35); }

/* ---------- 消息区 ---------- */
#msgList {
  flex: 1; overflow-y: auto; padding: 16px 12px 8px;
  -webkit-overflow-scrolling: touch;
}
.msg { display: flex; margin-bottom: 14px; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.msg.me { justify-content: flex-end; }
.msg.other, .msg.ai { justify-content: flex-start; }

.bubble {
  max-width: 78%; padding: 10px 14px; border-radius: 14px;
  font-size: 16px; line-height: 1.55; word-break: break-word;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.msg.me .bubble {
  background: #95EC69; color: #222; border-top-right-radius: 4px;
}
.msg.other .bubble {
  background: #fff; color: #222; border-top-left-radius: 4px;
}
.msg.ai .bubble {
  background: #fff; color: #222; border-top-left-radius: 4px;
  border-left: 3px solid #07C160;
}
.msg.ai .bubble.notice { background: #FFF8E1; border-left-color: #F5A623; }

.sender {
  font-size: 12px; color: #999; margin: 0 4px 4px;
}
.msg.me .sender { text-align: right; }
.ts { font-size: 11px; color: #b0b0b0; margin-top: 4px; text-align: right; }

/* 图片消息 */
.bubble img.msg-img {
  max-width: 100%; max-height: 320px; border-radius: 8px;
  display: block; cursor: zoom-in; margin: 4px 0;
  background: #f0f0f0;
}
.bubble .img-caption { font-size: 13px; color: #555; margin-top: 4px; }
.bubble .file-link {
  display: flex; align-items: center; gap: 8px;
  background: #F5F5F5; border-radius: 8px; padding: 10px;
  text-decoration: none; color: #333; font-size: 14px; margin-top: 4px;
}
.bubble .file-link .file-icon { font-size: 26px; }
.bubble .file-link .file-name { word-break: break-all; }

/* 正在输入 */
.typing { display: none; justify-content: flex-start; }
.typing .bubble { background: #fff; border-top-left-radius: 4px; }
.typing.show { display: flex; }
.typing .dots { display: inline-flex; gap: 5px; padding: 4px 2px; }
.typing .dots span {
  width: 8px; height: 8px; border-radius: 50%; background: #bbb;
  animation: blink 1.2s infinite;
}
.typing .dots span:nth-child(2) { animation-delay: .2s; }
.typing .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .3; } 40% { opacity: 1; } }

/* ---------- 快捷条 ---------- */
#quickBar {
  display: flex; gap: 8px; padding: 8px 12px;
  background: #fff; border-top: 1px solid #e5e5e5; flex-shrink: 0;
  overflow-x: auto;
}
.quick-btn {
  flex-shrink: 0; border: 1px solid #07C160; background: #fff; color: #07C160;
  border-radius: 20px; padding: 8px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.quick-btn:active { background: #07C160; color: #fff; }

/* ---------- 输入区 ---------- */
#inputBar {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px; background: #F7F7F7; border-top: 1px solid #e0e0e0;
  flex-shrink: 0;
}
#input {
  flex: 1; border: none; border-radius: 20px; padding: 12px 16px;
  font-size: 16px; font-family: inherit; background: #fff;
  resize: none; max-height: 120px; outline: none;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.06);
}
.send-btn {
  background: #07C160; color: #fff; border: none;
  border-radius: 20px; padding: 12px 22px; font-size: 16px; font-weight: 700;
  cursor: pointer; flex-shrink: 0;
}
.send-btn:active { background: #059F52; }
.send-btn:disabled { background: #b8e6cd; }

/* ---------- 放大看图 ---------- */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 100;
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.lightbox img { max-width: 96%; max-height: 96%; border-radius: 6px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: #fff; border-radius: 16px; padding: 24px; width: 86%; max-width: 340px;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
}
.modal h3 { font-size: 18px; margin-bottom: 14px; }
.modal input {
  width: 100%; border: 1px solid #ddd; border-radius: 10px;
  padding: 12px; font-size: 16px; outline: none; margin-bottom: 14px;
}
.modal-btns { display: flex; justify-content: flex-end; }
.modal .hint { font-size: 12px; color: #999; margin-top: 10px; }

/* ---------- 时间分隔条 ---------- */
.time-sep {
  text-align: center; font-size: 12px; color: #b0b0b0;
  margin: 10px 0 14px;
}
.time-sep::before, .time-sep::after {
  content: ""; display: inline-block; width: 24px; height: 1px;
  background: #d8d8d8; vertical-align: middle; margin: 0 8px;
}

/* ---------- 新消息角标 ---------- */
.new-badge {
  position: fixed; bottom: 150px; left: 50%; transform: translateX(-50%);
  background: rgba(7,193,96,.92); color: #fff;
  padding: 8px 18px; border-radius: 20px; font-size: 14px; font-weight: 600;
  cursor: pointer; z-index: 50; box-shadow: 0 4px 14px rgba(0,0,0,.2);
  animation: fadeIn .2s ease;
}

/* ---------- 角色选择弹窗 ---------- */
.role-picker { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.role-opt {
  display: flex; align-items: center; gap: 10px;
  border: 2px solid #e5e5e5; border-radius: 12px; padding: 10px 12px;
  cursor: pointer; transition: all .15s; background: #fff;
}
.role-opt:hover { border-color: #07C160; background: #F0FAF4; }
.role-opt.selected { border-color: #07C160; background: #E8F7EE; box-shadow: 0 0 0 2px rgba(7,193,96,.15); }
.role-icon { font-size: 26px; }
.role-name { font-weight: 700; font-size: 15px; color: #333; }
.role-desc { font-size: 12px; color: #999; margin-left: auto; text-align: right; }

/* ---------- 手机终端看板 ---------- */
.device-strip {
  display: flex; gap: 8px; overflow-x: auto; padding: 10px 12px;
  background: #fff; border-bottom: 1px solid #eee; flex-shrink: 0;
}
.device-chip {
  flex-shrink: 0; border: 1px solid #ddd; border-radius: 10px;
  padding: 6px 12px; font-size: 12px; background: #fff;
  display: flex; flex-direction: column; align-items: center;
}
.device-chip .d-label { font-weight: 700; color: #07C160; }
.device-chip .d-channel { color: #666; margin-top: 2px; }
.device-chip .d-phone { color: #999; font-size: 11px; }

/* ---------- 任务看板 ---------- */
.board-toggle {
  background: rgba(255,255,255,.18); border: none; color: #fff;
  border-radius: 16px; padding: 6px 12px; font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.board-toggle.active { background: #fff; color: #07C160; }
.board-stats {
  background: #fff; border-radius: 12px; padding: 12px 14px;
  margin-bottom: 12px; font-size: 13px; color: #444;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  display: flex; flex-wrap: wrap; gap: 14px;
}
.board-stats .stat b { color: #07C160; font-size: 16px; }
.board-cols { display: flex; gap: 10px; align-items: flex-start; }
.board-col { flex: 1; min-width: 0; }
.col-head {
  font-size: 14px; font-weight: 700; padding: 8px 10px;
  border-radius: 8px 8px 0 0; color: #fff;
}
.col-todo { background: #F5A623; }
.col-doing { background: #4A90D9; }
.col-done { background: #07C160; }
.col-body {
  background: #fff; border-radius: 0 0 8px 8px; padding: 8px;
  min-height: 60px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.board-card {
  border: 1px solid #eee; border-radius: 8px; padding: 10px;
  margin-bottom: 8px; background: #fff;
}
.board-card .bc-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.board-card .bc-id {
  font-weight: 700; color: #07C160; font-size: 13px;
}
.board-card .bc-pri {
  font-size: 11px; padding: 2px 8px; border-radius: 10px; color: #fff;
}
.bc-pri.P0 { background: #E5484D; }
.bc-pri.P1 { background: #F5A623; }
.bc-pri.P2 { background: #8A8A8A; }
.board-card .bc-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.board-card .bc-desc { font-size: 12px; color: #666; margin-bottom: 6px; }
.board-card .bc-meta { font-size: 11px; color: #999; margin-bottom: 8px; }
.board-card .bc-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bc-btn {
  border: none; border-radius: 6px; padding: 6px 10px; font-size: 12px;
  font-weight: 600; cursor: pointer; color: #fff;
}
.bc-btn.claim { background: #4A90D9; }
.bc-btn.done { background: #07C160; }
.bc-btn.verify-ok { background: #07C160; }
.bc-btn.verify-no { background: #E5484D; }
.bc-btn:disabled { background: #ccc; cursor: not-allowed; }
.board-card.done-card { opacity: .75; }
.board-empty { color: #aaa; font-size: 12px; text-align: center; padding: 16px 0; }

/* ---------- 移动端微调 ---------- */
@media (max-width: 480px) {
  .bubble { max-width: 86%; font-size: 15.5px; }
  .top-left .title { font-size: 17px; }
  /* 刘海屏安全区（Prime 增强） */
  #topbar { padding-top: calc(12px + env(safe-area-inset-top)); }
  #inputBar { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  body { min-height: 100dvh; }
}
