/* AI-MARK[QAI-UI:legal-role-management] 2026-07-23 10:32 (GMT+7) — add-mode nhân sự dùng danh bạ HR đủ 100 kết quả đầu và group theo Phòng trong modal | rel: QAI-LEGAL:multi-layer-access, QAI-UI:legal-workspace-nav */
.pc-card--role-management {
  padding: 16px 24px 24px;
  background: #f7f9fc;
  min-height: calc(100vh - 260px);
}

.pc-role-page-head,
.pc-role-bindings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.pc-role-page-head {
  margin: 0 0 8px;
  padding: 0 0 9px;
  border-bottom: 1px solid #e2e8f0;
  background: transparent;
}
.pc-role-page-head h2 {
  margin: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 17px;
}
.pc-role-page-head p,
.pc-role-bindings-head p {
  margin: 0;
  max-width: 900px;
  color: var(--pc-muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.pc-role-eyebrow {
  color: var(--pc-primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.pc-role-status {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 8px auto;
  padding: 6px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1e40af;
  font-size: 11.5px;
  font-weight: 600;
}
.pc-role-status--success { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.pc-role-status--error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.pc-role-status--conflict { border-color: #fde68a; background: #fffbeb; color: #92400e; }

.pc-role-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  min-height: 0;
  height: auto;
}

.pc-role-nav,
.pc-role-editor,
.pc-role-bindings {
  border: 1px solid var(--pc-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 9px rgba(15, 23, 42, .035);
}

.pc-role-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  align-self: start;
  min-height: 0;
  overflow: visible;
}

.pc-role-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 7px 9px;
  border-bottom: 1px solid var(--pc-border);
}
.pc-role-nav-head strong { color: var(--pc-text); font-size: 12.5px; }
.pc-role-nav-head small { color: var(--pc-muted); font-size: 11px; }

.pc-role-nav-search {
  display: grid;
  gap: 5px;
  padding: 6px 0;
}
.pc-role-nav-search .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.pc-role-nav-search input {
  width: 100%;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
  color: var(--pc-text);
  font-family: inherit;
  font-size: 11.5px;
}
.pc-role-nav-search input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
  outline: none;
}

.pc-role-create {
  display: grid;
  gap: 9px;
  margin: 4px 0 8px;
  padding: 11px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #f8fbff;
}
.pc-role-create-head {
  display: grid;
  gap: 3px;
}
.pc-role-create-head strong {
  color: var(--pc-text);
  font-size: 12px;
}
.pc-role-create-head small {
  color: var(--pc-muted);
  font-size: 10.5px;
  line-height: 1.35;
}
.pc-role-create-field {
  display: grid;
  gap: 4px;
}
.pc-role-create-field span {
  color: #64748b;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pc-role-create-field input,
.pc-role-create-field select {
  width: 100%;
  min-height: 33px;
  padding: 7px 9px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
  color: var(--pc-text);
  font-family: inherit;
  font-size: 11px;
}
.pc-role-create-field input:focus,
.pc-role-create-field select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
  outline: none;
}
.pc-role-create-submit {
  justify-self: stretch;
  min-height: 34px;
}
.pc-role-create-people {
  display: grid;
  gap: 8px;
  padding: 9px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #fff;
}
.pc-role-create-people-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.pc-role-create-people-head strong {
  color: var(--pc-text);
  font-size: 11.5px;
}
.pc-role-create-people-head small,
.pc-role-create-people-note {
  color: var(--pc-muted);
  font-size: 9.5px;
  line-height: 1.35;
}
.pc-role-create-people-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
}
.pc-role-create-person {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.pc-role-create-person.is-checked {
  border-color: #a5b4fc;
  background: #eef2ff;
}
.pc-role-create-person input {
  width: 14px;
  height: 14px;
  margin-top: 2px;
  accent-color: var(--pc-primary);
}
.pc-role-create-person strong {
  display: block;
  color: var(--pc-text);
  font-size: 10.5px;
  line-height: 1.25;
}
.pc-role-create-person small {
  display: block;
  margin-top: 2px;
  color: var(--pc-muted);
  font-size: 9px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.pc-role-nav-list {
  display: grid;
  gap: 5px;
}
.pc-role-nav-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--pc-text);
  cursor: pointer;
  text-align: left;
}
.pc-role-nav-item:hover { background: var(--pc-soft); }
.pc-role-nav-item.is-active { border-color: #c7d2fe; background: #eef2ff; color: var(--pc-primary); }
.pc-role-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.pc-role-nav-title { font-size: 12.5px; font-weight: 750; }
.pc-role-nav-meta { color: var(--pc-muted); font-size: 10.5px; line-height: 1.35; }
.pc-role-nav-pill {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 8.5px;
  font-weight: 850;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.pc-role-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  padding: 10px;
  border: 1px solid #d7e4f7;
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  background: #fff;
  box-shadow: 0 7px 22px rgba(15, 23, 42, .04);
}
.pc-role-tool-btn,
.pc-role-current {
  position: relative;
  display: grid;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 60px;
  padding: 9px 12px;
  border: 1px solid #dbe3ef;
  border-radius: 11px;
  background: #fdfefe;
  color: var(--pc-text);
  text-align: left;
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.pc-role-tool-btn {
  cursor: pointer;
}
.pc-role-tool-btn:first-child {
  flex: 1 1 auto;
  grid-template-columns: auto minmax(0, 1fr) auto;
}
.pc-role-tool-btn--subjects {
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  min-width: 126px;
  background: #f8fafc;
  border-color: #dbe3ef;
}
.pc-role-tool-btn:hover {
  border-color: #93c5fd;
  background: #f8fbff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .08);
}
.pc-role-tool-btn[aria-expanded="true"] {
  border-color: #60a5fa;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
}
.pc-role-tool-btn span,
.pc-role-current span {
  flex: 0 0 auto;
  min-width: 0;
  color: #64748b;
  font-size: 9.75px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pc-role-tool-btn--subjects span {
  grid-column: 1 / -1;
}
.pc-role-tool-btn strong,
.pc-role-current strong {
  min-width: 0;
  color: var(--pc-text);
  font-size: 13.5px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-align: left;
}
.pc-role-tool-btn em {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #1d4ed8;
  font-style: normal;
  font-size: 10px;
  font-weight: 850;
  white-space: nowrap;
}
.pc-role-tool-btn--subjects strong {
  font-size: 20px;
  line-height: 1;
}
.pc-role-toolbar-actions {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}
.pc-role-toolbar-action {
  min-width: 112px;
  min-height: 60px;
  padding: 0 16px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}
.pc-role-tool-btn small,
.pc-role-current small {
  color: var(--pc-muted);
  font-size: 11px;
  line-height: 1.35;
}
.pc-role-current {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #f8fbff, #fff);
}

.pc-role-content { min-width: 0; min-height: 0; }
.pc-role-workbench {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  height: auto;
  min-height: 0;
  align-items: start;
}
.pc-role-primary { min-width: 0; min-height: 0; }
.pc-role-editor {
  display: block;
  height: auto;
  min-height: 0;
  overflow: visible;
  padding: 0;
  border-color: #dbeafe;
  border-radius: 14px;
  background: #fff;
}
.pc-role-toolbar + .pc-role-workbench .pc-role-editor {
  border-top: 0;
  border-radius: 0 0 14px 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .045);
}
.pc-role-editor.is-focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .18), 0 2px 9px rgba(15, 23, 42, .035);
}
.pc-role-bindings-head h3 { margin: 0; color: var(--pc-text); font-size: 17px; }
.pc-role-unsaved {
  display: none;
  align-items: center;
  gap: 8px;
  margin: 14px 14px 0;
  max-width: 440px;
  min-height: 36px;
  padding: 6px 8px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.35;
}
.pc-role-unsaved.is-visible {
  display: inline-flex;
}
.pc-btn--danger-ghost {
  border-color: #fecaca;
  background: #fff;
  color: #b91c1c;
  font-weight: 850;
}
.pc-btn--danger-ghost:hover:not(:disabled),
.pc-btn--danger-ghost:focus-visible {
  border-color: #fca5a5;
  background: #fef2f2;
  outline: none;
}
.pc-btn--danger-solid {
  border-color: #dc2626;
  background: #dc2626;
  color: #fff;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(220, 38, 38, .18);
}
.pc-btn--danger-solid:hover:not(:disabled),
.pc-btn--danger-solid:focus-visible {
  border-color: #b91c1c;
  background: #b91c1c;
  color: #fff;
  outline: none;
}
.pc-btn--danger-solid:disabled {
  border-color: #fecaca;
  background: #fee2e2;
  color: #ef4444;
  box-shadow: none;
}
.pc-role-toolbar-actions .pc-btn--primary {
  border: 1px solid #1d4ed8;
  background: #1d4ed8;
  color: #fff;
  box-shadow: 0 8px 18px rgba(29, 78, 216, .16);
}
.pc-role-toolbar-actions .pc-btn--primary:hover:not(:disabled),
.pc-role-toolbar-actions .pc-btn--primary:focus-visible {
  border-color: #1e40af;
  background: #1e40af;
  color: #fff;
  box-shadow: 0 10px 22px rgba(29, 78, 216, .18);
  outline: none;
}
.pc-btn--danger-soft {
  border-color: #fecaca;
  background: #fff7f7;
  color: #b91c1c;
  font-weight: 850;
}
.pc-btn--danger-soft:hover:not(:disabled),
.pc-btn--danger-soft:focus-visible {
  border-color: #f87171;
  background: #fee2e2;
  outline: none;
}
.pc-role-unsaved span {
  min-width: 0;
}
.pc-role-policy-note {
  margin: 14px 14px 0;
  padding: 11px 13px;
  border: 1px solid #ddd6fe;
  border-radius: 9px;
  background: #f5f3ff;
  color: #5b21b6;
  font-size: 12px;
  line-height: 1.45;
}

.pc-role-permission-shell {
  padding: 14px;
  background: #fff;
  border-radius: 0 0 14px 14px;
}

.pc-role-control-panel {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.pc-role-permission-search {
  display: flex;
  min-width: 0;
  grid-column: 2;
  grid-row: 1;
}
.pc-role-permission-search input {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #dbe3ef;
  border-radius: 11px;
  background: #fff;
  color: var(--pc-text);
  font-family: inherit;
  font-size: 12.5px;
}
.pc-role-permission-search input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
  outline: none;
}
.pc-role-scope-picker {
  position: relative;
  display: grid;
  grid-template-columns: minmax(240px, .36fr) minmax(280px, 1fr) auto;
  align-items: stretch;
  gap: 8px;
}
.pc-role-scope-selectbox,
.pc-role-scope-total {
  min-width: 0;
  border: 1px solid #dbe3ef;
  border-radius: 11px;
  background: #fff;
}
.pc-role-scope-selectbox {
  display: flex;
  align-items: center;
  grid-column: 1;
  grid-row: 1;
  padding: 0 11px;
  border-color: #bfdbfe;
  box-shadow: inset 4px 0 0 #2563eb;
}
.pc-role-scope-selectbox .sr-only,
.pc-role-permission-search .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.pc-role-scope-total span {
  color: #64748b;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: none;
}
.pc-role-scope-selectbox select {
  width: 100%;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--pc-text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 800;
  outline: none;
}
.pc-role-scope-total {
  display: inline-flex;
  grid-column: 3;
  grid-row: 1;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  min-height: 40px;
  padding: 7px 10px;
}
.pc-role-scope-total {
  min-width: 86px;
}
.pc-role-scope-total strong {
  color: var(--pc-text);
  font-size: 15px;
  line-height: 1;
}
.pc-role-scope-total small {
  color: #64748b;
  font-size: 10px;
  font-weight: 850;
}

.pc-role-actions {
  display: grid;
  gap: 10px;
  margin-top: 0;
  padding: 12px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  min-height: 0;
}
.pc-role-permission-stage {
  display: grid;
  gap: 0;
  margin-top: 12px;
}
.pc-role-section-head,
.pc-role-layer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.pc-role-section-head > div:first-child { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.pc-role-section-head strong,
.pc-role-layer-toggle strong { color: var(--pc-text); font-size: 12px; }
.pc-role-section-head small,
.pc-role-layer-toggle small { color: var(--pc-muted); font-size: 10px; }
.pc-role-layer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}
.pc-role-layer-tools,
.pc-role-layer-toolrow {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}
.pc-role-layer-tools .pc-btn,
.pc-role-layer-toolrow .pc-btn {
  min-height: 26px;
  padding: 4px 8px;
  font-size: 9.5px;
}
.pc-role-layer-toolrow {
  justify-content: flex-start;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}
.pc-role-layer-toolrow span {
  color: #64748b;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pc-role-action-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}
.pc-role-action {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  font-size: 11px;
  font-weight: 720;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.pc-role-action:hover { border-color: #bfdbfe; background: #f8fbff; }
.pc-role-action:focus-within { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.pc-role-action.is-checked { border-color: #93c5fd; background: #eff6ff; color: #1e3a8a; box-shadow: inset 4px 0 0 #1d4ed8; }
.pc-role-action:has(input:disabled) { cursor: not-allowed; }
.pc-role-action input { width: 17px; height: 17px; accent-color: var(--pc-primary); }

.pc-role-layers {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  min-height: 0;
  margin-top: 0;
  overflow: visible;
  padding: 0;
  align-content: start;
}

.pc-role-layer {
  display: grid;
  grid-template-rows: auto auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 12px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.pc-role-layer[data-role-layer="partners"] {
  grid-column: auto;
}
.pc-role-layer[data-role-layer="contracts"],
.pc-role-layer[data-role-layer="dataFields"] {
  grid-column: auto;
}
.pc-role-layer legend { width: 100%; padding: 0; }
.pc-role-layer-toggle {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  cursor: pointer;
  min-width: 0;
}
.pc-role-layer-toggle > span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pc-role-layer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  border-radius: 7px;
  background: #eef2ff;
  color: var(--pc-primary);
  font-size: 12px;
  font-weight: 800;
}
.pc-role-layer[hidden],
.pc-role-actions[hidden] { display: none; }
.pc-role-layer.is-focus,
.pc-role-actions.is-focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .14);
}
.pc-role-layer-desc { margin: 8px 0; color: var(--pc-muted); font-size: 10.5px; line-height: 1.4; }
.pc-role-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 8px;
  min-height: 0;
  max-height: none;
  margin-top: 8px;
  overflow: visible;
  padding-right: 0;
}
.pc-role-layer[data-role-layer="partners"] .pc-role-check-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  max-height: none;
}
.pc-role-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  min-height: 46px;
  padding: 9px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.pc-role-check:hover { border-color: #bfdbfe; background: #f8fbff; }
.pc-role-check:focus-within { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.pc-role-check.is-checked { border-color: #93c5fd; background: #eff6ff; box-shadow: inset 4px 0 0 #1d4ed8; }
.pc-role-check > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pc-role-check strong { color: var(--pc-text); font-size: 11.25px; line-height: 1.3; overflow-wrap: anywhere; }
.pc-role-check small { color: var(--pc-muted); font-size: 9.75px; line-height: 1.35; }
.pc-role-check input,
.pc-role-layer-toggle input { width: 17px; height: 17px; accent-color: var(--pc-primary); }
.pc-role-check:has(input:disabled),
.pc-role-layer-toggle:has(input:disabled) { cursor: not-allowed; }
.pc-role-action.is-filter-hidden,
.pc-role-check.is-filter-hidden {
  display: none;
}

/* AI-MARK[QAI-UI:legal-role-scoped-org-chart] 2026-07-22 16:00 (GMT+7) — sơ đồ tổ chức Helen full-width có click từng ô để mở đúng nhân sự theo đơn vị, không ép panel phân quyền vào khung thấp | rel: QAI-UI:legal-role-management */
.pc-role-organization {
  margin-top: 18px;
  padding: 16px;
}
.pc-role-organization,
.pc-role-bindings { border: 1px solid var(--pc-border); border-radius: 12px; background: #fff; box-shadow: 0 2px 9px rgba(15, 23, 42, .035); }
.pc-role-organization-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
}
.pc-role-organization-head h3 { margin: 0 0 4px; color: var(--pc-text); font-size: 15px; }
.pc-role-organization-head p { margin: 0; color: var(--pc-muted); font-size: 11.5px; line-height: 1.45; }
.pc-role-org-total {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  padding: 8px 11px;
  border-radius: 9px;
  background: #eef2ff;
  color: #3730a3;
}
.pc-role-org-total strong { font-size: 17px; line-height: 1; }
.pc-role-org-total span { margin-top: 4px; font-size: 9.5px; font-weight: 700; }
.pc-role-org-warning {
  display: block;
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  font-size: 10.5px;
  line-height: 1.4;
}
.pc-role-org-details {
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #f8fafc;
}
.pc-role-org-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 8px 10px;
  color: #1e40af;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 800;
}
.pc-role-org-details summary::after {
  content: "Mở";
  color: #64748b;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pc-role-org-details[open] summary::after { content: "Đóng"; }
.pc-role-org-details summary small { color: #64748b; font-size: 10px; font-weight: 650; }
.pc-role-org-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}
.pc-role-org-chart {
  min-width: 1320px;
  padding: 18px 18px 20px;
}
.pc-role-org-governance {
  display: grid;
  grid-template-columns: 1fr 200px 1fr;
  gap: 8px 18px;
  justify-items: center;
  align-items: center;
  margin-bottom: 18px;
}
.pc-role-org-governance > .pc-role-org-card--board,
.pc-role-org-governance > .pc-role-org-card--ceo,
.pc-role-org-governance > .pc-role-org-card--exco { grid-column: 2; }
.pc-role-org-advisors {
  grid-column: 1 / -1;
  grid-row: 3;
  display: grid;
  grid-template-columns: 1fr 200px 1fr;
  width: 640px;
  align-items: center;
  gap: 18px;
}
.pc-role-org-advisors .pc-role-org-card:first-child { grid-column: 1; }
.pc-role-org-advisors .pc-role-org-card:last-child { grid-column: 3; }
.pc-role-org-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 8px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #bfdbfe;
  color: #111827;
  cursor: default;
  font-family: inherit;
  text-align: center;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.pc-role-org-card--clickable {
  cursor: pointer;
}
.pc-role-org-card--clickable:hover,
.pc-role-org-card--clickable:focus-visible {
  border-color: #1d4ed8;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .16);
  outline: none;
  transform: translateY(-1px);
}
.pc-role-org-card--clickable.is-active {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .25);
}
.pc-role-org-card strong {
  color: inherit;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.18;
  overflow-wrap: anywhere;
}
.pc-role-org-card em {
  margin-top: 3px;
  color: inherit;
  font-size: 9.5px;
  font-style: italic;
  line-height: 1.15;
  opacity: .88;
}
.pc-role-org-card--board { background: #ff3b35; border-color: #ff3b35; color: #fff; }
.pc-role-org-card--ceo { background: #ff7043; border-color: #ff7043; color: #fff; }
.pc-role-org-card--exco { background: linear-gradient(135deg, #030318, #3730a3); border-color: #1e1b4b; color: #fff; }
.pc-role-org-card--advisor { width: 176px; min-height: 38px; background: #bfdbfe; border-color: #bfdbfe; }
.pc-role-org-branches {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-top: 16px;
}
.pc-role-org-branches::before {
  content: "";
  position: absolute;
  top: 0;
  left: 74px;
  right: 74px;
  height: 2px;
  background: #475569;
}
.pc-role-org-branch {
  position: relative;
  display: grid;
  align-content: start;
  gap: 10px;
  width: 158px;
  min-width: 158px;
  padding-top: 8px;
}
.pc-role-org-branch::before {
  content: "";
  position: absolute;
  top: -16px;
  left: 50%;
  width: 2px;
  height: 24px;
  background: #475569;
}
.pc-role-org-branch--wide {
  width: 330px;
  min-width: 330px;
}
.pc-role-org-card--division {
  min-height: 56px;
  background: #0755b8;
  border-color: #0755b8;
  color: #fff;
}
.pc-role-org-card--standalone-center,
.pc-role-org-card--center {
  min-height: 58px;
  background: #58a4f7;
  border-color: #58a4f7;
  color: #06172f;
}
.pc-role-org-departments,
.pc-role-org-centers {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pc-role-org-node {
  display: block;
  min-width: 0;
}
.pc-role-org-node .pc-role-org-card {
  width: 100%;
}
.pc-role-org-centers { gap: 12px; }
.pc-role-org-center-block {
  display: grid;
  grid-template-columns: minmax(128px, 150px) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.pc-role-org-branch:not(.pc-role-org-branch--wide) .pc-role-org-center-block {
  grid-template-columns: 1fr;
}
.pc-role-org-card--department {
  min-height: 44px;
  background: #c7ddfb;
  border-color: #c7ddfb;
}
.pc-role-org-card--department:not(.pc-role-org-card--clickable) {
  opacity: .62;
}
.pc-role-org-branch--wide .pc-role-org-card--department { min-height: 38px; }
.pc-role-org-count {
  margin-top: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .74);
  color: #1e40af;
  font-size: 8px;
  font-weight: 850;
}
.pc-role-org-card--division .pc-role-org-count,
.pc-role-org-card--board .pc-role-org-count,
.pc-role-org-card--ceo .pc-role-org-count,
.pc-role-org-card--exco .pc-role-org-count {
  background: rgba(255, 255, 255, .18);
  color: #fff;
}
.pc-role-org-empty { margin: 0; padding: 18px; border: 1px dashed var(--pc-border-strong); border-radius: 9px; color: var(--pc-muted); text-align: center; font-size: 11.5px; }

.pc-role-bindings {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: visible;
  padding: 16px;
}
.pc-role-bindings-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 10px;
}
.pc-role-subject-search { flex: 0 1 auto; }
.pc-role-subject-search .sr-only,
.pc-role-binding-field .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.pc-role-subject-search input {
  width: 100%;
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid var(--pc-border-strong);
  border-radius: 8px;
  color: var(--pc-text);
  background: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
}
.pc-role-assignment-tabs {
  display: inline-flex;
  align-self: flex-start;
  gap: 4px;
  padding: 4px;
  border: 1px solid #dbe3ef;
  border-radius: 9px;
  background: #f8fafc;
}
.pc-role-assignment-tab {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #475569;
  cursor: pointer;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 850;
}
.pc-role-assignment-tab:hover,
.pc-role-assignment-tab:focus-visible {
  background: #fff;
  outline: none;
}
.pc-role-assignment-tab.is-active {
  border-color: #bfdbfe;
  background: #fff;
  color: #1e40af;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
}
.pc-role-assignment-count {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 9px;
  color: var(--pc-muted);
  font-size: 10.5px;
}
.pc-role-assignment-count strong { color: var(--pc-text); font-size: 14px; }
.pc-role-assignment-list {
  display: grid;
  align-content: start;
  gap: 9px;
  height: clamp(520px, 58vh, 680px);
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  contain: layout paint;
  padding-right: 4px;
}
.pc-role-assignment-group {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}
.pc-role-assignment-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 2px 2px 0;
}
.pc-role-assignment-group-head strong {
  display: block;
  color: var(--pc-text);
  font-size: 12px;
  line-height: 1.25;
}
.pc-role-assignment-group-head small {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 9.5px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.pc-role-assignment-group-head span {
  flex: 0 0 auto;
  color: #475569;
  font-size: 10px;
  font-weight: 850;
}
.pc-role-assignment-group-list {
  display: grid;
  gap: 8px;
}
.pc-role-assignment-card {
  display: grid;
  gap: 9px;
  padding: 11px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}
.pc-role-assignment-card.is-override { border-color: #c4b5fd; background: #fbfaff; }
.pc-role-assignment-card.is-revoked { border-color: #fde68a; background: #fffdf5; }
.pc-role-assignment-card header,
.pc-role-assignment-controls {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 9px;
}
.pc-role-assignment-card header strong {
  display: block;
  color: var(--pc-text);
  font-size: 12.5px;
  line-height: 1.25;
}
.pc-role-assignment-card header small {
  display: block;
  margin-top: 3px;
  color: var(--pc-muted);
  font-size: 10px;
  overflow-wrap: anywhere;
}
.pc-role-person-meta > strong {
  display: block;
  color: #334155;
  font-size: 11px;
  line-height: 1.3;
}
.pc-role-assignment-roles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}
.pc-role-assignment-roles > div:not(.pc-role-effective) {
  padding: 7px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #f8fafc;
}
.pc-role-assignment-roles span {
  display: block;
  margin-bottom: 2px;
  color: #64748b;
  font-size: 8.5px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pc-role-assignment-roles strong {
  color: var(--pc-text);
  font-size: 11px;
  line-height: 1.25;
}
.pc-role-org-path {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin-top: 6px;
  color: var(--pc-muted);
}
.pc-role-org-segment { display: flex; min-width: 0; flex-direction: column; gap: 1px; }
.pc-role-org-segment small { color: #64748b; font-size: 8.5px; font-weight: 800; text-transform: uppercase; }
.pc-role-org-segment strong { max-width: 120px; color: #475569; font-size: 9.5px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.pc-role-org-arrow { flex: 0 0 auto; color: #94a3b8; font-weight: 800; }
.pc-role-source-chip {
  display: inline-flex;
  margin-bottom: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #ecfeff;
  color: #0e7490;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .025em;
  text-transform: uppercase;
}
.pc-role-effective {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 2px 7px;
  margin-bottom: 7px;
  padding: 7px 8px;
  border: 1px solid #bae6fd;
  border-radius: 7px;
  background: #f0f9ff;
}
.pc-role-effective.is-override { border-color: #c4b5fd; background: #f5f3ff; }
.pc-role-effective > span { color: #0369a1; font-size: 8.5px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.pc-role-effective.is-override > span { color: #6d28d9; }
.pc-role-effective > strong { min-width: 0; color: var(--pc-text); font-size: 11px; overflow-wrap: anywhere; }
.pc-role-effective > small { grid-column: 1 / -1; color: var(--pc-muted); font-size: 9px; line-height: 1.3; }
.pc-role-binding-field { display: block; }
.pc-role-binding-select {
  width: 100%;
  min-width: 180px;
  padding: 7px 9px;
  border: 1px solid var(--pc-border-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--pc-text);
  font-size: 11.5px;
}
.pc-role-assignment-controls .pc-role-binding-field {
  flex: 1 1 auto;
  min-width: 0;
}
.pc-role-assignment-controls .pc-btn { flex: 0 0 auto; min-height: 32px; }
.pc-role-assignment-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}
.pc-btn--primary-soft {
  border-color: #bfdbfe;
  background: #eef2ff;
  color: #1e40af;
  font-weight: 850;
}
.pc-btn--primary-soft:hover:not(:disabled) {
  border-color: #93c5fd;
  background: #dbeafe;
}
.pc-role-binding-governance {
  display: grid;
  grid-template-columns: minmax(120px, .8fr) minmax(118px, .7fr) minmax(180px, 1.2fr);
  gap: 8px;
}
.pc-role-binding-governance label {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.pc-role-binding-governance span {
  color: #64748b;
  font-size: 8.5px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pc-role-binding-governance select,
.pc-role-binding-governance input {
  width: 100%;
  min-height: 31px;
  padding: 6px 8px;
  border: 1px solid #dbe3ef;
  border-radius: 7px;
  background: #fff;
  color: var(--pc-text);
  font-family: inherit;
  font-size: 10.5px;
}
.pc-role-binding-warning {
  margin: 0;
  padding: 8px 9px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  font-size: 10px;
  line-height: 1.35;
}
.pc-role-table-note { margin: 9px 0 0; color: var(--pc-muted); font-size: 10.5px; }
.pc-role-empty { padding: 24px; color: var(--pc-muted); text-align: center; font-size: 12.5px; }
.pc-role-empty--compact {
  padding: 14px 10px;
  border: 1px dashed #dbe3ef;
  border-radius: 9px;
  background: #f8fafc;
  font-size: 11px;
}

.pc-role-overlay {
  position: fixed;
  inset: 0;
  z-index: 260;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, .34);
}
.pc-role-overlay[data-role-overlay-kind="subjects"] {
  justify-content: center;
}
.pc-role-drawer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(680px, 96vw);
  max-height: min(820px, calc(100dvh - 48px));
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, .38);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .26);
}
.pc-role-drawer--roles {
  width: min(720px, 96vw);
}
.pc-role-drawer--subjects {
  width: min(1120px, 96vw);
}
.pc-role-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--pc-border);
  background: #f8fafc;
}
.pc-role-drawer-head strong {
  display: block;
  color: var(--pc-text);
  font-size: 13.5px;
  line-height: 1.25;
}
.pc-role-drawer-head small {
  display: block;
  margin-top: 3px;
  color: var(--pc-muted);
  font-size: 10.5px;
  line-height: 1.35;
}
.pc-role-drawer-body {
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
}
.pc-role-drawer--subjects .pc-role-drawer-body {
  overflow: hidden;
}
.pc-role-drawer .pc-role-nav,
.pc-role-drawer .pc-role-bindings {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.pc-role-drawer .pc-role-nav {
  padding: 0;
}
.pc-role-drawer .pc-role-bindings {
  height: 100%;
  padding: 0;
}
.pc-role-drawer .pc-role-assignment-list {
  height: min(620px, calc(100dvh - 290px));
}

.pc-access-lock-notice {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 8px 0;
  padding: 10px 12px;
  border: 1px solid #c4b5fd;
  border-radius: 9px;
  background: #f5f3ff;
  color: #5b21b6;
  font-size: 11.5px;
  line-height: 1.4;
}
.pc-approvers.is-access-locked { border-color: #c4b5fd; background: #faf8ff; }
.pc-approvers.is-access-locked input,
.pc-approvers.is-access-locked button { cursor: not-allowed; }

/* BOD/đơn vị nghiệp vụ chỉ đọc: giữ preview/tra cứu, gỡ toàn bộ điểm vào thao tác ghi. */
body[data-pc-can-upload="false"] #pcBtnOpenAdd,
body[data-pc-can-upload="false"] #pcBtnPartnerCreate,
body[data-pc-can-upload="false"] #pcBulkBar,
body[data-pc-can-upload="false"] #pcSelectAll,
body[data-pc-can-upload="false"] .pc-row-check,
body[data-pc-can-upload="false"] [data-edit],
body[data-pc-can-upload="false"] [data-compliance-path],
body[data-pc-can-upload="false"] #pcLifecycleAddNode,
body[data-pc-can-upload="false"] [data-life-mode="file"],
body[data-pc-can-upload="false"] [data-life-mode="editNode"],
body[data-pc-can-upload="false"] [data-life-delete-node],
body[data-pc-can-upload="false"] [data-life-delete-artifact],
body[data-pc-can-upload="false"] [data-life-sync-retry] {
  display: none !important;
}

@media (max-width: 1500px) {
  .pc-role-layers {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .pc-role-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }
  .pc-role-workbench { grid-template-columns: 1fr; }
  .pc-role-toolbar { flex-wrap: wrap; }
  .pc-role-scope-picker { grid-template-columns: 1fr; }
  .pc-role-scope-selectbox,
  .pc-role-permission-search,
  .pc-role-scope-total {
    grid-column: 1;
    grid-row: auto;
  }
  .pc-role-scope-total {
    justify-content: flex-start;
  }
  .pc-role-toolbar-actions {
    flex: 1 1 100%;
    margin-left: 0;
  }
  .pc-role-toolbar-action {
    flex: 1 1 140px;
  }
  .pc-role-nav { max-height: none; }
  .pc-role-editor {
    height: auto;
    min-height: 0;
  }
  .pc-role-bindings {
    height: auto;
    min-height: 0;
  }
  .pc-role-assignment-list {
    height: clamp(460px, 62vh, 640px);
  }
}

@media (max-width: 820px) {
  .pc-card--role-management { padding: 14px; }
  .pc-role-page-head { margin: 0 0 12px; padding: 0 0 14px; }
  .pc-card--role-management .pc-card-title,
  .pc-role-bindings-head h3 {
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .pc-role-page-head .pc-btn {
    align-self: flex-start;
    max-width: 100%;
  }
  .pc-role-layers { grid-template-columns: 1fr; }
  .pc-role-layer[data-role-layer="partners"],
  .pc-role-layer[data-role-layer="contracts"],
  .pc-role-layer[data-role-layer="dataFields"] { grid-column: auto; }
  .pc-role-check-grid,
  .pc-role-layer[data-role-layer="partners"] .pc-role-check-grid { grid-template-columns: 1fr; }
  .pc-role-org-chart { min-width: 1180px; padding: 14px; }
  .pc-role-page-head,
  .pc-role-bindings-head { flex-direction: column; align-items: stretch; }
  .pc-role-tool-btn:first-child,
  .pc-role-tool-btn--subjects { flex: 1 1 100%; }
  .pc-role-section-head,
  .pc-role-layer-head,
  .pc-role-layer-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .pc-role-layer-tools {
    justify-content: flex-start;
  }
  .pc-role-subject-search { flex-basis: auto; }
}

@media (max-width: 560px) {
  .pc-role-check-grid { grid-template-columns: 1fr; }
  .pc-role-status { align-items: stretch; flex-direction: column; }
  .pc-role-organization-head { align-items: stretch; flex-direction: column; }
  .pc-role-org-total { align-items: flex-start; }
  .pc-role-org-details summary { align-items: flex-start; flex-direction: column; }
  .pc-role-assignment-card header,
  .pc-role-assignment-controls { align-items: stretch; flex-direction: column; }
  .pc-role-assignment-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .pc-role-binding-governance { grid-template-columns: 1fr; }
  .pc-role-editor {
    height: auto;
    min-height: 0;
  }
  .pc-role-bindings {
    height: auto;
    min-height: 0;
  }
  .pc-role-assignment-list {
    height: clamp(380px, 58vh, 560px);
  }
  .pc-role-overlay {
    padding: 0;
  }
  .pc-role-drawer,
  .pc-role-drawer--subjects {
    width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
  }
  .pc-role-drawer .pc-role-assignment-list {
    height: calc(100dvh - 250px);
  }
}
