:root {
  --bg: #f5f7fb; --card: #ffffff; --border: #e4e9f2; --text: #1f2733; --muted: #7a869a;
  --primary: #2563eb; --primary-dark: #1d4ed8; --green: #16a34a; --red: #dc2626;
  --orange: #ea580c; --yellow: #ca8a04; --purple: #7c3aed;
  --sidebar: #101b30; --sidebar-text: #aab6cc;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Microsoft YaHei", "PingFang SC", -apple-system, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f1c33 0%, #1e3a68 60%, #2563eb 100%); }
.login-card { background: #fff; border-radius: 16px; padding: 40px 36px; width: 380px; box-shadow: 0 24px 64px rgba(0,0,0,.35); text-align: center; }
.login-logo { font-size: 40px; }
.login-card h1 { font-size: 24px; margin: 8px 0 4px; }
.login-sub { color: var(--muted); margin-bottom: 24px; }
.login-card input { width: 100%; margin-bottom: 12px; }
.login-error { color: var(--red); min-height: 20px; margin-top: 8px; font-size: 13px; }
.login-foot { margin-top: 18px; font-size: 12px; color: var(--muted); }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; }
.brand-title { color: #fff; font-size: 18px; font-weight: 700; padding: 22px 20px 18px; }
.nav-item { display: block; padding: 12px 20px; color: var(--sidebar-text); text-decoration: none; cursor: pointer; border-left: 3px solid transparent; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(37,99,235,.25); color: #fff; border-left-color: var(--primary); }
.sidebar-foot { margin-top: auto; padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.user-info { color: #fff; margin-bottom: 4px; }
.plan-info { margin-bottom: 10px; }
.logout { color: var(--sidebar-text); cursor: pointer; text-decoration: underline; }
.main { flex: 1; margin-left: 220px; padding: 24px 28px; max-width: 1200px; }

.view-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.view-head h2 { font-size: 20px; }
.head-actions { display: flex; gap: 10px; }

/* ---------- 组件 ---------- */
.btn { padding: 8px 16px; border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--text); }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-block { width: 100%; padding: 11px; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.input, .select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: #fff; color: var(--text); }
.input:focus, .select:focus { outline: none; border-color: var(--primary); }
.badge { background: var(--red); color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 11px; margin-left: 4px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; text-align: center; }
.stat-num { font-size: 30px; font-weight: 700; }
.stat-num.green { color: var(--green); } .stat-num.red { color: var(--red); }
.stat-num.orange { color: var(--orange); } .stat-num.purple { color: var(--purple); }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 4px; }

.chart-row { display: flex; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.chart-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; flex: 2; min-width: 420px; }
.chart-card.narrow { flex: 1; min-width: 280px; }
.chart-card h3 { font-size: 14px; margin-bottom: 10px; color: var(--muted); }
.chart-card canvas { max-height: 260px; }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.panel h3 { font-size: 15px; margin-bottom: 12px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.form-row .input { flex: 1; min-width: 160px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 8px; line-height: 1.6; }
.switch-row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.save-ok { color: var(--green); margin-left: 10px; }

/* ---------- 舆情卡片 ---------- */
.mention-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.mention-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.tag { padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.tag-platform { background: #eef2ff; color: #4338ca; }
.tag-NEGATIVE { background: #fef2f2; color: var(--red); }
.tag-POSITIVE { background: #f0fdf4; color: var(--green); }
.tag-NEUTRAL { background: #f8fafc; color: var(--muted); }
.tag-CRITICAL { background: var(--red); color: #fff; }
.tag-HIGH { background: var(--orange); color: #fff; }
.tag-MEDIUM { background: #fef9c3; color: #854d0e; }
.tag-LOW { background: #f1f5f9; color: var(--muted); }
.tag-status { background: #f1f5f9; color: var(--muted); }
.mention-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.mention-body { color: #4a5568; line-height: 1.6; margin-bottom: 8px; word-break: break-all; }
.mention-meta { color: var(--muted); font-size: 12px; display: flex; gap: 14px; flex-wrap: wrap; }
.mention-analysis { background: #f8fafc; border-radius: 8px; padding: 10px 12px; margin-top: 10px; font-size: 13px; line-height: 1.7; }
.mention-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.mention-card a { color: var(--primary); text-decoration: none; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 18px 0; }

/* ---------- 预警 ---------- */
.alert-card { background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--orange); border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; }
.alert-card.CRITICAL { border-left-color: var(--red); }
.alert-card.unread { background: #fffbeb; }
.alert-msg { white-space: pre-wrap; line-height: 1.7; font-size: 13px; }
.alert-time { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* ---------- 品牌 ---------- */
.brand-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 14px; }
.brand-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.brand-name { font-size: 16px; font-weight: 700; }
.kw-list { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.kw-chip { background: #eef2ff; color: #4338ca; border-radius: 14px; padding: 4px 12px; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.kw-chip .del { cursor: pointer; color: #818cf8; font-weight: 700; }
.kw-chip .del:hover { color: var(--red); }

/* ---------- 报告 ---------- */
.report-row { display: flex; align-items: center; justify-content: space-between; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 13px 16px; margin-bottom: 8px; }

/* ---------- 采集状态 ---------- */
.collect-status { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px; line-height: 1.7; }

/* ---------- 数据源状态 ---------- */
.collector-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.collector-row:last-child { border-bottom: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--green); } .dot.warn { background: var(--yellow); }

.empty { color: var(--muted); text-align: center; padding: 40px 0; }
@media (max-width: 900px) {
  .sidebar { width: 64px; } .brand-title { font-size: 13px; padding: 16px 8px; }
  .nav-item { padding: 12px 10px; font-size: 12px; } .sidebar-foot { display: none; }
  .main { margin-left: 64px; padding: 16px; }
}
