* { box-sizing: border-box; margin: 0; padding: 0; }

html, body, #app { height: 100%; }

body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #0f1419;
  color: #e6e6e6;
  font-size: 15px;
}

/* ---------- login ---------- */
.login-wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 340px;
  background: #1a2230;
  border: 1px solid #2a3648;
  border-radius: 12px;
  padding: 32px 28px;
}

.login-card h1 {
  font-size: 28px;
  letter-spacing: 4px;
  text-align: center;
}

.subtitle {
  text-align: center;
  color: #7a8aa0;
  font-size: 13px;
  margin: 6px 0 24px;
}

.login-card label {
  display: block;
  font-size: 13px;
  color: #9fb0c5;
  margin-bottom: 8px;
  line-height: 1.5;
}

.login-card input, .modal input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #2a3648;
  background: #0f1419;
  color: #e6e6e6;
  font-size: 16px;
  outline: none;
}

.login-card input:focus, .modal input:focus { border-color: #4a7ec2; }

.login-card button {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #2f6dbd;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

.login-card button:disabled { opacity: 0.5; cursor: default; }

.error { color: #e06c75; font-size: 13px; margin-top: 10px; }

/* ---------- chat layout ---------- */
.chat-wrap {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 760px;
  margin: 0 auto;
  border-left: 1px solid #2a3648;
  border-right: 1px solid #2a3648;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #1a2230;
  border-bottom: 1px solid #2a3648;
}

.chat-header .me { font-weight: 600; }

.presence { font-size: 13px; color: #7a8aa0; }
.presence.on { color: #61af7a; }
.presence.on::before { content: "● "; }

.chat-header .link-btn { margin-left: 0; }
.chat-header .link-btn:nth-of-type(1) { margin-left: auto; }

.link-btn {
  background: none;
  border: none;
  color: #7a8aa0;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
}
.link-btn:hover { color: #c5d3e5; }

.msg-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty { text-align: center; color: #56657a; margin-top: 40px; }

.msg { max-width: 78%; align-self: flex-start; }
.msg.mine { align-self: flex-end; }

.msg-meta {
  font-size: 11px;
  color: #56657a;
  margin-bottom: 3px;
}
.msg.mine .msg-meta { text-align: right; }

.bubble {
  padding: 9px 13px;
  border-radius: 12px;
  background: #223047;
  word-break: break-word;
  white-space: pre-wrap;
  line-height: 1.5;
}
.msg.mine .bubble { background: #2f6dbd; }

.bubble.image { padding: 6px; }
.bubble.image img {
  max-width: 240px;
  max-height: 240px;
  border-radius: 8px;
  display: block;
  cursor: zoom-in;
}
.file-name { font-size: 11px; color: #9fb0c5; padding: 4px 6px 2px; }

.bubble.file a { color: #8fc1ff; text-decoration: none; word-break: break-all; }
.msg.mine .bubble.file a { color: #dceaff; }
.file-size { font-size: 11px; color: #9fb0c5; margin-left: 8px; }

.upload-hint {
  padding: 4px 16px;
  font-size: 12px;
  color: #7a8aa0;
}

/* ---------- composer ---------- */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: #1a2230;
  border-top: 1px solid #2a3648;
}

.composer textarea {
  flex: 1;
  resize: none;
  max-height: 140px;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox：隐藏滚动条但仍可滚动 */
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #2a3648;
  background: #0f1419;
  color: #e6e6e6;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  line-height: 1.4;
}

.composer textarea::-webkit-scrollbar { display: none; } /* Chrome/Edge/Safari */

.attach-btn, .send-btn {
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  padding: 10px 14px;
  flex-shrink: 0;
}

.attach-btn {
  background: #223047;
  color: #9fb0c5;
  font-size: 18px;
}

.send-btn { background: #2f6dbd; color: #fff; }
.send-btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- modal ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal {
  width: 100%;
  max-width: 360px;
  background: #1a2230;
  border: 1px solid #2a3648;
  border-radius: 12px;
  padding: 24px;
}

.modal h3 { margin-bottom: 10px; }
.modal p { font-size: 13px; color: #9fb0c5; margin-bottom: 14px; line-height: 1.6; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.danger-btn {
  background: #b13c3c;
  border: none;
  border-radius: 8px;
  color: #fff;
  padding: 9px 16px;
  cursor: pointer;
  font-size: 14px;
}
.danger-btn:disabled { opacity: 0.5; cursor: default; }
