/* 超管面板专用样式(GitHub 风格,与 portal/style.css 协调) */

.admin-page { display: flex; flex-direction: column; }

.crumb { color: var(--gh-fg-muted); font-weight: normal; margin-left: 6px; font-size: 14px; }

.admin-nav {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  background: var(--gh-bg);
  border-bottom: 1px solid var(--gh-border);
  overflow-x: auto;
}
.admin-tab {
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--gh-fg-muted);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: all .15s;
}
.admin-tab:hover:not(:disabled) { color: var(--gh-fg); }
.admin-tab.active {
  color: var(--gh-accent);
  border-bottom-color: var(--gh-accent);
  font-weight: 600;
}
.admin-tab:disabled { opacity: .4; cursor: not-allowed; }

.admin-main {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
.admin-section { display: none; }
.admin-section.active { display: block; }

/* 监控仪表盘 */
.dash-cards { display: flex; flex-direction: column; gap: 18px; }
.dash-group { background: var(--gh-bg); border: 1px solid var(--gh-border);
              border-radius: var(--gh-radius); padding: 16px; }
.dash-group-head { display: flex; align-items: center; justify-content: space-between;
                   margin-bottom: 12px; }
.dash-group-head h3 { margin: 0; font-size: 14px; color: var(--gh-fg-muted); font-weight: 600; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
             gap: 12px; }
.dash-card { padding: 12px 14px; background: #f6f8fa;
             border-radius: var(--gh-radius); border: 1px solid var(--gh-border-muted); }
.dash-val { font-size: 24px; font-weight: 600; color: var(--gh-fg); line-height: 1.1; }
.dash-label { font-size: 12px; color: var(--gh-fg-muted); margin-top: 4px; }
.dash-hint { font-size: 10px; color: var(--gh-fg-subtle); margin-top: 4px; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 16px;
  flex-wrap: wrap;
}
.section-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  flex: 0 0 auto;
}
/* v0.17 修「下面账号管理和新建按钮挤一起」:全局 .btn 默认 width:100%(登录页用),
   admin 子页 section-head 的按钮要回归到 inline-flex 自适应宽度 */
.section-head .btn,
.section-head .btn-primary,
.filter-bar .btn,
.filter-bar .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 32px;
  padding: 0 14px;
  font-size: 13px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.section-head .head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.users-table-wrap {
  background: var(--gh-bg);
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius);
  overflow-x: auto;
}
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.users-table th {
  text-align: left;
  padding: 10px 12px;
  background: #f6f8fa;
  border-bottom: 1px solid var(--gh-border);
  font-weight: 600;
  color: var(--gh-fg);
  white-space: nowrap;
}
.users-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gh-border-muted);
  vertical-align: middle;
}
.users-table tr:last-child td { border-bottom: 0; }
.users-table tr.row-owner { background: rgba(240, 180, 41, .08); }
.users-table tr.row-pending {
  background: linear-gradient(90deg, rgba(245, 159, 0, .12) 0%, rgba(245, 159, 0, .04) 100%);
  border-left: 3px solid #f59f00;
}
.users-table tr.row-pending td:first-child { padding-left: calc(12px - 3px); }
.users-table tr.row-pending:hover td { background: rgba(245, 159, 0, .12); }

/* tab 红点 — "账号管理3" 这种 */
.tab-badge {
  display: inline-block;
  background: #cf222e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  padding: 1px 6px;
  margin-left: 4px;
  line-height: 1.4;
  vertical-align: middle;
  animation: pulse-warn 1.6s ease-in-out infinite;
}
@keyframes pulse-warn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(207, 34, 46, .4); }
  50% { box-shadow: 0 0 0 4px rgba(207, 34, 46, 0); }
}
.chip.chip-warn {
  border-color: #f59f00;
  color: #7d4e00;
  background: #fff8e1;
}
.chip.chip-warn:hover { background: #ffe89a; }
.chip.chip-warn.active { background: #f59f00; border-color: #f59f00; color: #fff; }
.chip-count {
  display: inline-block;
  background: #cf222e;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  padding: 0 5px;
  margin-left: 4px;
  vertical-align: middle;
}

/* pending 行的"批准为…"下拉 */
.act-approve-role {
  border: 1px solid #f59f00;
  border-radius: 4px;
  font-size: 11px;
  padding: 3px 6px;
  background: #fff;
  color: #7d4e00;
  margin-right: 4px;
  cursor: pointer;
}
.act-approve-role:hover { border-color: #d28000; }

.role-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.role-pill.role-superadmin { background: #ffebe9; color: #cf222e; }
.role-pill.role-management,
.role-pill.role-admin { background: #ddf4ff; color: #0969da; }
.role-pill.role-operations { background: #dafbe1; color: #1f883d; }
.role-pill.role-finance { background: #fff8c5; color: #7d4e00; }
.role-pill.role-sales { background: #e7d9fd; color: #6f42c1; }
.role-pill.role-customer { background: #f6f8fa; color: #656d76; }
.role-pill.role-pending { background: #fff7e6; color: #b08800; }
.role-pill.role-none { background: #f6f8fa; color: #9ba1a8; }
.role-pill.owner { background: #fce5a1; color: #5a4200; }

.users-table .actions { white-space: nowrap; }
.act-btn {
  border: none;
  background: transparent;
  color: var(--gh-accent);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 6px;
  margin-right: 4px;
  border-radius: 3px;
}
.act-btn:hover { background: #ddf4ff; }
.act-btn.act-danger { color: var(--gh-danger); }
.act-btn.act-danger:hover { background: #ffebe9; }
/* v0.17.5: 「批准…」按钮高亮提醒(pending 行专用) */
.act-btn.act-approve {
  background: #f59f00;
  color: #fff;
  border-color: #f59f00;
  font-weight: 600;
}
.act-btn.act-approve:hover { background: #d68900; border-color: #d68900; }

.empty-tip {
  text-align: center;
  color: var(--gh-fg-muted);
  padding: 40px;
}

/* ── 模块开通(v0.17.3 新建账号 dialog 用) ── */
.module-group {
  border: 1px solid var(--gh-border);
  border-radius: 6px;
  padding: 10px 14px 14px;
  margin: 8px 0;
}
.module-group legend {
  font-size: 12px;
  color: var(--gh-fg-muted);
  padding: 0 6px;
}
.module-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-direction: row;
}
.module-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
}
.module-row .module-label {
  width: 100px;
  font-weight: 600;
  font-size: 13px;
  flex: 0 0 100px;
  display: inline-block;
}
.module-row select {
  flex: 1;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--gh-border);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
}
.module-row select:disabled {
  background: #f6f8fa;
  color: #9ba1a8;
  cursor: not-allowed;
}
/* v0.20.3 RBAC v3 Stage 3b:动态 6 模块 grid + beta 标签 + owner 提示 */
.modules-grid { display: flex; flex-direction: column; gap: 0; }
.module-row-arrow,
.module-row .module-role-arrow {
  font-size: 11px;
  color: var(--gh-fg-muted);
  margin: 0 6px;
  flex: 0 0 auto;
  user-select: none;
}
.modules-loading {
  font-size: 12px;
  color: var(--gh-fg-muted);
  padding: 8px 0;
}
.module-row-beta {
  opacity: 0.85;
}
.module-status-tag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: #fff3cd;
  color: #856404;
  margin-left: 6px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.module-owner-hint {
  font-size: 11px;
  color: var(--gh-fg-muted);
  margin-left: 4px;
  font-weight: normal;
}
/* v0.21.0 角色权限新 UI:两栏 + 模块卡 */
.roles-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  height: calc(100vh - 200px);
  min-height: 500px;
}
.roles-sidebar {
  border: 1px solid var(--gh-border);
  border-radius: 6px;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.roles-side-head {
  padding: 10px;
  border-bottom: 1px solid var(--gh-border);
}
.roles-side-head input {
  width: 100%;
}
.roles-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}
.role-li-section {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gh-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #f6f8fa;
  border-bottom: 1px solid var(--gh-border);
  border-top: 1px solid var(--gh-border);
}
.role-li-section:first-child {
  border-top: none;
}
.role-li {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f0f3f6;
  transition: background 0.1s;
}
.role-li:hover { background: #f6f8fa; }
.role-li.active {
  background: #ddf4ff;
  border-left: 3px solid #0969da;
  padding-left: 9px;
}
.role-li-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}
.role-li-name {
  font-weight: 600;
  font-size: 13px;
  color: #1f2328;
}
.role-li-app-tag {
  font-size: 10px;
  padding: 1px 6px;
  background: #eaeef2;
  color: #57606a;
  border-radius: 10px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.role-li.active .role-li-app-tag {
  background: #b6e3ff;
  color: #0969da;
}
.role-li-meta { font-size: 11px; color: var(--gh-fg-muted); margin-top: 3px; }
.role-li-loading { padding: 12px; color: #9ba1a8; font-size: 12px; }

.role-detail {
  border: 1px solid var(--gh-border);
  border-radius: 6px;
  background: #fff;
  overflow-y: auto;
  padding: 0;   /* v0.21.3: padding 移到子元素,让 sticky head 撑满边缘 */
}
.role-detail-empty {
  color: #9ba1a8;
  padding: 40px;
  text-align: center;
}
/* v0.21.3: head sticky 在右栏顶部,滚动时按钮始终可见 */
.role-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gh-border);
  gap: 12px;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
}
.role-detail-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
}
.role-detail-meta {
  font-size: 12px;
  color: var(--gh-fg-muted);
}
.role-detail-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.role-detail-actions .btn {
  white-space: nowrap;   /* 不换行 */
  padding: 4px 10px;
  font-size: 13px;
  height: 28px;
}
.role-detail-actions .btn-primary { padding: 4px 14px; }
.btn-danger {
  color: #cf222e;
  border-color: rgba(207, 34, 46, 0.4);
}
.btn-danger:hover {
  background: rgba(207, 34, 46, 0.08);
}
/* 弹窗 role-modal 里 module-cards 仍是垂直堆叠(主面板 v0.21.4 改两栏不再用 module-cards) */
.module-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
}

/* v0.21.4 主面板右栏两栏布局:左模块列表 + 右子权限 */
.role-detail {
  display: flex;
  flex-direction: column;
}
.rd-2col {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.rd-mod-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  border-right: 1px solid var(--gh-border);
  overflow-y: auto;
  background: #fafbfc;
}
.rd-mod-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  border-left: 3px solid transparent;
  gap: 8px;
}
.rd-mod-item:hover { background: #f0f4f8; }
.rd-mod-item.active {
  background: #fff;
  border-left-color: #0969da;
  font-weight: 600;
}
.rd-mod-name {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-mod-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 500;
  background: #f0f3f6;
  color: var(--gh-fg-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.rd-mod-state-all .rd-mod-badge { background: #dafbe1; color: #116329; }
.rd-mod-state-partial .rd-mod-badge { background: #fff8c5; color: #7d4e00; }

.rd-mod-perms {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.rd-mod-perms-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--gh-border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 5;
}
.rd-mod-perms-title {
  font-weight: 600;
  font-size: 14px;
}
.rd-mod-perms-actions {
  display: flex;
  gap: 6px;
}
.rd-mod-perms-actions .link-btn {
  font-size: 11px;
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--gh-border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--gh-fg-muted);
}
.rd-mod-perms-actions .link-btn:hover { background: #f6f8fa; color: #1f2328; }
.rd-mod-perms-body {
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.module-card {
  border: 1px solid var(--gh-border);
  border-radius: 6px;
  background: #fff;
  transition: border-color 0.15s;
}
.module-card-state-all { border-color: #1f883d; }
.module-card-state-partial { border-color: #d29922; }
.module-card-state-none { opacity: 0.85; }
.module-card-head {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  gap: 10px;
  user-select: none;
}
.module-card-head:hover { background: #f6f8fa; }
.module-card-name {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.module-card-state-label {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  background: #f6f8fa;
  color: var(--gh-fg-muted);
}
.module-card-state-all .module-card-state-label { background: #dafbe1; color: #116329; }
.module-card-state-partial .module-card-state-label { background: #fff8c5; color: #7d4e00; }
.module-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.module-card-actions .link-btn {
  font-size: 11px;
  padding: 2px 6px;
  background: transparent;
  border: 1px solid var(--gh-border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--gh-fg-muted);
}
.module-card-actions .link-btn:hover { background: #f6f8fa; color: #1f2328; }
.module-card-chevron {
  color: var(--gh-fg-muted);
  font-size: 10px;
  width: 12px;
  text-align: center;
}
.module-card-body {
  padding: 8px 12px 10px;
  border-top: 1px solid var(--gh-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.module-card .role-perms-cat {
  background: transparent;
  border: none;
  padding: 0;
}
.module-card .role-perm-row {
  padding: 4px 0;
}

/* v0.21.0: 新建账号弹窗的角色多选 */
.user-roles-grid {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.role-pick-section {
  font-size: 11px;
  font-weight: 600;
  color: var(--gh-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 0 4px;
  margin-top: 6px;
}
.role-pick-section:first-child { margin-top: 0; padding-top: 0; }
.role-pick-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.role-pick-row:hover { background: #f6f8fa; }
.role-pick-row input[type="checkbox"] { flex: 0 0 auto; }
.role-pick-name {
  font-size: 13px;
  font-weight: 600;
  color: #1f2328;
}
.role-pick-meta {
  font-size: 11px;
  color: var(--gh-fg-muted);
  margin-left: auto;
}

/* v0.20.8: 新建角色弹窗的权限 checklist */
.role-perms-grid {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.role-perms-cat {
  border: 1px solid var(--gh-border);
  border-radius: 6px;
  padding: 8px 12px;
  background: #fafbfc;
}
.role-perms-cat-head {
  font-size: 11px;
  color: var(--gh-fg-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.role-perm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 4px;
  cursor: pointer;
}
.role-perm-row:hover { background: #f0f4f8; border-radius: 4px; }
.role-perm-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin: 0;
}
.role-perm-row .role-perm-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}
.role-perm-row .role-perm-label .perm-key {
  font-size: 11px;
  color: var(--gh-fg-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.module-tip {
  display: block;
  margin-top: 10px;
  font-size: 11px;
  color: var(--gh-fg-muted);
  line-height: 1.4;
}

/* ── modal ── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(31, 35, 40, .5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
/* v0.21.3: modal-card 改 flex column 三段(head 固定 / form 滚动 / actions 固定底部)
   form 自身也是 flex column,modal-card 整体不再 overflow,只 form 内容滚 */
.modal-card {
  background: var(--gh-bg);
  border-radius: var(--gh-radius);
  width: 100%;
  max-width: 480px;
  padding: 0;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-card h3 {
  margin: 0;
  padding: 18px 24px;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 1px solid var(--gh-border);
  flex-shrink: 0;
}
/* form 占满剩余高度,内部用 flex column 让 modal-actions 贴底 */
.modal-card form.user-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
/* 直接子级输入框 + fieldset:固定高 head 和 sticky body 之间 */
.modal-card form.user-form > label,
.modal-card form.user-form > fieldset {
  margin: 0;
  padding-left: 24px;
  padding-right: 24px;
  flex-shrink: 0;
}
.modal-card form.user-form > label:first-of-type {
  padding-top: 16px;
}
/* fieldset(权限/角色 grid 的容器)是滚动主区 */
.modal-card form.user-form > fieldset.module-group {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 24px;
  margin-top: 8px;
  border-top: 1px solid #f0f3f6;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
}

.user-form label {
  display: block;
  margin-bottom: 14px;
}
.user-form label span {
  display: block;
  font-size: 13px;
  color: var(--gh-fg-muted);
  margin-bottom: 6px;
}
.user-form em {
  color: var(--gh-danger);
  font-style: normal;
}
.user-form input,
.user-form select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius);
  font-size: 14px;
  background: var(--gh-bg);
  color: var(--gh-fg);
  box-sizing: border-box;
}
.user-form input:focus,
.user-form select:focus {
  outline: none;
  border-color: var(--gh-accent);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, .15);
}

/* v0.21.3: modal-actions sticky 在弹窗底部 */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 24px;
  border-top: 1px solid var(--gh-border);
  background: var(--gh-bg);
  flex-shrink: 0;
  margin-top: 0;
}
/* err 在 actions 里塞;放 modal-actions 之前的位置(form 内最后一段 fieldset 之后) */
.modal-card form.user-form > .modal-actions {
  border-top: 1px solid var(--gh-border);
}
.modal-card form.user-form > .err {
  margin: 0;
  padding: 8px 24px;
  flex-shrink: 0;
  background: #ffeef0;
  color: #cf222e;
  font-size: 12px;
  border-top: 1px solid var(--gh-border);
}

/* ── 筛选栏(账号 / 角色权限通用)── */
.filter-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 12px;
  background: #f6f8fa;
  border: 1px solid var(--gh-border);
  border-radius: 6px;
}
.filter-label { font-size: 11px; color: #656d76; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.chips { display: inline-flex; gap: 4px; }
.chip {
  background: #fff; border: 1px solid var(--gh-border); color: var(--gh-fg);
  padding: 4px 10px; font-size: 12px; border-radius: 16px; cursor: pointer;
  transition: all .12s;
}
.chip:hover { background: #f0f3f6; }
.chip.active { background: var(--gh-fg); color: #fff; border-color: var(--gh-fg); }
.filter-search {
  border: 1px solid var(--gh-border); border-radius: 6px;
  padding: 4px 10px; font-size: 12px; min-width: 160px; height: 28px;
  background: #fff; color: var(--gh-fg);
}
.filter-search:focus { outline: 2px solid rgba(9,105,218,.3); border-color: var(--gh-link); }

/* ── 应用归属标签(账号管理姓名后 + 矩阵 panel head)── */
.app-tag {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 6px;
  font-size: 10px; font-weight: 700;
  border-radius: 9px; vertical-align: middle;
}
.app-tag.app-fleet { background: #ddf4ff; color: #0969da; border: 1px solid rgba(9,105,218,.25); }
.app-tag.app-nempoi { background: #dafbe1; color: #1f883d; border: 1px solid rgba(31,136,61,.25); }
.app-tag.app-platform { background: #f0e7ff; color: #6f42c1; border: 1px solid rgba(111,66,193,.25); }
.app-tag.app-owner { background: #fff8c5; color: #7d4e00; border: 1px solid rgba(125,78,0,.25); }

/* ── 角色权限矩阵 ── */
.matrix-wrap { padding-bottom: 20px; display: flex; flex-direction: column; gap: 16px; }
.matrix-panel {
  border: 1px solid var(--gh-border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.matrix-panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: #f6f8fa;
  border-bottom: 1px solid var(--gh-border);
}
.matrix-panel-head .app-tag {
  font-size: 11px; padding: 2px 10px; height: 22px;
}
.matrix-panel-meta { font-size: 11px; color: #656d76; }
.matrix-table-wrap {
  max-height: 600px;
  overflow: auto;
  position: relative;
}
.matrix-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}
.matrix-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: #fff;
  border-bottom: 1px solid var(--gh-border);
  padding: 10px 8px;
  text-align: center;
  white-space: nowrap;
  font-weight: 600;
}
.matrix-table th.cell-perm { text-align: left; min-width: 280px; padding-left: 14px; }
.matrix-table th.cell-role { min-width: 90px; position: relative; }
.matrix-table th.cell-role.sys { background: #fff8e1; }
.matrix-table th.cell-role.lock { background: #f6f8fa; }
.matrix-table .role-name { font-size: 12px; }
.matrix-table .role-lock-ic { margin-left: 4px; font-size: 10px; }
.matrix-table .role-del {
  position: absolute; top: 4px; right: 4px;
  width: 16px; height: 16px; padding: 0;
  background: transparent; border: 0; color: #656d76;
  font-size: 14px; cursor: pointer; border-radius: 4px;
  line-height: 1;
}
.matrix-table .role-del:hover { background: #ffebe9; color: #cf222e; }
.matrix-table td {
  padding: 8px;
  border-bottom: 1px solid var(--gh-border-muted);
  vertical-align: middle;
}
.matrix-table tbody tr:hover td { background: rgba(9,105,218,.04); }
.matrix-table td.cell-perm { text-align: left; padding-left: 14px; }
.matrix-table td.cell-perm .perm-desc { color: #1f2328; line-height: 1.3; }
.matrix-table td.cell-perm .perm-key {
  font-size: 10px; color: #656d76;
  background: rgba(175,184,193,.15);
  padding: 1px 5px; border-radius: 3px;
  margin-top: 2px; display: inline-block;
}
.matrix-table td.cell-check { text-align: center; }
.matrix-table tr.cat-row td {
  background: #ddf4ff;
  font-size: 11px;
  font-weight: 600;
  color: #0969da;
  padding: 6px 14px;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid rgba(9,105,218,.2);
}
.matrix-table tbody tr.cat-row:hover td { background: #ddf4ff; }

/* iOS 风格 toggle 替代 checkbox */
.matrix-table .toggle {
  position: relative; display: inline-block;
  width: 32px; height: 18px; cursor: pointer;
  vertical-align: middle;
}
.matrix-table .toggle.disabled { cursor: not-allowed; opacity: .4; }
.matrix-table .toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.matrix-table .toggle-slider {
  position: absolute; inset: 0;
  background: #d0d7de;
  border-radius: 18px;
  transition: background .15s;
}
.matrix-table .toggle-slider::before {
  content: ''; position: absolute;
  width: 14px; height: 14px;
  left: 2px; top: 2px;
  background: #fff; border-radius: 50%;
  transition: transform .15s;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.matrix-table .toggle input:checked + .toggle-slider { background: var(--gh-success); }
.matrix-table .toggle input:checked + .toggle-slider::before { transform: translateX(14px); }
.matrix-table .toggle:hover .toggle-slider { box-shadow: 0 0 0 4px rgba(9,105,218,.08); }
.matrix-table .toggle.disabled:hover .toggle-slider { box-shadow: none; }

.matrix-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 10px 14px;
  background: #f6f8fa;
  border-top: 1px solid var(--gh-border);
}
.matrix-actions .matrix-save {
  width: auto;
  padding: 6px 14px;
  font-size: 12px;
  height: auto;
}
.matrix-actions .matrix-save:not(:disabled) {
  background: var(--gh-success);
  border-color: rgba(31,136,61,.4);
  color: #fff;
}

/* ── 系统架构页 ── */
.arch-doc h3 {
  margin: 24px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gh-border-muted);
  font-size: 15px;
  font-weight: 600;
}
.arch-doc h4 {
  margin: 12px 0 6px;
  font-size: 13px;
  color: var(--gh-fg-muted);
}
.arch-doc .arch-list {
  margin: 0; padding: 0 0 0 20px;
  font-size: 13px;
  line-height: 1.7;
}
.arch-doc .arch-list li code {
  font-size: 11px;
  background: rgba(175, 184, 193, .2);
  padding: 1px 4px;
  border-radius: 3px;
}
.arch-pre {
  background: #f6f8fa;
  padding: 16px;
  border-radius: 6px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-x: auto;
  border: 1px solid var(--gh-border);
  line-height: 1.4;
}

/* ── 移动端 ── */
@media (max-width: 600px) {
  .admin-nav { padding: 0 8px; }
  .admin-tab { padding: 10px 12px; font-size: 12px; }
  .admin-main { padding: 12px; }
  .section-head h2 { font-size: 16px; }
  .users-table { font-size: 12px; }
  .users-table th, .users-table td { padding: 8px 6px; }
}
