* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f4f1ea; --card: #fff; --ink: #23262f; --muted: #6b7280;
  --line: #e7e2d6; --accent: #b8862f; --accent-light: #e8c87a; --accent-deep: #6b4f1d;
  --accent-gradient: linear-gradient(135deg,#b8862f 0%,#e8c87a 50%,#b8862f 100%);
  --accent-gradient-hover: linear-gradient(135deg,#a6761f 0%,#d4b25a 50%,#a6761f 100%);
  --pos: #2e7d32; --neg: #c62828; --risk: #f57f17;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(31,35,40,.08);
}
body {
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",SimHei,sans-serif;
  background:
    radial-gradient(1200px 600px at 85% -5%, rgba(232,200,122,.18), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(61,139,125,.10), transparent 55%),
    var(--bg);
  background-attachment: fixed; color: var(--ink);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
#app { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: rgba(255,255,255,.82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px; background: var(--accent-gradient); }
.brand { display: flex; align-items: center; gap: 14px; }
.logo-box {
  width: 38px; height: 38px; border-radius: 10px; background: var(--accent-deep); color: #fff;
  display: grid; place-items: center; flex: 0 0 38px; padding: 7px; box-shadow: 0 2px 8px rgba(107,79,29,.3);
}
.logo-box .logo { width: 22px; height: 22px; }
.topbar h1 { font-size: 19px; font-weight: 800; background: var(--accent-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.subtitle { font-size: 12px; color: var(--muted); }
.badge { font-size: 12px; color: #8a5a14; background: linear-gradient(135deg,#fdf6e3,#f7e9c8); border: 1px solid #ecd9a8; padding: 4px 11px; border-radius: 999px; font-weight: 600; }

.tabs { display: flex; gap: 8px; padding: 16px 24px 0; max-width: 1100px; margin: 0 auto; }
.tab {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 9px 18px; border-radius: 10px 10px 0 0; font-size: 14px; font-weight: 600; cursor: pointer;
  border-bottom: none; transition: color .15s ease, background .15s ease;
}
.tab:hover { color: var(--accent); }
.tab.active { color: #8a5a14; background: linear-gradient(180deg,#fff,#fdf6e3); box-shadow: 0 -2px 8px rgba(184,134,47,.08); }

.content { padding: 0 24px 32px; max-width: 1100px; margin: 0 auto; }
.view { padding-top: 18px; }
.card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow-md); overflow: hidden; }
.card::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px; background: var(--accent-gradient); }
.card h3 { position: relative; padding-left: 12px; font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.card h3::before { content: ""; position: absolute; left: 0; top: 2px; width: 4px; height: 16px; border-radius: 2px; background: var(--accent-gradient); }
.card h4 { font-size: 13px; font-weight: 700; margin: 16px 0 8px; color: var(--ink); }
.mono { font-family: ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; }
.muted { color: var(--muted); }
.placeholder { color: var(--muted); font-size: 13px; }
.err { color: var(--neg); font-size: 13px; margin-top: 10px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.result-card { display: flex; flex-direction: column; }

/* 查询 + 表单控件 */
.field { margin-bottom: 14px; }
.field.inline { display: flex; align-items: center; gap: 8px; margin-bottom: 0; }
.field-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.field label { font-size: 13px; }
.field .unit { font-size: 12px; color: var(--muted); }
.field input[type=number], .field select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px;
  background: #fff; transition: border-color .15s ease, box-shadow .15s ease;
}
.field.inline select, .field.inline input { width: auto; }
.field input[type=number]:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(184,134,47,.12); }

.search-row { display: flex; gap: 10px; }
.search-row input { flex: 1; }
.reset-btn { padding: 9px 16px; border: none; cursor: pointer; font-size: 13px; font-weight: 600; color: #fff; border-radius: 10px; background: var(--accent-deep); box-shadow: 0 2px 8px rgba(107,79,29,.22); transition: background .15s ease, box-shadow .15s ease; white-space: nowrap; }
.reset-btn:hover:not(:disabled) { background: #5a3f16; box-shadow: 0 4px 14px rgba(107,79,29,.32); }
.reset-btn:disabled { opacity: .55; cursor: default; }
.reset-btn.ghost { background: #fff; color: var(--accent-deep); border: 1px solid var(--line); box-shadow: none; }
.reset-btn.ghost:hover:not(:disabled) { background: #fdf6e3; border-color: var(--accent); }

.hot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.hot-label { font-size: 13px; color: var(--muted); }
.chip { border: 1px solid var(--line); background: #fffdf8; color: #8a5a14; padding: 4px 12px; border-radius: 999px; font-size: 12px; cursor: pointer; transition: all .15s ease; }
.chip:hover { border-color: var(--accent); background: #fdf6e3; }

.seg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { flex: 1; padding: 8px 6px; border: none; background: #fff; font-size: 13px; cursor: pointer; color: var(--muted); transition: all .15s ease; }
.seg button.on { background: var(--accent-deep); color: #fff; font-weight: 600; }

/* 查询 - 分数与对照 */
.ind-name { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 8px; }
.score-row { display: flex; gap: 16px; margin-bottom: 8px; flex-wrap: wrap; }
.score-box { flex: 1; min-width: 140px; text-align: center; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fffdf8; }
.score-cap { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.score { font-size: 40px; font-weight: 800; background: var(--accent-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.score-meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.score-meta.center { text-align: center; font-size: 12px; margin-bottom: 8px; }

.band { display: inline-block; padding: 5px 14px; border-radius: 999px; font-weight: 600; font-size: 13px; margin-top: 6px; }
.band.low { background: #e8f5e9; color: var(--pos); }
.band.mid { background: #fff8e1; color: var(--risk); }
.band.high { background: #fdecea; color: var(--neg); }

.trend-wrap { margin: 8px 0 4px; }
.trend-cap { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.spark { width: 100%; height: 56px; display: block; }

table.breakdown { width: 100%; border-collapse: collapse; font-size: 13px; overflow: hidden; border-radius: 8px; }
table.breakdown thead th { background: var(--accent-deep); color: #fff; font-weight: 600; text-align: left; position: sticky; top: 0; padding: 8px 10px; }
table.breakdown th, table.breakdown td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.breakdown tbody tr:nth-child(even) { background: #fdfbf7; }
tr.flagged { background: #fdecea !important; }
tr.flagged td:first-child { font-weight: 700; color: var(--neg); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.note-flag { font-size: 11px; color: var(--neg); margin-top: 8px; }

.alert-box { margin-top: 14px; border: 1px solid #ecd9a8; background: #fdf6e3; border-radius: 10px; padding: 12px; }
.alert-cap { font-size: 12px; font-weight: 700; color: #8a5a14; margin-bottom: 6px; }
.alert-grid { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--ink); }

.alerts { list-style: none; font-size: 13px; }
.alerts li { padding: 5px 0; border-bottom: 1px dashed var(--line); color: var(--neg); }
.alerts li.ok { color: var(--pos); border-bottom: none; }

/* SHAP 瀑布图容器 */
.shap-wrap { margin: 4px 0 8px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fffdf8; overflow-x: auto; }
.shap-wrap svg { display: block; }

/* 排行榜 */
.filters { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.board-head { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 12px; }
.board-head .expect { color: var(--muted); }
.board-head b { color: var(--accent); }
.overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.ov-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fffdf8; text-align: center; }
.ov-num { font-size: 28px; font-weight: 800; background: var(--accent-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ov-cap { font-size: 12px; color: var(--muted); margin-top: 2px; }
.view-note { font-size: 12px; color: var(--accent-deep); margin-bottom: 8px; }
.view-note b { font-weight: 700; }
.table-scroll { max-height: 420px; overflow: auto; border-radius: 8px; border: 1px solid var(--line); margin-bottom: 8px; }
table.board td, table.board th { white-space: nowrap; }
tr.tier-top5 { background: #fdecea !important; }
tr.tier-top10 { background: #fff3e0 !important; }

.disclaimer { font-size: 11px; color: var(--muted); margin-top: 14px; line-height: 1.5; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg,#d9b964,#b8862f); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg,#c8a857,#a6761f); }
::-webkit-scrollbar-track { background: transparent; }
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
  .tabs { flex-wrap: wrap; }
}
