/* Cambright One · 统一居中弹窗组件 (cb-modal)
 * 单一真相：所有自研居中模态弹窗必须使用本组件。
 * 规范来源：弹窗(Modal)设计规则 —— 遮罩 + 三段式容器(深色头部/滚动内容区/固定底栏)。
 * JS helper: public/js/cb-modal.js (window.CbModal)
 * 宽度档位：--sm 480px(简单确认) / --md 760px(标准表单) / --lg 960px(复杂工作台)
 */

@keyframes cbmPop {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── 遮罩 ─────────────────────────────────────────────── */
.cbm-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 22, 38, .46);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  z-index: 1050;
}

/* ── 容器 ─────────────────────────────────────────────── */
.cbm-modal {
  --cbm-bg: #F4F5F7;
  --cbm-panel: #FFFFFF;
  --cbm-line: #E2E5E9;
  --cbm-line2: #EDEFF2;
  --cbm-ink: #1A1D26;
  --cbm-ink2: #5B616E;
  --cbm-ink3: #9AA0AC;
  --cbm-navy: #1E2A4A;
  --cbm-navy-soft: #2C3A5E;
  --cbm-brand: #3B5BDB;
  --cbm-brand-soft: #EEF2FF;
  --cbm-green: #0E9F6E;
  --cbm-green-soft: #E6F6F0;
  --cbm-amber: #D9930D;
  --cbm-amber-soft: #FBF3E2;
  --cbm-red: #C0392B;
  --cbm-red-soft: #FBEBE9;
  width: 760px;
  max-width: 100%;
  max-height: calc(100vh - 64px);
  background: var(--cbm-panel);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(16, 24, 40, .28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: cbmPop .18s ease;
  font-family: "Plus Jakarta Sans", "Noto Sans SC", system-ui, sans-serif;
  color: var(--cbm-ink);
  text-align: left;
}
.cbm-modal--sm { width: 480px; }
.cbm-modal--md { width: 760px; }
.cbm-modal--lg { width: 960px; }

/* ── 深色头部 ──────────────────────────────────────────── */
.cbm-head {
  flex-shrink: 0;
  background: linear-gradient(135deg, #1E2A4A 0%, #2C3A5E 100%);
  padding: 20px 26px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.cbm-head-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.cbm-head-txt { min-width: 0; }
.cbm-head-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.3px;
  color: #fff;
  line-height: 1.25;
}
.cbm-head-sub {
  margin-top: 3px;
  font-size: 11.5px;
  font-weight: 600;
  color: #9FB0D6;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.cbm-close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
  color: #9FB0D6;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: .14s;
  padding: 0;
}
.cbm-close:hover { background: rgba(255, 255, 255, .14); color: #fff; }

/* ── 内容区与分组 ──────────────────────────────────────── */
.cbm-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 26px;
  min-height: 0;
}
.cbm-grp { padding: 22px 0; border-bottom: 1px solid var(--cbm-line2); }
.cbm-grp:last-child { border-bottom: none; }
.cbm-grp-h { display: flex; align-items: baseline; gap: 9px; margin-bottom: 14px; }
.cbm-grp-en {
  font-size: 11px;
  font-weight: 800;
  font-style: italic;
  color: var(--cbm-brand);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.cbm-grp-cn { font-size: 14px; font-weight: 800; color: var(--cbm-ink); }
.cbm-grp-note { margin-left: auto; font-size: 11px; color: var(--cbm-ink3); }

/* ── 表单网格 ──────────────────────────────────────────── */
.cbm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.cbm-grid .full { grid-column: 1 / -1; }

/* ── 字段与控件 ────────────────────────────────────────── */
.cbm-fld label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--cbm-ink2);
  margin-bottom: 7px;
}
.cbm-req { color: var(--cbm-red); font-weight: 800; }
.cbm-opt {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--cbm-ink3);
  background: #F0F1F4;
  border-radius: 20px;
  padding: 2px 8px;
  margin-left: 6px;
  vertical-align: 1px;
}
.cbm-fld input[type="text"],
.cbm-fld input[type="number"],
.cbm-fld input[type="email"],
.cbm-fld input[type="tel"],
.cbm-fld input[type="url"],
.cbm-fld input[type="date"],
.cbm-fld input[type="time"],
.cbm-fld input[type="datetime-local"],
.cbm-fld select {
  width: 100%;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--cbm-line);
  font-size: 13.5px;
  padding: 0 13px;
  background: #fff;
  color: var(--cbm-ink);
  outline: none;
  font-family: inherit;
  transition: .14s;
  box-sizing: border-box;
}
.cbm-fld input[readonly] {
  background: var(--cbm-bg);
  color: var(--cbm-ink2);
  cursor: not-allowed;
}
.cbm-fld textarea {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--cbm-line);
  font-size: 13.5px;
  padding: 10px 13px;
  background: #fff;
  color: var(--cbm-ink);
  outline: none;
  font-family: inherit;
  resize: vertical;
  transition: .14s;
  box-sizing: border-box;
}
.cbm-fld input::placeholder,
.cbm-fld textarea::placeholder { color: var(--cbm-ink3); }
.cbm-fld input:focus,
.cbm-fld select:focus,
.cbm-fld textarea:focus {
  border-color: var(--cbm-brand);
  box-shadow: 0 0 0 3px var(--cbm-brand-soft);
}
.cbm-fld select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239AA0AC' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
}

/* 勾选行(checkbox + 文字，可多行并列) */
label.cbm-checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--cbm-ink);
  margin: 0 0 8px;
  cursor: pointer;
}
label.cbm-checkline input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--cbm-brand);
  cursor: pointer;
}

/* 组合输入(前缀段 + 输入框) */
.cbm-combo { display: flex; }
.cbm-combo-pre {
  flex-shrink: 0;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  background: #FCFCFD;
  border: 1px solid var(--cbm-line);
  border-right: none;
  border-radius: 8px 0 0 8px;
  font-size: 13px;
  color: var(--cbm-ink2);
  box-sizing: border-box;
}
.cbm-combo input,
.cbm-combo select { border-radius: 0 8px 8px 0; }

/* 控件下方说明 / 联动说明 */
.cbm-hint { font-size: 11px; color: var(--cbm-ink3); margin-top: 6px; line-height: 1.5; }
.cbm-hint b, .cbm-hint .num { color: var(--cbm-amber); font-weight: 800; }

/* ── 上传区 ───────────────────────────────────────────── */
.cbm-upload {
  border: 1.5px dashed var(--cbm-line);
  border-radius: 8px;
  background: #FCFCFD;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--cbm-ink2);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: .14s;
}
.cbm-upload:hover { border-color: var(--cbm-brand); background: var(--cbm-brand-soft); }

/* ── 合规/敏感信息提示条(PDPA) ─────────────────────────── */
.cbm-tip {
  background: var(--cbm-amber-soft);
  border-radius: 9px;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.55;
  color: #8a5d00;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.cbm-tip b { font-weight: 800; }

/* ── 固定底栏 ──────────────────────────────────────────── */
.cbm-foot {
  flex-shrink: 0;
  border-top: 1px solid var(--cbm-line);
  padding: 14px 26px;
  background: #FCFCFD;
  display: flex;
  align-items: center;
  gap: 10px;
}
.cbm-foot-hint { font-size: 11px; font-weight: 600; color: var(--cbm-ink3); line-height: 1.5; }
.cbm-foot-hint b { color: var(--cbm-ink2); font-weight: 800; }
.cbm-foot-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.cbm-btn {
  height: 38px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  padding: 0 18px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: .14s;
  font-family: inherit;
  white-space: nowrap;
}
.cbm-btn--primary { background: var(--cbm-navy); color: #fff; }
.cbm-btn--primary:hover { background: var(--cbm-navy-soft); }
.cbm-btn--secondary { background: #fff; border-color: var(--cbm-line); color: var(--cbm-ink2); }
.cbm-btn--secondary:hover { background: var(--cbm-bg); }
.cbm-btn--danger { background: var(--cbm-red); color: #fff; }
.cbm-btn--danger:hover { background: #A93226; }
.cbm-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── 响应式(≤680px) ───────────────────────────────────── */
@media (max-width: 680px) {
  .cbm-mask { padding: 0; }
  .cbm-modal,
  .cbm-modal--sm,
  .cbm-modal--md,
  .cbm-modal--lg {
    width: 100%;
    max-height: 100vh;
    height: 100%;
    border-radius: 0;
  }
  .cbm-grid { grid-template-columns: 1fr; }
  .cbm-foot { flex-direction: column; align-items: stretch; }
  .cbm-foot-actions { margin-left: 0; width: 100%; }
  .cbm-foot-actions .cbm-btn { flex: 1; }
}
