* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #3370ff;
  --bg: #f5f6f7;
  --card: #ffffff;
  --text: #1f2329;
  --text2: #646a73;
  --line: #e5e6eb;
  --chip-bg: #f0f4ff;
  --chip-text: #3370ff;
  --danger: #f54a45;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
  -webkit-tap-highlight-color: transparent;
}
#app {
  max-width: 640px; margin: 0 auto; min-height: 100%;
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
.hidden { display: none !important; }

/* ---------- 启动/登录遮罩 ---------- */
.screen {
  position: fixed; inset: 0; z-index: 99; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 24px; text-align: center;
}
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--line);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot-msg { color: var(--text2); max-width: 300px; word-break: break-all; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; background: #fff;
  padding: 10px 14px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--line);
}
.me { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.badge {
  background: var(--chip-bg); color: var(--chip-text);
  border-radius: 4px; padding: 1px 6px; font-size: 12px; font-weight: 500;
}
.seg { display: flex; background: var(--bg); border-radius: 8px; padding: 2px; }
.seg-btn {
  border: none; background: transparent; padding: 5px 14px;
  border-radius: 6px; font-size: 13px; color: var(--text2); cursor: pointer;
}
.seg-btn.active {
  background: #fff; color: var(--primary); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* ---------- 筛选区 ---------- */
.filters { padding: 10px 14px 0; }
.search { display: flex; gap: 8px; }
.search input {
  flex: 1; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; font-size: 14px; outline: none; background: #fff;
}
.search input:focus { border-color: var(--primary); }
.btn {
  border: none; border-radius: 8px; padding: 8px 16px;
  background: var(--primary); color: #fff; font-size: 14px; cursor: pointer;
}
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.staff-filter { margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--chip-bg); color: var(--chip-text);
  border-radius: 12px; padding: 3px 10px; font-size: 12px;
}
.chip-active { background: var(--primary); color: #fff; }
.hint {
  margin-top: 8px; font-size: 12px; color: #b45309;
  background: #fffbeb; border-radius: 6px; padding: 6px 10px;
}

/* ---------- 状态区 ---------- */
.status { text-align: center; padding: 40px 14px; color: var(--text2); }
.status.error { color: var(--danger); }
.status button { margin-top: 12px; }

/* ---------- 用户卡片 ---------- */
.list { flex: 1; padding: 10px 14px; display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card); border-radius: 12px; padding: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.card-head { display: flex; gap: 10px; align-items: center; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--bg); object-fit: cover; flex-shrink: 0;
}
.avatar-fallback {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: var(--chip-bg); color: var(--chip-text);
  display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.who { flex: 1; min-width: 0; }
.nick {
  font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sub { color: var(--text2); font-size: 12px; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-chip {
  flex-shrink: 0; background: #fff3e0; color: #b26a00;
  border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600;
}
.card-meta {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin-top: 10px; font-size: 12px; color: var(--text2);
}
.card-meta b { color: var(--text); font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  background: var(--chip-bg); color: var(--chip-text);
  border-radius: 10px; padding: 2px 8px; font-size: 11px;
}
.staff-line {
  margin-top: 8px; font-size: 12px; color: var(--text2);
}
.staff-line .staff-link { color: var(--primary); cursor: pointer; font-weight: 600; }
.card-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.toggle-detail {
  border: none; background: none; color: var(--primary);
  font-size: 13px; cursor: pointer; padding: 4px 0;
}
.mark-btn {
  border: 1px solid var(--primary); background: #fff; color: var(--primary);
  border-radius: 8px; padding: 5px 14px; font-size: 13px; cursor: pointer;
}
.detail {
  margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px;
  font-size: 12px; color: var(--text2); line-height: 1.8;
}
.detail b { color: var(--text); font-weight: 600; }
.detail pre {
  background: var(--bg); border-radius: 6px; padding: 8px;
  overflow-x: auto; font-size: 11px; margin-top: 4px; white-space: pre-wrap; word-break: break-all;
}

/* ---------- 分页 ---------- */
.pager {
  position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line);
  padding: 10px 14px; display: flex; align-items: center; justify-content: space-between;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.page-info { font-size: 12px; color: var(--text2); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75); color: #fff; border-radius: 8px;
  padding: 8px 18px; font-size: 13px; z-index: 100; max-width: 80vw;
}
