:root {
  color-scheme: light;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-2: #6366f1;
  --primary-2-hover: #4f46e5;
  --ok: #10b981;
  --fail: #ef4444;
  --warn: #f59e0b;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --radius: 16px;
  --radius-sm: 10px;
}

html[data-theme="dark"], body.dark {
  color-scheme: dark;
  --bg: #0b0f19;
  --card: #151b2c;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: #222f47;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

button, input, textarea { font: inherit; }
code { font-size: 0.92em; color: var(--primary); background: rgba(59, 130, 246, 0.08); padding: 2px 4px; border-radius: 4px; }

.app-shell { width: min(1480px, 100%); margin: 0 auto; padding: 24px; }
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.hero {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
}
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; }
h1 { margin: 8px 0; font-size: clamp(24px, 3.5vw, 36px); font-weight: 800; letter-spacing: -0.03em; }
p { margin: 0; color: var(--muted); line-height: 1.6; font-size: 14px; }
.hero-copy { max-width: 800px; position: relative; z-index: 1; }
.hero-copy h1 { margin: 0; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(90px, 1fr)); gap: 12px; min-width: 320px; position: relative; z-index: 1; }
.hero-stats .stat-item { border: 1px solid var(--border); border-radius: 12px; padding: 16px; background: var(--bg); }
.hero-stats strong { display: block; font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }
.hero-stats span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-top: 4px; }

.grid { display: grid; grid-template-columns: 360px 1fr; gap: 20px; margin-top: 20px; align-items: stretch; }
.control-card, .result-card { padding: 24px; height: 100%; min-height: 0; }
.result-card { display: flex; flex-direction: column; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.section-title h2 { margin: 0; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.section-title span { color: var(--muted); font-size: 12px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.field small { color: var(--muted); font-size: 12px; line-height: 1.4; }
input, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input { height: 38px; padding: 0 12px; }
textarea { resize: vertical; min-height: 80px; padding: 10px 12px; }
input:focus, textarea:focus, .custom-select:focus-within .custom-select-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.custom-select {
  position: relative;
  width: 100%;
  outline: none;
  user-select: none;
}
.custom-select-trigger {
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--card);
  padding: 0 12px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.custom-select-trigger:hover { border-color: rgba(59, 130, 246, 0.55); background: rgba(59, 130, 246, 0.03); }
.custom-select-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.custom-select-arrow { color: var(--muted); font-size: 11px; transition: transform .18s ease; }
.custom-select.open .custom-select-arrow { transform: rotate(180deg); }
.custom-select-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 40;
  display: grid;
  gap: 4px;
  max-height: 240px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--card) 96%, var(--bg));
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16), 0 4px 12px rgba(15, 23, 42, 0.08);
  opacity: 0;
  transform: translateY(-6px) scale(.98);
  transform-origin: top center;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.custom-select.open .custom-select-menu { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.custom-select-option {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 10px;
  color: var(--text);
  background: transparent;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  line-height: 1.35;
  transition: background-color .14s ease, color .14s ease;
}
.custom-select-option:hover { background: rgba(59, 130, 246, 0.08); color: var(--primary); }
.custom-select-option.selected { background: rgba(59, 130, 246, 0.12); color: var(--primary); font-weight: 700; }
.custom-select-option.selected::after { content: "00c"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 11px; margin-left: 10px; }
html[data-theme="dark"] .custom-select-menu, body.dark .custom-select-menu { box-shadow: 0 20px 50px rgba(0, 0, 0, 0.34); }
.secret-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-row { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; margin: 4px 0 16px; cursor: pointer; user-select: none; }
.check-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}
.custom-checkbox {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: border-color .15s, background-color .15s;
  flex-shrink: 0;
}
.check-row input[type="checkbox"]:focus + .custom-checkbox {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}
.check-row input[type="checkbox"]:checked + .custom-checkbox {
  background: var(--primary);
  border-color: var(--primary);
}
.check-row input[type="checkbox"]:checked + .custom-checkbox::after {
  content: "\f00c";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  color: white;
  font-size: 10px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.secondary-actions { margin-top: 8px; padding-top: 12px; border-top: 1px dashed var(--border); }
.btn, .icon-btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn { min-height: 38px; padding: 0 14px; }
.icon-btn { width: 38px; height: 38px; border: 1px solid var(--border); background: var(--card); color: var(--text); }
.icon-btn:hover { background: var(--bg); border-color: var(--muted); }
.btn:disabled, .icon-btn:disabled { cursor: not-allowed; opacity: .5; }
.primary { color: white; background: var(--primary); }
.primary:hover:not(:disabled) { background: var(--primary-hover); }
.accent { color: white; background: var(--primary-2); }
.accent:hover:not(:disabled) { background: var(--primary-2-hover); }
.danger { color: white; background: var(--fail); }
.danger:hover:not(:disabled) { background: #dc2626; }
.ghost { color: var(--text); border: 1px solid var(--border); background: var(--card); }
.ghost:hover:not(:disabled) { background: var(--bg); border-color: var(--muted); }
.notice { margin-top: 16px; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--muted); background: rgba(59, 130, 246, 0.05); border: 1px solid rgba(59, 130, 246, 0.1); line-height: 1.5; font-size: 13px; }
.notice.error { color: var(--fail); background: rgba(239, 68, 68, 0.05); border-color: rgba(239, 68, 68, 0.1); }
.notice.ok { color: var(--ok); background: rgba(16, 185, 129, 0.05); border-color: rgba(16, 185, 129, 0.1); }

.result-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.result-toolbar .section-title { margin-bottom: 0; display: block; }
.result-toolbar .section-title span { display: block; margin-top: 4px; }
.filter-row { display: flex; gap: 8px; align-items: center; }
.search-wrapper { position: relative; display: flex; align-items: center; width: 220px; }
.search-wrapper .search-icon { position: absolute; left: 10px; color: var(--muted); font-size: 13px; pointer-events: none; }
.search-wrapper input { padding-left: 28px; }
.filter-row .custom-select { width: 132px; flex: 0 0 132px; }

.table-wrap { flex: 1 1 auto; min-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; max-height: calc(100vh - 220px); background: var(--card); }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { position: sticky; top: 0; z-index: 1; background: var(--bg); color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
td { font-size: 13px; }
.model-name { font-weight: 600; word-break: break-all; }
.badge { display: inline-flex; align-items: center; gap: 6px; min-width: 76px; justify-content: center; border-radius: 6px; padding: 4px 8px; font-size: 11px; font-weight: 600; border: 1px solid transparent; }
.badge.pending { color: var(--muted); background: rgba(100, 116, 139, 0.08); border-color: rgba(100, 116, 139, 0.15); }
.badge.running { color: var(--warn); background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.15); }
.badge.ok { color: var(--ok); background: rgba(16, 185, 129, 0.08); border-color: rgba(16, 185, 129, 0.15); }
.badge.failed { color: var(--fail); background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.15); }
.summary { max-width: 520px; white-space: pre-wrap; word-break: break-word; color: var(--muted); line-height: 1.5; }
.latency { font-variant-numeric: tabular-nums; font-weight: 600; }
.empty-row td { text-align: center; color: var(--muted); padding: 40px 16px; }

@media (max-width: 1060px) {
  .hero, .result-toolbar { flex-direction: column; align-items: stretch; gap: 16px; }
  .hero-stats { min-width: 0; }
  .grid { grid-template-columns: 1fr; align-items: start; }
  .control-card, .result-card { height: auto; }
  .table-wrap { min-height: 220px; max-height: none; }
}
@media (max-width: 640px) {
  .app-shell { padding: 12px; }
  .hero, .control-card, .result-card { padding: 16px; border-radius: 12px; }
  .hero-stats, .two-cols { grid-template-columns: 1fr; }
  .filter-row { flex-direction: column; align-items: stretch; }
  .search-wrapper { width: 100%; }
  .filter-row .custom-select { width: 100%; flex-basis: auto; }
  h1 { font-size: 26px; }
  .actions { flex-direction: column; }
  .actions .btn { width: 100%; }
}

/* 去除原生微调箭头及原生搜索清除按钮 */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
}

/* 自定义滚动条 */
.table-wrap::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.table-wrap::-webkit-scrollbar-track {
  background: transparent;
}
.table-wrap::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}
