/* 提示词雷达 · 前端样式
 *
 * 约束：零第三方依赖、无构建步骤（验收 N3），所以是手写CSS。
 * 面向对象是「无编程基础的用户 + 每天要看几十条提示词」，
 * 因此字号偏大、行距偏松、关键动作（复制/反馈）永远在同一位置。
 */

:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --panel-2: #fbfcfd;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --text: #1b2027;
  --text-2: #5b6472;
  --text-3: #8b95a3;
  --accent: #2f6fed;
  --accent-soft: #eaf1fe;
  --green: #128a5b;
  --green-soft: #e6f5ee;
  --red: #c8402f;
  --red-soft: #fdecea;
  --amber: #a76a00;
  --amber-soft: #fdf3e0;
  --purple: #6b46c1;
  --purple-soft: #f0eafc;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, .12);
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 键盘 Tab 一定要看得出焦点落在哪。
   原来只有输入框有蓝圈，按钮 / 标签页 / 能力 chip 全是裸焦点，
   纯桌面端每天点几十下，键盘操作根本不知道自己在哪。 */
button:focus-visible, .chip:focus-visible, a:focus-visible,
.switch input:focus-visible + .track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* 鼠标点击时不画这个圈（只给键盘），否则每次点按钮都闪一下很吵 */
button:focus:not(:focus-visible), .chip:focus:not(:focus-visible) { outline: none; }

/* ---------- 布局 ---------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px;
  flex: 0 0 216px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { padding: 20px 20px 16px; border-bottom: 1px solid var(--border); }
.brand h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.brand .sub { margin-top: 3px; font-size: 12px; color: var(--text-3); }

.nav { padding: 10px 10px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  margin-bottom: 2px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; }
.nav-item .badge {
  margin-left: auto;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  line-height: 18px;
}
.nav-item.active .badge { background: var(--accent); }

.sidebar-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
}
.sidebar-foot .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-right: 6px; }
.sidebar-foot .dot.warn { background: var(--amber); }
.sidebar-foot .dot.err { background: var(--red); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.page-head {
  padding: 22px 28px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 20;
}
.page-head h2 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.page-head .desc { margin-top: 4px; font-size: 13px; color: var(--text-2); }
.page-head .actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.page-body { padding: 20px 28px 48px; flex: 1; }

/* ---------- 基础组件 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover:not(:disabled) { background: var(--bg); border-color: var(--text-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #2560d8; border-color: #2560d8; }
.btn.danger { color: var(--red); border-color: #f0c4bf; }
.btn.danger:hover:not(:disabled) { background: var(--red-soft); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
/* 「当前选中的标签页」用描边表达，跟「这页的主操作按钮」(.btn.primary) 分开。
   原来详情页的 tab 选中态直接复用 .btn.primary，
   于是同一行里「选中态」和「主操作」长得一样，看不出哪个是这页最重要的事。 */
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.btn.on:hover:not(:disabled) { background: #dfeaff; border-color: var(--accent); }

.input, .select, .textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { min-height: 120px; resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.6; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card-head {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-head h3 { margin: 0; font-size: 15px; font-weight: 620; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.empty { padding: 44px 20px; text-align: center; color: var(--text-3); }
.empty .big { font-size: 30px; margin-bottom: 8px; }
.empty .msg { font-size: 14px; }
.empty .hint { margin-top: 8px; font-size: 12.5px; color: var(--text-3); }

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11.5px;
  white-space: nowrap;
}
.tag.accent { background: var(--accent-soft); border-color: #cfe0fd; color: var(--accent); }
.tag.green { background: var(--green-soft); border-color: #c9e8d9; color: var(--green); }
.tag.red { background: var(--red-soft); border-color: #f5cdc8; color: var(--red); }
.tag.amber { background: var(--amber-soft); border-color: #f0dcb4; color: var(--amber); }
.tag.purple { background: var(--purple-soft); border-color: #ddd0f5; color: var(--purple); }
/* 用户自己打的标签：底色与系统标签区分开，否则用户分不清哪个是自己加的 */
.tag.mine { background: var(--green-soft); border-color: #c9e8d9; color: var(--green); font-weight: 600; }

.level { font-weight: 600; }
.level.expert { color: var(--purple); }
.level.advanced { color: var(--accent); }
.level.beginner { color: var(--text-2); }

.score-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
}
.score-pill b { font-size: 13.5px; color: var(--text); }

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  border: 1px solid;
  margin-bottom: 14px;
}
.alert.warn { background: var(--amber-soft); border-color: #f0dcb4; color: #7a4e00; }
.alert.err { background: var(--red-soft); border-color: #f5cdc8; color: #9c2f21; }
.alert.info { background: var(--accent-soft); border-color: #cfe0fd; color: #1d4fb5; }
.alert.ok { background: var(--green-soft); border-color: #c9e8d9; color: #0d6b45; }

.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat { padding: 14px 16px; }
.stat .label { font-size: 12px; color: var(--text-3); }
.stat .value { margin-top: 3px; font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.stat .foot { margin-top: 2px; font-size: 11.5px; color: var(--text-3); }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.hidden { display: none !important; }

/* ---------- 提示词卡片 ---------- */

.plist { display: flex; flex-direction: column; gap: 12px; }

.pcard {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.pcard:hover { border-color: var(--border-strong); }
.pcard .top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px 10px;
}
.pcard .title { font-size: 15.5px; font-weight: 620; line-height: 1.4; }
.pcard .title a { color: var(--text); }
.pcard .title a:hover { color: var(--accent); }
.pcard .meta { margin-top: 5px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.pcard .body {
  /* ⚠️ 底部要留出比渐变更高的一段空白（48px > 渐变 40px）。
     原来 padding-bottom 只有 12px，40px 的白色渐变正好盖在正文最后一行上，
     用户看到的是「文字被吃掉了」而不是「还有更多内容」。
     现在渐变落在空白区里，文字自然收尾，下面才是「展开全文」按钮。 */
  padding: 0 16px 48px;
  font-family: var(--mono);
  font-size: 12.8px;
  line-height: 1.65;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 108px;
  overflow: hidden;
  position: relative;
}
.pcard .body::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 40px;
  background: linear-gradient(transparent, var(--panel));
}
.pcard.open .body { max-height: none; padding-bottom: 12px; }
.pcard.open .body::after { display: none; }

.pcard .why {
  margin: 0 16px 10px;
  padding: 8px 11px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: #1d4fb5;
  line-height: 1.55;
}

.pcard .foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
  flex-wrap: wrap;
}
.pcard .foot .state { font-size: 12.5px; }
.pcard .foot .state.adopted { color: var(--green); }
.pcard .foot .state.ignored { color: var(--text-3); }
.pcard .foot .state.irrelevant { color: var(--red); }

/* ---------- 中文翻译（F3.5） ---------- */

/* ⚠️ 只在「有异常」时出现（还没翻到 / 翻失败）。
   已翻译成功的卡片不显示任何条——满屏「中文 ✓」徽章没有信息量，只会把卡片撑高。 */
.transbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  font-size: 12.5px;
  border-top: 1px solid var(--border);
}
.transbar.pending { background: var(--panel-2); color: var(--text-3); }
.transbar.failed  { background: var(--red-soft); color: var(--red); }
.transbar .muted { color: var(--text-3); }

.zhflag {
  display: inline-block;
  padding: 1px 7px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .3px;
  color: #fff;
  background: var(--green);
  border-radius: 4px;
}

/* card-head 是 flex；右侧一放徽章，标题 h3 会被压成竖排多行。
   修法：标题与控件都不许收缩，放不下时整行换行，而不是把标题挤变形。
   只加通用工具类，不改 .card-head 全局行为（会影响所有卡片）。 */
.card-head h3.flex1 { flex: 1 1 auto; min-width: 0; }
.row.nowrap, .nowrap { flex-wrap: nowrap; white-space: nowrap; }

/* ---------- 表格 ---------- */

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--panel-2); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--panel-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 筛选栏 ---------- */

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters .input, .filters .select { width: auto; min-width: 130px; }
.filters .grow { flex: 1; min-width: 200px; }

/* ---------- 引导式画像 ---------- */

.guide-step { margin-bottom: 20px; }
.guide-step .q { font-size: 14.5px; font-weight: 620; margin-bottom: 3px; }
.guide-step .h { font-size: 12.5px; color: var(--text-3); margin-bottom: 9px; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--panel);
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }

.progress { display: flex; gap: 4px; margin-bottom: 18px; }
.progress i { flex: 1; height: 3px; border-radius: 2px; background: var(--border); }
.progress i.on { background: var(--accent); }

/* ---------- 详情 / 弹层 ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  z-index: 100;
  overflow-y: auto;
}
.modal {
  width: 100%;
  max-width: 720px;
  background: var(--panel);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 640; }
.modal-head .x {
  margin-left: auto;
  border: 0;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  color: var(--text-3);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.modal-head .x:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 20px; }
.modal-foot { padding: 13px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--panel-2); }

.kv { display: grid; grid-template-columns: 92px 1fr; gap: 7px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; }

.full-text {
  padding: 13px 15px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
  overflow-y: auto;
}

.ver-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.ver-item:last-child { border-bottom: 0; }
.ver-item .v { font-family: var(--mono); font-weight: 600; min-width: 34px; }
.ver-item .prev { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 提示条 ---------- */

.toast-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}
.toast {
  padding: 10px 15px;
  border-radius: var(--radius-sm);
  background: #1b2027;
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  max-width: 380px;
  animation: toastin .18s ease-out;
}
.toast.ok { background: #0d6b45; }
.toast.err { background: #9c2f21; }
@keyframes toastin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 时间线 ---------- */

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 9px 0 9px 4px; }
.tl-item::before {
  content: '';
  position: absolute;
  left: -21px; top: 15px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
  border: 2px solid var(--panel);
}
.tl-item.adopted::before { background: var(--green); }
.tl-item.ignored::before { background: var(--text-3); }
.tl-item.irrelevant::before { background: var(--red); }
.tl-item .t { font-size: 13.5px; }
.tl-item .d { font-size: 12px; color: var(--text-3); margin-top: 1px; }

/* ---------- 采集日志 ---------- */

.job {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.job:last-child { border-bottom: 0; }
.job .st { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: 0 0 auto; }
.job .st.done { background: var(--green); }
.job .st.running { background: var(--accent); animation: pulse 1s infinite; }
.job .st.failed { background: var(--red); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.source-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.source-item:last-child { border-bottom: 0; }
.source-item .nm { font-size: 14px; font-weight: 550; }
.source-item .url { font-size: 12px; color: var(--text-3); word-break: break-all; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0;
  background: var(--border-strong);
  border-radius: 22px;
  cursor: pointer;
  transition: background .15s;
}
.switch .track::before {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform .15s;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::before { transform: translateX(18px); }

/* ---------- 隐私说明（N12） ---------- */

.privacy-list { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.75; }
.privacy-list li { margin-bottom: 5px; }

.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
