/* ==========================================================================
   console.css —— 控制面板（仅 administer 组成员可见）
   ========================================================================== */

.console {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.console-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex: none;
  padding: 18px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.console-head h2 { font-size: 19px; }
.console-head p { margin-top: 4px; font-size: 12.5px; color: var(--muted); }

.console-main {
  flex: 1;
  min-height: 0;
  display: flex;
}

/* 左侧固定导航：样式与对话页的会话列表一致 */
.console-nav {
  flex: none;
  width: 216px;
  height: 100%;
  padding: 14px 10px;
  overflow-y: auto;
  background: linear-gradient(180deg, #f2f7ff 0%, #eef4ff 100%);
  border-right: 1px solid var(--blue-150);
}
.console-nav-title {
  padding: 0 8px 8px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.console-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}
.console-nav-item svg { flex: none; width: 15px; height: 15px; color: var(--blue-400); }
.console-nav-item:hover { background: rgba(255, 255, 255, .78); }
.console-nav-item.is-active {
  background: var(--surface);
  color: var(--blue-700);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.console-nav-item.is-active svg { color: var(--blue-600); }

.console-content {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 22px 26px 42px;
  overflow-y: auto;
}
.console-panel { max-width: 900px; }
.console-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.console-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.console-panel-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.console-panel-head .count {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--blue-50);
  border: 1px solid var(--blue-150);
  color: var(--blue-600);
  font-size: 11.5px;
  font-weight: 500;
}

.primary-btn.small {
  width: auto;
  height: 34px;
  margin: 0;
  padding: 0 14px;
  font-size: 13px;
  letter-spacing: 0;
  border-radius: 9px;
}

.console-hint {
  margin: 8px 0 14px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted-2);
}

.console-list { display: grid; gap: 10px; }

/* ---------------------------------------------------------------- 模型卡片 */
.model-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 15px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface-2);
}
.model-card .m-main { flex: 1; min-width: 0; }
.model-card .m-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.model-card .m-sub {
  margin-top: 3px;
  overflow: hidden;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tag {
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}
.tag.is-live { border-color: #c3e7d7; background: #f0fbf5; color: #2f8f68; }
.tag.is-admin { border-color: var(--blue-200); background: var(--blue-50); color: var(--blue-700); }
.tag.is-key { border-color: #eadfc7; background: #fdf7ec; color: #a4782c; }

.card-actions { display: flex; gap: 6px; flex: none; }
.mini-btn {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}
.mini-btn:hover { border-color: var(--blue-300); background: var(--blue-50); color: var(--blue-700); }
.mini-btn.danger { color: #b94a4a; }
.mini-btn.danger:hover { border-color: #f0c8c8; background: #fdeeee; color: #b93b3b; }

/* ---------------------------------------------------------------- 人设卡片 */
.persona-card {
  display: flex;
  gap: 14px;
  padding: 13px 15px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface-2);
}
.persona-card .p-main { flex: 1; min-width: 0; }
.persona-card .p-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.persona-card .p-id { font-size: 11.5px; color: var(--muted-2); font-weight: 400; }
.persona-card .p-desc { margin-top: 3px; font-size: 12px; color: var(--muted); }
.persona-card .p-prompt {
  margin-top: 8px;
  max-height: 74px;
  padding: 8px 10px;
  overflow: hidden;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ---------------------------------------------------------------- 用户行 */
.user-row {
  display: grid;
  gap: 10px;
  padding: 13px 15px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface-2);
}
.user-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-head .u-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.user-head .u-sub { font-size: 12px; color: var(--muted); }
.user-head .u-tags { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }

.assign-block { display: grid; gap: 8px; }
.assign-label { font-size: 12px; color: var(--muted); }
.assign-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.assign-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
  color: var(--text-soft);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.assign-item:hover { border-color: var(--blue-300); }
.assign-item input { accent-color: var(--blue-500); margin: 0; }
.assign-item.is-checked { border-color: var(--blue-300); background: var(--blue-50); color: var(--blue-700); }
.assign-empty { font-size: 12px; color: var(--muted-2); }

@media (max-width: 860px) {
  .console-head { padding: 14px 16px; }
  .console-main { flex-direction: column; }
  .console-nav {
    width: 100%;
    height: auto;
    flex-direction: row;
    gap: 6px;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--blue-150);
    overflow-x: auto;
    overflow-y: hidden;
  }
  .console-nav-title { display: none; }
  .console-nav-item { flex: none; width: auto; height: 36px; }
  .console-content { padding: 14px 14px 32px; }
  .console-panel { padding: 14px; }
  .model-card { flex-direction: column; align-items: stretch; }
  .card-actions { justify-content: flex-end; }
}

/* ---------------------------------------------------------------- 头像 */
.avatar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar-preview {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue-400), var(--blue-600));
  color: #fff;
  font-size: 19px;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(61, 126, 240, .22);
}
.avatar-row input { flex: 1; }

.persona-card .p-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  margin-top: 2px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue-400), var(--blue-600));
  color: #fff;
  font-size: 17px;
  line-height: 1;
}
.avatar-actions { display: flex; gap: 8px; }
.avatar-actions .ghost-action { height: 32px; padding: 0 12px; font-size: 12.5px; }

.avatar-preview img,
.p-avatar img,
.msg-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}
/* ---------------------------------------------------------------- 用户头像与资料 */
.u-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  overflow: hidden;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--blue-400), var(--blue-600));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.u-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-block { display: grid; gap: 8px; }
.profile-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.profile-input {
  flex: 1 1 200px;
  min-width: 160px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.profile-input:focus {
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(77, 141, 255, .12);
}
/* ---------------------------------------------------------------- 用户表格 */
.console-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.search-input {
  flex: 1 1 240px;
  min-width: 180px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input:focus {
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(77, 141, 255, .12);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface-2);
}
.console-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.console-table th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}
.console-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-soft);
  vertical-align: middle;
}
.console-table tbody tr:last-child td { border-bottom: 0; }
.console-table tbody tr:hover { background: var(--surface); }
.console-table .uid-cell {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}
.console-table .name-cell { color: var(--text); font-weight: 600; }
.console-table .tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.table-actions { display: flex; gap: 6px; white-space: nowrap; }
.assign-row td { background: var(--surface); }
.assign-row .assign-grid { margin-top: 8px; }

/* ---------------------------------------------------------------- 组卡片 */
.group-card {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface-2);
}
.group-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.group-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.group-meta { color: var(--muted); font-size: 12px; }
.group-members { display: flex; flex-wrap: wrap; gap: 6px; }
.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
  color: var(--text-soft);
}
.member-chip button {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.member-chip button:hover { background: #fdecec; color: #d64545; }
.group-add { display: flex; gap: 8px; align-items: center; }
.group-add select {
  flex: 1 1 200px;
  min-width: 160px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
}
/* 只读字段（个人资料里的 UUID） */
.field-value {
  margin: 0;
  padding: 8px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
}
/* 组成员：名字 + uuid */
.member-chip small {
  color: var(--muted-2);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10.5px;
}
/* 组管理：UUID 查询加入 */
.group-uid-input {
  flex: 0 1 150px;
  min-width: 110px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  outline: none;
}
.group-uid-input:focus {
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(77, 141, 255, .12);
}
.group-lookup-result {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--blue-700);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 个人资料：昵称「显示 + 修改/确定」，按钮靠右 */
.nickname-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nickname-row .nickname-text { flex: 1 1 auto; min-width: 0; }
.nickname-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
}
.nickname-input:focus {
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(77, 141, 255, .12);
}
.nickname-row .ghost-action,
.nickname-row .primary-btn {
  flex: none;
  margin-left: auto;
}
.nickname-row .ghost-action + .primary-btn { margin-left: 0; }
/* 个人资料：密码输入 + 显示密码 */
.password-row {
  display: grid;
  gap: 8px;
}
.password-input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
}
.password-input:focus {
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(77, 141, 255, .12);
}
/* 注意：登录页的 .field input 会撑满宽度，勾选框需要单独还原 */
.field .password-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  margin-bottom: 0;
  margin-top: 8px;
  font-weight: 400;
  color: var(--text-soft);
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
}
.field .password-toggle input[type="checkbox"] {
  flex: none;
  width: 15px;
  height: 15px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  accent-color: var(--blue-500);
  cursor: pointer;
}
/* 个人资料底部的「修改密码」靠左 */
.settings-foot .footer-left { margin-right: auto; }
/* 修改密码弹窗窄一点 */
.password-modal { max-width: 420px; }
.password-modal .settings-body { gap: 14px; }
/* 用户弹窗：两个密码框上下排列 */
.stacked-input { margin-top: 8px; }
/* 用户弹窗：编辑态的「修改密码」按钮 */
#userPasswordBtnRow .ghost-action { margin-top: 2px; }
#userPasswordBtnRow .field-hint { margin-top: 8px; }
/* 用户弹窗里的密钥列表 */
.user-keys { display: grid; gap: 6px; margin-bottom: 8px; }
.user-key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 12.5px;
}
.user-key-row .key-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-key-row code { color: var(--blue-700); font-size: 12px; }
.user-key-row .ghost-action { padding: 2px 8px; }
.user-keys-empty { color: var(--muted); font-size: 12.5px; padding: 2px 0 6px; }