/* 权限与安全页专用样式 */

/* ---------- Hero ---------- */
.sec-hero-actions { justify-content: flex-start; }
.sec-hero-points { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: var(--sp-6); }
.sec-hero-points li { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-2); }
.sec-hero-points svg { width: 16px; height: 16px; color: var(--success); }

.sec-chain .mock-body { padding: var(--sp-4); }
.chain-list { list-style: none; display: grid; gap: 8px; position: relative; }
.chain-list li {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border);
}
.chain-list li + li::before {
  content: ""; position: absolute; left: 28px; top: -9px; width: 2px; height: 8px; background: var(--border-strong);
}
.chain-ico { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.chain-ico svg { width: 18px; height: 18px; }
.chain-list div { flex: 1; min-width: 0; }
.chain-list strong { display: block; font-size: 14px; line-height: 1.4; color: var(--text); }
.chain-list div span { display: block; font-size: 12.5px; color: var(--text-3); line-height: 1.45; }
.chain-list em { flex: none; font-style: normal; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: var(--r-full); }
.chain-ok { color: var(--success); background: rgba(34,197,94,.14); }
.chain-warn { color: var(--warning); background: rgba(245,158,11,.14); }
.chain-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 10px; padding: 10px 12px; border-radius: var(--r-md);
  background: var(--grad-brand); color: #06281c; font-size: 13.5px; font-weight: 600;
}
.chain-foot span { display: inline-flex; align-items: center; gap: 8px; }
.chain-foot svg { width: 18px; height: 18px; }
.chain-foot .muted { color: rgba(6,40,28,.72); font-weight: 500; font-size: 12px; }

/* ---------- 组织模型 ---------- */
.level-list { display: grid; gap: var(--sp-3); margin: var(--sp-6) 0 0; }
.level-item { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--sp-3); align-items: start; padding: 12px 0; border-bottom: 1px dashed var(--border); }
.level-item:last-child { border-bottom: 0; }
.level-item dt { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); }
.level-item dd { margin: 0; font-size: 15px; color: var(--text-2); line-height: 1.6; padding-top: 3px; }
.lv-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.lv-ico svg { width: 16px; height: 16px; }

.org-tree { padding: var(--sp-6); box-shadow: var(--shadow-md); }
.ot-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-4); font-size: 13px; font-weight: 600; color: var(--text-3); letter-spacing: .04em; }
.org-tree ul { list-style: none; margin: 0; padding: 0 0 0 18px; }
.org-tree li { position: relative; padding: 10px 0 0 22px; }
.org-tree li::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 1.5px solid var(--border-strong); }
.org-tree li:last-child::before { bottom: auto; height: 31px; }
.org-tree li::after { content: ""; position: absolute; left: 0; top: 31px; width: 18px; border-top: 1.5px solid var(--border-strong); }
.ot-node {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  min-height: 42px; padding: 8px 12px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border);
}
.ot-node b { font-size: 14.5px; color: var(--text); }
.ot-meta { font-size: 12px; color: var(--text-3); margin-left: auto; }
.ot-ico { flex: none; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; }
.ot-ico svg { width: 15px; height: 15px; }
.ot-org { background: var(--grad-brand); border-color: transparent; }
.ot-org b, .ot-org .ot-meta { color: #06281c; }
.ot-org .ot-meta { opacity: .8; }
.ot-org .ot-ico { background: rgba(6,40,28,.14); color: #06281c; }
.ot-team .ot-ico { background: var(--primary-soft); color: var(--primary); }
.ot-proj .ot-ico { background: rgba(45,212,191,.14); color: var(--accent-400); }
:root[data-theme="light"] .ot-proj .ot-ico { color: var(--accent-600); }
.ot-members { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }
.mbr {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px;
  border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-2);
}
.mbr i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 700; color: #fff; background: var(--av); }
.mbr em { font-style: normal; font-size: 11.5px; color: var(--text-3); }

/* ---------- RBAC ---------- */
.role-card { display: flex; flex-direction: column; }
.role-card p { flex: 1; margin-bottom: var(--sp-4); }
.role-card .tag { align-self: flex-start; }
.role-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: var(--sp-4); color: #06281c; }
.role-ico svg { width: 22px; height: 22px; }
.role-ico.r1 { background: linear-gradient(135deg, #34d399, #10b981); }
.role-ico.r2 { background: linear-gradient(135deg, #6ee7b7, #34d399); }
.role-ico.r3 { background: linear-gradient(135deg, #5eead4, #2dd4bf); }
.role-ico.r4 { background: linear-gradient(135deg, #cbd5e1, #94a3b8); color: #1e293b; }

.custom-role {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--sp-8); align-items: center;
  margin-top: var(--sp-6); padding: var(--sp-8);
}
.custom-role h3 { margin: var(--sp-3) 0 var(--sp-2); }
.cr-perms { padding: var(--sp-5); border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); }
.cr-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; margin-bottom: var(--sp-3); color: var(--text); }
.cr-title svg { width: 18px; height: 18px; color: var(--primary); }
.cr-title .muted { font-weight: 500; font-size: 13px; }
.cr-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.cr-tags .perm { font-size: 12.5px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); }
.cr-tags .perm.on { color: var(--primary-soft-text); background: var(--primary-soft); border-color: transparent; }
.cr-tags .perm.on::before { content: "✓ "; font-weight: 700; }
.cr-tags .perm.off { color: var(--text-3); text-decoration: line-through; opacity: .75; }

.matrix-title { margin: var(--sp-16) 0 var(--sp-5); font-size: var(--fs-xl); text-align: center; }
.perm-table td:first-child { color: var(--text); }
.perm-table th:not(:first-child), .perm-table td:not(:first-child) { width: 13%; }
.perm-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: center; margin-top: var(--sp-4); font-size: 13px; color: var(--text-3); }
.perm-legend li { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- SSO ---------- */
.sso-panel {
  padding: var(--sp-8); border-radius: var(--r-xl); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-md);
}
.sso-group + .sso-group { margin-top: var(--sp-6); }
.sso-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--text-3); margin-bottom: var(--sp-3); }
.sso-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.sso-chip {
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px;
  border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface-2);
  font-weight: 600; font-size: 15px; color: var(--text);
}
.sso-chip b { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; color: #fff; background: var(--sc); }
.sso-flow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: var(--sp-8); padding-top: var(--sp-6); border-top: 1px dashed var(--border);
}
.sso-flow span {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--r-sm);
  background: var(--bg-muted); font-size: 13px; font-weight: 600; color: var(--text-2);
}
.sso-flow span svg { width: 15px; height: 15px; }
.sso-flow span.hl { background: var(--primary); color: var(--on-primary); }
.sso-flow i { color: var(--text-3); display: inline-grid; }
.sso-flow i svg { width: 14px; height: 14px; }

/* ---------- API Key ---------- */
.key-points { display: grid; gap: var(--sp-4); margin-top: var(--sp-6); }
.kp { display: flex; gap: 12px; align-items: flex-start; }
.kp > svg { flex: none; width: 36px; height: 36px; padding: 8px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.kp h3 { font-size: 16px; margin-bottom: 2px; }
.kp p { margin: 0; font-size: 14.5px; }

.key-mock .mock-body { padding: var(--sp-4); }
.km-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: var(--sp-3); }
.km-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.km-pill { font-size: 12.5px; padding: 4px 10px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); }
.key-list { list-style: none; display: grid; gap: 8px; }
.key-row {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.4fr) auto; grid-template-areas: "main meta status" "main exp revoke";
  gap: 4px 12px; align-items: center;
  padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface);
  transition: opacity .2s, background .2s;
}
.kr-main { grid-area: main; min-width: 0; }
.kr-main strong { display: block; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kr-main code { font-size: 12.5px; color: var(--text-3); background: none; padding: 0; }
.kr-meta { grid-area: meta; min-width: 0; font-size: 12.5px; color: var(--text-2); }
.kr-meta span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kr-meta span + span { color: var(--text-3); }
.kr-exp { grid-area: exp; font-size: 12px; color: var(--text-3); }
.kr-exp.is-warn { color: var(--warning); font-weight: 600; }
.kr-status { grid-area: status; justify-self: end; }
.kr-revoke {
  grid-area: revoke; justify-self: end;
  padding: 3px 10px; border-radius: var(--r-sm); font-size: 12.5px; font-weight: 600;
  background: transparent; border: 1px solid rgba(220,38,38,.35); color: var(--danger);
}
.kr-revoke:hover:not(:disabled) { background: rgba(248,113,113,.1); }
.kr-revoke:disabled { border-color: var(--border); color: var(--text-3); cursor: default; }
.key-row.is-revoked { background: var(--surface-2); }
.key-row.is-revoked .kr-main, .key-row.is-revoked .kr-meta { opacity: .55; }
.key-row.is-revoked .kr-main code { text-decoration: line-through; }

/* ---------- 审计日志 ---------- */
.audit-facets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-8); }
.af { display: flex; gap: 12px; align-items: flex-start; padding: var(--sp-4); border-radius: var(--r-lg); background: var(--bg-soft); border: 1px solid var(--border); }
.af > svg { flex: none; width: 22px; height: 22px; color: var(--primary); margin-top: 2px; }
.af strong { display: block; color: var(--text); font-size: 15px; }
.af span { display: block; font-size: 13.5px; color: var(--text-3); line-height: 1.55; }
.audit-mock .mock-body { padding: var(--sp-4); }
.am-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: var(--sp-3); }
.am-search {
  flex: 1 1 240px; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px;
  border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden;
}
.am-search svg { flex: none; width: 15px; height: 15px; }
.am-toolbar .btn svg { width: 15px; height: 15px; }
.am-table { border-radius: var(--r-md); }
.am-table .table { font-size: 13.5px; min-width: 860px; }
.am-table .table th, .am-table .table td { padding: 10px 14px; white-space: nowrap; }
.am-table .mono { font-family: var(--font-mono); font-size: 12.5px; }
.am-table .badge { font-size: 11.5px; padding: 2px 8px; }

/* ---------- 数据安全 ---------- */
.redact { padding: var(--sp-8); margin-bottom: var(--sp-6); }
.redact-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-5); }
.redact-head h3 { margin: 0; }
.redact-rules { display: flex; gap: 6px; flex-wrap: wrap; }
.redact-body { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: var(--sp-5); align-items: stretch; }
.rd-pane { padding: var(--sp-5); border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); }
.rd-pane p { margin: 0; font-size: 15px; line-height: 1.9; color: var(--text); }
.rd-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--text-3); margin-bottom: var(--sp-2); letter-spacing: .03em; }
.rd-label svg { width: 15px; height: 15px; }
.rd-after { border-color: var(--brand-200); background: var(--primary-soft); }
:root:not([data-theme="light"]) .rd-after { border-color: rgba(52,211,153,.35); }
.pii { -webkit-box-decoration-break: clone; box-decoration-break: clone; background: rgba(245,158,11,.2); color: inherit; padding: 1px 4px; border-radius: 4px; box-shadow: inset 0 -2px 0 rgba(217,119,6,.55); }
.masked { display: inline-block; font-family: var(--font-mono); font-size: .88em; line-height: 1.5; padding: 0 6px; border-radius: 4px; background: var(--primary); color: var(--on-primary); }
.rd-arrow { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--primary); }
.rd-arrow span { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--grad-brand); color: #06281c; box-shadow: 0 8px 20px rgba(52, 211, 153,.3); }
.rd-arrow span svg { width: 20px; height: 20px; }
.rd-arrow em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--text-3); white-space: nowrap; }
.redact-note { margin: var(--sp-5) 0 0; font-size: 13.5px; color: var(--text-3); }

/* ---------- 部署 ---------- */
.deploy-grid .card { display: flex; flex-direction: column; }
.dp-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); }
.dp-top .icon-box { margin: 0; }
.deploy-grid .card > p { margin-bottom: var(--sp-4); }
.deploy-grid .check-list { margin-top: auto; padding-top: var(--sp-4); border-top: 1px solid var(--border); }
.deploy-grid .check-list li { font-size: 14px; }
.deploy-actions { margin-top: var(--sp-8); }

/* ---------- 合规占位 ---------- */
.compliance {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--sp-8); align-items: center;
  padding: var(--sp-8); border-radius: var(--r-xl); background: var(--surface);
  border: 1.5px dashed var(--border-strong);
}
.cp-text { display: flex; gap: var(--sp-5); align-items: flex-start; }
.cp-text .icon-box { flex: none; margin: 0; }
.cp-text h2 { font-size: var(--fs-xl); display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.cp-text p { margin-bottom: var(--sp-3); }
.cp-slots { display: grid; gap: 10px; }
.cp-slots span {
  display: flex; align-items: center; justify-content: center; height: 52px; border-radius: var(--r-md);
  border: 1.5px dashed var(--border-strong); background: var(--bg-soft); color: var(--text-3); font-size: 13px; letter-spacing: .04em;
}

/* ---------- 英文页：标签更长 ---------- */
html[lang="en"] .level-item { grid-template-columns: 148px minmax(0, 1fr); }
html[lang="en"] .perm-table th:not(:first-child), html[lang="en"] .perm-table td:not(:first-child) { width: 12%; }
html[lang="en"] .chain-list em { white-space: nowrap; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .custom-role { grid-template-columns: 1fr; gap: var(--sp-5); }
  .audit-facets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compliance { grid-template-columns: 1fr; }
  .cp-slots { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .redact { padding: var(--sp-5); }
  .redact-body { grid-template-columns: 1fr; }
  .rd-arrow { flex-direction: row; }
  .rd-arrow span { width: 38px; height: 38px; }
  .custom-role, .sso-panel, .compliance { padding: var(--sp-5); }
  .matrix-title { margin-top: var(--sp-12); font-size: var(--fs-lg); }
  .cp-text { flex-direction: column; gap: var(--sp-4); }
  .cp-slots { grid-template-columns: 1fr; }
  .level-item, html[lang="en"] .level-item { grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 480px) {
  .audit-facets { grid-template-columns: 1fr; }
  .key-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main status" "meta meta" "exp revoke"; }
  .chain-list div span { font-size: 12px; }
  .org-tree { padding: var(--sp-4); }
  .org-tree ul { padding-left: 8px; }
  .org-tree li { padding-left: 16px; }
  .org-tree li::after { width: 12px; }
  .ot-meta { margin-left: 0; width: 100%; padding-left: 36px; margin-top: -6px; }
  .org-tree li:last-child::before { height: 31px; }
}
