
/* hidden 属性必须真的生效——否则会被 .locked{display:flex} 之类的规则盖掉 */
[hidden] { display: none !important; }
/* 福利监控 · 仪表盘样式（零依赖，深色） */

:root {
  --bg: #0f1115;
  --panel: #161a21;
  --panel-2: #1c212a;
  --border: #262d39;
  --text: #e6e9ef;
  --muted: #8b93a7;
  --accent: #f5a623;
  --ok: #2ecc71;
  --bad: #ef5350;
  --slow: #b06cf0;
  --skip: #6b7280;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #1a2030 0%, var(--bg) 55%);
  color: var(--text);
  font: 14px/1.55 "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px; padding: 18px 28px 10px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 26px; }
h1 { margin: 0; font-size: 18px; letter-spacing: .3px; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.actions { display: flex; align-items: center; gap: 14px; }

.btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 14px; cursor: pointer; font-size: 13px;
  transition: border-color .15s, transform .05s;
}
.btn:hover { border-color: #3a4658; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; }

.switch { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; cursor: pointer; }
.switch input { accent-color: var(--accent); }
.switch.small { font-size: 12px; }

/* 区域切换（国内/海外） */
.seg {
  display: inline-flex; background: #12161d; border: 1px solid var(--border);
  border-radius: 8px; padding: 2px; gap: 2px;
}
.seg button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 12.5px; padding: 5px 12px; border-radius: 6px; transition: all .12s;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--panel-2); color: var(--accent); box-shadow: inset 0 0 0 1px #33405a; }

/* ---------- 布局 ---------- */
main { padding: 8px 28px 32px; display: flex; flex-direction: column; gap: 16px; }
.row { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; }
@media (max-width: 1080px) {
  .row { grid-template-columns: 1fr; }
  main, .topbar { padding-left: 16px; padding-right: 16px; }
}

.card {
  background: linear-gradient(180deg, var(--panel) 0%, #141821 100%);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.card-head h2 { margin: 0; font-size: 14px; font-weight: 600; color: #cfd6e4; }
.hint { color: var(--muted); font-size: 12px; }
.inline { display: flex; align-items: center; gap: 10px; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, 1fr); } }

.kpi {
  background: linear-gradient(180deg, var(--panel) 0%, #141821 100%);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 26px; font-weight: 650; margin-top: 4px; letter-spacing: .5px; }
.kpi .value small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.kpi.accent .value { color: var(--accent); }

/* ---------- 图表 ---------- */
.chart svg { width: 100%; height: 168px; display: block; }
.chart .bar { fill: var(--accent); opacity: .85; }
.chart .bar:hover { opacity: 1; }
.chart .axis { stroke: #2b3341; stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .val { fill: #cfd6e4; font-size: 11px; }

/* ---------- 源健康 ---------- */
.health { display: flex; flex-direction: column; gap: 8px; max-height: 200px; overflow: auto; }
.health-row {
  display: grid; grid-template-columns: 18px 1fr auto auto; gap: 10px;
  align-items: center; padding: 6px 8px; border-radius: 8px; background: #12161d;
  border: 1px solid transparent;
}
.health-row:hover { border-color: var(--border); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
.dot.slow { background: var(--slow); }
.dot.skip { background: var(--skip); }
.health-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health-meta { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.health-err { color: var(--bad); font-size: 11px; grid-column: 2 / -1; margin-top: -2px; }

/* ---------- 列表 ---------- */
.list { display: flex; flex-direction: column; gap: 2px; max-height: 420px; overflow: auto; }
.list.compact { max-height: 360px; }

.hit {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; gap: 12px;
  padding: 9px 8px; border-radius: 8px; align-items: baseline;
}
.hit:hover { background: #12161d; }
.hit .when { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.hit .title { font-size: 13.5px; }
.hit .title a { color: var(--text); text-decoration: none; }
.hit .title a:hover { color: var(--accent); text-decoration: underline; }
.hit .reason { color: var(--accent); font-size: 11.5px; margin-left: 6px; }

/* 反馈按钮：默认很淡，鼠标移上去才显眼——它不该抢内容的视线 */
.fb { display: inline-flex; gap: 3px; margin-left: 8px; opacity: .35; transition: opacity .15s; }
.hit:hover .fb, .item:hover .fb, .fb:focus-within { opacity: 1; }
.fb-btn {
  background: none; border: 1px solid transparent; border-radius: 6px;
  cursor: pointer; font-size: 12px; line-height: 1; padding: 3px 4px;
  color: #8b95a7; transition: all .12s;
}
.fb-btn:hover { background: #232c3a; color: #e6ebf5; }
.fb-btn.on { background: #223247; border-color: #3b5b86; color: #7fb2ff; }
.fb-btn.busy { opacity: .5; }
.fb-stats { color: #7d8798; font-size: 12px; padding: 0 6px; }

/* 内容类型标签：比分类更淡，避免每行两个标签抢戏 */
.chip.ctype { background: #1d2634; color: #8fa3c0; border-color: #2a3647; font-weight: 500; }

/* 收藏夹里的条目：左边一条金线，和其它列表区分开 */
.hit.fav { border-left: 2px solid #6b5b2e; padding-left: 8px; }

/* 阅读状态：未读是正常亮度，读过压暗，稍后留蓝边，忽略再淡一档 */
.rs { display: inline-flex; gap: 2px; margin-left: 6px; opacity: .35; transition: opacity .15s; }
.item:hover .rs, .rs:focus-within { opacity: 1; }
.rs-btn {
  background: none; border: 1px solid transparent; border-radius: 6px;
  cursor: pointer; font-size: 11.5px; line-height: 1; padding: 3px 4px;
  color: #8b95a7;
}
.rs-btn:hover { background: #232c3a; color: #e6ebf5; }
.rs-btn.on { background: #1f3a2c; border-color: #2f6b4a; color: #7ddba0; }
.item.st-read .it-title { opacity: .5; }
.item.st-read .it-title a { text-decoration: line-through; text-decoration-color: #3c4657; }
.item.st-later { border-left: 2px solid #3b5b86; padding-left: 6px; }
.item.st-dismissed .it-title { opacity: .3; }
.hit .summary {
  display: block; margin-top: 3px; color: #9aa4b8; font-size: 12px;
  line-height: 1.6; border-left: 2px solid #2e3746; padding-left: 8px;
}
.hit .tag { color: var(--muted); font-size: 11px; white-space: nowrap; }
.hit .price { color: var(--accent); font-variant-numeric: tabular-nums; font-size: 12.5px; }

.item {
  display: grid; grid-template-columns: minmax(0, 1fr) 84px auto auto;
  gap: 12px; padding: 8px; border-radius: 8px; cursor: pointer; align-items: baseline;
}
.item:hover { background: #12161d; }
.item .it-title { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .it-src { color: var(--muted); font-size: 11.5px; }
.item .it-price { color: var(--accent); font-variant-numeric: tabular-nums; text-align: right; }
.item .it-hit { color: var(--muted); font-size: 11px; text-align: right; }
.item.is-hit .it-hit { color: var(--accent); }
.item .it-link { color: var(--text); text-decoration: none; }
.item .it-link:hover { color: var(--accent); text-decoration: underline; }

/* 分类小标签 */
.chip {
  display: inline-block; padding: 0 6px; margin-right: 6px; border-radius: 999px;
  font-size: 10.5px; font-style: normal; line-height: 16px; vertical-align: 1px;
  color: #cfd6e4; background: #232b38; border: 1px solid #313b4c;
}
.chip.cat { color: var(--accent); background: rgba(245, 166, 35, .1); border-color: rgba(245, 166, 35, .3); }

.health-row.clickable { cursor: pointer; }
.health-row.clickable:hover { background: #171c25; border-color: #33405a; }

/* 正文预览 */
.article { max-height: 58vh; overflow: auto; white-space: pre-wrap; line-height: 1.75;
  font-size: 13.5px; color: #cfd6e4; background: #12161d; border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; }
.article-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.article-actions a { color: var(--accent); text-decoration: none; font-size: 13px; }

/* 入口链接：这类券的价值就在「去领券」那一下，必须显眼 */
.links {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 12px; border-radius: 10px;
  background: rgba(245, 166, 35, .08); border: 1px solid rgba(245, 166, 35, .25);
}
.link-btn {
  display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 12.5px;
  color: #16181d; background: var(--accent); text-decoration: none; font-weight: 600;
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-btn:hover { filter: brightness(1.08); }

.empty { color: var(--muted); padding: 18px 6px; font-size: 13px; text-align: center; }

/* ---------- 输入 ---------- */
.input, .select {
  background: #12161d; color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; font-size: 13px; outline: none;
}
.input { min-width: 220px; }
.input:focus, .select:focus { border-color: #3d4a5f; }

/* ---------- 弹层 ---------- */
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; background: rgba(5, 7, 10, .72);
  display: grid; place-items: center; padding: 24px; z-index: 50;
  backdrop-filter: blur(2px);
}
.modal-box {
  width: min(760px, 100%); background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px 20px; box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h2 { margin: 0; font-size: 15px; }
#modal-body { margin-top: 12px; }
#modal-body svg { width: 100%; height: 220px; }
.meta { color: var(--muted); font-size: 12px; margin-top: 8px; }
.line { fill: none; stroke: var(--accent); stroke-width: 2; }
.grid-line { stroke: #2b3341; stroke-width: 1; }
.point { fill: var(--accent); }

.foot {
  display: flex; justify-content: space-between; color: var(--muted);
  font-size: 11.5px; padding: 0 28px 20px;
}

/* LLM 解读：和摘要同层级，但用不同颜色区分"模型判断"和"原文摘录" */
.llm-why, .llm-rel {
  display: block; margin-top: 3px; font-size: 12px; line-height: 1.55;
  color: #9fb3d1; padding-left: 8px; border-left: 2px solid #2d4266;
}
.llm-rel { color: #8fa8c9; border-left-color: #3b5b86; }

/* 今日精选卡片：和命中时间线区分（左边一道浅金线） */
.hit.pick { border-left: 2px solid #3b4a63; padding-left: 8px; }

/* 今日精选：没有时间列，标题要占满整行；来源和按钮落到下一行的右侧 */
.hit.pick {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 10px 10px 12px;
}
.hit.pick .title { flex: 1 1 100%; font-size: 14px; line-height: 1.6; }
.hit.pick .tag { flex: 0 0 auto; margin-left: 0; }
.hit.pick .fb { margin-left: auto; }
/* 解读文字别铺满整屏：超过 ~52 个汉字就换行，眼睛回扫距离短一点 */
.hit.pick .summary,
.hit.pick .llm-why,
.hit.pick .llm-rel { max-width: 88ch; }

/* 可折叠卡片：标题行像按钮，展开后才是内容 */
.card.collapsible > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px;
  margin: 0; padding: 0; user-select: none;
}
.card.collapsible > summary::-webkit-details-marker { display: none; }
.card.collapsible > summary::before {
  content: "▸"; color: #7d8798; font-size: 12px; transition: transform .15s;
}
.card.collapsible[open] > summary::before { transform: rotate(90deg); }
.card.collapsible[open] > summary { margin-bottom: 10px; }

/* 条目行是 4 列网格；加进来的摘要/解读要占满整行，否则会被塞进第一列 */
.item .summary,
.item .llm-why,
.item .llm-rel {
  grid-column: 1 / -1;   /* 摘要/解读占满整行 */
}
.item .fb { justify-self: end; }
.item .rs { justify-self: end; }
.item .summary { margin-top: 2px; }
.item .fb, .item .rs { margin-top: 2px; }

/* 学习库：已学的整行变暗并加删除线 */
.item.lib { grid-template-columns: 1fr auto auto; }
.item.lib .summary, .item.lib .llm-why, .item.lib .llm-rel { grid-column: 1 / -1; }
.item.lib.learned .it-title a { opacity: .45; text-decoration: line-through; }

/* 访客只读：隐藏所有"写"入口（评分、已读、已学、收藏夹） */
body.guest .fb,
body.guest .rs,
body.guest .learn-btn,
body.guest #fav-card { display: none !important; }

/* 条目浏览：加载更多 */
.load-more-wrap { text-align: center; padding: 10px 0 2px; }
.load-more-wrap .btn { min-width: 140px; }

/* 回博客：低调一点，别抢内容视线 */
.back-blog {
  color: #8b95a7; font-size: 12.5px; text-decoration: none;
  padding: 5px 8px; border-radius: 6px; transition: all .12s;
}
.back-blog:hover { color: #e6ebf5; background: #232c3a; }

/* 投票按钮上的票数：小一号、不抢眼 */
.fb-btn b { font-weight: 600; font-size: 11px; margin-left: 1px; color: #9fb3d1; }
.fb-btn.on b { color: #7fb2ff; }

/* 顶部菜单：把"条目/学习库/命中/收藏"从首页挪走 */
.tabs {
  flex-basis: 100%;
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 12px;
  border-top: 1px solid #1e2530; padding-top: 10px;
}
.tabs button {
  background: none; border: none; cursor: pointer;
  color: #8b95a7; font-size: 13.5px; padding: 6px 14px; border-radius: 7px;
  transition: all .12s;
}
.tabs button:hover { color: #e6ebf5; background: #1b2230; }
.tabs button.active { color: #7fb2ff; background: #1b2434; font-weight: 600; }

/* 分页：只有当前页显示 */
.page { display: none; }
.page.active { display: block; }

/* 跨页菜单项（日记本是独立页面） */
.tabs .tab-link {
  color: #8b95a7; font-size: 13.5px; padding: 6px 14px; border-radius: 7px;
  text-decoration: none; transition: all .12s;
}
.tabs .tab-link:hover { color: #e6ebf5; background: #1b2230; }

/* ---------- 手机端：命中/条目都改成"时间在左、内容占满" ---------- */
@media (max-width: 720px) {
  .hit {
    grid-template-columns: 42px minmax(0, 1fr);
    grid-template-areas:
      "when title"
      "when tag"
      "when fb";
    row-gap: 2px;
    align-items: start;
  }
  .hit .when { grid-area: when; padding-top: 2px; }
  .hit .title { grid-area: title; }
  .hit .tag { grid-area: tag; font-size: 11px; }
  .hit .fb { grid-area: fb; justify-self: start; margin-left: 0; }
  .hit .summary { display: block; margin-top: 3px; }
  .hit .llm-why, .hit .llm-rel { display: block; }

  .item {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 3px;
  }
  .item .it-title { grid-column: 1 / -1; white-space: normal; }
  .item .it-hit { grid-column: 1; text-align: left; }
  .item .fb, .item .rs { grid-column: 2; justify-self: end; }

  .card-head { flex-wrap: wrap; }
  .card-head .inline { flex-wrap: wrap; width: 100%; }
  .inline .input, .inline .select { flex: 1 1 140px; min-width: 0; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .tabs { gap: 2px; }
  .tabs button, .tabs .tab-link { padding: 6px 10px; font-size: 13px; }
}

/* 只有一张图卡时占满整行 */
.row.single { grid-template-columns: 1fr; }

/* 站点健康提示 */
.health-warn {
  grid-column: 1 / -1;
  background: #3a2320; border: 1px solid #7d3a2c; border-left: 3px solid #c0563f;
  color: #f0cbbd; font-size: 12.5px; line-height: 1.9;
  padding: 8px 14px; border-radius: 6px; margin-bottom: 12px;
}
