/* ===== 顶部「选择角色」面板（明道云风格） ===== */
.role-wrap { position: relative; display: inline-flex; }

.top-act.role { font-weight: 600; padding-right: 10px; }
.top-act.role .lbl { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-act.role .caret { font-size: 10px; opacity: .55; margin-left: 1px; }
.top-act.role.open {
  border-color: var(--brand-400);
  color: var(--brand-600);
  background: var(--brand-50);
}

/* 下拉面板 */
.role-panel {
  position: absolute; top: 48px; right: 0;
  width: 300px; max-height: 72vh;
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  z-index: 50; overflow: hidden;
  animation: rolePop .14s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes rolePop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.role-panel.hidden { display: none; }

.role-panel-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line-soft); }
.rph-title { display: block; font-size: 15px; font-weight: 700; color: var(--gray-900); }
.rph-sub { display: block; margin-top: 3px; font-size: 12px; color: var(--sub); }

.role-search { padding: 10px 12px; }
.role-search-input {
  width: 100%; height: 34px; padding: 0 12px; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--gray-50); color: var(--txt); font-size: 13px; outline: none;
  transition: all var(--t-fast);
}
.role-search-input:focus { border-color: var(--brand-400); background: #fff; box-shadow: 0 0 0 3px var(--brand-100); }

.role-list { flex: 1; overflow-y: auto; padding: 4px 8px 8px; }
.role-group { margin-bottom: 2px; }
.role-group-title {
  padding: 9px 8px 4px; font-size: 11px; font-weight: 700;
  color: var(--sub); letter-spacing: .04em;
}
.role-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r-md);
  cursor: pointer; transition: background var(--t-fast);
}
.role-item:hover { background: var(--brand-50); }
.role-item.on { background: var(--brand-50); }
.role-ic {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-100); font-size: 16px;
}
.role-item.on .role-ic { background: var(--brand-100); }
.role-name { flex: 1; font-size: 13.5px; font-weight: 500; color: var(--txt); }
.role-check { width: 16px; text-align: center; font-size: 14px; font-weight: 700; color: var(--brand-600); }

.role-panel-foot {
  padding: 10px 14px; border-top: 1px solid var(--line-soft);
  font-size: 12.5px; color: var(--sub);
}
.role-panel-foot b { color: var(--brand-600); }

/* ---------- 深色主题 ---------- */
body.dark-theme .role-panel { background: #0f172a; border-color: rgba(255, 255, 255, 0.12); }
body.dark-theme .rph-title { color: #e2e8f0; }
body.dark-theme .role-search-input {
  background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.12); color: #e2e8f0;
}
body.dark-theme .role-search-input:focus { background: rgba(255, 255, 255, 0.1); }
body.dark-theme .role-group-title { color: #94a3b8; }
body.dark-theme .role-item:hover { background: rgba(59, 130, 246, 0.14); }
body.dark-theme .role-item.on { background: rgba(59, 130, 246, 0.18); }
body.dark-theme .role-ic { background: rgba(255, 255, 255, 0.08); }
body.dark-theme .role-item.on .role-ic { background: rgba(59, 130, 246, 0.3); }
body.dark-theme .role-name { color: #cbd5e1; }
body.dark-theme .role-check { color: #93c5fd; }
body.dark-theme .role-panel-foot b { color: #93c5fd; }

/* ---------- 窄屏适配 ---------- */
@media (max-width: 1100px) {
  .top-act.role .lbl { display: none; }
  .top-act.role { padding-right: 14px; }
  .role-panel { width: 264px; }
}
@media (max-width: 640px) {
  .role-panel { position: fixed; top: 56px; right: 10px; left: 10px; width: auto; }
}
