:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --bg: #f1f3f9;
  --card: #ffffff;
  --border: #e6e8ee;
  --border-strong: #d6d9e0;
  --text: #1e2430;
  --muted: #7a8194;
  --ok: #0f9d58;
  --err: #e5484d;
  --warn: #d97706;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, .08);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* 顶栏 */
header.topbar {
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}
header.topbar h1 { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: .2px; }
header.topbar nav { display: flex; gap: 4px; }
header.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all .15s;
}
header.topbar nav a:hover { color: var(--text); background: var(--primary-soft); }
header.topbar nav a.active { color: var(--primary); background: var(--primary-soft); }
.gateway-box { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.gateway-box input { width: 230px; }

/* 布局 */
.container { max-width: 1080px; margin: 28px auto; padding: 0 20px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.card h2 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.card h2 + .hint { margin-top: 0; margin-bottom: 16px; }
.card h3 { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; margin: 20px 0 10px; }
.hint { color: var(--muted); font-size: 12px; margin: 0 0 14px; }
.muted { color: var(--muted); }

/* 表单 */
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.field { flex: 1 1 180px; display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.field .req::after { content: " *"; color: var(--err); }
input, select, textarea {
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #aab0bd; }
input:hover, select:hover { border-color: #b9bdc8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }

/* 按钮 */
button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .05s;
}
button:hover { background: var(--primary-dark); }
button:active { transform: translateY(1px); }
button.secondary { background: #fff; color: var(--text); border: 1px solid var(--border-strong); }
button.secondary:hover { background: #f7f8fa; border-color: #b9bdc8; }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.actions { display: flex; gap: 10px; align-items: center; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input { flex: 1; min-width: 180px; }

/* 投保页两栏 */
.main-content { display: flex; gap: 18px; align-items: flex-start; }
.left-panel { flex: 0 0 340px; position: sticky; top: 76px; }
.right-panel { flex: 1; min-width: 0; }

/* 产品项 */
.product-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; cursor: pointer; transition: all .15s;
}
.product-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.product-item:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary) inset; }
.product-item input { width: auto; margin-top: 3px; accent-color: var(--primary); }
.product-item .pname { font-weight: 600; }
.product-item .pmeta { color: var(--muted); font-size: 11.5px; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; margin-left: 6px; font-weight: 500; }
.tag.tk { background: #ede9fe; color: #6d28d9; }
.tag.rs { background: #e0f2fe; color: #075985; }
.tag.gift { background: #fef3c7; color: #92400e; }

.radio-group { display: flex; gap: 18px; align-items: center; padding-top: 4px; }
.radio-group label { display: flex; align-items: center; gap: 5px; color: var(--text); font-size: 13.5px; }
.radio-group input { width: auto; accent-color: var(--primary); }

/* 信息网格 */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.info-item { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid #f0f1f4; padding: 9px 0; font-size: 13px; }
.info-item:nth-last-child(-n+2) { border-bottom: none; }
.info-label { color: var(--muted); white-space: nowrap; }
.info-value { font-weight: 600; text-align: right; word-break: break-all; }

/* 结果提示 */
.result { margin-top: 14px; padding: 12px 14px; border-radius: 10px; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; line-height: 1.6; }
.result.ok { background: #ecfdf3; border: 1px solid #abefc6; color: #067647; }
.result.err { background: #fef3f2; border: 1px solid #fecdca; color: #b42318; }
.result.info { background: var(--primary-soft); border: 1px solid #c7d2fe; color: #3730a3; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; background: #fafbfc; font-size: 12px; }
tbody tr:hover { background: #fafbfd; }
.badge { padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500; }
.badge.active { background: #ecfdf3; color: #067647; }
.badge.pending { background: #fffaeb; color: #b54708; }
.badge.failed { background: #fef3f2; color: #b42318; }

/* 日志 */
.log-container {
  background: #0b1220; color: #cbd5e1; border-radius: 10px; padding: 14px 16px;
  height: 240px; overflow-y: auto; font-family: "JetBrains Mono", Consolas, monospace; font-size: 12px; line-height: 1.65;
}
.log-line { white-space: pre-wrap; word-break: break-all; }
.log-line.ok { color: #4ade80; }
.log-line.err { color: #fb7185; }
.log-line.warn { color: #fbbf24; }
.log-line.info { color: #93c5fd; }
.log-time { color: #5b6577; margin-right: 8px; }

pre.code { background: #0b1220; color: #e2e8f0; padding: 16px; border-radius: 10px; overflow: auto; font-size: 12px; line-height: 1.55; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: var(--radius); width: min(880px, 100%); max-height: 88vh; overflow: auto; padding: 24px 26px; box-shadow: var(--shadow-md); }
.modal h2 { margin-top: 0; }
.modal textarea { width: 100%; min-height: 380px; font-family: Consolas, monospace; font-size: 12px; }
.modal .actions { justify-content: flex-end; margin-top: 14px; }

@media (max-width: 860px) {
  .main-content { flex-direction: column; }
  .left-panel { flex-basis: auto; width: 100%; position: static; }
  .info-grid { grid-template-columns: 1fr; }
}
