#role-edit-form {
  --role-muted: #59645c;
  --role-control: #859188;
  width: min(1180px, calc(100vw - 32px));
  height: calc(100dvh - 32px);
  max-height: 1000px;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  letter-spacing: 0;
}
html[data-theme="dark"] #role-edit-form { --role-muted: #b2beb4; --role-control: #7c8c80; }
#role-edit-form .modal-head { flex: none; align-items: center; gap: 16px; margin: 0; padding: 14px 20px; border-bottom: 1px solid var(--line); }
#role-edit-form .modal-head h2 { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.3; letter-spacing: 0; }
#role-edit-members { margin-top: 4px; color: var(--role-muted); font-size: 12px; }
#role-edit-form .close-modal { min-width: 36px; height: 36px; }
#role-edit-form .role-editor-fields { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 320px); gap: 8px 16px; padding: 12px 20px 8px; }
#role-edit-form label { margin: 0; color: var(--role-muted); font-size: 12px; font-weight: 500; }
#role-edit-form input:not([type="checkbox"]), #role-edit-form select, #role-edit-form textarea { min-width: 0; height: 36px; margin: 5px 0 0; padding: 6px 10px; border: 1px solid var(--role-control); border-radius: 4px; background: var(--paper); color: var(--ink); font: inherit; font-size: 14px; font-weight: 400; }
#role-edit-form input::placeholder, #role-edit-form textarea::placeholder { color: var(--role-muted); opacity: 1; }
#role-edit-form input[type="checkbox"] { flex: none; width: 17px; height: 17px; margin: 0; padding: 0; accent-color: var(--green-dark); cursor: pointer; }
#role-edit-form input:disabled, #role-edit-form select:disabled { cursor: not-allowed; opacity: .65; }
#role-edit-form input[readonly] { background: var(--paper-soft); }
#role-edit-form :is(input, select, textarea, button, summary, [tabindex]):focus-visible { outline: 2px solid var(--green-dark); outline-offset: 3px; }
#role-edit-form .role-editor-description { grid-column: 1 / -1; font-size: 12px; color: var(--role-muted); }
#role-edit-form .role-editor-description summary { width: fit-content; padding: 4px 0; cursor: pointer; }
#role-edit-form .role-editor-description textarea { display: block; width: 100%; min-height: 56px; height: 56px; max-height: 112px; resize: vertical; }
#role-edit-form .role-editor-description label { font-size: 0; }
#role-edit-form .role-editor-notice { flex: none; margin: 0 20px 8px; padding: 8px 12px; border: 1px solid var(--role-control); border-radius: 4px; background: var(--paper-soft); font-size: 13px; line-height: 1.5; }
#role-edit-form .role-editor-toolbar { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 8px 20px 12px; border-bottom: 1px solid var(--line); }
#role-edit-form .role-editor-toolbar input[type="search"] { flex: 1 1 240px; width: auto; margin: 0; }
#role-edit-form .role-editor-toolbar select { flex: 0 1 216px; width: auto; margin: 0; }
#role-edit-form .role-editor-granted { display: flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--ink); font-size: 13px; }
#role-edit-summary { margin-left: auto; color: var(--role-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
#role-edit-form .role-editor-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-color: var(--role-control) var(--paper); }
#role-edit-form .role-editor-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: 14px; }
#role-edit-form .role-action-column { width: 92px; }
#role-edit-form .role-scope-column { width: 184px; }
#role-edit-form .role-editor-table th, #role-edit-form .role-editor-table td { padding: 8px 16px; border: 0; border-bottom: 1px solid var(--line); vertical-align: middle; background: var(--paper); }
#role-edit-form .role-editor-table thead th { position: sticky; top: 0; z-index: 1; height: 40px; padding: 8px 4px; color: var(--role-muted); font-size: 12px; font-weight: 500; text-align: center; box-shadow: 0 1px 0 var(--role-control); }
#role-edit-form .role-editor-table thead th:first-child { padding-left: 20px; text-align: left; }
#role-edit-form .role-editor-table thead th:last-child { text-align: left; padding-left: 16px; }
#role-edit-form .wf-role-feature { display: table-row; }
#role-edit-form .wf-role-feature[hidden] { display: none; }
#role-edit-form .wf-role-feature th { padding-left: 20px; text-align: left; font-weight: 500; overflow-wrap: anywhere; }
#role-edit-form .wf-role-feature th b { font-size: 14px; font-weight: 500; }
#role-edit-form .wf-role-feature td:not(.role-editor-scope) { padding: 0; text-align: center; }
#role-edit-form .wf-role-feature:focus-within td, #role-edit-form .wf-role-feature:focus-within th { background: var(--paper-soft); }
#role-edit-form .role-editor-check { display: flex; min-height: 44px; align-items: center; justify-content: center; flex-wrap: wrap; gap: 3px; padding: 8px; cursor: pointer; }
#role-edit-form .role-editor-check small { flex-basis: 100%; font-size: 11px; color: var(--role-muted); font-weight: 400; }
#role-edit-form .role-editor-extra { display: inline-flex; align-items: center; gap: 7px; margin: 5px 12px 0; font-size: 12px; color: var(--ink); }
#role-edit-form .role-editor-help { display: inline-block; margin: 4px 0 0 10px; font-size: 12px; font-weight: 400; color: var(--role-muted); }
#role-edit-form .role-editor-help summary { width: fit-content; cursor: pointer; }
#role-edit-form .role-editor-help p { margin: 6px 0 2px; font-size: 12px; line-height: 1.5; color: var(--ink-2); }
#role-edit-form .role-editor-scope select { width: 100%; height: 32px; margin: 0; font-size: 13px; }
#role-edit-form .role-editor-scope>span, #role-edit-form .role-editor-na { color: var(--role-muted); font-size: 12px; }
#role-edit-form .role-editor-changed { outline: 2px solid var(--blue); outline-offset: 3px; }
#role-edit-form .role-editor-empty { padding: 32px 20px; color: var(--role-muted); font-size: 14px; text-align: center; }
#role-edit-form .modal-actions { flex: none; align-items: center; margin: 0; padding: 12px 20px; background: var(--paper); box-shadow: none; }
#role-edit-form .modal-actions>span { margin-right: auto; color: var(--role-muted); font-size: 12px; }
#role-edit-form .modal-actions button { height: 36px; border-radius: 4px; font-family: inherit; font-size: 13px; font-weight: 600; }
html:not([data-theme="dark"]) #role-edit-form .primary-btn:not(:disabled) { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
#role-edit-form .primary-btn:disabled { opacity: 1; background: var(--paper-soft); color: var(--role-muted); border-color: var(--line); cursor: not-allowed; }
#role-edit-form .role-editor-error { flex: none; padding: 8px 20px; color: var(--red); font-size: 13px; line-height: 1.4; }
.role-editor-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 900px) {
  #role-edit-form .role-action-column { width: 78px; }
  #role-edit-form .role-scope-column { width: 162px; }
  #role-edit-form .role-editor-table th, #role-edit-form .role-editor-table td { padding-left: 10px; padding-right: 10px; }
  #role-edit-summary { flex-basis: 100%; margin: 0; }
}
@media (max-width: 640px) {
  #role-edit-form { width: calc(100vw - 16px); height: calc(100dvh - 16px); max-height: none; }
  #role-edit-form .modal-head { padding: 12px; }
  #role-edit-form .modal-head h2 { font-size: 18px; }
  #role-edit-form .role-editor-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 10px 12px 4px; gap: 6px 10px; }
  #role-edit-form .role-editor-toolbar { gap: 8px; padding: 8px 12px; }
  #role-edit-form .role-editor-toolbar input[type="search"] { flex: 1 1 100%; }
  #role-edit-form .role-editor-toolbar select { flex: 1; width: 0; }
  #role-edit-form .role-editor-granted { font-size: 12px; min-height: 36px; }
  #role-edit-form .role-editor-notice { margin: 0 12px 4px; font-size: 12px; }
  #role-edit-form .role-editor-table, #role-edit-form .role-editor-table tbody { display: block; }
  #role-edit-form .role-editor-table thead, #role-edit-form .role-editor-table colgroup { display: none; }
  #role-edit-form .wf-role-feature { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 12px; border: 0; border-bottom: 1px solid var(--line); gap: 8px 0; }
  #role-edit-form .wf-role-feature th { grid-column: 1 / -1; display: block; padding: 0; border: 0; }
  #role-edit-form .wf-role-feature td { display: block; padding: 0; border: 0; }
  #role-edit-form .wf-role-feature td::before { content: attr(data-label); display: block; font-size: 11px; color: var(--role-muted); }
  #role-edit-form .wf-role-feature td.role-editor-scope { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  #role-edit-form .role-editor-scope select { width: 55%; height: 36px; }
  #role-edit-form .role-editor-check { min-height: 44px; padding: 8px; }
  #role-edit-form .role-editor-na { display: block; padding-top: 14px; }
  #role-edit-form .modal-actions { padding: 10px 12px; flex-wrap: nowrap; }
  #role-edit-form .modal-actions button { flex: none; padding: 0 10px; }
}
