:root {
  --bg: #f5f7f6;
  --card: #ffffff;
  --ink: #1a2b22;
  --muted: #6b7f75;
  --line: #e3e9e5;
  --green: #16a34a;
  --green-dark: #15803d;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--red); margin-top: 8px; }

/* ---- 顶栏 ---- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  background: #0f1f17; color: #fff; padding: 0 24px; height: 56px;
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand { font-weight: 700; font-size: 16px; }
.topbar .brand .logo {
  background: var(--green); color: #fff; border-radius: 6px; padding: 2px 7px; margin-right: 6px;
}
.topbar .brand .sub { font-weight: 400; font-size: 12px; color: #9fb8ab; margin-left: 8px; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  background: none; border: none; color: #b7c9bf; padding: 8px 14px; border-radius: 8px;
  font-size: 14px; cursor: pointer;
}
.tab.active { background: #1d3529; color: #fff; }
.tab:hover { color: #fff; }

/* ---- 布局 ---- */
main { max-width: 1100px; margin: 24px auto; padding: 0 20px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head h2 { font-size: 18px; }

/* ---- 按钮 / 表单 ---- */
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 7px 14px; cursor: pointer; font-size: 13px;
}
.btn:hover { border-color: var(--green); color: var(--green-dark); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.ghost { background: none; border-color: #3b5546; color: #b7c9bf; }
.btn.ghost:hover { color: #fff; border-color: #9fb8ab; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 14px; font-family: inherit; background: #fff;
}
input:focus, textarea:focus { outline: 2px solid #bfe6cf; border-color: var(--green); }
label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; }

/* ---- 总览卡片 ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.pcard .phead { display: flex; justify-content: space-between; align-items: baseline; }
.pcard .pname { font-size: 16px; font-weight: 700; }
.pcard .pbrand { color: var(--muted); font-size: 12px; }
.bignum { font-size: 40px; font-weight: 800; margin: 10px 0 2px; }
.bignum.good { color: var(--green); }
.bignum.low { color: var(--amber); }
.bignum.none { color: var(--muted); font-size: 22px; }
.stat-line { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.section-title { font-size: 12px; color: var(--muted); margin: 12px 0 6px; }
.bar-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 12px; }
.bar-row .label { width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; background: #eef2ef; border-radius: 4px; height: 14px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--green); border-radius: 4px; transition: width .4s; }
.bar-fill.gray { background: #9fb8ab; }
.bar-row .val { width: 48px; text-align: right; color: var(--muted); }
.trend { display: flex; align-items: flex-end; gap: 4px; height: 44px; }
.trend .tcol { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; }
.trend .tbar { width: 100%; max-width: 22px; background: #bfe6cf; border-radius: 3px 3px 0 0; min-height: 2px; }
.trend .tbar.hot { background: var(--green); }
.pcard .pfoot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px;
  background: #eef2ef; color: var(--muted);
}
.badge.run { background: #fef3c7; color: var(--amber); }

/* ---- 表格 ---- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tr:hover td { background: #f8faf9; }
.tag-ok { color: var(--green-dark); font-weight: 700; }
.tag-no { color: var(--red); font-weight: 700; }
.tag-na { color: var(--muted); }
.rank { font-size: 10px; color: var(--amber); vertical-align: super; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.dot.pos { background: var(--green); }
.dot.neu { background: #9fb8ab; }
.dot.neg { background: var(--red); }

/* ---- 问法列表 ---- */
.qitem { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.qitem:last-child { border-bottom: none; }
.qitem .qtext { flex: 1; }
.qitem .qtext.off { color: var(--muted); text-decoration: line-through; }
.switch { position: relative; width: 34px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl {
  position: absolute; inset: 0; background: #cbd5d0; border-radius: 20px; cursor: pointer; transition: .2s;
}
.switch .sl::before {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: .2s;
}
.switch input:checked + .sl { background: var(--green); }
.switch input:checked + .sl::before { left: 17px; }

/* ---- 弹窗 ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 31, 23, .45);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal {
  background: #fff; border-radius: var(--radius); padding: 24px;
  width: 100%; max-width: 520px; max-height: 85vh; overflow-y: auto;
}
.modal h3 { margin-bottom: 4px; }
.modal .mfoot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.answer-box {
  background: #f8faf9; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; white-space: pre-wrap; font-size: 13px; line-height: 1.7; max-height: 45vh; overflow-y: auto;
}

/* ---- 登录 ---- */
.login-overlay {
  position: fixed; inset: 0; background: #0f1f17; z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  background: #fff; border-radius: 16px; padding: 36px; width: 340px; text-align: center;
}
.login-box h1 { font-size: 22px; margin-bottom: 6px; }
.login-box input { margin-top: 20px; }
.login-box .btn { width: 100%; margin-top: 12px; padding: 10px; }

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #0f1f17; color: #fff; padding: 10px 20px; border-radius: 10px; z-index: 99;
  font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.progress-cell { color: var(--amber); }
