:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --ink: #2a2622;
  --muted: #8a8178;
  --line: #ece8e1;
  --red: #e23b3b;
  --red-soft: #fdeaea;
  --amber: #e8913a;
  --green: #3a9d6e;
  --chip: #f1ede6;
  --shadow: 0 1px 3px rgba(40,30,20,.06), 0 6px 18px rgba(40,30,20,.05);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* 顶栏 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 18px 28px;
  background: linear-gradient(120deg, #fff 0%, #fbf3ee 100%);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo { font-size: 34px; line-height: 1; }
.topbar h1 { font-size: 20px; margin: 0; letter-spacing: .5px; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.topstat { font-size: 13px; color: var(--muted); }

/* 布局 */
main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 22px 26px; margin-bottom: 24px;
}
.panel-title { font-size: 17px; margin: 0 0 16px; display: flex; align-items: baseline; gap: 10px; }
.count { font-size: 13px; color: var(--muted); font-weight: 400; }

/* 看板 */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 16px 14px; text-align: center;
}
.stat .n { font-size: 30px; font-weight: 700; color: var(--red); line-height: 1.1; }
.stat .l { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.card-block h3 { font-size: 14px; margin: 0 0 12px; color: var(--ink); }

.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 36px; align-items: center; gap: 10px; font-size: 13px; }
.bar-row .name { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--line); border-radius: 6px; height: 14px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--red), var(--amber)); border-radius: 6px; }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.tag-cloud .t { background: var(--chip); color: #5a524a; border-radius: 999px; padding: 5px 12px; font-size: 12.5px; }

/* 控件 */
.controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
#search {
  flex: 1; min-width: 240px; padding: 11px 14px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink);
}
#search:focus { outline: 2px solid var(--red-soft); border-color: var(--red); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters .f, .tag-filters .tf {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer; transition: .15s;
}
.filters .f:hover, .tag-filters .tf:hover { border-color: var(--red); color: var(--red); }
.filters .f.active, .tag-filters .tf.active { background: var(--red); border-color: var(--red); color: #fff; }
.tag-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

/* 卡片网格 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column; transition: .18s; cursor: pointer;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: #e0d8cc; }
.thumb { position: relative; aspect-ratio: 16/9; background: #eee; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.18); opacity: 0; transition: .18s;
}
.card:hover .thumb .play { opacity: 1; }
.thumb .play span {
  width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.92);
  display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--red);
}
.thumb .aud {
  position: absolute; left: 8px; top: 8px; background: var(--red); color: #fff;
  font-size: 11px; padding: 3px 8px; border-radius: 6px;
}
.card-body { padding: 12px 13px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body .fn { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snippet { font-size: 13px; color: #443d36; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.card-tags .ct { background: var(--chip); color: #6a6157; font-size: 11px; padding: 2px 8px; border-radius: 6px; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20,15,10,.55); backdrop-filter: blur(2px); }
.modal-box {
  position: relative; background: #fff; border-radius: 16px; width: min(820px, 94vw);
  max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-close { position: absolute; right: 12px; top: 10px; z-index: 2; border: none; background: rgba(0,0,0,.4); color: #fff; width: 32px; height: 32px; border-radius: 50%; font-size: 20px; cursor: pointer; }
#modal-video { width: 100%; display: block; background: #000; max-height: 52vh; }
.modal-meta { padding: 18px 22px 6px; }
.modal-meta h3 { margin: 0 0 10px; font-size: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .c { background: var(--red-soft); color: var(--red); font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.modal-transcript { padding: 6px 22px 24px; }
.modal-transcript h4 { font-size: 13px; color: var(--muted); margin: 14px 0 8px; }
.modal-transcript p { margin: 0; font-size: 14.5px; line-height: 1.9; white-space: pre-wrap; }

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 26px 16px 40px; }

@media (max-width: 760px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .topbar { padding: 14px 16px; }
}
