:root {
  /* 主色：深青/墨绿 —— 顶部栏、导航、品牌标识 */
  --primary: #1F3A3D;
  --primary-2: #2A4A45;
  --primary-3: #3d5f5a;
  /* 辅助色：深蓝/藏青 —— 侧边栏、卡片底、次级按钮 */
  --secondary: #0F2A3A;
  --secondary-2: #17384c;
  /* 背景：浅灰蓝 */
  --bg: #EEF3F5;
  /* 点缀：暖橙/珊瑚红 —— 主按钮、重要标签、选中态、提醒 */
  --accent: #E07A5F;
  --accent-2: #F2A65A;
  --accent-3: #c9644a;
  --accent-soft: #fbe9e2;
  /* 文字：深灰 */
  --text: #2B2B2B;
  --text-2: #5b656b;
  --text-3: #97a1a7;
  --on-primary: #f2f5f5;
  --on-primary-2: #b6c2c4;
  /* 其他 */
  --card: #ffffff;
  --line: #dfe6ea;
  --shadow: 0 2px 10px rgba(15, 42, 58, 0.08);
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ---------- 通用 ---------- */
.btn {
  border: none; border-radius: 8px; cursor: pointer;
  padding: 9px 16px; font-size: 14px; font-weight: 600;
  background: var(--secondary); color: var(--on-primary); transition: .15s;
}
.btn:hover { opacity: .88; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-danger { background: transparent; color: var(--accent-3); border: 1px solid var(--accent); }
.btn-danger:hover { background: var(--accent); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; outline: none; margin-bottom: 12px;
  background: #fff; color: var(--text);
}
.input:focus { border-color: var(--accent); }
.textarea { min-height: 140px; resize: vertical; line-height: 1.6; }
.hint { color: var(--text-3); font-size: 12px; margin-top: 8px; }
.error { background: var(--accent-soft); color: var(--accent-3); padding: 10px; border-radius: 8px; font-size: 13px; margin-top: 12px; }
.level-tag {
  font-size: 12px; padding: 2px 8px; border-radius: 20px; font-weight: 600;
}
.lv-1 { background: #e6ecef; color: var(--text-2); }
.lv-2 { background: #dfe9e7; color: var(--primary-2); }
.lv-3 { background: var(--accent-soft); color: var(--accent-3); }

/* ---------- 品牌标识 ---------- */
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--accent); color: #fff;
  font-weight: 800; font-size: 13px; letter-spacing: -0.5px;
  margin-right: 9px; vertical-align: middle;
}

/* ---------- 认证页 ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #e4edf0 0%, var(--bg) 55%);
}
.auth-card {
  width: 380px; background: var(--card); border-radius: 16px; padding: 36px 32px;
  box-shadow: var(--shadow);
}
.auth-logo { font-size: 22px; font-weight: 800; text-align: center; color: var(--primary); display: flex; align-items: center; justify-content: center; }
.auth-logo .logo-mark { width: 32px; height: 32px; font-size: 15px; border-radius: 8px; }
.auth-sub { text-align: center; color: var(--text-3); margin: 6px 0 20px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.auth-tab {
  flex: 1; padding: 9px; border: none; background: #eef2f3; border-radius: 8px;
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-2);
}
.auth-tab.active { background: var(--accent); color: #fff; }
.auth-form input { display: block; }
.code-row { display: flex; gap: 10px; }
.code-row input { flex: 1; }
.code-btn { flex-shrink: 0; white-space: nowrap; height: 42px; }
.code-btn:disabled { opacity: .6; cursor: not-allowed; }
.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text-3); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.btn-outline {
  background: #fff; color: var(--text); border: 1px solid var(--line);
  width: 100%; padding: 10px 16px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent-3); }
.auth-hint { text-align: center; margin-top: 16px; }

/* ---------- 顶栏（主色：深青墨绿） ---------- */
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 56px;
  background: var(--primary); border-bottom: 1px solid rgba(255,255,255,.06);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 800; font-size: 17px; color: var(--on-primary); display: flex; align-items: center; }
.nav { display: flex; gap: 4px; }
.nav-item {
  border: none; background: transparent; padding: 8px 16px; border-radius: 8px;
  cursor: pointer; font-size: 15px; font-weight: 600; color: var(--on-primary-2);
  position: relative; transition: .15s;
}
.nav-item:hover { color: var(--on-primary); }
.nav-item.active { color: #fff; background: var(--accent); }
.badge {
  position: absolute; top: 4px; right: 4px; background: var(--accent-2); color: #fff;
  font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 4px;
}
.me { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.me-name { font-weight: 600; color: var(--on-primary); }
.topbar .btn-ghost { color: var(--on-primary-2); border-color: rgba(255,255,255,.25); }
.topbar .btn-ghost:hover { color: #fff; border-color: var(--accent); }

/* ---------- 主区域 ---------- */
.main { max-width: 900px; margin: 0 auto; padding: 20px; }
.tab { display: none; }
.tab.active { display: block; }

.feed-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
#feed-title { font-size: 18px; font-weight: 700; color: var(--primary); }

.feed { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 640px) { .feed { grid-template-columns: 1fr; } }

/* ---------- 帖子卡片 ---------- */
.post-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer; transition: .15s; break-inside: avoid;
  border: 1px solid var(--line);
}
.post-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(15, 42, 58, .12); }
.post-cover { width: 100%; height: 180px; object-fit: cover; background: #e9eef1; display: block; }
.post-cover-grid { display: grid; gap: 2px; }
.post-cover-grid img { width: 100%; height: 120px; object-fit: cover; }
.post-body { padding: 14px; }
.post-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; color: var(--text); }
.post-content { color: var(--text-2); font-size: 14px; line-height: 1.5; }
.post-meta {
  display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px;
  color: var(--on-primary-2); background: var(--secondary);
  padding: 8px 10px; border-radius: 8px;
}
.post-author { font-weight: 600; color: var(--on-primary); }
.post-del { margin-left: auto; }

/* ---------- 发布 ---------- */
.compose-panel, .admin-panel {
  background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
  max-width: 640px; margin: 0 auto; border: 1px solid var(--line);
}
.compose-panel h2, .admin-panel h2 { margin-bottom: 16px; color: var(--primary); }
.perm-bar {
  padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px;
  background: #fdf1e6; color: var(--accent-3); border: 1px solid #f5dcbf;
}
.upload-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.upload-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
  background: var(--accent-soft); color: var(--accent-3); border-radius: 8px; cursor: pointer; font-size: 14px;
}
.preview { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.preview-item { position: relative; }
.preview-item img { width: 88px; height: 88px; object-fit: cover; border-radius: 8px; }
.preview-item .rm {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none; cursor: pointer; font-size: 12px; line-height: 20px;
}

/* ---------- 私聊（侧边栏：辅助色深蓝藏青） ---------- */
.chat-layout { display: grid; grid-template-columns: 260px 1fr; gap: 16px; height: calc(100vh - 96px); }
.chat-list-pane {
  background: var(--secondary); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; color: var(--on-primary);
}
.pane-head { display: flex; align-items: center; justify-content: space-between; padding: 14px; border-bottom: 1px solid rgba(255,255,255,.08); font-weight: 700; color: #fff; }
.pane-head .btn-ghost { color: var(--on-primary-2); border-color: rgba(255,255,255,.2); }
.pane-head .btn-ghost:hover { color: #fff; }
.conv-list { overflow-y: auto; flex: 1; }
.conv-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,.06); }
.conv-item:hover { background: var(--secondary-2); }
.conv-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-weight: 600; font-size: 14px; color: #fff; }
.conv-last { color: var(--on-primary-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-badge { background: var(--accent); color: #fff; border-radius: 10px; font-size: 11px; min-width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.chat-main { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; border: 1px solid var(--line); }
.chat-placeholder { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.chat-window { flex: 1; display: flex; flex-direction: column; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 700; color: var(--primary); }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.msg { max-width: 70%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; word-break: break-word; }
.msg.mine { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.theirs { align-self: flex-start; background: #fff; border: 1px solid var(--line); color: var(--text); border-bottom-left-radius: 4px; }
.msg-time { font-size: 10px; opacity: .7; margin-top: 4px; }
.chat-input-row { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--line); }
.chat-input-row input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: #fff; color: var(--text); }
.chat-input-row input:focus { border-color: var(--accent); }

/* ---------- 管理 ---------- */
.admin-section { margin-top: 20px; }
.admin-section h3 { font-size: 15px; margin-bottom: 10px; color: var(--text-2); }
.admin-list { display: flex; flex-direction: column; gap: 8px; }
.admin-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.admin-row .info { flex: 1; min-width: 0; }
.admin-row .name { font-weight: 600; }
.admin-row .sub { color: var(--text-3); font-size: 12px; }
select.level-select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 42, 58, .45); }
.modal-body { position: relative; background: #fff; border-radius: 16px; width: 560px; max-width: 92vw; max-height: 84vh; overflow-y: auto; padding: 24px; }
.modal-close { position: absolute; top: 14px; right: 16px; background: transparent; border: none; font-size: 18px; cursor: pointer; color: var(--text-3); }
.modal-close:hover { color: var(--text); }

.post-detail-cover { width: 100%; max-height: 360px; object-fit: cover; border-radius: 10px; margin-bottom: 16px; }
.post-detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 16px; }
.post-detail-grid img { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; }
.post-detail-title { font-size: 20px; font-weight: 800; margin-bottom: 8px; color: var(--text); }
.post-detail-content { color: var(--text-2); line-height: 1.7; white-space: pre-wrap; margin-bottom: 16px; }
.post-detail-meta { color: var(--text-3); font-size: 13px; margin-bottom: 18px; }

.comments-title { font-weight: 700; margin-bottom: 12px; color: var(--primary); }
.comment { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.comment-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--secondary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; font-size: 13px; }
.comment-body { flex: 1; }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.comment-name { font-weight: 600; }
.comment-time { color: var(--text-3); font-size: 11px; }
.comment-text { margin-top: 4px; font-size: 14px; line-height: 1.5; color: var(--text); }
.comment-del { margin-left: auto; }
.comment-input-row { display: flex; gap: 10px; margin-top: 16px; }
.comment-input-row input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: #fff; color: var(--text); }
.comment-input-row input:focus { border-color: var(--accent); }

.user-picker { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; max-height: 50vh; overflow-y: auto; }
.user-picker-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: #fff; }
.user-picker-item:hover { background: #f5f8f9; }
.user-picker-item .up-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }

.empty { text-align: center; color: var(--text-3); padding: 60px 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  background: rgba(15, 42, 58, .92); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 14px; z-index: 99; max-width: 80vw;
}
