:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #1f2328;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --primary: #fe2c55;          /* 抖音红 */
  --primary-dark: #d91f45;
  --primary-light: #fff0f3;
  --blue: #185fa5;
  --green: #1d9e75;
  --amber: #ba7517;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}
.login-card h1 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}
.login-card .sub { color: var(--text-2); font-size: 13px; margin-bottom: 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
.field input:focus { border-color: var(--primary); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: opacity .15s;
  white-space: nowrap;
}
.btn:active { opacity: .8; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }
.login-err { color: #b91c1c; font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ---------- 主布局 ---------- */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-header .logo { font-size: 16px; font-weight: 600; }
.app-header .logo span { color: var(--primary); }
.app-header .right { display: flex; align-items: center; gap: 12px; }
.app-header .user { color: var(--text-2); font-size: 13px; }

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* ---------- 概览卡片 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card .label { font-size: 12px; color: var(--text-2); }
.card .value { font-size: 24px; font-weight: 600; margin-top: 4px; }
.card .value.primary { color: var(--primary); }

/* ---------- 区块 ---------- */
.section { margin-bottom: 20px; }
.section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title .actions { display: flex; gap: 8px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ---------- 账号管理 ---------- */
.add-account {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.add-account input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
.add-account input:focus { border-color: var(--primary); }
.add-account .hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }

.account-list { padding: 8px 12px; }
.account-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}
.account-item:last-child { border-bottom: none; }
.account-item .info { flex: 1; min-width: 0; }
.account-item .nickname { font-weight: 500; }
.account-item .meta { font-size: 12px; color: var(--text-3); }
.account-item .ops { display: flex; gap: 8px; align-items: center; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
th { background: #fafafa; color: var(--text-2); font-weight: 500; white-space: nowrap; }
tr:hover td { background: #fafbfc; }
.t-desc { max-width: 320px; }
.t-desc .text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag {
  display: inline-block;
  padding: 1px 8px;
  margin: 1px 2px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
}
.num { font-variant-numeric: tabular-nums; }

/* 量级颜色（医美/中文习惯：涨用红系高亮，这里用品牌红区分量级）*/
.num.digg { color: var(--primary); font-weight: 500; }

/* ---------- 标签统计 ---------- */
.tag-stat { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px; }
.tag-pill {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.tag-pill:hover { border-color: var(--primary); color: var(--primary); }
.tag-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tag-pill .cnt { color: var(--text-3); font-size: 12px; margin-left: 4px; }
.tag-pill.active .cnt { color: rgba(255,255,255,.8); }

/* ---------- 空状态 & 加载 ---------- */
.empty { text-align: center; color: var(--text-3); padding: 40px 20px; }
.loading { text-align: center; color: var(--text-2); padding: 30px; }
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2328;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 100;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

.sync-badge {
  display: inline-block;
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 10px;
}
.sync-badge.ok { background: #e6f7ee; color: var(--green); }
.sync-badge.wait { background: #f3f4f6; color: var(--text-3); }
.sync-badge.syncing { background: #fff7e6; color: var(--amber); }

.filter-bar { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); align-items: center; flex-wrap: wrap; }
.filter-bar select, .filter-bar input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}
.filter-bar select { min-width: 140px; }

/* ---------- tab 面板 ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 10px 20px;
  cursor: pointer;
  color: var(--text-2);
  font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  user-select: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- 账号状态 ---------- */
.account-item.disabled { opacity: .55; }
.t-account { white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.t-account .douyin-id { font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 380px;
}
.modal h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

@media (max-width: 640px) {
  .container { padding: 12px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .app-header { padding: 0 12px; }
}
