/* =========================================================
   展信包装 · 网站管理后台 v1.7 · 管理员与权限样式（S2）
   ---------------------------------------------------------------
   仅在 app.css / manage.css / ext.css 基础上补充本模块特有样式：
   - 页面 Tab 行（复用 .seg-tabs，加计数胶囊与右侧主按钮）
   - 管理员列表：头像 + 用户名、状态开关、行内操作
   - 角色列表：code 标识、管理员数胶囊、系统徽标
   - 角色弹窗：分组权限树（组全选 / 全不选、只读态）
   - 编辑弹窗内的「重置密码」折叠面板
   公共按钮 / 卡片 / 表单 / 表格 / 徽标 / 开关 / 空态一律复用 app.css。
   所有选择器以 v17- / ext3- 前缀，避免影响既有页面。
   ========================================================= */

/* ---------- 1. 页面与 Tab 行 ---------- */
.ext3-page { min-width: 0; }

.v17-tabs-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.v17-tabs-row .spacer { flex: 1 1 auto; }
.v17-tabs-row .seg-tab { display: inline-flex; align-items: center; gap: 6px; }
.v17-tabs-row .seg-tab .icon { color: var(--muted-2); }
.v17-tabs-row .seg-tab.active .icon { color: var(--brand); }

.v17-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #E5E8EA;
  color: #5A6167;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.seg-tab.active .v17-tab-count { background: var(--brand-soft); color: var(--brand); }

/* ---------- 2. 工具栏 ---------- */
.v17-toolbar { min-height: 60px; }
.v17-toolbar-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted-2);
  line-height: 1.5;
}
.v17-toolbar-hint .icon { color: var(--muted-2); }
.v17-toolbar .spacer { flex: 1 1 auto; }

/* 加载失败 / 权限不足提示区留白 */
.v17-toolbar + .v17-warn-strip { margin: 0; }

/* ---------- 3. 警告条 ---------- */
.v17-warn-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 18px;
  margin-top: 14px;
  padding: 9px 12px;
  border: 1px solid #F1DFBB;
  border-radius: 9px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12.5px;
  line-height: 1.6;
}
.v17-warn-strip > span { flex: 1 1 220px; }
.v17-warn-strip .icon { flex: none; }
.v17-warn-strip .btn { flex: none; }

/* ---------- 4. 管理员列表 ---------- */
.v17-table td { vertical-align: middle; }
.v17-table .col-actions { min-width: 250px; }

.v17-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
}
.v17-avatar {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  user-select: none;
}
.v17-user-main { min-width: 0; }
.v17-user-main .cell-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }

.v17-inline-badge { margin-left: 6px; font-size: 10.5px; }

.v17-status-cell { display: flex; align-items: center; gap: 8px; }
.v17-status-text { font-size: 12px; color: var(--muted-2); white-space: nowrap; }
.v17-status-text.is-on { color: var(--ok); }
.v17-status-cell .switch { flex: none; }

.v17-code {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #FAFBFC;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.5;
}

.v17-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 27px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--info-soft);
  color: var(--info);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.v17-unit { margin-left: 4px; font-size: 12px; color: var(--muted-2); }

/* ---------- 5. 角色弹窗：权限树 ---------- */
.v17-perm-section {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.v17-perm-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.v17-perm-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 3px;
}
.v17-perm-title .icon { color: var(--brand); }
.v17-perm-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.v17-perm-summary {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.v17-perm-tree {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 46vh;
  overflow-y: auto;
  padding: 2px 4px 2px 2px;
  -webkit-overflow-scrolling: touch;
}
.v17-perm-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.v17-perm-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  background: #FAFBFC;
  border-bottom: 1px solid var(--line);
}
.v17-group-check { flex: 0 1 auto; }
.v17-group-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.v17-perm-count {
  flex: none;
  font-size: 11.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.v17-perm-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px 14px;
  padding: 10px 12px 12px;
}

.v17-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 3px 0;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  line-height: 1.55;
}
.v17-check > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v17-check input {
  flex: none;
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}
.v17-check.is-readonly { cursor: default; color: var(--muted); }
.v17-check.is-readonly input { cursor: not-allowed; }
.v17-check input:disabled { cursor: not-allowed; }

.v17-readonly-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-bottom: 10px;
  padding: 9px 12px;
  border: 1px solid #D9E3F5;
  border-radius: 9px;
  background: var(--info-soft);
  color: var(--info);
  font-size: 12.5px;
  line-height: 1.6;
}
.v17-readonly-note .icon { flex: none; margin-top: 1px; }

/* ---------- 6. 编辑弹窗：重置密码面板 ---------- */
.v17-form-error {
  margin-top: 12px;
  padding: 8px 11px;
  border: 1px solid var(--danger-line);
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12.5px;
  line-height: 1.6;
  word-break: break-word;
}

.v17-reset-box {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line-strong);
}
.v17-reset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.v17-reset-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 3px;
}
.v17-reset-title .icon { color: var(--warn); }
.v17-reset-panel {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #FAFBFC;
}
.v17-reset-panel .form-grid { margin-bottom: 0; }
.v17-reset-actions { display: flex; justify-content: flex-end; }

.v17-modal-text {
  margin: 0 0 14px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink-2);
}
.v17-modal-text .mono { color: var(--muted); font-size: 12.5px; }

/* ---------- 7. 响应式 ---------- */
@media (max-width: 1100px) {
  .v17-perm-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .v17-tabs-row { gap: 10px; }
  .v17-tabs-row .spacer { display: none; }
  .v17-tabs-row > .btn { width: 100%; justify-content: center; }
  .v17-tabs-row .seg-tabs { width: 100%; }
  .v17-tabs-row .seg-tab { flex: 1 1 auto; justify-content: center; }
  .v17-perm-items { grid-template-columns: 1fr; }
  .v17-perm-tree { max-height: none; }
  .v17-warn-strip { margin: 12px 14px 0; }
  .v17-perm-head { flex-direction: column; align-items: stretch; }
  .v17-perm-meta { justify-content: flex-start; }
}

@media (max-width: 520px) {
  .v17-tab-count { display: none; }
  .v17-reset-head { align-items: flex-start; }
  .v17-reset-head .btn { width: 100%; justify-content: center; }
}
