/* ===== 新能源政策追踪 - juejin 风格 ===== */
:root {
  --bg: #f2f3f5;
  --card-bg: #ffffff;
  --text-1: #252933;
  --text-2: #8a919f;
  --text-3: #c2c8d1;
  --brand: #1e80ff;
  --brand-soft: #eaf2ff;
  --green: #2bb673;
  --green-soft: #e6f7ef;
  --orange: #ff7426;
  --border: #e4e6eb;
  --hover-bg: #f7f8fa;
  --radius: 4px;
  --shadow: 0 1px 2px rgba(0,0,0,.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text-1);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue",
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}
h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: var(--text-1); text-decoration: none; }
a:hover { color: var(--brand); }
button { cursor: pointer; font-family: inherit; }
input, select { font-family: inherit; outline: none; }
.muted { color: var(--text-2); }
.small { font-size: 12px; line-height: 1.6; }
.hidden { display: none !important; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--card-bg);
  height: 60px;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0,0,0,.02);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  padding: 0 16px;
  display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: baseline; gap: 4px; }
.brand-logo { font-size: 22px; margin-right: 4px; }
.brand-name { font-size: 20px; font-weight: 700; color: var(--brand); }
.brand-sub { font-size: 14px; color: var(--text-2); }

.topbar-nav { display: flex; gap: 8px; flex: 0 0 auto; }
.nav-link {
  display: inline-block; padding: 8px 14px;
  font-size: 14px; color: var(--text-1);
  border-radius: var(--radius);
  transition: all .15s;
}
.nav-link:hover { background: var(--hover-bg); color: var(--brand); }
.nav-link.active { color: var(--brand); font-weight: 600; }

.topbar-search {
  flex: 1; max-width: 420px;
  display: flex; align-items: center;
  background: var(--hover-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 6px 4px 14px;
}
.topbar-search input {
  flex: 1; background: transparent; border: none;
  font-size: 13px; padding: 6px 4px;
}
.topbar-search input:focus { outline: none; }
.search-btn {
  background: var(--brand); color: #fff;
  border: none; border-radius: 16px;
  padding: 6px 16px; font-size: 13px;
}
.search-btn:hover { background: #1171ee; }

/* ===== 三栏布局 ===== */
.layout {
  max-width: 1200px;
  margin: 16px auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 200px 1fr 240px;
  gap: 16px;
  align-items: start;
}
.sidebar { position: sticky; top: 76px; }
.sidebar-left, .sidebar-right {
  display: flex; flex-direction: column; gap: 12px;
}

/* 侧栏卡片 */
.side-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.side-title {
  font-size: 14px; font-weight: 600;
  color: var(--text-1);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* 统计 */
.stat-list li {
  display: flex; align-items: baseline; gap: 8px;
  padding: 4px 0;
}
.stat-num { font-size: 18px; font-weight: 700; color: var(--brand); }
.stat-label { font-size: 12px; color: var(--text-2); }
.last-collected { margin-top: 10px; font-size: 12px; }

/* 筛选列表 */
.filter-list li {
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text-1);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  transition: all .15s;
}
.filter-list li:hover { background: var(--hover-bg); color: var(--brand); }
.filter-list li.active { background: var(--brand-soft); color: var(--brand); font-weight: 500; }
.filter-list li .count { font-size: 11px; color: var(--text-3); }

/* 标签云 */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  display: inline-block; padding: 4px 10px;
  font-size: 12px; color: var(--text-1);
  background: var(--hover-bg);
  border-radius: 12px;
  cursor: pointer;
  transition: all .15s;
}
.tag-chip:hover { background: var(--brand-soft); color: var(--brand); }

.scrape-info { font-size: 12px; line-height: 1.8; }
.scrape-info .row { display: flex; justify-content: space-between; }
.scrape-info .row span:first-child { color: var(--text-2); }
.about-card p { margin-bottom: 6px; }

/* ===== 中栏工具条 ===== */
.content {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.content-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: 8px;
  background: #fafbfc;
}
.date-range {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.date-range .lbl { font-size: 12px; color: var(--text-2); }
.date-inputs { display: flex; align-items: center; gap: 6px; }
.date-field {
  width: 120px; padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--card-bg);
  cursor: pointer;
  color: var(--text-1);
}
.date-field:hover { border-color: var(--brand); }
.date-field:focus { border-color: var(--brand); color: var(--brand); }
.dash { color: var(--text-3); }
.link-btn {
  background: none; border: 1px solid transparent;
  color: var(--text-2);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: var(--radius);
}
.link-btn:hover { background: var(--hover-bg); color: var(--brand); }

.page-size {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  background: var(--card-bg);
}

/* 状态条 */
.status-bar {
  padding: 8px 16px;
  font-size: 12px; color: var(--text-2);
  background: #fffbea;
  border-bottom: 1px solid #ffe58f;
  display: flex; justify-content: space-between; align-items: center;
}
.status-bar.ok { background: var(--green-soft); border-color: #b7ebbf; color: #1d6a43; }
.status-bar.busy { background: #eaf2ff; border-color: #b3d4ff; color: #1e5dc8; }
.status-bar.err { background: #fff1f0; border-color: #ffccc7; color: #b3261e; }
.status-worker { font-size: 11px; }

/* ===== 卡片流（仿 juejin entry-list） ===== */
.feed-list { background: var(--card-bg); }
.feed-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-2);
  font-size: 13px;
}
.feed-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.feed-item:hover { background: #fafbfc; }
.feed-item:last-child { border-bottom: none; }

.feed-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  margin-bottom: 6px;
}
.feed-title a { color: var(--text-1); }
.feed-title a:hover { color: var(--brand); }
.feed-title .cat-badge {
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
}
.cat-badge.cat-国家级 { background: #fff1f0; color: #b3261e; }
.cat-badge.cat-部委行业 { background: #fff7e6; color: #b35c00; }
.cat-badge.cat-地方 { background: #f3eaff; color: #6b3fb0; }
.cat-badge.cat-媒体解读 { background: var(--green-soft); color: #1d6a43; }
.cat-badge.cat-行业动态 { background: var(--brand-soft); color: var(--brand); }

.feed-abstract {
  font-size: 13px;
  color: var(--text-2);
  line-height: 22px;
  margin-bottom: 8px;
}

/* AI 摘要块（绿色卡片，默认展示） */
.feed-summary {
  margin: 8px 0;
  padding: 10px 12px;
  background: var(--green-soft);
  border-left: 3px solid var(--green);
  border-radius: 3px;
  font-size: 13px;
  color: #14513a;
  line-height: 1.7;
  position: relative;
}
.feed-summary .ai-badge {
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
  padding: 1px 5px;
  background: var(--green);
  color: #fff;
  font-size: 10px;
  border-radius: 2px;
  font-weight: 600;
}
.feed-summary .ai-meta {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #4d8c6c;
}
.feed-summary.loading {
  color: var(--text-2);
  background: var(--hover-bg);
  border-left-color: var(--text-3);
}
.feed-summary.loading::after {
  content: '生成中…';
  animation: dots 1.2s infinite;
}
@keyframes dots {
  0%, 100% { content: '生成中…'; }
  33% { content: '生成中….'; }
  66% { content: '生成中…..'; }
}

.feed-footer {
  display: flex; align-items: center; gap: 16px;
  font-size: 12px; color: var(--text-2);
}
.feed-footer .meta-item { display: inline-flex; align-items: center; gap: 4px; }
.feed-footer .meta-item::before { content: '·'; margin-right: 8px; color: var(--text-3); }
.feed-footer .meta-item:first-child::before { content: ''; margin: 0; }
.feed-footer .source-tag { color: var(--brand); }
.feed-footer .date-tag { color: var(--text-2); }

.feed-actions {
  display: flex; gap: 8px; margin-left: auto;
}
.action-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--radius);
  transition: all .15s;
}
.action-btn:hover { color: var(--brand); border-color: var(--brand); }
.action-btn.primary {
  color: var(--brand); border-color: var(--brand);
}
.action-btn.primary:hover { background: var(--brand-soft); }
.action-btn:disabled { opacity: .5; cursor: wait; }
.feed-footer-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}

/* 分页 */
.pager {
  display: flex; justify-content: center; align-items: center;
  gap: 16px;
  padding: 20px;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
}
.pager-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text-1);
  padding: 5px 14px;
  border-radius: var(--radius);
  font-size: 13px;
}
.pager-btn:hover:not(:disabled) { color: var(--brand); border-color: var(--brand); }
.pager-btn:disabled { opacity: .5; cursor: not-allowed; }
.page-info { font-size: 13px; color: var(--text-2); }

/* ===== 中文日期选择器 ===== */
.dp-mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.3);
  z-index: 200;
}
.date-picker {
  position: fixed;
  z-index: 201;
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  padding: 12px;
  width: 280px;
  font-size: 13px;
  user-select: none;
}
.dp-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.dp-nav {
  background: transparent; border: none;
  padding: 4px 8px;
  font-size: 14px;
  color: var(--text-2);
  border-radius: var(--radius);
}
.dp-nav:hover { background: var(--hover-bg); color: var(--brand); }
.dp-title { font-weight: 600; font-size: 14px; }

.dp-week, .dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.dp-week {
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.dp-week span {
  text-align: center;
  font-size: 12px;
  color: var(--text-2);
  padding: 4px 0;
}
.dp-week span.wk { color: var(--orange); }

.dp-grid .dp-cell {
  text-align: center;
  padding: 6px 0;
  font-size: 13px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-1);
  transition: all .12s;
}
.dp-grid .dp-cell:hover { background: var(--hover-bg); }
.dp-grid .dp-cell.muted { color: var(--text-3); }
.dp-grid .dp-cell.today { color: var(--brand); font-weight: 600; }
.dp-grid .dp-cell.selected {
  background: var(--brand); color: #fff;
  font-weight: 600;
}
.dp-grid .dp-cell.disabled {
  color: var(--text-3);
  cursor: not-allowed;
}
.dp-grid .dp-cell.weekend:not(.selected):not(.muted) { color: var(--orange); }

.dp-footer {
  display: flex; justify-content: flex-end; gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.dp-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 4px 12px;
  font-size: 12px;
  border-radius: var(--radius);
  color: var(--text-1);
}
.dp-btn:hover { color: var(--brand); border-color: var(--brand); }
.dp-btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.dp-btn-primary:hover { background: #1171ee; color: #fff; }

/* ===== Toast ===== */
.toast {
  position: fixed; right: 20px; bottom: 20px;
  padding: 10px 16px;
  background: rgba(0,0,0,.85);
  color: #fff;
  border-radius: 4px;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  max-width: 320px;
  z-index: 999;
}
.toast.ok { background: var(--green); }
.toast.err { background: #b3261e; }

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .sidebar-left, .sidebar-right {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}
@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
  .topbar-search { order: 3; flex: 1 1 100%; max-width: none; }
  .sidebar-left, .sidebar-right { grid-template-columns: 1fr; }
  .date-range { width: 100%; }
}
