/* ============================================================
 * 产品库模块样式（并入红马系统后自动生成）
 *
 * 所有规则都限定在 .ph-scope 容器内，避免与主系统同名的
 * .btn / .card / .tag / .toast / .active 等类互相污染。
 * 改动请改 js/ph 对应页面，勿直接手改本文件的选择器前缀。
 * ============================================================ */

.ph-scope {
  --brand: #1d4ed8;
  --brand-dark: #1e3a8a;
  --brand-light: #eef4ff;
  --bg: #f4f6fa;
  --card: #ffffff;
  --border: #e3e8ef;
  --border-2: #eef1f6;
  --text: #1f2a37;
  --text-2: #667085;
  --text-3: #98a2b3;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --info-bg: #e0f2fe;
  --info: #0369a1;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
}
.ph-scope * { box-sizing: border-box; }
.ph-scope {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.ph-scope button, .ph-scope input, .ph-scope select, .ph-scope textarea { font-family: inherit; font-size: inherit; color: inherit; }
.ph-scope a { color: var(--brand); text-decoration: none; }
/* ---------- 布局 ---------- */
.ph-scope #app { min-height: 100vh; display: flex; flex-direction: column; }
.ph-scope .topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.ph-scope .topbar-inner {
  max-width: 1440px; margin: 0 auto; padding: 0 20px;
  height: 58px; display: flex; align-items: center; gap: 28px;
}
.ph-scope .brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; letter-spacing: .2px; white-space: nowrap; }
.ph-scope .brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, #2563eb, #1e3a8a);
  color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.ph-scope .nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.ph-scope .nav a {
  padding: 7px 14px; border-radius: 8px; color: var(--text-2);
  font-weight: 500; white-space: nowrap; transition: .15s;
}
.ph-scope .nav a:hover { background: var(--border-2); color: var(--text); }
.ph-scope .nav a.active { background: var(--brand-light); color: var(--brand); font-weight: 600; }
.ph-scope .main { flex: 1; max-width: 1440px; width: 100%; margin: 0 auto; padding: 22px 20px 60px; }
/* ---------- 通用组件 ---------- */
.ph-scope .btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 8px 15px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text); cursor: pointer; font-weight: 500;
  transition: .15s; white-space: nowrap;
}
.ph-scope .btn:hover { background: #fafbfc; border-color: #d0d5dd; }
.ph-scope .btn:disabled { opacity: .5; cursor: not-allowed; }
.ph-scope .btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.ph-scope .btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.ph-scope .btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 7px; }
.ph-scope .btn-danger { color: var(--danger); border-color: #fecaca; }
.ph-scope .btn-danger:hover { background: var(--danger-bg); }
.ph-scope .btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.ph-scope .btn-ghost:hover { background: var(--border-2); }
.ph-scope .card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.ph-scope .card-hd { padding: 15px 18px; border-bottom: 1px solid var(--border-2); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ph-scope .card-hd h2 { margin: 0; font-size: 15px; font-weight: 650; }
.ph-scope .card-bd { padding: 18px; }
.ph-scope .card-bd.flush { padding: 0; }
.ph-scope .field { margin-bottom: 14px; }
.ph-scope .field label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; font-weight: 500; }
.ph-scope .field label .req { color: var(--danger); margin-left: 2px; }
.ph-scope .input, .ph-scope .select, .ph-scope .textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border);
  border-radius: 8px; background: #fff; transition: .15s; outline: none;
}
.ph-scope .input:focus, .ph-scope .select:focus, .ph-scope .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29, 78, 216, .1); }
.ph-scope .textarea { resize: vertical; min-height: 64px; }
.ph-scope .hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.ph-scope .grid { display: grid; gap: 14px; }
.ph-scope .g2 { grid-template-columns: repeat(2, 1fr); }
.ph-scope .g3 { grid-template-columns: repeat(3, 1fr); }
.ph-scope .g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
.ph-scope .g3, .ph-scope .g4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
.ph-scope .g2, .ph-scope .g3, .ph-scope .g4 { grid-template-columns: 1fr; }
}
.ph-scope .tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border-radius: 6px; font-size: 12px; font-weight: 500;
  background: var(--border-2); color: var(--text-2); white-space: nowrap;
}
.ph-scope .tag-ok { background: var(--ok-bg); color: var(--ok); }
.ph-scope .tag-warn { background: var(--warn-bg); color: var(--warn); }
.ph-scope .tag-danger { background: var(--danger-bg); color: var(--danger); }
.ph-scope .tag-info { background: var(--info-bg); color: var(--info); }
.ph-scope .tag-brand { background: var(--brand-light); color: var(--brand); }
.ph-scope .stat { padding: 16px 18px; }
.ph-scope .stat-num { font-size: 26px; font-weight: 700; letter-spacing: -.5px; line-height: 1.2; }
.ph-scope .stat-lbl { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.ph-scope table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.ph-scope table.tbl th {
  text-align: left; padding: 10px 12px; background: #fafbfc; color: var(--text-2);
  font-weight: 600; font-size: 12.5px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2; white-space: nowrap;
}
.ph-scope table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border-2); vertical-align: top; }
.ph-scope table.tbl tbody tr:hover { background: #fafbfc; }
.ph-scope table.tbl tbody tr { cursor: pointer; }
.ph-scope .tbl-wrap { overflow: auto; max-height: calc(100vh - 260px); }
.ph-scope .empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.ph-scope .empty-icon { font-size: 34px; margin-bottom: 10px; opacity: .5; }
.ph-scope .toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(12px);
  background: #1f2a37; color: #fff; padding: 10px 18px; border-radius: 9px;
  box-shadow: var(--shadow-lg); opacity: 0; transition: .25s; z-index: 999;
  max-width: 90vw; font-size: 13.5px;
}
.ph-scope .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.ph-scope .toast.err { background: #b91c1c; }
.ph-scope .toast.ok { background: #15803d; }
.ph-scope .modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto; z-index: 200;
}
.ph-scope .modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 880px;
  box-shadow: var(--shadow-lg); animation: ph-pop .18s ease-out;
}
.ph-scope .modal.narrow { max-width: 480px; }
@keyframes ph-pop {
from { opacity: 0; transform: translateY(8px) scale(.99); }
}
.ph-scope .modal-hd {
  padding: 16px 20px; border-bottom: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; background: #fff; border-radius: 12px 12px 0 0; z-index: 3;
}
.ph-scope .modal-hd h3 { margin: 0; font-size: 15.5px; font-weight: 650; }
.ph-scope .modal-bd { padding: 20px; }
.ph-scope .modal-ft {
  padding: 14px 20px; border-top: 1px solid var(--border-2); display: flex;
  justify-content: flex-end; gap: 10px; position: sticky; bottom: 0;
  background: #fff; border-radius: 0 0 12px 12px;
}
.ph-scope .x-btn { border: none; background: none; font-size: 20px; color: var(--text-3); cursor: pointer; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.ph-scope .x-btn:hover { background: var(--border-2); color: var(--text); }
.ph-scope .section-title {
  font-size: 12px; font-weight: 700; color: var(--text-3); letter-spacing: .8px;
  text-transform: uppercase; margin: 22px 0 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border-2);
}
.ph-scope .section-title:first-child { margin-top: 0; }
.ph-scope .kv { display: grid; grid-template-columns: 92px 1fr; gap: 6px 12px; font-size: 13px; }
.ph-scope .kv dt { color: var(--text-2); }
.ph-scope .kv dd { margin: 0; word-break: break-word; }
/* ---------- 匹配结果 ---------- */
.ph-scope .match-row { display: flex; align-items: center; gap: 12px; }
.ph-scope .score-bar { width: 74px; height: 5px; border-radius: 3px; background: var(--border-2); overflow: hidden; flex: none; }
.ph-scope .score-bar > i { display: block; height: 100%; border-radius: 3px; }
.ph-scope .score-num { font-weight: 700; font-size: 15px; width: 34px; text-align: right; flex: none; }
.ph-scope .cond-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.ph-scope .cond {
  font-size: 11.5px; padding: 1px 7px; border-radius: 5px;
  border: 1px solid transparent; cursor: default;
}
.ph-scope .cond.ok { background: var(--ok-bg); color: var(--ok); }
.ph-scope .cond.bad { background: var(--danger-bg); color: var(--danger); }
.ph-scope .cond.unk { background: #f1f3f7; color: var(--text-2); border-color: var(--border); }
.ph-scope .reason { font-size: 12.5px; color: var(--danger); margin-top: 5px; }
.ph-scope .why { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
/* ---------- 产品库列表：机构分组 + 缺项标签 ---------- */
.ph-scope table.tbl tbody tr.grp td {
  background: #f7f9fc; border-bottom: 1px solid var(--border); cursor: pointer;
  padding: 9px 12px; font-size: 13px;
}
.ph-scope table.tbl tbody tr.grp:hover td { background: #eef3fb; }
.ph-scope table.tbl tbody tr.grp .grp-caret { display: inline-block; width: 14px; color: var(--text-2); }
.ph-scope .miss-tag {
  display: inline-block; font-size: 11.5px; line-height: 1.6; padding: 0 6px;
  border-radius: 5px; background: var(--warn-bg); color: var(--warn);
  border: 1px solid #fde68a; margin: 1px 3px 1px 0; cursor: pointer; white-space: nowrap;
}
.ph-scope .miss-tag:hover { background: #fde68a; }
.ph-scope .miss-tag.more { background: #f1f3f7; color: var(--text-2); border-color: var(--border); cursor: default; }
.ph-scope .miss-tag.elem { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; cursor: default; }
.ph-scope .miss-tag.judge { background: #fff1f0; color: #cf1322; border-color: #ffccc7; }
/* ---------- 征信报告解读 ---------- */
.ph-scope .cr-hd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ph-scope .cr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.ph-scope .cr-cell {
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px;
  background: #fbfcfe;
}
.ph-scope .cr-cell .k { font-size: 11.5px; color: var(--text-3); line-height: 1.4; }
.ph-scope .cr-cell .v { font-size: 14px; font-weight: 650; margin-top: 2px; word-break: break-all; }
.ph-scope .cr-cell .v.cr-strong { color: var(--brand); }
.ph-scope .cr-cell .v.cr-info { color: var(--info); }
.ph-scope .cr-cell .v.cr-warn { color: var(--warn); }
.ph-scope .cr-cell .v.cr-danger { color: var(--danger); }
.ph-scope table.cr-tbl { font-size: 12.5px; }
.ph-scope table.cr-tbl th, .ph-scope table.cr-tbl td { padding: 6px 9px; }
.ph-scope table.cr-tbl tbody tr { cursor: default; }
.ph-scope .cr-raw { margin-top: 8px; }
.ph-scope .cr-raw > summary { cursor: pointer; color: var(--brand); padding: 4px 0; }
/* 智能导入校对区里的征信解读块 */
.ph-scope .cr-wrap {
  border: 1px solid var(--border); border-left: 3px solid var(--brand);
  border-radius: 8px; background: #fbfcfe; padding: 12px 14px; margin-bottom: 16px;
}
.ph-scope .cr-wrap-hd {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-weight: 650; font-size: 13.5px; margin-bottom: 10px;
}
.ph-scope .cr-wrap .section-title { margin-top: 16px; }

/* ---------- 登录 ---------- */
.ph-scope .auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, #eef4ff, #f4f6fa 45%); }
.ph-scope .auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); padding: 30px; }
.ph-scope .auth-card h1 { margin: 0 0 4px; font-size: 19px; }
.ph-scope .auth-card p.sub { margin: 0 0 22px; color: var(--text-2); font-size: 13px; }
.ph-scope .tabs { display: flex; gap: 4px; background: var(--border-2); padding: 3px; border-radius: 9px; margin-bottom: 20px; }
.ph-scope .tabs button {
  flex: 1; padding: 7px; border: none; background: transparent; border-radius: 7px;
  cursor: pointer; color: var(--text-2); font-weight: 500; transition: .15s;
}
.ph-scope .tabs button.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.ph-scope .alert { padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.ph-scope .alert-err { background: var(--danger-bg); color: var(--danger); }
.ph-scope .alert-ok { background: var(--ok-bg); color: var(--ok); }
.ph-scope .alert-info { background: var(--info-bg); color: var(--info); }
.ph-scope .alert-warn { background: var(--warn-bg); color: var(--warn); }
.ph-scope .row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ph-scope .toolbar { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.ph-scope .toolbar .input, .ph-scope .toolbar .select { width: auto; min-width: 130px; }
.ph-scope .spacer { flex: 1; }
.ph-scope .muted { color: var(--text-2); }
.ph-scope .tiny { font-size: 12px; }
.ph-scope .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.ph-scope .nowrap { white-space: nowrap; }
.ph-scope .loading { padding: 60px; text-align: center; color: var(--text-3); }
.ph-scope .spin { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: ph-sp .7s linear infinite; vertical-align: -3px; }
@keyframes ph-sp {
to { transform: rotate(360deg); }
}
/* ---------- 智能导入 ---------- */
.ph-scope .imptabs { display: flex; gap: 5px; background: var(--bg); padding: 4px; border-radius: 9px; margin-bottom: 16px; width: fit-content; max-width: 100%; overflow-x: auto; }
.ph-scope .imptabs button { border: 0; background: transparent; padding: 7px 14px; border-radius: 7px; font-size: 13px; color: var(--text-2); cursor: pointer; font-family: inherit; white-space: nowrap; }
.ph-scope .imptabs button.active { background: var(--card); color: var(--brand); font-weight: 600; box-shadow: var(--shadow); }
.ph-scope .drop { border: 2px dashed var(--border); border-radius: var(--radius); background: var(--card); padding: 32px 20px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.ph-scope .drop:hover, .ph-scope .drop.on { border-color: var(--brand); background: var(--brand-light); }
.ph-scope .drop-t { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.ph-scope .drop-s { font-size: 12px; color: var(--text-3); line-height: 1.7; }
.ph-scope .fqueue { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.ph-scope .fitem { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); font-size: 13px; }
.ph-scope .fitem .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-scope .fitem.st-ok { border-color: #bbf7d0; background: #f6fef9; }
.ph-scope .fitem.st-err { border-color: #fecaca; background: #fff7f7; }
.ph-scope .fitem.st-run { border-color: #bfdbfe; background: #f5f9ff; }
.ph-scope .rec-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); margin-bottom: 14px; box-shadow: var(--shadow); overflow: hidden; }
.ph-scope .rec-hd { display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: var(--bg); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ph-scope .rec-hd .rt { font-weight: 600; font-size: 13.5px; }
.ph-scope .rec-bd { padding: 14px; }
.ph-scope .rec-bd .section-title:first-child { margin-top: 0; }
.ph-scope .flagged > label::after { content: '待核'; font-size: 10px; color: var(--warn); background: var(--warn-bg); padding: 1px 5px; border-radius: 4px; margin-left: 6px; }
.ph-scope .flagged input, .ph-scope .flagged select, .ph-scope .flagged textarea { border-color: #f59e0b; background: #fffbeb; }
.ph-scope .conflict { font-size: 11.5px; color: var(--warn); margin-top: 4px; line-height: 1.5; }
/* 已有同名客户：卡片左侧描边加重，一眼看出这条要处理 */
.ph-scope .rec-dup { border-color: #f0b429; box-shadow: 0 0 0 1px #f0b429 inset, var(--shadow); }
.ph-scope .merge-box { border-left: 3px solid #f0b429; }
.ph-scope .merge-box > div + div { margin-top: 6px; }
.ph-scope .merge-box .tiny { line-height: 1.6; }
.ph-scope .merge-pick { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12.5px; }
.ph-scope .merge-pick label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-weight: 500; }
.ph-scope .merge-pick input { accent-color: var(--brand); }
.ph-scope .prog { height: 4px; background: var(--border-2); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.ph-scope .prog > i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .25s; }
@media (max-width: 700px) {
.ph-scope .topbar-inner { padding: 0 12px; gap: 12px; }
.ph-scope .brand span { display: none; }
.ph-scope .main { padding: 16px 12px 60px; }
.ph-scope .tbl-wrap { max-height: none; }
.ph-scope table.tbl { font-size: 12.5px; }
.ph-scope table.tbl th, .ph-scope table.tbl td { padding: 8px; }
}


/* 主系统页面容器已提供外边距，这里只补一点上间距 */
.ph-scope { padding-top: 2px; }

/* 提示条与弹窗挂在 body 下（各自带 .ph-scope），保证层级高于页面内容 */
#ph-toast-host, #ph-modal-root { position: relative; z-index: 900; }
