.rolemenu-admin {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  font-size: 13.5px;
  color: #2b2f36;
}

.rolemenu-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between; // pushes close icon to the right
}

.rolemenu-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #5b606b;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;

  &:hover {
    background: #f1f2f4;
    color: #2b2f36;
  }
}
.rolemenu-filters {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-bordered {
  border: 1px solid var(--border-focus);
  border-radius: 4px;
  background: var(--border-focus);
  color: #fff;
  padding: 7px 16px;
  font-size: 16.5px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;

  &:hover:not(:disabled) {
    background: #f4f5f7;
    border-color: #b9bfc9;
  }

  &:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
}

.btn-primary {
  border: 1px solid var(--border-focus);
  border-radius: 4px;
  background: var(--border-focus);
  color: #fff;
  padding: 7px 18px;
  font-size: 17.5px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, opacity 0.15s ease;

  &:hover:not(:disabled) {
    background: var(--border-focus);
    border-color: var(--border-focus);
  }

  &:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
}

.rolemenu-grid-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #e4e6ea;
  border-radius: 6px;
  overflow: hidden; // clips corners only; scrolling happens in the child below
  max-height: 480px; // adjust to fit your layout
}

// The actual scroll container — scrolls both axes as needed
.rolemenu-table-scroll {
  flex: 1;
  min-height: 0; // required inside a flex column so it can actually shrink/scroll
  overflow: auto;
}

.rolemenu-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;

  thead {
    background: var(--bg-subtle);

    th {
      position: sticky;
      top: 0;
      z-index: 1;
      font-size: 12px;
      letter-spacing: 0.02em;
      text-transform: uppercase;
      color: var(--text-secondary);
      font-weight: 700;
      border-bottom: 1px solid #e4e6ea;
      padding: 10px 12px;
      text-align: left;
      white-space: nowrap;
      background: #f7f8fa;
    }
  }

  tbody {
    tr {
      border-bottom: 1px solid #eef0f3;
      transition: background-color 0.1s ease;

      &:last-child {
        border-bottom: none;
      }

      &:not(.row-readonly):not(.row-empty):hover {
        background: #f7f9ff;
      }
    }

    td {
      padding: 9px 12px;
      vertical-align: middle;
    }
  }

  input[type='checkbox'] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--border-focus);

    &:focus,
    &:focus-visible {
      outline: 2px solid var(--border-focus);
      outline-offset: 2px;
    }
  }

  input[type='checkbox']:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
  }

  .col-sno {
    width: 48px;
    color: #8b909a;
  }

  .col-role {
    min-width: 180px;
    font-weight: 500;
  }

  .col-perm {
    width: 72px;
    text-align: center;
  }

  .col-action {
    width: 76px;
    text-align: right;
    white-space: nowrap;
  }
}

// Whole-row tint for roles that already have a RoleVsMenu record (locked/readonly),
// so the row reads as non-interactive at a glance.
tr.row-readonly {
  background-color: #fafbfc;
  color: #a2a7b1;
}

tr.row-empty td {
  padding: 24px 12px;
  text-align: center;
  color: #8b909a;
  font-style: italic;
}

.icon-add,
.icon-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  font-size: 11px;
  transition: opacity 0.15s ease;

  &:hover {
    opacity: 0.85;
  }
}

.icon-add {
  background: #2e9e46;
}

.icon-remove {
  background: #d9362f;
  margin-left: 4px;
}

thead .col-action {

  .icon-add,
  .icon-remove {
    vertical-align: middle;
  }
}

.rolemenu-footer-actions {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  padding: 4px 2px 0;
}