.role-manager-panel {
  display: grid;
  gap: 18px;
}

.role-manager-head {
  align-items: center;
}

.role-editor {
  display: grid;
  gap: 16px;
}

.role-editor-fields {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(220px, 1fr) minmax(260px, 1.4fr) auto;
  gap: 12px;
  align-items: end;
}

.role-editor-fields label,
.role-editor-fields input,
.role-editor-fields select {
  min-width: 0;
}

.role-active-toggle {
  display: flex !important;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #d8e1dd;
  border-radius: 10px;
  background: #f8fbf9;
  white-space: nowrap;
}

.role-active-toggle input,
.role-check input,
.role-special input {
  width: auto !important;
  margin: 0;
}

.role-lock-note {
  padding: 11px 13px;
  border: 1px solid #d8e1dd;
  border-radius: 10px;
  background: #f4f7f5;
  color: #4b5c53;
  font-size: 13px;
  font-weight: 650;
}

.role-matrix-wrap {
  border: 1px solid #e0e7e3;
  border-radius: 12px;
}

.role-matrix {
  min-width: 860px;
}

.role-matrix th:not(:first-child),
.role-matrix td:not(:first-child) {
  text-align: center;
}

.role-matrix td:first-child {
  min-width: 170px;
}

.role-check,
.role-special {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: #355047;
}

.role-check span {
  display: none;
}

.role-special-cell {
  min-width: 190px;
}

.role-special {
  margin: 3px 6px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #f3f8f5;
}

.role-na {
  color: #a8b1ac;
}

.role-help {
  margin: -4px 0 0;
  color: #68776f;
  font-size: 12px;
}

.role-editor-actions,
.staff-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.role-editor-actions .btn {
  width: auto;
  min-width: 120px;
}

.role-editor-actions .danger {
  border-color: #f0c7c2;
  background: #fff7f5;
  color: #ad372c;
}

.staff-create-panel,
.staff-list-panel {
  margin-top: 18px;
}

.staff-role-select {
  min-width: 150px;
  max-width: 210px;
}

.staff-actions .small-action {
  white-space: nowrap;
}

@media (max-width: 1120px) {
  .role-editor-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .role-editor-fields {
    grid-template-columns: 1fr;
  }
}





/* RMCJJ_ROLE_UNIFORM_BOXES_START */

/* Consistent sizing for Staff & Roles controls */
#staff input:not([type="checkbox"]),
#staff select,
[data-section="staff"] input:not([type="checkbox"]),
[data-section="staff"] select,
[data-admin-section="staff"] input:not([type="checkbox"]),
[data-admin-section="staff"] select {
  width: 100%;
  height: 40px !important;
  min-height: 40px !important;
  box-sizing: border-box;
  padding: 0 12px !important;
  border-radius: 9px;
  font-family: inherit !important;
  font-size: 14px !important;
  line-height: 40px !important;
}

/* Add staff account: equal column widths */
#staff .form-grid,
[data-section="staff"] .form-grid,
[data-admin-section="staff"] .form-grid {
  align-items: end;
}

/* Labels stay consistently above each field */
#staff .form-grid > label,
[data-section="staff"] .form-grid > label,
[data-admin-section="staff"] .form-grid > label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

/* Buttons match field height */
#staff .btn,
[data-section="staff"] .btn,
[data-admin-section="staff"] .btn {
  min-height: 40px;
  height: 40px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Role editor row: make text/select boxes same width */
#staff .role-editor select,
#staff .role-editor input:not([type="checkbox"]),
#staff .role-settings select,
#staff .role-settings input:not([type="checkbox"]),
[data-section="staff"] .role-editor select,
[data-section="staff"] .role-editor input:not([type="checkbox"]),
[data-admin-section="staff"] .role-editor select,
[data-admin-section="staff"] .role-editor input:not([type="checkbox"]) {
  width: 220px !important;
}

/* Active role box same visual height */
#staff .check-label,
[data-section="staff"] .check-label,
[data-admin-section="staff"] .check-label {
  min-height: 40px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
}

/* Checkbox itself centered */
#staff .check-label input[type="checkbox"],
[data-section="staff"] .check-label input[type="checkbox"],
[data-admin-section="staff"] .check-label input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  margin: 0 8px 0 0 !important;
  flex: 0 0 16px;
}

/* Avoid native select appearance changing its height */
#staff select,
[data-section="staff"] select,
[data-admin-section="staff"] select {
  line-height: normal !important;
}

/* RMCJJ_ROLE_UNIFORM_BOXES_END */

/* RMCJJ_ROLE_CONTROL_FONT_UNIFORM_START */

/* Uniform text inside all Staff & Roles form boxes */
#staff input:not([type="checkbox"]),
#staff select,
[data-section="staff"] input:not([type="checkbox"]),
[data-section="staff"] select,
[data-admin-section="staff"] input:not([type="checkbox"]),
[data-admin-section="staff"] select {
  font-family: inherit !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  letter-spacing: 0 !important;
  color: #102a22 !important;
}

/* Read-only/disabled fields should not look faded */
#staff input[readonly],
#staff input:disabled,
#staff select:disabled,
[data-section="staff"] input[readonly],
[data-section="staff"] input:disabled,
[data-section="staff"] select:disabled,
[data-admin-section="staff"] input[readonly],
[data-admin-section="staff"] input:disabled,
[data-admin-section="staff"] select:disabled {
  opacity: 1 !important;
  color: #102a22 !important;
  -webkit-text-fill-color: #102a22 !important;
}

/* Same vertical text position inside every box */
#staff input:not([type="checkbox"]),
[data-section="staff"] input:not([type="checkbox"]),
[data-admin-section="staff"] input:not([type="checkbox"]) {
  padding: 0 12px !important;
}

/* RMCJJ_ROLE_CONTROL_FONT_UNIFORM_END */

/* RMCJJ_COVERAGE_ACCESS_V1_CSS */

.coverage-access-panel {
  overflow: hidden;
}

.coverage-access-toolbar {
  display: grid;
  grid-template-columns:
    minmax(260px, 1fr)
    auto
    auto
    auto;
  gap: 14px;
  align-items: end;
  padding: 18px 20px;
  border-bottom: 1px solid #e4e9e6;
}

.coverage-staff-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
}

.coverage-staff-field select {
  width: 100%;
  height: 40px;
  box-sizing: border-box;
  font: inherit;
}

.coverage-master-check {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid #d9e2dd;
  border-radius: 10px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  background: #f8faf9;
}

.coverage-master-check input,
.coverage-access-check input {
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  flex: 0 0 16px;
}

.coverage-access-table th:nth-child(3),
.coverage-access-table th:nth-child(4),
.coverage-access-table td:nth-child(3),
.coverage-access-table td:nth-child(4) {
  width: 120px;
  text-align: center;
}

.coverage-access-check {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 86px;
  min-height: 32px;
  box-sizing: border-box;
  padding: 5px 10px;
  margin: 0 auto;
  border-radius: 999px;
  background: #f3f7f5;
  font-size: 13px;
  font-weight: 700;
}

.coverage-access-table td strong {
  display: block;
}

.coverage-access-table td small {
  display: block;
  margin-top: 3px;
  opacity: .65;
}

.coverage-access-panel .role-help {
  margin: 0;
  padding: 14px 20px 18px;
}

@media (max-width: 1050px) {
  .coverage-access-toolbar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .coverage-access-toolbar {
    grid-template-columns: 1fr;
  }
}

/* RMCJJ_COVERAGE_DARK_V1 */
html[data-theme="dark"] body.admin-body .coverage-master-check {
  background: rgba(255, 255, 255, 0.055) !important;
  border: 1px solid rgba(255, 255, 255, 0.13) !important;
  color: rgba(235, 248, 241, 0.92) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body.admin-body .coverage-master-check span {
  color: inherit !important;
}

html[data-theme="dark"] body.admin-body .coverage-master-check:hover {
  background: rgba(255, 255, 255, 0.09) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}

html[data-theme="dark"] body.admin-body .coverage-master-check input {
  accent-color: #16a34a;
}

html[data-theme="dark"] body.admin-body .coverage-master-check:has(input:disabled) {
  background: rgba(255, 255, 255, 0.025) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: rgba(235, 248, 241, 0.38) !important;
  cursor: not-allowed;
}

html[data-theme="dark"] body.admin-body .coverage-master-check input:disabled {
  opacity: 0.45;
}

html[data-theme="dark"] body.admin-body #coverage-access-save:disabled {
  background: rgba(22, 163, 74, 0.18) !important;
  border-color: rgba(34, 197, 94, 0.22) !important;
  color: rgba(235, 248, 241, 0.42) !important;
  opacity: 1 !important;
  box-shadow: none !important;
  cursor: not-allowed;
}
/* RMCJJ_COVERAGE_DARK_V1_END */

/* RMCJJ NIGHT MODE COVERAGE CHECKS V2 */

html[data-theme="dark"] body.admin-body .coverage-access-check,
html[data-theme="dark"] body.admin-body .coverage-master-check {
  background: #132a22 !important;
  border-color: #31584b !important;
  color: #e5f5ef !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body.admin-body .coverage-access-check span,
html[data-theme="dark"] body.admin-body .coverage-master-check span {
  color: #e5f5ef !important;
}

html[data-theme="dark"] body.admin-body .coverage-access-check input,
html[data-theme="dark"] body.admin-body .coverage-master-check input {
  accent-color: #0aa86b;
}

/* Disabled because All Coverages is selected */
html[data-theme="dark"] body.admin-body .coverage-access-check:has(input:disabled) {
  background: #10221c !important;
  border-color: #24473b !important;
  color: #829f95 !important;
  opacity: 1 !important;
}

html[data-theme="dark"] body.admin-body .coverage-access-check:has(input:disabled) span {
  color: #829f95 !important;
}

html[data-theme="dark"] body.admin-body .coverage-access-check input:disabled {
  opacity: .75 !important;
}

/* RMCJJ_ROLE_MATRIX_FINAL_CLEAN_START */

/*
 * RM-CJJ zapConnect
 * Staff & Role FINAL CLEAN implementation.
 *
 * One CSS source for the permission matrix.
 * V15 HTML supplies max two Special items per row.
 */


/* =========================================
   MATRIX TABLE
   ========================================= */

.role-manager-panel .role-matrix {
    width: 100%;
    min-width: 860px;
    table-layout: fixed;
    font-family: inherit;
    font-size: 10px;
}


/* Menu */
.role-manager-panel .role-matrix th:nth-child(1),
.role-manager-panel .role-matrix td:nth-child(1) {
    width: 46%;

    min-width: 0;

    text-align: left;

    white-space: normal !important;
}


/* View / Add / Edit / Delete */
.role-manager-panel .role-matrix th:nth-child(2),
.role-manager-panel .role-matrix td:nth-child(2),
.role-manager-panel .role-matrix th:nth-child(3),
.role-manager-panel .role-matrix td:nth-child(3),
.role-manager-panel .role-matrix th:nth-child(4),
.role-manager-panel .role-matrix td:nth-child(4),
.role-manager-panel .role-matrix th:nth-child(5),
.role-manager-panel .role-matrix td:nth-child(5) {
    width: 6%;

    min-width: 0;
    max-width: none;

    text-align: center;

    white-space: nowrap;
}


/* Special */
.role-manager-panel .role-matrix th:nth-child(6),
.role-manager-panel .role-matrix td:nth-child(6) {
    width: 30%;

    min-width: 0;

    text-align: left !important;
}

.role-manager-panel .role-matrix th:nth-child(6) {
    padding-left: 0 !important;
}


/* Table headers */
.role-manager-panel .role-matrix th {
    font-family: inherit;
    font-size: 8px;
    font-weight: 800;
    line-height: 1.15;

    white-space: nowrap;
}


/* Normal row/module title */
.role-manager-panel .role-matrix td:first-child > strong {
    display: block;

    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
}


/* Small module explanation */
.role-manager-panel .role-matrix .role-feature-note {
    display: block;

    margin-top: 2px;

    font-family: inherit;
    font-size: 8px;
    font-weight: 400;
    line-height: 1.2;

    white-space: normal !important;
    overflow-wrap: normal;
    word-break: normal;

    opacity: .72;
}


/* =========================================
   VIEW / ADD / EDIT / DELETE CHECKBOX
   ========================================= */

.role-manager-panel .role-matrix .role-check {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    margin: 0;
    padding: 0;

    gap: 0;

    font-family: inherit;
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
}


/*
 * Text is intentionally hidden for View/Add/Edit/Delete
 * because the column header already identifies it.
 */
.role-manager-panel .role-matrix .role-check > span {
    display: none;
}


.role-manager-panel .role-matrix
.role-check
input[type="checkbox"] {
    width: 12px !important;
    min-width: 12px !important;
    max-width: 12px !important;

    height: 12px !important;

    margin: 0 !important;
    padding: 0 !important;

    vertical-align: middle;

    flex: 0 0 12px;
}


/* =========================================
   SPECIAL COLUMN
   ========================================= */

.role-manager-panel .role-matrix
td.role-special-cell {
    min-width: 0;

    padding:
        5px
        4px
        5px
        0 !important;

    text-align: left !important;
    vertical-align: middle;

    line-height: normal !important;
}


/*
 * V15 outer stack.
 */
.role-manager-panel .role-matrix
.rmcjj-special-stack-v15 {
    display: flex;

    flex-direction: column;

    align-items: flex-start !important;
    justify-content: flex-start !important;

    width: max-content !important;
    max-width: 100%;

    margin: 0;
    padding: 0;

    gap: 2px;
}


/*
 * V15 HTML already batches Special permissions
 * two at a time.
 */
.role-manager-panel .role-matrix
.rmcjj-special-row-v15 {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    width: 100%;
    max-width: 300px;

    column-gap: 8px;
    row-gap: 2px;

    margin: 0;
    padding: 0;

    justify-content: start !important;
    justify-items: start !important;
    align-items: center !important;

    margin-left: 0 !important;
    margin-right: 0 !important;
}


/*
 * Checkbox + text.
 *
 * NO:
 *   margin:auto
 *   pill box
 *   large left padding
 *   16px checkbox
 */
.role-manager-panel .role-matrix
.rmcjj-special-item-v15 {
    display: flex !important;

    align-items: center !important;
    justify-content: flex-start !important;

    position: static !important;
    float: none !important;

    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;

    min-height: 20px !important;

    margin: 0 !important;
    padding: 1px 0 !important;

    gap: 5px !important;

    border: 0 !important;
    border-radius: 0 !important;

    background: transparent !important;

    font-family: inherit !important;
    font-size: 10px !important;
    font-weight: 500 !important;
    line-height: 1.15 !important;

    text-align: left !important;

    cursor: pointer;
}


/* Special checkbox */
.role-manager-panel .role-matrix
.rmcjj-special-item-v15
input[type="checkbox"] {
    position: static !important;

    display: block !important;

    flex: 0 0 12px !important;

    width: 12px !important;
    min-width: 12px !important;
    max-width: 12px !important;

    height: 12px !important;

    margin: 0 !important;
    padding: 0 !important;

    align-self: center !important;
}


/* Special text */
.role-manager-panel .role-matrix
.rmcjj-special-item-v15 > span {
    display: block !important;

    flex: 1 1 auto !important;

    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;

    margin: 0 !important;
    padding: 0 !important;

    font-family: inherit !important;
    font-size: 10px !important;
    font-weight: 500 !important;
    line-height: 1.15 !important;

    text-align: left !important;

    white-space: normal !important;

    overflow: visible !important;
    text-overflow: clip !important;

    overflow-wrap: normal !important;
    word-break: normal !important;
}


/* Empty second slot */
.role-manager-panel .role-matrix
.rmcjj-special-empty-v15 {
    display: block;

    width: 100%;
    min-height: 1px;
}


/* No Special permission */
.role-manager-panel .role-matrix
td.role-special-cell > .role-na {
    display: inline-block;

    margin: 0;
    padding: 0;

    font-family: inherit;
    font-size: 10px;

    text-align: left;
}


/* =========================================
   ROLE EDITOR TOP FIELDS
   Keep normal Billing form appearance.
   Do not leak their styles into permission labels.
   ========================================= */

.role-manager-panel .role-editor-fields > label {
    font-family: inherit;
    font-size: 11px;
    line-height: 1.2;
}


/* =========================================
   MOBILE
   ========================================= */

@media (max-width: 760px) {

    .role-manager-panel .role-matrix
    .rmcjj-special-row-v15 {
        grid-template-columns:
            minmax(135px, 1fr);

        width: 100%;
    }

    .role-manager-panel .role-matrix
    .rmcjj-special-item-v15 {
        width: 100% !important;
        max-width: none !important;
    }

    .role-manager-panel .role-matrix
    .rmcjj-special-empty-v15 {
        display: none;
    }
}


/* RMCJJ_ROLE_MATRIX_FINAL_CLEAN_END */

