/* ============================================================
   敏感信息判定测试台 · 样式（浅色主题）
   ============================================================ */

:root {
  --bg:        #f5f6f8;
  --panel:     #ffffff;
  --panel-2:   #fafbfc;
  --border:    #e5e8ee;
  --border-2:  #d3d8e0;
  --text:      #0f1520;
  --text-2:    #4a5568;
  --text-3:    #8b94a3;
  --accent:    #4f46e5;
  --accent-2:  #4338ca;
  --accent-bg: #eef2ff;

  --risk-high: #d92d20;
  --risk-mid:  #b54708;
  --risk-low:  #0e7090;
  --risk-none: #067647;

  --ok-bg:   #ecfdf3;
  --ok-fg:   #067647;
  --bad-bg:  #fef3f2;
  --bad-fg:  #b42318;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: var(--mono);
  font-size: .88em;
  background: #eef0f4;
  padding: 1px 5px;
  border-radius: 4px;
  color: #374151;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 12px; }

.mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: linear-gradient(140deg, #6366f1, #4338ca);
  color: #fff;
  font: 700 11px/1 var(--mono);
  letter-spacing: .06em;
}

.brand-text h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
}
.brand-text p {
  margin: 0;
  font-size: 12px;
  color: var(--text-3);
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--panel-2);
  color: var(--text-2);
  white-space: nowrap;
}
.pill-ok   { background: var(--ok-bg);  color: var(--ok-fg);  border-color: #abefc6; }
.pill-warn { background: #fffaeb;       color: #b54708;       border-color: #fedf89; }
.pill-idle { color: var(--text-3); }

/* ---------------- 布局 ---------------- */
.layout {
  display: grid;
  grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px 22px 60px;
  align-items: start;
}
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
}

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 16px;
}

.card-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .01em;
  color: var(--text);
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
}

.card-actions {
  display: flex;
  gap: 10px;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

/* ---------------- 表单 ---------------- */
input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
textarea { resize: vertical; line-height: 1.6; }
textarea#questionsInput { font-family: var(--mono); font-size: 11.5px; }

.row { display: flex; gap: 8px; align-items: center; }
.row-between { justify-content: space-between; margin-top: 8px; }

.btn {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 550;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled)   { background: var(--accent-2); }
.btn-secondary { background: #fff; border-color: var(--border-2); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--panel-2); border-color: var(--text-3); }
.btn-ghost     { background: transparent; border-color: var(--border-2); color: var(--text-2); }
.btn-ghost:hover:not(:disabled)     { background: var(--panel-2); color: var(--text); }
.btn-lg { flex: 1; padding: 10px 16px; font-size: 13.5px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.msg { font-size: 12px; margin-top: 8px; min-height: 0; }
.msg.err { color: var(--bad-fg); }
.msg.ok  { color: var(--ok-fg); }

/* ---------------- 计费 ---------------- */
.cost-hero {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.1;
  margin: 4px 0 12px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.cost-symbol {
  font-size: 17px;
  font-weight: 500;
  color: var(--text-3);
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.usage-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  min-width: 0;
}
.usage-k { font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.usage-v {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cost-chip {
  flex: none;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent-2);
  border: 1px solid #c7d2fe;
  white-space: nowrap;
}

.field { margin-bottom: 12px; }
.field-label {
  display: block;
  font-size: 11.5px;
  color: var(--text-3);
  margin-bottom: 4px;
  font-weight: 550;
}
.field-note {
  display: block;
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.5;
  margin-top: 4px;
}

/* ---------------- 开关 ---------------- */
.switch {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  user-select: none;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui {
  flex: none;
  width: 34px; height: 20px;
  margin-top: 1px;
  border-radius: 999px;
  background: var(--border-2);
  position: relative;
  transition: background .18s;
}
.switch-ui::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16,24,40,.2);
  transition: transform .18s;
}
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(14px); }
.switch-label { font-size: 13px; font-weight: 550; }
.switch-label em {
  display: block;
  font-style: normal;
  font-weight: 400;
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
  line-height: 1.45;
}

/* ---------------- 高级区 ---------------- */
.advanced { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 10px; }
.advanced summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-2);
  font-weight: 550;
  list-style: none;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: "▸ "; color: var(--text-3); }
.advanced[open] summary::before { content: "▾ "; }
.advanced-body { padding-top: 10px; }
.advanced-body .row { margin-top: 8px; }

/* ---------------- 提示词库 ---------------- */
.preset-list { display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow-y: auto; padding-right: 3px; }
.preset-group-title {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .04em;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 5px;
}
.preset-group { display: flex; flex-direction: column; }
.preset-item {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  width: 100%;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: background .13s, border-color .13s;
}
.preset-item:hover { background: var(--accent-bg); border-color: #c7d2fe; }
.preset-item.active { background: var(--accent-bg); border-color: var(--accent); }
.preset-item .pt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset-item .pexpect {
  flex: none;
  font-size: 10.5px;
  font-family: var(--mono);
  padding: 1px 6px;
  border-radius: 4px;
  background: #eef0f4;
  color: var(--text-2);
}
.preset-item .pexpect.risk { background: #fef3f2; color: var(--bad-fg); }
.preset-item .pexpect.safe { background: var(--ok-bg); color: var(--ok-fg); }
.preset-item .pexpect.edge { background: #fffaeb; color: #b54708; }

/* ---------------- 空状态 ---------------- */
.empty-state {
  padding: 22px 12px;
  text-align: center;
  color: var(--text-3);
  font-size: 12.5px;
  background: var(--panel-2);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-sm);
}
.empty-state p { margin: 0; }

/* ---------------- 结果 ---------------- */
.verdict {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-2);
  margin-bottom: 14px;
}
.verdict-score {
  font-family: var(--mono);
  font-size: 38px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.02em;
}
.verdict-side { flex: 1; min-width: 0; }
.verdict-label { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.verdict-sub { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }

.bar {
  height: 7px;
  border-radius: 999px;
  background: #e9ecf1;
  overflow: hidden;
}
.bar > i { display: block; height: 100%; border-radius: 999px; transition: width .35s ease; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.stat {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  background: var(--panel);
}
.stat-k { font-size: 11px; color: var(--text-3); margin-bottom: 3px; }
.stat-v { font-family: var(--mono); font-size: 17px; font-weight: 600; }
.stat-n { font-size: 11px; color: var(--text-2); margin-top: 3px; line-height: 1.4; }

.section-sub {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--text-3);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin: 16px 0 8px;
}

.prob-row {
  display: grid;
  grid-template-columns: 92px 1fr 52px;
  align-items: center;
  gap: 10px;
  padding: 3px 0;
}
.prob-name { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prob-val  { font-family: var(--mono); font-size: 11.5px; text-align: right; color: var(--text-2); }
.prob-row.is-top .prob-name { color: var(--text); font-weight: 600; }
.prob-row.is-top .prob-val  { color: var(--text); font-weight: 600; }

.meta-line {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

details.raw { margin-top: 10px; }
details.raw summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-2);
  list-style: none;
}
details.raw summary::-webkit-details-marker { display: none; }
details.raw summary::before { content: "▸ "; color: var(--text-3); }
details.raw[open] summary::before { content: "▾ "; }
details.raw pre {
  margin: 8px 0 0;
  padding: 10px;
  background: #0f1520;
  color: #d6e0f0;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.error-box {
  padding: 12px 14px;
  background: var(--bad-bg);
  border: 1px solid #fecdca;
  border-radius: var(--radius-sm);
  color: var(--bad-fg);
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------------- 批量表格 ---------------- */
.table-wrap { overflow-x: auto; margin-top: 6px; }
table.batch {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
table.batch th, table.batch td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.batch th {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 600;
  letter-spacing: .03em;
  background: var(--panel);
}
table.batch td.num { font-family: var(--mono); }
table.batch tr:hover td { background: var(--panel-2); }
.tag {
  display: inline-block;
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--mono);
}
.tag-ok  { background: var(--ok-bg);  color: var(--ok-fg); }
.tag-bad { background: var(--bad-bg); color: var(--bad-fg); }
.tag-na  { background: #eef0f4;       color: var(--text-3); }
.cell-title { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }

.spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 14px);
  background: #101828;
  color: #fff;
  font-size: 12.5px;
  padding: 9px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 50;
  max-width: 70vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
