:root {
  --brand: #2b7de9;
  --brand-weak: #eaf2fd;
  --text: #1f2329;
  --text-weak: #646a73;
  --text-faint: #8f959e;
  --line: #e5e6eb;
  --bg: #f5f6f7;
  --card: #ffffff;
  --ok: #00b42a;
  --warn: #ff7d00;
  --err: #f53f3f;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* ---------- 顶部 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 15px; font-weight: 600; }

.badge {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
}
.badge-loading { background: #f2f3f5; color: var(--text-weak); }
.badge-ok      { background: #e8ffea; color: var(--ok); }
.badge-warn    { background: #fff7e8; color: var(--warn); }
.badge-err     { background: #ffece8; color: var(--err); }

/* ---------- 环境提示 ---------- */
.env-tip {
  margin: 8px 12px 0;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.6;
}
.env-tip-loading { background: #f2f3f5; color: var(--text-weak); }
.env-tip-ok      { background: #e8ffea; color: #0a8a24; }
.env-tip-warn    { background: #fff7e8; color: #a35c00; }
.env-tip-err     { background: #ffece8; color: #b52020; }
.env-tip code {
  padding: 1px 4px;
  background: rgba(0,0,0,.06);
  border-radius: 3px;
  font-size: 11px;
}

/* ---------- 搜索 ---------- */
.search-wrap { padding: 8px 12px; }
#searchInput {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--card);
  font-size: 13px;
  color: var(--text);
  outline: none;
}
#searchInput:focus { border-color: var(--brand); }

/* ---------- 内容区 ---------- */
.content { padding: 0 12px 24px; }

.placeholder {
  padding: 40px 0;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

.group { margin-bottom: 16px; }
.group-name {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-weak);
}
.group-name::before {
  content: "";
  width: 3px;
  height: 13px;
  background: var(--brand);
  border-radius: 2px;
}
.group-count { font-weight: 400; color: var(--text-faint); }

/* ---------- 话术卡片 ---------- */
.item {
  margin-bottom: 8px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .15s, transform .08s;
}
.item:hover { border-color: var(--brand); }
.item:active { transform: scale(.995); background: var(--brand-weak); }
.item.sending { opacity: .6; pointer-events: none; }

.item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.item-title {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-type {
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  background: #f2f3f5;
  color: var(--text-weak);
}
.item-type.type-text  { background: #eaf2fd; color: var(--brand); }
.item-type.type-image { background: #e8ffea; color: var(--ok); }
.item-type.type-mixed { background: #fff7e8; color: var(--warn); }

.item-content {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-weak);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.item-meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-faint);
}

.empty {
  padding: 40px 0;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}
.empty a { color: var(--brand); text-decoration: none; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(10px);
  max-width: 80%;
  padding: 8px 16px;
  border-radius: 6px;
  background: rgba(0, 0, 0, .8);
  color: #fff;
  font-size: 13px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
