﻿/* ==========================================================================
   screens-admin.css — PC 后台业务件：指标配置 / 数据源与口径 / 填报审核 /
   告警规则 / 权限矩阵。布局骨架（侧栏、顶栏、表格、抽屉）在 admin.css，
   这里只补这五屏自己的说法，不重写骨架。
   ========================================================================== */

/* ---------- 表单标签（A.field 的 span 版） ---------- */
.field > span { font-size: 10px; color: var(--c-text-2); }
.per-label { display: inline-flex; align-items: center; gap: 4px; color: var(--c-text-2); }

/* ---------- 顶栏数据新鲜度 ---------- */
.top-fresh {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px;
  border-radius: var(--r-99);
  background: var(--c-fill);
  font-size: var(--fs-11); color: var(--c-text-2);
  white-space: nowrap;
}
.top-fresh .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-style: normal; }

/* ---------- 单位（跟在数字后面，只读） ---------- */
.unit { font-size: var(--fs-10); color: var(--c-text-2); font-weight: var(--fw-r); margin-left: 2px; }

/* ---------- 指标值 ---------- */
.metric-value {
  font-family: var(--font-num); font-variant-numeric: tabular-nums; font-style: normal;
  font-size: var(--fs-13); font-weight: var(--fw-s); text-align: right;
  white-space: nowrap;
}
.metric-value--muted { color: var(--c-text-2); font-weight: var(--fw-r); }
.mono-num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-style: normal; }

/* ---------- 冲突行 / 发布门槛 ---------- */
.conflict-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; margin-bottom: 12px;
  background: var(--c-warn-soft);
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-10);
  font-size: var(--fs-12); color: var(--c-warn-ink);
}
.conflict-banner .btn { margin-left: auto; }
table.tbl tbody tr.is-conflict td { background: var(--c-warn-soft); }
table.tbl tbody tr.is-conflict:hover td { background: var(--c-warn-soft); }

/* ---------- 开关 ---------- */
.switch {
  position: relative; width: 38px; height: 22px; border-radius: var(--r-99);
  background: var(--c-line-2); flex: 0 0 auto;
  transition: background var(--t-base);
}
.switch__knob {
  position: absolute; left: 2px; top: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--c-card); box-shadow: var(--sh-1);
  transition: transform var(--t-base) var(--ease-spring);
}
.switch.is-on { background: var(--c-brand); }
.switch.is-on .switch__knob { transform: translateX(16px); }

/* ---------- 数据源：左列表 + 右详情 ---------- */
.source-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
.source-list { padding: 0; }
.source-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--c-line);
  transition: background var(--t-fast);
}
.source-item:last-child { border-bottom: 0; }
.source-item:hover { background: var(--c-fill); }
.source-item.is-on { background: var(--c-brand-soft); box-shadow: inset 3px 0 0 var(--c-brand); }
.source-item__main { flex: 1; min-width: 0; }
.source-item__name { font-size: var(--fs-12); font-weight: var(--fw-m); }
.source-item__meta { font-size: 10px; color: var(--c-text-2); margin-top: 2px; }
.source-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.source-head__main { flex: 1; min-width: 0; }
.source-head__name { font-size: var(--fs-17); font-weight: var(--fw-s); letter-spacing: -.01em; }
.source-head__sub { font-size: var(--fs-11); color: var(--c-text-2); margin-top: 3px; }
.source-kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 14px; margin-top: 14px; }
.source-kv > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.source-kv dt, .source-kv .k { font-size: 10px; color: var(--c-text-2); }
.source-kv dd, .source-kv .v { margin: 0; font-size: var(--fs-12); font-weight: var(--fw-m); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 口径详情 */
.def-block { padding: 12px 14px; background: var(--c-fill); border-radius: var(--r-10); }
.def-block__k { font-size: 10px; color: var(--c-text-2); letter-spacing: .04em; margin-bottom: 4px; }
.def-block__v { font-size: var(--fs-12); line-height: 1.7; color: var(--c-text-1); }
.def-block + .def-block { margin-top: 8px; }
.def-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; font-size: var(--fs-11); color: var(--c-text-2); }
.def-meta .tag { font-size: 10px; }

/* 版本 diff：左只读旧版 / 右当前版 */
.diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.diff-col { border: 1px solid var(--c-line); border-radius: var(--r-10); overflow: hidden; }
.diff-col__head {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px; background: var(--c-fill);
  font-size: 10px; color: var(--c-text-2);
}
.diff-col__head b { font-size: var(--fs-11); color: var(--c-text-1); font-weight: var(--fw-m); }
.diff-col__body { padding: 10px; font-size: var(--fs-11); line-height: 1.65; color: var(--c-text-2); background: var(--c-card); }
.diff-col--old { opacity: .86; }
.diff-line { padding: 4px 6px; border-radius: var(--r-6); }
.diff-line + .diff-line { margin-top: 3px; }
.diff-line--add { background: var(--c-success-soft); color: var(--c-success-ink); }
.diff-line--del { background: var(--c-danger-soft); color: var(--c-danger-ink); }
.diff-note { font-size: var(--fs-10); color: var(--c-text-2); margin-top: 6px; }

/* ---------- 审核抽屉 ---------- */
.review-values { width: 100%; border-collapse: collapse; font-size: var(--fs-12); }
.review-values th {
  text-align: left; font-size: 10px; color: var(--c-text-2); font-weight: var(--fw-m);
  padding: 6px 8px; border-bottom: 1px solid var(--c-line); white-space: nowrap;
}
.review-values td { padding: 8px; border-bottom: 1px solid var(--c-line); vertical-align: middle; }
.review-values td.num-cell { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-style: normal; white-space: nowrap; }
.review-values tr.is-diff td { background: var(--c-brand-soft); }
.review-values tr.is-diff td:first-child { box-shadow: inset 2px 0 0 var(--c-brand); }
.delta-cell { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-style: normal; font-size: 11px; color: var(--c-text-2); }

/* ---------- 告警规则 ---------- */
.rule-threshold { display: inline-flex; align-items: center; gap: 6px; }
.rule-step {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--c-line-2); background: var(--c-card);
  display: grid; place-items: center; color: var(--c-text-2);
}
.rule-step:hover { border-color: var(--c-brand); color: var(--c-brand-ink); background: var(--c-brand-soft); }
.rule-threshold b {
  min-width: 40px; text-align: center;
  font-family: var(--font-num); font-variant-numeric: tabular-nums; font-style: normal;
  font-size: var(--fs-12);
}
.trial-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.trial-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--r-8);
  background: var(--c-fill); font-size: var(--fs-11); color: var(--c-text-2);
}
.trial-row .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-style: normal; color: var(--c-text-1); }
.trial-row--hit { background: var(--c-warn-soft); color: var(--c-warn-ink); }
.trial-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.trial-kpi { flex: 1; min-width: 100px; padding: 10px 12px; background: var(--c-fill); border-radius: var(--r-10); }
.trial-kpi__v { font-size: var(--fs-18); font-weight: var(--fw-s); font-family: var(--font-num); font-variant-numeric: tabular-nums; font-style: normal; }
.trial-kpi__k { font-size: 10px; color: var(--c-text-2); margin-top: 2px; }

/* ---------- 权限矩阵 ---------- */
.matrix-wrap { overflow: auto; max-height: calc(100vh - 320px); }
table.matrix { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-12); }
table.matrix th, table.matrix td { border-bottom: 1px solid var(--c-line); padding: 0 10px; }
table.matrix thead th {
  position: sticky; top: 0; z-index: 2;
  height: 52px; background: var(--c-fill);
  font-size: var(--fs-11); font-weight: var(--fw-s); color: var(--c-text-1);
  text-align: center; white-space: nowrap;
}
table.matrix thead th:first-child { text-align: left; }
table.matrix thead th span { display: block; font-size: 9px; color: var(--c-text-2); font-weight: var(--fw-r); }
table.matrix td { height: 44px; text-align: center; white-space: nowrap; }
table.matrix td:first-child { text-align: left; }
table.matrix tbody th {
  position: sticky; left: 0; z-index: 1;
  background: var(--c-card);
  text-align: left; font-weight: var(--fw-r); font-size: var(--fs-12); color: var(--c-text-1);
  height: 44px; white-space: nowrap;
}
table.matrix tbody tr:hover td, table.matrix tbody tr:hover th { background: var(--c-bg); }
table.matrix .group-row th {
  background: var(--c-fill); color: var(--c-text-2);
  font-size: 10px; letter-spacing: .06em;
  height: 30px;
}
.perm-cell { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.perm-lock {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; color: var(--c-text-2);
}

/* ---------- 操作留痕 ---------- */
.audit-list { display: flex; flex-direction: column; }
.audit-row {
  display: grid; grid-template-columns: 88px 72px 1fr;
  gap: 12px; align-items: start;
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-line);
  font-size: var(--fs-11);
}
.audit-row:last-child { border-bottom: 0; }
.audit-row__at { color: var(--c-text-2); font-family: var(--font-num); font-variant-numeric: tabular-nums; font-style: normal; white-space: nowrap; }
.audit-row__by { color: var(--c-text-1); }
.audit-row__main b { font-size: var(--fs-12); font-weight: var(--fw-m); }
.audit-row__main span { display: block; color: var(--c-text-2); margin-top: 2px; line-height: 1.55; }

/* ---------- 抽屉里的说明 ---------- */
.drawer-tip { display: flex; align-items: flex-start; gap: 6px; margin-top: 10px; font-size: var(--fs-11); color: var(--c-text-2); line-height: 1.6; }
.drawer-tip b { color: var(--c-text-1); font-weight: var(--fw-m); }

@media (max-width: 1279px) {
  .source-layout { grid-template-columns: 1fr; }
  .source-kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}