/* 预测模型迭代看板样式（复用 style.css 的变量） */
main { padding: 22px; max-width: 1280px; margin: 0 auto; }
section { margin-bottom: 34px; scroll-margin-top: 70px; }
h2 { font-size: 19px; margin-bottom: 6px; }
h3 { font-size: 14px; color: var(--accent); margin-bottom: 12px; font-weight: 600; }
.subtitle { color: var(--muted); font-size: 13px; margin-bottom: 14px; line-height: 1.6; }

.fnav { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.fnav a { color: var(--muted); text-decoration: none; font-size: 13px; padding: 6px 10px; border-radius: 8px; border: 1px solid transparent; }
.fnav a:hover { color: var(--text); background: var(--panel2); }
.fnav a.back { border-color: var(--border); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.card .k { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.card .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card .s { color: var(--muted); font-size: 11px; margin-top: 4px; }
.card .v.good { color: var(--up); }
.card .v.mid { color: var(--hot); }
.card .v.bad { color: var(--down); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { background: var(--panel); border: 1px solid var(--border); color: var(--muted); border-radius: 20px; padding: 6px 14px; font-size: 13px; cursor: pointer; }
.chip.active { background: var(--accent); color: var(--bg); font-weight: 600; border-color: var(--accent); }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-row .lbl { width: 64px; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.bar-track { flex: 1; height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--accent); }
.bar-row .val { width: 44px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text); }

.rank-row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.rank-row:hover { background: var(--panel2); }
.rank-no { width: 30px; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-name { width: 190px; flex-shrink: 0; font-size: 14px; }
.rank-track { flex: 1; height: 14px; background: var(--panel2); border-radius: 7px; overflow: hidden; }
.rank-fill { height: 100%; border-radius: 7px; }
.rank-score { width: 64px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.rank-conf { width: 54px; text-align: right; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border); color: var(--muted); margin-left: 6px; }
.badge.deep { color: var(--up); border-color: var(--up); }
.badge.partial { color: var(--hot); border-color: var(--hot); }
.badge.emerging { color: var(--accent); border-color: var(--accent); }
.badge.latent { color: var(--muted); }
.badge.src { color: var(--hot); border-color: var(--hot); }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.tbl thead th { color: var(--muted); font-weight: 600; font-size: 12px; }
.tbl tbody tr:hover { background: var(--panel2); }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.sel { background: var(--panel2); outline: 1px solid var(--accent); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

.pp-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.pp-card .pp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pp-card .pp-rank { width: 26px; height: 26px; border-radius: 50%; background: var(--panel2); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.pp-card .pp-name { font-weight: 600; font-size: 14px; }
.pp-card .pp-meta { color: var(--muted); font-size: 12px; margin-bottom: 8px; line-height: 1.6; }
.pp-evidence { color: var(--muted); font-size: 12px; border-left: 2px solid var(--border); padding-left: 10px; margin-top: 8px; }
.pp-caps { color: var(--muted); font-size: 11px; margin-top: 4px; }

.conflict { padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px; line-height: 1.5; }
.conflict .arrow { color: var(--down); font-weight: 700; }

.guide { font-size: 13px; line-height: 1.8; color: var(--text); }
.guide code { background: var(--panel2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; font-size: 12px; color: var(--accent); }
.guide .step { margin-bottom: 10px; }

.empty { color: var(--muted); font-size: 13px; padding: 14px 0; }
footer { color: var(--muted); font-size: 12px; text-align: center; padding: 26px 0 40px; border-top: 1px solid var(--border); margin-top: 10px; }

/* 评估模型板块 */
.rubric-detail { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 8px; }
.rubric-detail summary { cursor: pointer; color: var(--accent); font-size: 12px; }
.rubric-detail .bar-row { margin-bottom: 4px; }
.rubric-detail .bar-row .bar-track { height: 6px; }


/* ---------- AI 会话（独立页，移动优先） ---------- */
.chat-header { padding: 10px 14px; gap: 10px; }
.chat-header .brand { font-size: 17px; }
.chat-page { max-width: 1100px; }
.chat-intro { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; padding: 7px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; font-size: 12px; color: var(--muted); cursor: pointer; }
.chat-intro p { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-intro.open p { white-space: normal; }
.intro-arrow { flex-shrink: 0; font-size: 13px; color: var(--accent); line-height: 1; }

.new-session { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.new-session textarea,
#chatInput {
  flex: 1; min-height: 44px; max-height: 120px; resize: none;
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  border-radius: 12px; padding: 10px 12px; font-size: 15px; line-height: 1.5; font-family: inherit;
}
.new-session textarea:focus, #chatInput:focus { outline: none; border-color: var(--accent); }
.send-btn {
  width: 44px; height: 44px; flex-shrink: 0; border: none; border-radius: 50%;
  background: var(--accent); color: var(--bg); font-size: 15px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.send-btn:hover { filter: brightness(1.12); }
.send-btn:disabled { opacity: 0.5; cursor: wait; }

.chat-layout { display: grid; grid-template-columns: 240px 1fr; gap: 14px; align-items: stretch; }
@media (max-width: 900px) { .chat-layout { grid-template-columns: 1fr; } }
.chat-side { display: flex; flex-direction: column; max-height: calc(100vh - 250px); max-height: calc(100dvh - 250px); overflow: hidden; }
.side-title { margin-bottom: 8px; }
.side-toggle { display: none; }
#chatSessions { flex: 1; min-height: 0; overflow-y: auto; padding-right: 2px; }
.chat-session { margin-bottom: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel2); font-size: 13px; overflow: hidden; }
.chat-session .hd { padding: 9px 11px; cursor: pointer; color: var(--text); }
.chat-session .hd:hover { background: var(--panel); }
.chat-session.open .hd, .chat-session.active .hd { color: var(--accent); }
.chat-session.active { border-color: var(--accent); }
.chat-session .t { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-session .m { color: var(--muted); font-size: 11px; }
.chat-session .bd { display: none; padding: 8px 11px; border-top: 1px dashed var(--border); }
.chat-session.open .bd { display: flex; flex-direction: column; gap: 8px; }
.chat-session .prev { color: var(--muted); font-size: 12px; line-height: 1.5; word-break: break-word; }
.chat-session .bd .chip { align-self: flex-start; font-size: 12px; padding: 5px 12px; }

.chat-main { display: flex; flex-direction: column; height: calc(100vh - 250px); height: calc(100dvh - 250px); min-height: 420px; padding: 12px; }
#chatMessages { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; }
.chat-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.chat-keyrow { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 220px; }
#chatKey { flex: 1; min-width: 120px; background: var(--panel2); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 8px 12px; font-size: 13px; font-family: inherit; }
#chatKey:focus { outline: none; border-color: var(--accent); }
.key-hint { color: var(--muted); font-size: 11px; }
.mode-switch { display: inline-flex; gap: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 3px; }
.mode-opt { border: none; background: transparent; color: var(--muted); font-size: 12px; padding: 6px 12px; border-radius: 18px; cursor: pointer; }
.mode-opt.active { background: var(--accent); color: var(--bg); font-weight: 600; }

.msg { margin-bottom: 12px; max-width: 88%; }
.msg .who { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.msg .body { font-size: 14px; line-height: 1.7; padding: 10px 13px; border-radius: 12px; white-space: pre-wrap; word-break: break-word; }
.msg.user { margin-left: auto; }
.msg.user .body { background: var(--accent); color: var(--bg); }
.msg.assistant .body { background: var(--panel2); border: 1px solid var(--border); }
.msg.tool { max-width: 100%; }
.msg.tool .who { color: var(--accent); }
.msg.tool .body { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--accent); background: var(--bg); border: 1px solid var(--border); overflow-x: auto; max-height: 60vh; overflow-y: auto; }
.msg.collapsible { cursor: pointer; border-radius: 12px; }
.msg.collapsible:hover { outline: 1px dashed var(--accent); }
.msg.collapsible .preview { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.msg.collapsible .full { display: none; }
.msg.collapsible.expanded .preview { display: none; }
.msg.collapsible.expanded .full { display: block; }
.msg.collapsible .hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

.chat-input {
  display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; flex-shrink: 0;
  position: sticky; bottom: 0; z-index: 5; background: var(--bg);
  padding-top: 8px; padding-bottom: env(safe-area-inset-bottom);
}
.chat-loading { color: var(--muted); font-size: 13px; padding: 8px 0; }
.chat-status { display: none; min-height: 22px; margin: 8px 0 4px; padding: 7px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.chat-status.thinking { display: block; color: var(--accent); background: var(--panel2); border: 1px solid var(--border); }
.chat-status.error { display: block; color: #fff; background: var(--down); }
.chat-status.done { display: block; color: var(--up); background: var(--panel2); border: 1px solid var(--up); }
.chat-status.warn { display: block; color: var(--hot); background: var(--panel2); border: 1px solid var(--hot); }

/* v0.13 refinement layer */
.fnav a {
  border-radius: 999px;
  padding: 7px 13px;
  border-color: rgba(102,192,244,.10);
  background: linear-gradient(180deg, rgba(24,37,56,.90), rgba(17,26,41,.92));
  transition: color .18s ease, border-color .18s ease, transform .18s ease, background .18s ease;
}
.fnav a:hover {
  color: #fff;
  border-color: rgba(102,192,244,.35);
  transform: translateY(-1px);
}
h2 { color: #fff; letter-spacing: -.025em; }
h3 { letter-spacing: -.01em; }
.cards { gap: 14px; }
.card,
.panel {
  background: var(--panel-raised);
  border-color: rgba(102,192,244,.10);
  border-radius: 17px;
  box-shadow: var(--shadow-soft);
}
.card { transition: transform .20s ease, border-color .20s ease, box-shadow .20s ease; }
.card:hover {
  transform: translateY(-2px);
  border-color: rgba(102,192,244,.24);
}
.card .k {
  text-transform: uppercase;
  letter-spacing: .055em;
  font-size: 10.5px;
}
.card .v { letter-spacing: -.035em; }
.chip {
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(24,37,56,.92), rgba(17,26,41,.92));
  border-color: rgba(102,192,244,.10);
  transition: transform .18s ease, color .18s ease, border-color .18s ease, background .18s ease;
}
.chip:hover { color: #fff; border-color: rgba(102,192,244,.35); transform: translateY(-1px); }
.chip.active {
  background: rgba(102,192,244,.20);
  border-color: rgba(102,192,244,.52);
  color: #fff;
  box-shadow: 0 6px 20px rgba(102,192,244,.12);
}
.bar-track,
.rank-track { background: rgba(102,192,244,.10); }
.bar-fill { background: var(--gradient-accent); }
.rank-row,
.conflict { border-bottom-color: rgba(102,192,244,.07); transition: background .16s ease; }
.rank-row:hover { background: rgba(102,192,244,.05); }
.rank-name { color: #fff; }
.badge {
  border-radius: 999px;
  background: rgba(17,26,41,.75);
}
.tbl th,
.tbl td { border-bottom-color: rgba(102,192,244,.07); }
.tbl thead th {
  text-transform: uppercase;
  letter-spacing: .035em;
  font-size: 11px;
}
.tbl tbody tr:hover { background: rgba(102,192,244,.05); }
.pp-card {
  background: rgba(11,17,28,.45);
  border-color: rgba(102,192,244,.10);
  border-radius: 14px;
  transition: border-color .18s ease, transform .18s ease;
}
.pp-card:hover { border-color: rgba(102,192,244,.24); transform: translateY(-1px); }
.pp-name { color: #fff; }
.guide code { border-radius: 6px; }
.chat-status .spin { display: inline-block; width: 13px; height: 13px; border: 2px solid var(--accent); border-top-color: transparent; border-radius: 50%; animation: chatSpin 0.8s linear infinite; margin-right: 7px; vertical-align: -2px; }
@keyframes chatSpin { to { transform: rotate(360deg); } }
.chip:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- 修改链路测试页 ---------- */
.test-panel { margin-bottom: 14px; }
.test-panel h3 { margin-bottom: 6px; }
.test-panel .subtitle { margin-bottom: 10px; }
#testMsg { width: 100%; min-height: 72px; resize: vertical; background: var(--panel2); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: 15px; line-height: 1.6; font-family: inherit; }
#testMsg:focus { outline: none; border-color: var(--accent); }
.test-actions { display: flex; gap: 8px; margin-top: 10px; }
#testKey { flex: 1; min-width: 0; background: var(--panel2); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 9px 12px; font-size: 14px; font-family: inherit; }
#testKey:focus { outline: none; border-color: var(--accent); }
.test-actions .chip { flex-shrink: 0; }
.file-box { border: 1px solid var(--border); border-radius: 10px; background: var(--bg); padding: 10px 12px; }
.file-body { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--text); white-space: pre-wrap; word-break: break-word; max-height: 180px; overflow-y: auto; }
.file-body.empty { color: var(--muted); }
.tmeta { color: var(--muted); font-size: 12px; margin-top: 6px; }
.tblock { margin-top: 12px; }
.tblock h4 { font-size: 13px; margin-bottom: 6px; color: var(--accent); }
.tblock pre { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px; white-space: pre-wrap; word-break: break-word; color: var(--text); }
.tblock pre.small { max-height: 160px; overflow-y: auto; }
.ok-line { color: var(--up); font-size: 13px; padding: 3px 0; word-break: break-word; }
.err-line { color: var(--down); font-size: 13px; padding: 3px 0; word-break: break-word; }
.warn-line { color: var(--hot); font-size: 13px; padding: 3px 0; }
.mono-line { color: var(--muted); font-size: 12px; font-family: ui-monospace, Menlo, Consolas, monospace; padding: 3px 0; }
.verdict { font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius: 8px; margin-bottom: 8px; }
.verdict.ok { color: var(--up); background: var(--panel2); border: 1px solid var(--up); }
.verdict.fail { color: var(--down); background: var(--panel2); border: 1px solid var(--down); }

/* ---------- 手机端优化 ---------- */
@media (max-width: 720px) {
  main { padding: 12px; }
  section { margin-bottom: 26px; scroll-margin-top: 8px; }
  h2 { font-size: 17px; }
  h3 { font-size: 13px; }
  .fnav { gap: 6px; }
  .fnav a { font-size: 12px; padding: 5px 8px; }
  .cards { gap: 8px; }
  .card { padding: 10px 12px; }
  .card .v { font-size: 20px; }
  .grid2 { gap: 10px; }
  .panel { padding: 12px; }
  .rank-row { flex-wrap: wrap; gap: 6px; padding: 8px 10px; }
  .rank-name { width: 100%; }
  .rank-score, .rank-conf { width: auto; }
  .bar-row .lbl { width: 52px; }
  .tbl { display: block; overflow-x: auto; white-space: nowrap; font-size: 12px; }
  .tbl th, .tbl td { padding: 6px 8px; }
  .pp-card { padding: 10px; }
  .conflict { font-size: 12px; }
  .guide { font-size: 12px; }
  footer { font-size: 11px; padding: 20px 12px 32px; }
  /* 聊天区：会话列表在下方（默认折叠），输入区固定 */
  .chat-header { padding: 8px 12px; }
  .chat-header .brand { font-size: 15px; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-side { order: 2; max-height: none; }
  .side-title { display: none; }
  .side-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; background: var(--panel2); border: 1px solid var(--border); color: var(--muted); border-radius: 10px; padding: 10px 12px; font-size: 13px; cursor: pointer; }
  #chatSessions { display: none; max-height: 260px; }
  .chat-side.open #chatSessions { display: block; }
  .chat-main { height: calc(100dvh - 150px); min-height: 0; padding: 10px; }
  .chat-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .mode-switch { width: 100%; }
  .mode-opt { flex: 1; text-align: center; }
  #chatKey { min-width: 0; font-size: 16px; }
  .new-session textarea, #chatInput { font-size: 16px; }
  .new-session { margin-bottom: 10px; }
  .chat-intro { font-size: 12px; }
  .intro-arrow { font-size: 12px; }
  .msg { max-width: 100%; }
  .msg .body { font-size: 14px; }
}
