* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: #f0f2f5; color: #333; min-height: 100vh;
}
#app { display: flex; height: 100vh; }

/* ======================== LOGIN OVERLAY ======================== */
.login-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: #f0f2f5; display: flex; justify-content: center; align-items: center;
  z-index: 9999;
}
.login-box {
  background: #fff; padding: 40px; border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08); width: 320px; text-align: center;
}
.login-input {
  width: 100%; padding: 12px 14px; background: #f7f8fa; border: 1px solid #dde1e6;
  border-radius: 8px; color: #333; font-size: 15px; outline: none; transition: border-color 0.2s;
}
.login-input:focus { border-color: #1a73e8; }

/* ======================== TOOLBAR ======================== */
#toolbar {
  width: 320px; min-width: 320px; background: #fff; padding: 18px 16px;
  overflow-y: auto; border-right: 1px solid #e5e5e5;
}
#toolbar h2 { color: #1a73e8; font-size: 17px; margin-bottom: 14px; text-align: center; font-weight: 700; }

.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: #666; margin-bottom: 3px; }
.field input[type="text"], .field input[type="number"], .field textarea, .field select {
  width: 100%; padding: 7px 10px; background: #f7f8fa; border: 1px solid #dde1e6;
  border-radius: 6px; color: #333; font-size: 13px; outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: #1a73e8; }
.field input[type="file"] { font-size: 11px; color: #888; }
.checkbox-label { display: flex !important; align-items: center; gap: 6px; cursor: pointer; }
.checkbox-label input[type="checkbox"] { accent-color: #1a73e8; }

.btn {
  width: 100%; padding: 9px; border: none; border-radius: 7px; font-size: 13px;
  cursor: pointer; margin-bottom: 6px; font-weight: 600; transition: all 0.15s;
}
.btn-sm { font-size: 12px; padding: 6px; }
.btn-primary { background: #1a73e8; color: #fff; }
.btn-primary:hover { background: #1557b0; }
.btn-danger { background: #ff4d4f; color: #fff; }
.btn-danger:hover { background: #d9363e; }
.btn-export { background: #fff; color: #1a73e8; border: 2px solid #1a73e8; }
.btn-export:hover { background: #1a73e8; color: #fff; }
.btn-row { display: flex; gap: 6px; }
.btn-row .btn { flex: 1; }
.btn-secondary { background: #f7f8fa; color: #555; border: 1px solid #dde1e6; }
.btn-secondary:hover { background: #edf0f5; color: #333; }

/* Accordion */
.accordion { margin-bottom: 6px; border-radius: 8px; overflow: hidden; border: 1px solid #e5e5e5; }
.accordion-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; background: #f7f8fa; cursor: pointer;
  font-size: 13px; font-weight: 600; color: #1a73e8; user-select: none;
}
.accordion-header:hover { background: #edf0f5; }
.accordion-arrow { transition: transform 0.2s; font-size: 11px; color: #999; }
.accordion:not(.open) .accordion-arrow { transform: rotate(-90deg); }
.accordion-body { padding: 10px 12px; background: #fff; }

/* Avatar */
.avatar-row { display: flex; align-items: center; gap: 8px; }
.avatar-thumb {
  width: 34px; height: 34px; border-radius: 4px; object-fit: cover;
  flex-shrink: 0; border: 1px solid #dde1e6;
}

/* Message list */
.msg-list-panel { max-height: 280px; overflow-y: auto; }
.msg-list-panel::-webkit-scrollbar { width: 4px; }
.msg-list-panel::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }
.msg-list-empty { text-align: center; color: #aaa; font-size: 12px; padding: 14px 0; }
.msg-list-item {
  display: flex; align-items: center; gap: 6px; padding: 5px 7px;
  background: #f7f8fa; border-radius: 5px; margin-bottom: 3px;
  font-size: 11px; color: #444; cursor: grab;
  border: 1px solid transparent; transition: border-color 0.15s;
}
.msg-list-item:hover { border-color: #d0d5dd; }
.msg-list-item.drag-over { border-color: #1a73e8; border-style: dashed; }
.msg-tag {
  font-size: 10px; padding: 1px 5px; border-radius: 3px; flex-shrink: 0;
  font-weight: 600; color: #fff;
}
.msg-tag.left { background: #666; }
.msg-tag.right { background: #4a90d9; }
.msg-tag.time { background: #888; }
.msg-tag.system { background: #9b59b6; }
.msg-text-preview { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-actions { display: flex; gap: 3px; flex-shrink: 0; }
.msg-actions button {
  background: none; border: none; cursor: pointer; font-size: 11px;
  color: #999; padding: 2px 4px; border-radius: 3px;
}
.msg-actions button:hover { background: #edf0f5; color: #1a73e8; }

/* ======================== PREVIEW ======================== */
#preview-container {
  flex: 1; display: flex; justify-content: center; align-items: flex-start;
  padding: 24px; overflow-y: auto; background: #e8eaed;
}
#phone-frame {
  width: 360px; background: #ebedf0;
  box-shadow: 0 2px 20px rgba(0,0,0,0.12); overflow: hidden; border-radius: 0;
}
#wechat-screen {
  display: flex; flex-direction: column; width: 360px; height: 1314px;
  background: #ebedf0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ===== 状态栏 ===== */
.status-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 21px 0px 22px; background: #ebedf0; color: #000;
  height: 22px; flex-shrink: 0;
}
.sb-left { display: flex; align-items: center; gap: 4px; }
.sb-time { font-size: 12px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.sb-right { display: flex; align-items: center; gap: 4px; }
.sb-hd { font-size: 9px; font-weight: 700; letter-spacing: -0.5px; }
.sb-battery { position: relative; display: inline-flex; align-items: center; }

/* ===== 聊天头部 ===== */
.chat-header {
  display: flex; align-items: center; padding: 0 22px 0 16px;
  background: #ebedf0; border-bottom: none;
  height: 42px; flex-shrink: 0;
}
.ch-left { width: 34px; flex-shrink: 0; display: flex; align-items: center; }
.ch-center { flex: 1; padding-left: 6px; }
.ch-name { font-size: 17px; font-weight: 500; color: #000; display: block; line-height: 1.15; }
.ch-tag { font-size: 12px; color: #999; display: block; margin-top: 1px; }
.ch-right { display: flex; align-items: center; gap: 32px; flex-shrink: 0; }

/* ===== 聊天内容 ===== */
.chat-body {
  flex: 1; padding: 10px; background: #ebedf0;
  display: flex; flex-direction: column; gap: 14px;
  overflow: hidden;
}
.chat-time {
  text-align: center; font-size: 11px; color: #b2b2b2;
  padding: 2px 0; line-height: 1.6;
}
.chat-system {
  text-align: center; font-size: 12px; color: #b2b2b2;
  padding: 2px 0;
}

/* 消息行 */
.msg-row { display: flex; align-items: flex-start; gap: 10px; }
.msg-row.left { flex-direction: row; }
.msg-row.right { flex-direction: row-reverse; }

/* 头像 */
.msg-avatar {
  width: 35px; height: 35px; border-radius: 4px; flex-shrink: 0;
  overflow: hidden; background: #e0e0e0;
}
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 气泡 */
.msg-bubble {
  max-width: 255px; padding: 10px 12px; font-size: 15px;
  line-height: 1.35; word-break: break-word; position: relative;
  border-radius: 5px;
}
.msg-row.left .msg-bubble {
  background: #fff; color: #000;
}
.msg-row.left .msg-bubble::before {
  content: ''; position: absolute; top: 12px; left: -4px;
  width: 8px; height: 8px; background: #fff;
  transform: rotate(45deg);
}
.msg-row.right .msg-bubble {
  background: #c9e7ff; color: #000;
}
.msg-row.right .msg-bubble::before {
  content: ''; position: absolute; top: 12px; right: -4px;
  width: 8px; height: 8px; background: #c9e7ff;
  transform: rotate(45deg);
}

/* 图片气泡 */
.msg-bubble.img-bubble {
  padding: 0; background: transparent !important;
  border-radius: 6px; overflow: hidden;
  max-width: none;
}
.msg-bubble.img-bubble::before { display: none; }
.msg-bubble.img-bubble img {
  width: 110px; display: block; border-radius: 6px;
}

/* ===== 快捷操作栏 ===== */
.pill-bar {
  display: flex; gap: 7px; padding: 7px 7px;
  background: #f5f6f7; border-top: 0.5px solid #e8e8e8;
  justify-content: center; align-items: center; flex-wrap: nowrap; flex-shrink: 0;
  height: 40px;
}
.pill {
  display: flex; align-items: center; gap: 5px;
  background: #fff; padding: 6px 9px; border-radius: 18px;
  white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.pill span { font-size: 11px; color: #222; }

/* ===== 输入栏 ===== */
.input-bar {
  display: flex; align-items: center; gap: 8px;
  height: 47px; padding: 6px 10px; background: #f5f6f7;
  border-top: 0.5px solid #e8e8e8;
  flex-shrink: 0;
}
.ib-field {
  flex: 1; height: 34px; background: #fff; border-radius: 4px;
  border: 0.5px solid #ddd;
}

/* ===== Android 导航 ===== */
.android-nav {
  display: flex; align-items: center; justify-content: center;
  gap: 40px; height: 40px; padding: 4px 0 6px; background: #fafbfc;
  border-top: 0.5px solid #e8e8e8;
  flex-shrink: 0;
}
.android-nav svg { opacity: 0.55; }

/* ===== Scrollbar ===== */
.chat-body::-webkit-scrollbar { width: 0; }
#toolbar::-webkit-scrollbar { width: 5px; }
#toolbar::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
