* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: #eef1f6; color: #222; line-height: 1.5;
}
a { color: #ff4d4f; text-decoration: none; }

/* ===== 通用控件 ===== */
.btn {
  display: inline-block; border: none; border-radius: 8px; cursor: pointer;
  padding: 10px 16px; font-size: 14px; font-weight: 600; background: #f0f0f0; color: #333;
}
.btn:active { opacity: .85; }
.btn-primary { background: linear-gradient(90deg,#ff6a3d,#ff3b30); color: #fff; }
.btn-blue { background: #2f6bff; color: #fff; }
.btn-green { background: #18b566; color: #fff; }
.btn-gray { background: #e8e8e8; color: #555; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 6px; }
.btn:disabled { opacity: .6; cursor: default; }
input, select, textarea {
  font-family: inherit; font-size: 14px; padding: 9px 11px;
  border: 1px solid #dcdfe6; border-radius: 8px; outline: none; width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: #ff4d4f; }
label.fld { display: block; font-size: 13px; color: #666; margin-bottom: 5px; }
.field { margin-bottom: 12px; }
.muted { color: #999; font-size: 12px; }

/* ===== 前台 ===== */
.fe-wrap {
  max-width: 460px; margin: 0 auto; padding: 18px 12px 60px;
  display: flex; flex-direction: column; gap: 16px;
}
.card { background: #fff; border-radius: 14px; padding: 16px; box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.card h2 { font-size: 16px; margin-bottom: 12px; }
.tpl-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.tpl-pick .chip {
  padding: 7px 14px; border-radius: 20px; background: #f3f4f6; color: #555;
  font-size: 13px; cursor: pointer; border: 1px solid transparent;
}
.tpl-pick .chip.active { background: #fff0ec; color: #ff4d2e; border-color: #ff7a59; font-weight: 600; }
.row2 { display: flex; gap: 10px; }
.row2 .field { flex: 1; }
.preview-box { text-align: center; }
.preview-box canvas { width: 100%; max-width: 380px; border-radius: 6px; box-shadow: 0 6px 24px rgba(0,0,0,.12); }
.actions { display: flex; gap: 10px; }
.actions .btn { flex: 1; }

/* 卡密验证 */
.gate { max-width: 380px; margin: 80px auto; }
.gate .card { text-align: center; }
.gate .logo { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.gate .tip { color: #999; font-size: 13px; margin-bottom: 18px; }
.gate .err { color: #ff3b30; font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ===== 后台 ===== */
.admin-top {
  background: #1f2330; color: #fff; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.admin-top .brand { font-weight: 700; }
.admin-top a { color: #cfd3dc; margin-left: 16px; font-size: 14px; }
.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.panel { background: #fff; border-radius: 12px; padding: 18px; margin-bottom: 18px; box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.panel h3 { font-size: 16px; margin-bottom: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 8px; border-bottom: 1px solid #eef0f3; text-align: left; }
th { color: #888; font-weight: 600; background: #fafbfc; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; }
.tag-on { background: #e7f8ed; color: #18b566; }
.tag-off { background: #fdeaea; color: #e44; }
.toolbar-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.toolbar-row .field { margin-bottom: 0; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 10px; align-items: end; }
.login-wrap { max-width: 340px; margin: 120px auto; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.flash-ok { background: #e7f8ed; color: #18794e; }
.flash-err { background: #fdeaea; color: #c0392b; }

/* 卡密信息条 */
.keyinfo { display: flex; justify-content: space-between; font-size: 13px; color: #555; padding: 12px 16px; }
.keyinfo span { display: inline-flex; align-items: center; }

/* 公告弹窗 / 通用模态 */
.modal-mask, .block-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 999; padding: 20px;
}
.modal-box, .block-box {
  background: #fff; border-radius: 14px; padding: 22px; max-width: 360px; width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 12px; text-align: center; }
.modal-content { font-size: 14px; color: #555; line-height: 1.7; max-height: 50vh; overflow: auto; }
.block-box { text-align: center; }
.block-title { font-size: 18px; font-weight: 700; color: #e44; margin-bottom: 10px; }
.block-msg { font-size: 14px; color: #555; line-height: 1.6; }

/* 风控日志 */
.log-ok { color: #18b566; }
.log-blocked { color: #e44; font-weight: 600; }
.log-new { color: #2f6bff; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0; }
.radio-row label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }

/* 校准器 */
.cal-layout { display: flex; gap: 20px; flex-wrap: wrap; }
.cal-canvas-wrap { position: relative; flex: 0 0 auto; }
#calCanvas { border: 1px solid #ddd; cursor: crosshair; max-width: 472px; }
.cal-side { flex: 1; min-width: 300px; }
.item-row { border: 1px solid #eee; border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.item-row .grid-form { gap: 8px; }
.mini { font-size: 12px; color: #999; }
