* { box-sizing: border-box; }
:root {
  --bg: #f0f2f5;
  --card: #fff;
  --primary: #0088cc;
  --primary-dark: #006699;
  --text: #222;
  --muted: #888;
  --border: #e5e5e5;
}
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
}
.topbar .logo { color: #fff; font-weight: 700; font-size: 18px; }
.topbar nav { display: flex; gap: 16px; }
.topbar nav a { color: #fff; font-size: 14px; }

.main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 16px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 0; }

.card { background: var(--card); border-radius: 10px; padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.empty { text-align: center; color: var(--muted); padding: 30px; }

.btn {
  background: var(--primary); color: #fff; border: none; padding: 8px 16px;
  border-radius: 6px; cursor: pointer; font-size: 14px;
}
.btn:hover { background: var(--primary-dark); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.danger { background: #e0245e; }
.btn.warn { background: #f0a500; }

input, textarea {
  width: 100%; padding: 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 14px; font-family: inherit; outline: none;
}
input:focus, textarea:focus { border-color: var(--primary); }
textarea { min-height: 80px; resize: vertical; margin-bottom: 8px; }
label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
label input { margin-top: 6px; color: var(--text); }
label.inline { display: inline-flex; align-items: center; gap: 6px; }
label.inline input { width: auto; margin: 0; }

.composer h3 { margin: 0 0 10px; font-size: 15px; }
.composer .row { display: flex; justify-content: flex-end; gap: 8px; }

.post-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.post-body { margin-bottom: 10px; line-height: 1.6; word-break: break-word; }
.post-actions { display: flex; gap: 16px; color: var(--muted); font-size: 13px; }
.post-actions button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 4px 0; font-size: 13px;
}
.post-actions button:hover { color: var(--primary); }
.post-actions .liked { color: #e0245e; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 16px;
  flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 80px; height: 80px; font-size: 32px; }
img.avatar { object-fit: cover; }

.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 12px; }
.user-card { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: 8px; }

.profile-card { display: flex; gap: 20px; }
.profile-info { flex: 1; }
.profile-info h2 { margin: 0 0 6px; }
.profile-info .stats { display: flex; gap: 20px; margin: 10px 0; }
.profile-info .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.small { color: var(--muted); font-size: 12px; }
.error { color: #d00; }

.comments { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.comment { font-size: 13px; margin-bottom: 6px; }
.comment-form input { margin-top: 8px; }

.notif { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.notif.read { opacity: .55; }
.notif .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex-shrink: 0; }

.badge {
  display: inline-block; background: #e0245e; color: #fff;
  border-radius: 10px; padding: 0 6px; font-size: 11px;
  line-height: 16px; margin-left: 4px;
}

.verified-badge {
  display: inline-block; background: #1da1f2; color: #fff;
  border-radius: 50%; width: 14px; height: 14px; line-height: 14px;
  text-align: center; font-size: 10px; margin-left: 4px; vertical-align: middle;
}

.post-img { max-width: 100%; border-radius: 8px; margin-top: 8px; }
.quoted { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin: 8px 0; background: #fafafa; }

.messages-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; }
.convo-list h3 { margin: 0 0 10px; }
.convo { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 8px; color: var(--text); }
.convo:hover, .convo.active { background: #eaf4fb; text-decoration: none; }
.convo-info { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo .badge { flex-shrink: 0; }

.chat { display: flex; flex-direction: column; min-height: 500px; }
.chat-head { border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 8px; }
.chat-box { flex: 1; overflow-y: auto; padding: 8px 0; max-height: 500px; }
.msg { display: flex; flex-direction: column; margin-bottom: 10px; }
.msg.mine { align-items: flex-end; }
.msg.theirs { align-items: flex-start; }
.msg .bubble {
  max-width: 70%; padding: 8px 12px; border-radius: 10px;
  background: #e4e6eb; word-break: break-word;
}
.msg.mine .bubble { background: var(--primary); color: #fff; }
.msg .small { margin-top: 2px; }
.chat-input { display: flex; gap: 8px; margin-top: 10px; }

.auth-card { max-width: 360px; margin: 40px auto; }
.auth-card h2 { margin-top: 0; }

.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.8); color: #fff;
  padding: 10px 20px; border-radius: 20px; font-size: 14px; z-index: 9999;
}

.announce { background: #fff8e1; border-left: 4px solid #f0a500; }

@media (max-width: 760px) {
  .messages-layout { grid-template-columns: 1fr; }
  .convo-list { max-height: 220px; overflow-y: auto; }
  .topbar { padding: 0 10px; font-size: 13px; }
  .topbar nav { gap: 10px; flex-wrap: wrap; }
  .profile-card { flex-direction: column; align-items: center; text-align: center; }
}